/* Command Center — PortalOS base template pass
   Source rule: PortalOS shell/topbar/rail/panel/card/settings patterns are the base.
   Odarius overrides: accent defaults to Odarius blue; sidebar uses the same grey as cards. */

:root {
  --odarius-blue: #007BFF;
  --odarius-cyan: #00D4FF;
  --odarius-purple: #7B2CFF;
  --odarius-navy: #0A0F1D;
  --odarius-white: #FFFFFF;

  --bg:        #000000;
  --glow-1:    #000000;
  --glow-2:    #000000;
  --panel:     #11151c;
  --panel-2:   #161b24;
  --border:    #232b38;
  --border-2:  #2e3949;
  --text:      #e7edf4;
  --muted:     #8794a6;
  --accent:    var(--odarius-blue);
  --accent-dim:#005fcc;
  --warn:      #ffb454;
  --ext:       #7aa2ff;
  --danger:    #ff5d6c;
  --ok:        #46d39a;
  --radius:    14px;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --ui: 'Hanken Grotesk', system-ui, sans-serif;
  --topbar-h: 58px;
  --adv-h: 44px;
  --rail-collapsed: 54px;
  --rail-expanded: 232px;
  --sidebar-bg: var(--panel);
}

:root[data-theme="day"] {
  --bg:        #eef1f6;
  --glow-1:    #dde8f6;
  --glow-2:    #e7f4ee;
  --panel:     #ffffff;
  --panel-2:   #f3f6fb;
  --border:    #e3e9f1;
  --border-2:  #cdd7e3;
  --text:      #15202e;
  --muted:     #5d6b7d;
  --ok:        #0f9d6e;
  --warn:      #bd7916;
  --ext:       #3360e0;
  --danger:    #d2384a;
  --sidebar-bg: var(--panel);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { font-size: var(--ui-scale, 16px); }
body {
  font-family: var(--ui);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}

button, input { font: inherit; }
code { font-family: var(--mono); font-size: 0.85em; color: var(--accent); }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin-top: 0; }
.muted { color: var(--muted); margin: 4px 0 0; font-size: 0.9rem; }

.btn {
  font-family: var(--ui); font-size: 0.92rem; font-weight: 600;
  color: #04110e; background: var(--accent); border: none;
  padding: 10px 18px; border-radius: 10px; cursor: pointer;
  transition: transform .08s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border-2); }
.btn.ghost:hover { border-color: var(--accent-dim); color: var(--accent); }
.btn.sm { padding: 6px 12px; font-size: 0.85rem; }

.pill {
  font-family: var(--mono); font-size: 0.66rem; text-transform: uppercase;
  letter-spacing: .08em; padding: 3px 8px; border-radius: 20px;
  border: 1px solid currentColor; white-space: nowrap;
}
.pill.live { color: var(--ok); }
.pill.warn { color: var(--warn); }
.pill.ext  { color: var(--ext); }

.shell { min-height: 100vh; display: flex; flex-direction: column; --topbar-h: 58px; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 22px; border-bottom: 1px solid var(--border);
  background: rgba(10,12,16,.7); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 60;
}
:root[data-theme="day"] .topbar { background: rgba(255,255,255,.72); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.user { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); }
.brand { font-weight: 750; font-size: 1.15rem; letter-spacing: -0.02em; display: flex; align-items: center; gap: 9px; }
.brand-mark { color: var(--accent); }
.ver { font-family: var(--mono); font-size: 0.62rem; color: var(--muted); border: 1px solid var(--border-2); padding: 2px 6px; border-radius: 6px; letter-spacing: .05em; }
.mono-context { font-family: var(--mono); font-size: 0.74rem; }
#sectionTitle { font-size: 0.9rem; font-weight: 650; }

.body { flex: 1; position: relative; min-height: 0; }
.rail {
  position: fixed; top: var(--topbar-h); left: 0; bottom: var(--adv-h);
  width: var(--rail-collapsed); z-index: 30;
  display: flex; flex-direction: column; gap: 3px; overflow: hidden;
  padding: 12px 9px; background: transparent; border-right: 1px solid var(--border);
  transition: width .16s ease, background .16s ease, box-shadow .16s ease;
}
.rail:hover,
.shell.rail-pinned .rail {
  width: var(--rail-expanded); background: var(--sidebar-bg); box-shadow: 8px 0 28px rgba(0,0,0,.30); overflow-y: auto;
}
.workzone { margin-left: var(--rail-collapsed); }

