/* Rad tool SaaS shell — the RadSim-style grounded app look for Rad product
   tools (RadRival, RadSignal, ...). Light page, dark left nav, strong contrast.

   Per-product accent: set these on :root AFTER importing this file.
     --accent-fill   button/brand fill (needs AA for --on-accent text on it)
     --on-accent     text color placed ON the fill
     --accent-ink    links/emphasis on light surfaces (AA on #FFF and --bg)
     --accent-soft   pale tint for active nav / selected chips
   All defaults below are measured AA+ pairs. If you change one, re-measure.
*/

:root {
  --bg:        #F4F6F1;
  --bg-elev:   #FFFFFF;
  --ink:       #10151F;
  --ink-muted: #47505E;   /* AA on white and --bg */
  --ink-dim:   #5B6470;   /* labels only, 16px+; AA on white and --bg */
  --border:     rgba(16, 21, 31, 0.10);
  --border-mid: rgba(16, 21, 31, 0.18);
  --danger:  #C81E1E;
  --success: #15803D;
  --side-bg:   #10151F;
  --side-ink:  #E7EAF0;   /* 14.9:1 on side-bg */
  --side-dim:  #A8B0BC;   /* 7.6:1 on side-bg */
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Menlo', monospace;

  --accent-fill: #7C3AED;
  --on-accent:   #FFFFFF;
  --accent-ink:  #5B21B6;
  --accent-soft: #EDE9FE;
  --accent-on-dark: #A78BFA;  /* accent AS TEXT on side-bg; a raw fill fails there */
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); }
::selection { background: var(--accent-soft); }

/* ---- shell ---- */
.app { display: flex; min-height: 100vh; }
.side {
  width: 248px; flex-shrink: 0;
  background: var(--side-bg); color: var(--side-ink);
  display: flex; flex-direction: column;
  padding: 22px 0 18px;
  position: sticky; top: 0; height: 100vh;
}
.side-brand { padding: 0 22px 20px; }
.side-brand .eyebrow { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--side-dim); }
.side-brand .word { font-size: 24px; font-weight: 700; color: #FFFFFF; letter-spacing: -0.01em; }
.side-brand .word .accent { color: var(--accent-on-dark); }
.side-brand .tag { font-size: 13px; color: var(--side-dim); line-height: 1.45; margin-top: 6px; }

.side-nav { flex: 1; padding: 6px 12px; }
.side-nav .nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; margin-bottom: 2px;
  border: 0; border-radius: 8px; background: none; text-align: left;
  font: 500 15px/1.4 var(--font-body); color: var(--side-ink);
  cursor: pointer; text-decoration: none;
}
.side-nav .nav-item:hover { background: rgba(255,255,255,0.07); }
.side-nav .nav-item.on { background: rgba(255,255,255,0.10); color: #FFFFFF; box-shadow: inset 3px 0 0 var(--accent-on-dark); }
.side-nav .nav-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--side-dim); padding: 14px 12px 6px; }

.side-foot { padding: 12px 22px 0; border-top: 1px solid rgba(255,255,255,0.10); }
.side-foot .who { font-size: 13.5px; color: var(--side-dim); word-break: break-all; margin-bottom: 8px; }
.side-foot select {
  width: 100%; margin-bottom: 10px; padding: 8px 10px;
  background: rgba(255,255,255,0.08); color: var(--side-ink);
  border: 1px solid rgba(255,255,255,0.18); border-radius: 8px;
  font: 500 14px var(--font-body);
}
/* The dropdown's OPEN list is drawn by the browser with a white popup
   background regardless of the select's own dark styling above, so its
   <option> text needs its own dark-on-white pair or it renders unreadable. */
