/* =============================================================================
   Nimbus control panel — design system.
   Operator console: FQDNs/container names in monospace as first-class identity,
   a teal "signal" accent (network/TLS), status signal-dots as the signature.
   Custom CSS with design tokens (no framework) per architecture-principles
   laravel/design-system.md. Theme-aware (light default, dark via media query).
   ============================================================================= */

:root {
  /* Surfaces (cool off-white — deliberately not cream) */
  --bg:        #eef1f4;
  --surface:   #ffffff;
  --surface-2: #f6f8fa;
  --ink:       #141a20;
  --muted:     #5a6773;
  --line:      #dde3e9;

  /* Signal accent — teal (network/TLS), not acid-green/terracotta */
  --signal:      #0e7c86;
  --signal-strong:#0a5c64;
  --signal-tint: #e3f2f3;

  /* Semantic status */
  --up:       #1f9d57;
  --down:     #d64545;
  --warn:     #c17d12;
  --starting: #2f6fed;
  --idle:     #8a94a0;

  /* Type */
  --font-ui:   ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --radius: 7px;
  --radius-sm: 5px;
  --shadow: 0 1px 2px rgba(20,26,32,.06), 0 4px 16px rgba(20,26,32,.05);
  --wire: linear-gradient(90deg, var(--signal), #4bb8bf 60%, transparent);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0e1418;
    --surface:   #151d23;
    --surface-2: #1a242b;
    --ink:       #e8eef2;
    --muted:     #93a1ac;
    --line:      #263139;
    --signal:      #35b3bd;
    --signal-strong:#63cdd6;
    --signal-tint: #10312f;
    --up:       #34c46f;
    --down:     #ef6b6b;
    --warn:     #e0a44a;
    --starting: #5a8cf5;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

code, .mono, .domain, .cname { font-family: var(--font-mono); }

a { color: var(--signal-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- App shell ----------------------------------------------------------- */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

.rail {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.rail .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 650; letter-spacing: .02em; font-size: 16px;
  padding: 6px 8px 16px;
}
.rail .brand .mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--wire);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}
.rail nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--ink); font-weight: 500;
}
.rail nav a:hover { background: var(--surface-2); text-decoration: none; }
.rail nav a.active { background: var(--signal-tint); color: var(--signal-strong); }
.rail .spacer { flex: 1; }
.rail .who { color: var(--muted); font-size: 13px; padding: 8px; border-top: 1px solid var(--line); }

.main { padding: 28px 32px; max-width: 1100px; }

/* ---- Page header --------------------------------------------------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head h1 { font-size: 22px; margin: 0; font-weight: 640; letter-spacing: -.01em; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 11px; color: var(--signal-strong); font-weight: 600; }

/* ---- Cards / tables ------------------------------------------------------ */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.card + .card { margin-top: 18px; }
.card .card-h { padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.card .card-b { padding: 18px; }

table.grid { width: 100%; border-collapse: collapse; }
table.grid th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 600; padding: 12px 18px; border-bottom: 1px solid var(--line);
}
table.grid td { padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tr.row:hover td { background: var(--surface-2); }
.domain { font-size: 14.5px; font-weight: 550; }
.cname { color: var(--muted); font-size: 12.5px; }

/* ---- Status signal-dot (the signature) ----------------------------------- */
.signal { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 550; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--idle); position: relative; flex: none; }
.signal.up    .dot { background: var(--up); }
.signal.down  .dot { background: var(--down); }
.signal.starting .dot { background: var(--starting); }
.signal.up    { color: var(--up); }
.signal.down  { color: var(--down); }
.signal.starting { color: var(--starting); }
.signal.maintenance .dot { background: var(--warn); }
.signal.maintenance { color: var(--warn); }
/* gentle pulse only for healthy — motion reserved for the "all good" signal */
.signal.up .dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--up); opacity: .5; animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(.6); opacity: .55; } 100% { transform: scale(1.5); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .signal.up .dot::after { animation: none; } }

/* ---- Publish state chip -------------------------------------------------- */
.chip { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--line); }
.chip.public  { background: var(--signal-tint); color: var(--signal-strong); border-color: transparent; }
.chip.private { background: var(--surface-2); color: var(--muted); }
.chip.zero    { background: transparent; color: var(--muted); border-style: dashed; }

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  font: inherit; font-weight: 560; font-size: 13.5px;
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--signal); border-color: var(--signal); color: #fff; }
.btn.primary:hover { background: var(--signal-strong); border-color: var(--signal-strong); }
.btn.danger { color: var(--down); border-color: color-mix(in srgb, var(--down) 40%, var(--line)); }
.btn.danger:hover { background: color-mix(in srgb, var(--down) 12%, var(--surface)); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Action bar: site-level actions, held apart from the settings tabs -----
   A bordered surface strip above the tabs so the destructive + state actions
   read as "things you do to the site", separate from "settings you edit". */
.action-bar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px 16px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px 16px; margin-bottom: 20px;
}
.action-bar .action-group { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.action-bar form { margin: 0; }

/* ---- Tabs: underline strip. Active tab carries the brand wire gradient,
   tying the settings navigation to the mark in the rail and the auth card. */
.tabs {
  display: flex; gap: 2px; align-items: stretch;
  border-bottom: 1px solid var(--line); margin-bottom: 22px;
}
.tabs .tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 14px; margin-bottom: -1px;
  color: var(--muted); font-weight: 560; font-size: 14px;
  border-bottom: 2px solid transparent;
}
.tabs .tab:hover { color: var(--ink); text-decoration: none; }
.tabs .tab.active { color: var(--signal-strong); }
.tabs .tab.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--wire);
}
.tabs .tab:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: var(--radius-sm); }
/* Static "deployments on" dot — reuses the signal colour, no pulse in a tab. */
.tab-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--up); flex: none; }