.rail-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 9px 7px; border-radius: 10px; cursor: pointer; white-space: nowrap;
  background: transparent; border: none; border-left: 2px solid transparent; color: var(--muted);
  justify-content: center;
  transition: background .12s ease, color .12s ease;
}
.rail:hover .rail-item,
.shell.rail-pinned .rail-item { justify-content: flex-start; }
.rail-item:hover { background: var(--panel-2); color: var(--text); }
.rail-item.active { color: var(--text); border-left-color: var(--accent); }
.ri-icon { width: 22px; height: 22px; color: inherit; opacity: .75; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.rail-item:hover .ri-icon,
.rail-item.active .ri-icon { opacity: 1; }
.rail-item.active .ri-icon { color: var(--accent); }
.ri-text { display: none; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.rail:hover .ri-text,
.shell.rail-pinned .rail .ri-text { display: flex; }
.rail .pill { display: none; flex: 0 0 auto; }
.rail:hover .pill,
.shell.rail-pinned .rail .pill { display: inline-block; }
.ri-label { font-weight: 600; font-size: 0.9rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.ri-sub { font-size: 0.72rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rail-subnav {
  display: none;
  margin: -2px 0 5px 32px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
  gap: 3px;
}
.rail:hover .rail-subnav.open,
.shell.rail-pinned .rail .rail-subnav.open { display: grid; }
.rail-subitem {
  text-align: left;
  color: var(--muted);
  border: none;
  background: transparent;
  padding: 6px 8px;
  font-size: 0.78rem;
  border-radius: 8px;
  cursor: pointer;
}
.rail-subitem:hover,
.rail-subitem.active { background: var(--panel-2); color: var(--text); }

.panel { padding: 28px 32px; overflow-y: auto; }
.panel { --page-w: 1080px; }
@media (min-width: 1500px) { .panel { --page-w: 1280px; } }
@media (min-width: 1920px) { .panel { --page-w: 1520px; } }
@media (min-width: 2400px) { .panel { --page-w: 1780px; } }
.panel > * { max-width: var(--page-w); margin-inline: auto; width: 100%; }

.section { display: none; }
.active-section { display: block; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 0 0 14px; }
.section-heading p { max-width: 680px; }
.sec { font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin: 0 0 12px; }
.sec-inline { font-family: var(--mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }

.dash-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.dtile {
  position: relative; text-align: left; color: var(--text);
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 8px; min-height: 130px;
  transition: transform .1s ease, border-color .15s ease, background .15s ease;
}
.dtile:hover { transform: translateY(-2px); border-color: var(--border-2); background: var(--panel-2); }
.dtile-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.dtile strong { font-size: .96rem; font-weight: 650; line-height: 1.25; }
.dtile p { line-height: 1.48; }
.metric { min-height: 142px; }

.hero-card { margin-bottom: 16px; }
.hero-card.dtile { min-height: 0; }
.hero-body { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 24px; padding-top: 2px; }
.hero-body h1 { max-width: 650px; font-size: clamp(1.45rem, 2.1vw, 2.25rem); line-height: 1.12; margin-bottom: 10px; }
.lede { max-width: 720px; }
.hero-stack { display: grid; align-content: start; gap: 8px; }

.app-links,
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 8px; }
.app-links a,
.card-meta span { color: var(--muted); text-decoration: none; border: 1px solid var(--border); border-radius: 999px; padding: 4px 7px; font-size: 0.72rem; background: rgba(255,255,255,0.03); }
.app-links a:hover { color: var(--accent); border-color: var(--accent-dim); }

.record-list { display: grid; gap: 10px; }
.record-row { display: grid; grid-template-columns: 130px minmax(0,1fr) 140px; gap: 10px; align-items: center; border: 1px solid var(--border); background: var(--panel); border-radius: 11px; padding: 12px; }
.record-row p { color: var(--muted); margin: 4px 0 0; font-size: 0.86rem; line-height: 1.45; }
.record-kind { color: var(--accent); font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 500; }
.record-status { justify-self: end; border: 1px solid var(--border); border-radius: 999px; padding: 4px 8px; color: var(--muted); font-size: 0.76rem; }

.two-column { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.7fr); gap: 14px; }
.task-list { color: var(--muted); line-height: 1.7; padding: 4px 22px 0; margin: 0; }

.settings { max-width: 980px; }
.setting-row { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: 0; }
.setting-row small { display: block; color: var(--muted); margin-top: 4px; }
.segmented { display: inline-flex; border: 1px solid var(--border-2); border-radius: 9px; overflow: hidden; }
.segmented button { border: 0; border-radius: 0; padding: 7px 12px; color: var(--muted); background: var(--bg); cursor: pointer; }
.segmented button.active { background: var(--accent-dim); color: #fff; }
.accent-dots { display: flex; gap: 9px; }
.dot { width: 20px; height: 20px; border-radius: 999px; border: 1px solid var(--border-2); cursor: pointer; }
.dot.active { outline: 2px solid var(--odarius-white); outline-offset: 2px; }
.dot.blue { background: var(--odarius-blue); }
.dot.cyan { background: var(--odarius-cyan); }
.dot.purple { background: var(--odarius-purple); }
.dot.gold { background: var(--warn); }
.dot.green { background: var(--ok); }
.dot.red { background: var(--danger); }

.bottom-advisor {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--adv-h); z-index: 50;
  display: grid; grid-template-columns: 18px minmax(0, 1fr) 36px; align-items: center; gap: 8px;
  padding: 7px 12px; background: var(--panel); border-top: 1px solid var(--border-2);
}
.advisor-dot { width: 9px; height: 9px; border-radius: 999px; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.bottom-advisor input { width: 100%; border: 1px solid var(--border-2); background: var(--bg); color: var(--text); border-radius: 8px; padding: 8px 11px; outline: none; }
.bottom-advisor input:focus { border-color: var(--accent-dim); }
.bottom-advisor button { height: 32px; }

@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .hero-body { grid-template-columns: 1fr; }
  .two-column { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .topbar { position: static; align-items: flex-start; flex-direction: column; }
  .rail { position: static; width: auto; background: var(--sidebar-bg); box-shadow: none; border-right: 0; border-bottom: 1px solid var(--border); }
  .rail .ri-text, .rail .pill { display: flex; }
  .rail-item { justify-content: flex-start; }
  .rail-subnav.open { display: grid; }
  .workzone { margin-left: 0; }
  .panel { padding: 14px; }
  .dash-grid { grid-template-columns: 1fr; }
  .record-row { grid-template-columns: 1fr; }
  .record-status { justify-self: start; }
}
