/* =========================================================================
   RGOS — Command Deck design system
   Palette: deep ink navy, with GOLD as James/intelligence, CYAN as live/system,
   VERMILION as risk. Type: Space Grotesk (display) + Inter (UI) + JetBrains Mono.
   ========================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --ink: #0A0F1A;
  --panel: #111A2B;
  --panel-2: #16223A;
  --line: #233044;
  --text: #E7EDF7;
  --muted: #8A98B0;
  --gold: #E0A53B;      /* James / intelligence */
  --gold-dim: #6e5a2f;
  --cyan: #3DD8C4;      /* live / positive */
  --vermilion: #E5634D; /* risk / alert */
  --violet: #8C7BE8;
  --radius: 12px;
  --shadow: 0 12px 40px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(224,165,59,.07), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, rgba(61,216,196,.06), transparent 55%),
    var(--ink);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4 { font-family: 'Space Grotesk', sans-serif; font-weight: 600; margin: 0; letter-spacing: -.01em; }
a { color: var(--cyan); text-decoration: none; }
.mono { font-family: 'JetBrains Mono', monospace; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---- Layout ---- */
#app { display: flex; min-height: 100vh; }
.rail {
  width: 248px; flex-shrink: 0; background: var(--panel);
  border-right: 1px solid var(--line); padding: 22px 16px;
  display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; overscroll-behavior: contain;
}
/* slim scrollbar for the navigation rail */
.rail::-webkit-scrollbar { width: 8px; }
.rail::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
.rail::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.rail { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; }
.brand .mark {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--gold), #b9842a);
  display: grid; place-items: center; font-family: 'Space Grotesk'; font-weight: 700; color: #1a1304;
  box-shadow: 0 0 24px rgba(224,165,59,.35);
}
.brand .brand-logo {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0; object-fit: cover;
  background: #fff; box-shadow: 0 0 24px rgba(224,165,59,.30);
}
.brand b { font-family: 'Space Grotesk'; font-size: 15px; display: block; line-height: 1.1; }
.brand small { color: var(--muted); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; }

.nav-group { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 16px 8px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px;
  color: var(--muted); cursor: pointer; font-weight: 500; transition: .15s;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(224,165,59,.16), transparent); color: var(--gold); }
.nav-item .ic { width: 18px; text-align: center; }
.rail .foot { margin-top: auto; font-size: 11px; color: var(--muted); padding: 12px 8px 0; border-top: 1px solid var(--line); }

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 28px; border-bottom: 1px solid var(--line); position: sticky; top: 0;
  background: rgba(10,15,26,.8); backdrop-filter: blur(8px); z-index: 5;
}
.topbar h2 { font-size: 18px; }
.content { padding: 24px 28px 64px; max-width: 1280px; }

/* ---- Pill / badges ---- */
.pill { font-size: 11px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.pill.live { color: var(--cyan); border-color: rgba(61,216,196,.4); background: rgba(61,216,196,.08); }
.pill.gold { color: var(--gold); border-color: rgba(224,165,59,.4); background: rgba(224,165,59,.08); }
.pill.risk { color: var(--vermilion); border-color: rgba(229,99,77,.4); background: rgba(229,99,77,.08); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ---- Cards ---- */
.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: 1.4fr 1fr; }
.card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
}
.card h3 { font-size: 13px; color: var(--muted); font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }
.kpi { font-family: 'Space Grotesk'; font-size: 30px; font-weight: 700; margin-top: 8px; }
.kpi small { font-size: 13px; color: var(--muted); font-weight: 400; }
.bar { height: 7px; background: var(--ink); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--cyan)); }

/* ---- James briefing ---- */
.briefing { border-left: 3px solid var(--gold); }
.briefing .line { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.briefing .line:last-child { border: 0; }
.reco { background: rgba(224,165,59,.08); border: 1px solid rgba(224,165,59,.3); border-radius: 9px; padding: 12px; margin-top: 12px; color: var(--gold); }

/* ---- James chat ---- */
.chat { display: flex; flex-direction: column; height: 520px; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-right: 6px; }
.msg { max-width: 85%; padding: 11px 14px; border-radius: 12px; line-height: 1.5; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--panel-2); border: 1px solid var(--line); }
.msg.james { align-self: flex-start; background: rgba(224,165,59,.07); border: 1px solid rgba(224,165,59,.25); }
.msg .who { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--gold); margin-bottom: 5px; }
.exec-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0; }
.chip { font-size: 11.5px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); cursor: pointer; color: var(--muted); }
.chip.active { border-color: var(--gold); color: var(--gold); background: rgba(224,165,59,.1); }