/* ---- Forms --------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.input, select.input {
  width: 100%; padding: 9px 11px; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.input:focus, select.input:focus { outline: 2px solid var(--signal); outline-offset: 1px; border-color: var(--signal); }
.input.mono { font-family: var(--font-mono); }
.err { color: var(--down); font-size: 12.5px; margin-top: 5px; }

/* ---- Alerts / flashes ---------------------------------------------------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 14px; border: 1px solid transparent; }
.alert.ok   { background: color-mix(in srgb, var(--up) 12%, var(--surface)); border-color: color-mix(in srgb, var(--up) 30%, transparent); color: color-mix(in srgb, var(--up) 60%, var(--ink)); }
.alert.bad  { background: color-mix(in srgb, var(--down) 12%, var(--surface)); border-color: color-mix(in srgb, var(--down) 30%, transparent); color: color-mix(in srgb, var(--down) 65%, var(--ink)); }
.alert.warn { background: color-mix(in srgb, var(--warn) 14%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 34%, transparent); color: color-mix(in srgb, var(--warn) 62%, var(--ink)); }

/* ---- Detail list --------------------------------------------------------- */
.detail { display: grid; grid-template-columns: 160px 1fr; gap: 2px 18px; }
.detail dt { color: var(--muted); font-size: 13px; padding: 9px 0; }
.detail dd { margin: 0; padding: 9px 0; border-bottom: 1px solid var(--line); }
.detail dt { border-bottom: 1px solid var(--line); }
.detail dt:last-of-type, .detail dd:last-of-type { border-bottom: 0; }

/* ---- Empty state --------------------------------------------------------- */
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); margin: 0 0 6px; font-weight: 600; }

/* ---- Access: the address as the key --------------------------------------
   On a network console, your IP *is* your credential — so on the unlock view it
   carries the weight a headline would, rather than sitting in a label row. */
.ipkey { margin-bottom: 6px; }
.ipkey-label {
  display: block; text-transform: uppercase; letter-spacing: .12em;
  font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 6px;
}
.ipkey-value {
  display: block; font-size: 30px; font-weight: 600; letter-spacing: -.01em;
  line-height: 1.15; word-break: break-all;
}
.ipkey-state { color: var(--muted); font-size: 13.5px; margin: 10px 0 20px; }
.ipkey-state.admitted { color: var(--up); display: flex; align-items: center; gap: 8px; }

/* Locked chip — dashed edge reads as "gated", distinct from public/private. */
.chip.locked {
  background: var(--signal-tint); color: var(--signal-strong);
  border-color: color-mix(in srgb, var(--signal) 45%, transparent); border-style: dashed;
}

/* Lock panel row: statement on the left, the single action on the right. */
.lock-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 0 18px; margin-bottom: 6px; border-bottom: 1px solid var(--line);
}
.lock-row .hint { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

textarea.input { resize: vertical; min-height: 84px; line-height: 1.55; }

p.hint { color: var(--muted); font-size: 12.5px; }

/* Stored credential — shown as a masked hint, never a value.
   The dashed edge is this panel's existing idiom for "gated" (.chip.locked,
   .chip.zero), reused here so a value you cannot read looks deliberate rather
   than broken or still loading. */
.cred-value {
  display: inline-block; font-size: 20px; font-weight: 600; letter-spacing: .02em;
  padding: 8px 14px; margin-bottom: 4px; border-radius: var(--radius-sm);
  border: 1px dashed color-mix(in srgb, var(--signal) 45%, transparent);
  background: var(--signal-tint); color: var(--signal-strong);
}
.cred-value.cred-empty {
  border-color: var(--line); background: var(--surface-2);
  color: var(--muted); font-weight: 500;
}

@media (max-width: 760px) {
  .lock-row { flex-direction: column; align-items: flex-start; }
  .ipkey-value { font-size: 24px; }
  .cred-value { font-size: 17px; word-break: break-all; }
}

/* ---- Auth screen --------------------------------------------------------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .top { height: 4px; background: var(--wire); }
.auth-card .card-b { padding: 26px 26px 28px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 18px; margin-bottom: 4px; }
.auth-brand .mark { width: 24px; height: 24px; border-radius: 7px; background: var(--wire); }
.auth-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 22px; }

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .rail { flex-direction: row; align-items: center; overflow-x: auto; }
  .rail .spacer, .rail .who { display: none; }
  .main { padding: 20px 16px; }
  .detail { grid-template-columns: 1fr; }
  .detail dt { border-bottom: 0; padding-bottom: 0; }
  table.grid th.hide-sm, table.grid td.hide-sm { display: none; }
}
