/* tisavibe console design system.
   One place for the palette + components. Formalizes the previously-inlined shell styles
   into tokens, adds reusable component classes, and makes the shell responsive. */

:root {
  /* surfaces */
  --bg:        #0c1929;   /* app background — deep navy */
  --surface:   #10233b;   /* cards */
  --surface-2: #0a1526;   /* sidebar, code, insets */
  --border:    #1d3557;
  --border-2:  #2c476b;   /* input borders */
  /* ink */
  --text:      #e7eef7;
  --text-2:    #c4d3e8;   /* nav links */
  --muted:     #93a4bd;
  --muted-2:   #6580a3;
  /* brand + semantic */
  --accent:      #7ab4f0;
  --accent-ink:  #0c1929;
  --accent-soft: #14304d;
  --good:   #5fd08a;
  --warn:   #e2b35b;
  --danger: #ffb4ad;
  /* shape */
  --r:    8px;
  --r-lg: 14px;
  --sidebar: 220px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
       background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin-bottom: 6px; text-transform: lowercase; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
.sub { color: var(--muted); font-size: 13.5px; margin-bottom: 22px; }
.muted { color: var(--muted); }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 5px; font-size: 13px; }

button, .btn { font: inherit; font-weight: 600; padding: 9px 15px; border: 0; border-radius: var(--r);
               background: var(--accent); color: var(--accent-ink); cursor: pointer; }
button:hover, .btn:hover { filter: brightness(1.06); text-decoration: none; }
button.ghost, .btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border-2); }
button.sm, .btn.sm { padding: 5px 11px; font-size: 13px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input, textarea, select { background: var(--bg); color: var(--text); border: 1px solid var(--border-2);
                          border-radius: var(--r); padding: 9px 11px; font: inherit; }
textarea { resize: vertical; }

/* ---- app shell (body.app) --------------------------------------------------------- */
body.app { display: flex; }
aside { width: var(--sidebar); background: var(--surface-2); border-right: 1px solid var(--border);
        padding: 20px 16px; position: sticky; top: 0; height: 100vh; flex-shrink: 0; overflow-y: auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.wordmark { font-size: 17px; font-weight: 800; display: flex; align-items: center; gap: 8px; color: var(--text); }
.wordmark .mark { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: var(--accent-ink);
                  display: flex; align-items: center; justify-content: center; font-weight: 900; }
.hamburger { display: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--text);
             padding: 4px 8px; border-radius: var(--r); }
.navtoggle { position: absolute; left: -9999px; }
aside select { width: 100%; margin-bottom: 16px; }
nav a { display: block; padding: 8px 10px; border-radius: var(--r); color: var(--text-2); font-size: 14px; }
nav a:hover, nav a.active { background: var(--accent-soft); color: #fff; text-decoration: none; }
nav .group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2);
             margin: 16px 0 6px 10px; }
nav form { margin-top: 10px; }

main { flex: 1; min-width: 0; padding: 32px 40px; max-width: 940px; }

.banner { padding: 9px 14px; border-radius: var(--r); margin-bottom: 16px; font-size: 13.5px; }
.banner.warn   { background: #4a3a12; color: #ffd98a; }
.banner.hijack { background: #3a1f4a; color: #e0b4ff; }
.msg { background: var(--accent-soft); padding: 10px 14px; border-radius: var(--r); margin-bottom: 12px; font-size: 14px; }
.msg.error { background: #4a1f22; color: var(--danger); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
        padding: 20px 22px; margin-bottom: 16px; }

/* ---- reusable components (to migrate inline styles into) --------------------------- */
.kpi-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .value { font-size: 26px; font-weight: 800; }
.row { padding: 7px 0; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; }
.chip { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.chip.good { color: var(--good); } .chip.warn { color: var(--warn); } .chip.bad { color: var(--danger); }
.chip.info { color: var(--accent); } .chip.dim { color: var(--muted); }

/* ---- auth screens (body.auth) ----------------------------------------------------- */
body.auth { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
             padding: 32px 34px; width: 100%; max-width: 380px; box-shadow: 0 12px 40px rgba(0,0,0,.4); }
.auth-card .wordmark { margin-bottom: 6px; }
.auth-card label { font-size: 12px; color: var(--muted); display: block; margin: 12px 0 4px; font-weight: 600; }
.auth-card input { width: 100%; }
.auth-card button { width: 100%; margin-top: 16px; }
.auth-card .err { background: #4a1f22; color: var(--danger); padding: 9px 12px; border-radius: var(--r); font-size: 14px; margin-bottom: 12px; }
.auth-card .links { margin-top: 14px; font-size: 12.5px; text-align: center; color: var(--muted); }

/* ---- responsive: collapse the sidebar into a top bar + hamburger drawer ------------ */
@media (max-width: 760px) {
  body.app { flex-direction: column; }
  aside { width: 100%; height: auto; position: static; border-right: 0;
          border-bottom: 1px solid var(--border); padding: 12px 16px; overflow: visible; }
  .topbar { margin-bottom: 0; }
  .hamburger { display: block; }
  .navwrap { display: none; margin-top: 12px; }
  .navtoggle:checked ~ .navwrap { display: block; }
  main { padding: 22px 18px; max-width: 100%; }
}