/* ---- Forms / buttons ---- */
input, select, textarea {
  background: var(--ink); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 10px 12px; font: inherit; width: 100%; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
label { display: block; font-size: 12px; color: var(--muted); margin: 0 0 6px; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 10px; }
.btn {
  background: linear-gradient(135deg, var(--gold), #c08c2c); color: #1a1304; border: 0;
  border-radius: 9px; padding: 10px 16px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.sm { padding: 6px 11px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Table ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
tr:hover td { background: rgba(255,255,255,.02); }
.score { font-family: 'JetBrains Mono'; font-weight: 500; }
.score.hi { color: var(--cyan); } .score.mid { color: var(--gold); } .score.lo { color: var(--muted); }

/* ---- Kanban ---- */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; }
.col { min-width: 220px; flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.col h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; justify-content: space-between; }
.lead-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 10px; margin-top: 9px; cursor: grab; }
.lead-card b { font-size: 13px; } .lead-card .meta { font-size: 11px; color: var(--muted); margin-top: 4px; display: flex; justify-content: space-between; }

/* ---- James browser ---- */
.browser-shell { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.browser-bar { display: flex; gap: 8px; align-items: center; padding: 10px 12px; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.browser-bar .dots { display: flex; gap: 5px; }
.browser-bar .dots i { width: 11px; height: 11px; border-radius: 50%; display: block; }
.browser-bar input { flex: 1; }
.browser-body { display: grid; grid-template-columns: 1fr 300px; min-height: 420px; }
.browser-page { padding: 16px 18px; overflow-y: auto; max-height: 560px; }
.browser-page .ln { padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,.03); font-size: 13px; line-height: 1.5; }
.browser-side { border-left: 1px solid var(--line); padding: 14px; background: var(--ink); overflow-y: auto; max-height: 560px; }
.james-says { background: rgba(224,165,59,.07); border: 1px solid rgba(224,165,59,.25); border-radius: 9px; padding: 12px; line-height: 1.55; white-space: pre-wrap; }
.link-list a { display: block; padding: 6px 0; font-size: 12px; border-bottom: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Login ---- */
.login-wrap { display: grid; place-items: center; min-height: 100vh; width: 100%; }
.login-card { width: 380px; max-width: 90vw; }
.login-card .mark-lg { width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--gold), #b9842a); display: grid; place-items: center;
  font-family: 'Space Grotesk'; font-weight: 700; font-size: 24px; color: #1a1304; box-shadow: 0 0 30px rgba(224,165,59,.4); }
.login-card .login-logo { display: block; width: 96px; height: 96px; object-fit: cover; border-radius: 18px;
  margin: 0 auto 14px; background: #fff; box-shadow: 0 0 40px rgba(224,165,59,.35); }
.pwrap { position: relative; }
.pwrap input { width: 100%; padding-right: 44px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: rgba(224,165,59,.12); border: 1px solid rgba(224,165,59,.4); border-radius: 7px;
  cursor: pointer; padding: 5px 6px; color: var(--gold); display: inline-flex; align-items: center;
  justify-content: center; line-height: 0; }
.pw-eye:hover { background: rgba(224,165,59,.22); color: #f3c879; }
.pw-eye svg { display: block; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line); padding: 12px 18px; border-radius: 10px;
  box-shadow: var(--shadow); z-index: 50; }
.toast.err { border-color: var(--vermilion); color: var(--vermilion); }

.section-title { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 12px; }
.section-title h3 { font-size: 15px; }

@media (max-width: 960px) {
  .rail { display: none; }
  .cols-4, .cols-3 { grid-template-columns: 1fr 1fr; }
  .cols-2 { grid-template-columns: 1fr; }
  .browser-body { grid-template-columns: 1fr; }
}

/* Modal (password change, etc.) */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal-card { width: 380px; max-width: 92vw; }
/* selection delete toolbar checkbox column */
#view table th.sel-th, #view table td:first-child input.sel-row { text-align: center; }
#view select { background: var(--panel-2, #16202e); color: var(--text, #e8eef5); border: 1px solid var(--line, #2a3850); border-radius: 8px; padding: 6px 10px; }