.side-foot select option {
  color: var(--ink);
  background: var(--bg-elev);
}
.side-foot .foot-links { display: flex; gap: 14px; }
.side-foot .foot-links a, .side-foot .foot-links button {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: 500 14px var(--font-body); color: var(--side-dim); text-decoration: none;
}
.side-foot .foot-links a:hover, .side-foot .foot-links button:hover { color: #FFFFFF; }

.main { flex: 1; min-width: 0; padding: 34px 42px 60px; }
.main-inner { max-width: 980px; }
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.page-sub { font-size: 15.5px; color: var(--ink-muted); margin-top: 4px; }

@media (max-width: 820px) {
  .app { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; padding-bottom: 12px; }
  .side-nav { display: flex; flex-wrap: wrap; }
  .main { padding: 22px 18px 48px; }
}

/* ---- cards, forms, buttons ---- */
.card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 12px; padding: 24px 26px; margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(16,21,31,0.04);
}
.card-title { font-size: 18px; font-weight: 700; margin-bottom: 14px; }

.field { margin-bottom: 16px; }
.label { display: block; font: 600 13.5px/1.4 var(--font-body); color: var(--ink-muted);
  margin-bottom: 6px; }
.label .hint { font-weight: 400; color: var(--ink-dim); }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 13px;
  background: #FFFFFF; color: var(--ink);
  border: 1px solid var(--border-mid); border-radius: 8px;
  font: 400 15.5px/1.5 var(--font-body);
}
.input:focus { outline: 2px solid var(--accent-fill); outline-offset: 1px; border-color: transparent; }
textarea.input { resize: vertical; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .field-grid { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border-mid); background: #FFFFFF; color: var(--ink);
  font: 600 15px/1.3 var(--font-body); text-decoration: none;
}
.btn:hover { border-color: var(--ink-muted); }
.btn.primary { background: var(--accent-fill); color: var(--on-accent); border-color: transparent; }
.btn.primary:hover { filter: brightness(0.94); }
.btn.danger { color: var(--danger); border-color: rgba(200,30,30,0.35); }
.btn.danger:hover { background: rgba(200,30,30,0.06); }
.btn.sm { padding: 7px 13px; font-size: 14px; }
.btn:disabled { opacity: 0.55; cursor: default; }
.linklike { background: none; border: 0; padding: 0; cursor: pointer;
  font: 600 15px var(--font-body); color: var(--accent-ink); text-decoration: underline; }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---- small pieces ---- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px;
  border-radius: 999px; border: 1px solid var(--border-mid);
  font: 500 13.5px/1.5 var(--font-body); color: var(--ink); background: #FFFFFF; }
.chip.click { cursor: pointer; }
.chip.on { background: var(--accent-soft); border-color: var(--accent-ink); color: var(--accent-ink); font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot.ok { background: var(--success); } .dot.warn { background: #B45309; }
.dot.err { background: var(--danger); } .dot.off { background: var(--ink-dim); }

.muted { color: var(--ink-muted); }
.dim { color: var(--ink-dim); }
.mono { font-family: var(--font-mono); font-size: 0.9em; }
.empty { text-align: center; color: var(--ink-muted); font-size: 15.5px; padding: 26px 12px; }
.msg { font-size: 14.5px; min-height: 20px; } .msg.err { color: var(--danger); font-weight: 600; }

.note-banner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: #FEF3C7; border: 1px solid #D97706; color: #713F12;
  border-radius: 10px; padding: 12px 16px; margin-bottom: 18px;
  font-size: 15px; font-weight: 500; }

.spinner { width: 16px; height: 16px; border: 2px solid rgba(16,21,31,0.2);
  border-top-color: var(--ink); border-radius: 50%; display: inline-block;
  animation: rt-spin 0.8s linear infinite; vertical-align: -3px; }
.btn.primary .spinner { border-color: rgba(255,255,255,0.35); border-top-color: var(--on-accent); }
@keyframes rt-spin { to { transform: rotate(360deg); } }

.toast-host { position: fixed; bottom: 22px; right: 22px; z-index: 60;
  display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--side-bg); color: #FFFFFF; padding: 12px 18px;
  border-radius: 10px; font-size: 14.5px; font-weight: 500; max-width: 380px;
  box-shadow: 0 6px 24px rgba(16,21,31,0.25); }
.toast.err { background: #7F1D1D; }

/* ---- login ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 20px; }
.login-card { width: 100%; max-width: 460px; background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: 14px; padding: 34px 36px;
  box-shadow: 0 8px 30px rgba(16,21,31,0.08); }
.login-card .word { font-size: 27px; font-weight: 700; }
.login-card .word .accent { color: var(--accent-ink); }
