/* =============================================================================
   Portal styles
   =============================================================================
   The palette block below is carried over verbatim from erp-web's
   src/styles/palettes.css, so the portal and the ERP a customer lands in are
   the same colours rather than two things that merely look similar.

   The contract there is exactly 13 custom properties, each a `light-dark()`
   pair covering both modes. Mode is pure CSS: `color-scheme` is what
   `light-dark()` reads, so following the operating system needs no JavaScript
   and cannot flash the wrong theme on load.

   Nothing below hardcodes a colour. If a value is missing, add a token.
   ========================================================================== */

:root,
[data-theme='teal'] {
  --palette-bg: light-dark(#f1f4f0, #0a0f0e);
  --palette-surface: light-dark(#ffffff, #12191b);
  --palette-surface-muted: light-dark(#eaeee6, #17211f);
  --palette-surface-strong: light-dark(#e0e6db, #1c2a27);
  --palette-border: light-dark(#d2d9cb, #29352f);
  --palette-border-muted: light-dark(#e4e8de, #1d2723);
  --palette-fg: light-dark(#141c17, #dfe9e2);
  --palette-fg-muted: light-dark(#4c5a52, #99ab9f);
  --palette-fg-subtle: light-dark(#7c8a80, #67766c);
  --palette-accent: light-dark(#0f5f6f, #4bc4d6);
  --palette-accent-hover: light-dark(#147e93, #74d6e6);
  --palette-accent-soft: light-dark(rgb(15 95 111 / 0.1), rgb(75 196 214 / 0.14));
  --palette-accent-fg: light-dark(#ffffff, #04161a);
}

:root {
  color-scheme: light dark;

  /* Status colours are deliberately NOT part of the palette: green-is-good is
     a fact about the domain, not about branding. */
  --color-good: light-dark(#1c6b3f, #5fd08a);
  --color-warn: light-dark(#8a5a00, #e5b45c);
  --color-crit: light-dark(#a32a22, #f18b83);

  --radius: 6px;
  --radius-lg: 10px;
  --gap: 1rem;
  --measure: 68ch;

  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--palette-bg);
  color: var(--palette-fg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.wrap { width: min(100% - 2rem, 68rem); margin-inline: auto; }
main.wrap { flex: 1; padding-block: 2.5rem; }

/* --- Header / footer ------------------------------------------------------ */

.site-header {
  background: var(--palette-surface);
  border-bottom: 1px solid var(--palette-border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding-block: 0.85rem;
}
.brand { font-weight: 650; letter-spacing: -0.01em; text-decoration: none; color: var(--palette-fg); }
.site-header nav { display: flex; align-items: center; gap: 1.25rem; }
.site-header nav a { color: var(--palette-fg-muted); text-decoration: none; }
.site-header nav a:hover { color: var(--palette-fg); }
.site-header nav a.btn { color: var(--palette-accent-fg); }

.site-footer {
  border-top: 1px solid var(--palette-border-muted);
  padding-block: 1.5rem;
  margin-top: 3rem;
}

/* --- Type ---------------------------------------------------------------- */

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; margin: 0 0 0.6em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1rem; max-width: var(--measure); }
a { color: var(--palette-accent); }
.muted { color: var(--palette-fg-muted); }
.subtle { color: var(--palette-fg-subtle); font-size: 0.875rem; }
.lead { font-size: 1.15rem; color: var(--palette-fg-muted); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }

/* --- Panels and grids ---------------------------------------------------- */

.panel {
  background: var(--palette-surface);
  border: 1px solid var(--palette-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.panel + .panel { margin-top: 1.25rem; }
.grid { display: grid; gap: var(--gap); }
@media (min-width: 44rem) { .grid-2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 60rem) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

.stack > * + * { margin-top: 1rem; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.between { justify-content: space-between; }

/* --- Buttons ------------------------------------------------------------- */

.btn {
  display: inline-block;
  background: var(--palette-accent);
  color: var(--palette-accent-fg);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0.6rem 1.1rem;
  font: inherit;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--palette-accent-hover); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.9rem; }
.btn-secondary {
  background: transparent;
  color: var(--palette-fg);
  border-color: var(--palette-border);
}
.btn-secondary:hover { background: var(--palette-surface-muted); }
.btn-danger { background: transparent; color: var(--color-crit); border-color: var(--color-crit); }
.btn-danger:hover { background: transparent; color: var(--palette-accent-fg); background: var(--color-crit); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
button.link {
  background: none; border: 0; padding: 0; font: inherit;
  color: var(--palette-fg-muted); cursor: pointer; text-decoration: none;
}
button.link:hover { color: var(--palette-fg); }
form.inline { display: inline; }

/* --- Forms --------------------------------------------------------------- */

.field { margin-bottom: 1.1rem; max-width: 32rem; }
.field label { display: block; font-weight: 550; margin-bottom: 0.3rem; }
.field .hint { color: var(--palette-fg-subtle); font-size: 0.875rem; margin: 0.3rem 0 0; }
input[type=text], input[type=email], input[type=password] {
  width: 100%;
  background: var(--palette-surface);
  color: var(--palette-fg);
  border: 1px solid var(--palette-border);
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
  font: inherit;
}
input:focus-visible, .btn:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--palette-accent);
  outline-offset: 2px;
}
.input-suffix { display: flex; align-items: center; gap: 0.4rem; }
.input-suffix .suffix { color: var(--palette-fg-subtle); white-space: nowrap; }

/* --- Flashes and callouts ------------------------------------------------ */

.flash, .callout {
  border: 1px solid var(--palette-border);
  border-left-width: 3px;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  max-width: none;
}
.flash-success, .callout-good { border-left-color: var(--color-good); }
.flash-error, .callout-crit { border-left-color: var(--color-crit); }
.callout-warn { border-left-color: var(--color-warn); }
.form-error { color: var(--color-crit); margin-bottom: 1rem; }

/* --- Status badges ------------------------------------------------------- */

.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 550;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--palette-border);
  color: var(--palette-fg-muted);
  background: var(--palette-surface-muted);
}
.badge-active { color: var(--color-good); border-color: currentColor; background: transparent; }
.badge-failed { color: var(--color-crit); border-color: currentColor; background: transparent; }
.badge-busy { color: var(--color-warn); border-color: currentColor; background: transparent; }

/* --- Environment cards --------------------------------------------------- */

.env {
  border: 1px solid var(--palette-border);
  border-radius: var(--radius);
  padding: 1.1rem;
  background: var(--palette-surface-muted);
}
.env h3 { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.env .url { word-break: break-all; }

/* --- Tables -------------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--palette-border-muted); }
th { color: var(--palette-fg-muted); font-weight: 550; }

/* --- Company list -------------------------------------------------------- */

.company-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--palette-surface);
  border: 1px solid var(--palette-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}
.company-card:hover { border-color: var(--palette-accent); }

.empty {
  border: 1px dashed var(--palette-border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  text-align: center;
  color: var(--palette-fg-muted);
}

/* --- Secret reveal ------------------------------------------------------- */

.secret {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.15rem;
  background: var(--palette-surface-strong);
  border: 1px solid var(--palette-border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  display: inline-block;
  user-select: all;
}

/* --- Marketing ----------------------------------------------------------- */

.hero { padding-block: 2rem 3rem; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); max-width: 18ch; }
.module-list { list-style: none; padding: 0; margin: 0; }
.module-list li { padding: 0.4rem 0; border-bottom: 1px solid var(--palette-border-muted); }
.price { font-size: 2rem; font-weight: 650; }
