/* NOEKRON console — glass.
 *
 * The visual idea follows the system's: layers you can see through. Every panel
 * is translucent over a single deep field, so the console reads as one surface
 * with depth rather than a stack of opaque cards. Nothing here is decorative for
 * its own sake — the blur separates planes, the borders catch a light source,
 * and colour is reserved for state that matters (grounded, refused, unverified).
 *
 * No fonts, images, or scripts are fetched. The API sets a strict CSP, and a
 * console for a governed system should not be making third-party requests.
 */

:root {
  --bg: #05070d;
  --field-1: #123a6b;
  --field-2: #2b1b5e;
  --field-3: #06304a;

  --glass: rgba(255, 255, 255, 0.055);
  --glass-strong: rgba(255, 255, 255, 0.085);
  --edge: rgba(255, 255, 255, 0.11);
  --edge-bright: rgba(255, 255, 255, 0.2);

  --ink: #eaf0fb;
  --ink-dim: #9db0cc;
  --ink-faint: #64789a;

  --accent: #5eead4;
  --accent-deep: #0f766e;
  --warn: #fbbf24;
  --danger: #fb7185;
  --ok: #4ade80;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  --sans: ui-sans-serif, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

/* The UA's `[hidden] { display: none }` has lower priority than any author rule
 * that sets `display`, so `.banner { display: flex }` silently defeated
 * `hidden` on every banner in this file — the "view-only" notice stayed up next
 * to enabled Approve buttons, which is exactly the kind of contradiction a
 * console must never show. Author-level and !important so `hidden` means hidden. */
[hidden] { display: none !important; }

html {
  /* The base colour lives here, not on `body`. `body::before` carries the field
   * at `z-index: -1`, and a pseudo-element behind its own element is *also*
   * behind that element's background — so an opaque `body` background paints
   * straight over the field and the whole console goes flat black. Painting the
   * base on `html` leaves `body` transparent and lets the field through. */
  background: var(--bg);
}

html, body {
  height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* The field the glass sits on. Fixed and behind everything, so panels blur a
 * stable background instead of each other — layered blurs are what make
 * glassmorphism turn to mud. */
body::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -1;
  background:
    radial-gradient(45% 55% at 18% 12%, var(--field-1) 0%, transparent 60%),
    radial-gradient(40% 50% at 82% 8%, var(--field-2) 0%, transparent 62%),
    radial-gradient(55% 60% at 60% 95%, var(--field-3) 0%, transparent 65%),
    var(--bg);
  filter: saturate(1.15);
}

/* ------------------------------------------------------------------ shell */

.shell {
  display: grid;
  grid-template-columns: 264px 1fr;
  grid-template-rows: auto 1fr;
  gap: 16px;
  height: 100vh;
  padding: 16px;
}

.glass {
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(1.6);
  -webkit-backdrop-filter: blur(22px) saturate(1.6);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
}

/* A single specular line along the top edge. This is what makes a translucent
 * panel read as glass rather than as a semi-transparent rectangle. */
.glass::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, transparent, var(--edge-bright) 22%,
              var(--edge-bright) 78%, transparent);
  pointer-events: none;
}

/* ------------------------------------------------------------------ header */

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
  height: 62px;
}

.brand { display: flex; align-items: baseline; gap: 10px; }
.brand h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 620;
  letter-spacing: 0.16em;
}
.brand .by {
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.status-strip { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  font-size: 11.5px;
  border-radius: 999px;
  background: var(--glass-strong);
  border: 1px solid var(--edge);
  color: var(--ink-dim);
  white-space: nowrap;
}
.chip b { color: var(--ink); font-weight: 600; }
.chip .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink-faint);
  box-shadow: 0 0 8px currentColor;
}
.chip.ok    .dot { background: var(--ok); }
.chip.warn  .dot { background: var(--warn); }
.chip.bad   .dot { background: var(--danger); }
.chip.warn  { border-color: rgba(251, 191, 36, 0.35); color: #fde68a; }
.chip.bad   { border-color: rgba(251, 113, 133, 0.35); color: #fecdd3; }

/* ------------------------------------------------------------------- nav */

.sidebar { display: flex; flex-direction: column; padding: 14px; gap: 6px; min-height: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: none;
  color: var(--ink-dim);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.nav-item:hover { background: var(--glass); color: var(--ink); }
.nav-item[aria-current="page"] {
  background: var(--glass-strong);
  border-color: var(--edge-bright);
  color: var(--ink);
}
.nav-item .glyph { width: 18px; text-align: center; opacity: 0.85; }
.badge {
  margin-left: auto; min-width: 20px; padding: 1px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 650; text-align: center;
  background: var(--warn); color: #3a2a05;
}

.nav-heading {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 14px 12px 6px;
}

.session-list { overflow-y: auto; min-height: 0; flex: 1; margin: 0 -4px; padding: 0 4px; }
.session {
  display: block; width: 100%; text-align: left;
  padding: 7px 12px; border-radius: 10px; border: 1px solid transparent;
  background: none; color: var(--ink-dim); font: inherit; font-size: 13px;
  cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.session:hover { background: var(--glass); color: var(--ink); }
.session[aria-current="true"] { background: var(--glass-strong); color: var(--ink); }

/* ------------------------------------------------------------------ main */

.main { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }

.view { display: none; flex-direction: column; min-height: 0; flex: 1; }
.view[data-active] { display: flex; }

.view-head {
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--edge);
}
.view-head h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: 0.02em; }
.view-head p { margin: 5px 0 0; font-size: 13px; color: var(--ink-faint); max-width: 68ch; }

.scroll { overflow-y: auto; flex: 1; padding: 20px 24px; min-height: 0; }

/* ------------------------------------------------------------------ chat */

.turn { display: flex; gap: 13px; margin-bottom: 20px; animation: rise 0.28s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(7px); } }

.avatar {
  flex: none; width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  background: var(--glass-strong); border: 1px solid var(--edge); color: var(--ink-dim);
}
.turn.noekron .avatar {
  background: linear-gradient(140deg, rgba(94, 234, 212, 0.22), rgba(45, 212, 191, 0.06));
  border-color: rgba(94, 234, 212, 0.35);
  color: var(--accent);
}

.bubble { flex: 1; min-width: 0; }
.bubble .who { font-size: 11px; color: var(--ink-faint); letter-spacing: 0.09em;
               text-transform: uppercase; margin-bottom: 5px; }
.bubble .body { white-space: pre-wrap; overflow-wrap: anywhere; }

.meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; align-items: center; }

.tag {
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--edge); color: var(--ink-dim);
}
.tag.grounded { border-color: rgba(74, 222, 128, 0.3); color: #bbf7d0; }
.tag.ungrounded { border-color: rgba(251, 191, 36, 0.3); color: #fde68a; }

.link-btn {
  font: inherit; font-size: 11px; padding: 3px 10px; border-radius: 999px;
  background: none; border: 1px dashed var(--edge-bright); color: var(--ink-dim);
  cursor: pointer;
}
.link-btn:hover { color: var(--accent); border-color: var(--accent); }

.rewrite {
  font-size: 12px; color: var(--ink-faint); font-style: italic;
  border-left: 2px solid var(--edge); padding-left: 9px; margin-top: 6px;
}

/* ---------------------------------------------------------------- composer */

.composer { padding: 14px 24px 18px; border-top: 1px solid var(--edge); }
.composer form { display: flex; gap: 10px; align-items: flex-end; }

textarea, input[type="text"] {
  flex: 1; resize: none;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--edge);
  border-radius: 14px;
  padding: 12px 15px;
  color: var(--ink); font: inherit;
  max-height: 180px;
}
textarea:focus, input[type="text"]:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.13);
}
textarea::placeholder, input::placeholder { color: var(--ink-faint); }

.btn {
  font: inherit; font-size: 14px; font-weight: 560;
  padding: 11px 20px; border-radius: 14px; cursor: pointer;
  color: #04231f;
  background: linear-gradient(140deg, var(--accent), #34d399);
  border: 1px solid rgba(94, 234, 212, 0.6);
  transition: filter 0.16s, transform 0.16s;
}
.btn:hover:not(:disabled) { filter: brightness(1.07); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn.ghost {
  background: var(--glass-strong); border: 1px solid var(--edge); color: var(--ink);
}
.btn.small { padding: 7px 13px; font-size: 12.5px; border-radius: 11px; }
.hint { font-size: 11.5px; color: var(--ink-faint); margin-top: 9px; }

/* ------------------------------------------------------------------ cards */

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.card {
  padding: 15px 17px;
  border-radius: var(--radius-sm);
  background: var(--glass);
  border: 1px solid var(--edge);
}
.card h3 { margin: 0 0 4px; font-size: 13.5px; font-weight: 600; }
.card p  { margin: 0; font-size: 12.5px; color: var(--ink-dim); }
.card .value { font-size: 26px; font-weight: 640; letter-spacing: -0.01em; }
.card .value.small { font-size: 17px; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 5px 16px; font-size: 13px; }
.kv dt { color: var(--ink-faint); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.rows { display: flex; flex-direction: column; gap: 9px; }
.row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 11px 14px; border-radius: var(--radius-sm);
  background: var(--glass); border: 1px solid var(--edge);
}
.row .grow { flex: 1; min-width: 0; }
.row .title { font-size: 13.5px; font-weight: 560; }
.row .sub { font-size: 12px; color: var(--ink-faint); overflow-wrap: anywhere; }

/* Disposition colouring. The refusals are the point of the autonomy view, so
 * they are as legible as the actions — a console that only highlights what the
 * loop did cannot be used to audit what it declined. */
.row.performed { border-left: 3px solid var(--ok); }
.row.refused   { border-left: 3px solid var(--danger); }
.row.escalated { border-left: 3px solid var(--warn); }
.row.deferred  { border-left: 3px solid var(--ink-faint); }

code, .mono { font-family: var(--mono); font-size: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--edge); }
th { color: var(--ink-faint); font-weight: 500; font-size: 11px;
     text-transform: uppercase; letter-spacing: 0.08em; }
.table-wrap { overflow-x: auto; }

/* ----------------------------------------------------------------- drawer */

.drawer {
  position: fixed; inset: 0 0 0 auto; width: min(620px, 92vw);
  z-index: 40; transform: translateX(102%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex; flex-direction: column;
  border-radius: var(--radius) 0 0 var(--radius);
  background: rgba(10, 14, 24, 0.82);
  backdrop-filter: blur(30px) saturate(1.5);
  -webkit-backdrop-filter: blur(30px) saturate(1.5);
  border-left: 1px solid var(--edge-bright);
}
.drawer[data-open] { transform: none; }
.drawer-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--edge);
}
.drawer-head h2 { margin: 0; font-size: 15px; flex: 1; }
.icon-btn {
  background: none; border: 1px solid var(--edge); color: var(--ink-dim);
  border-radius: 9px; width: 30px; height: 30px; cursor: pointer; font-size: 15px;
}
.icon-btn:hover { color: var(--ink); border-color: var(--edge-bright); }

.scrim {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(2, 4, 9, 0.55);
  backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity 0.28s;
}
.scrim[data-open] { opacity: 1; pointer-events: auto; }

/* ------------------------------------------------------------------ misc */

.empty { color: var(--ink-faint); font-size: 13px; padding: 26px 0; text-align: center; }

.banner {
  margin: 0 24px 14px; padding: 11px 15px; border-radius: var(--radius-sm);
  font-size: 12.5px; display: flex; gap: 10px; align-items: flex-start;
}
.banner.warn { background: rgba(251, 191, 36, 0.1);
               border: 1px solid rgba(251, 191, 36, 0.3); color: #fde68a; }
.banner.bad  { background: rgba(251, 113, 133, 0.1);
               border: 1px solid rgba(251, 113, 133, 0.32); color: #fecdd3; }

.thinking { display: inline-flex; gap: 4px; align-items: center; }
.thinking i {
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
  animation: pulse 1.1s ease-in-out infinite;
}
.thinking i:nth-child(2) { animation-delay: 0.16s; }
.thinking i:nth-child(3) { animation-delay: 0.32s; }
@keyframes pulse { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

.gate { display: grid; place-items: center; height: 100vh; padding: 24px; }
.gate .glass { padding: 30px; width: min(430px, 100%); }
.gate h1 { margin: 0 0 6px; font-size: 20px; letter-spacing: 0.16em; }
.gate p { color: var(--ink-dim); font-size: 13px; margin: 0 0 18px; }
.gate form { display: flex; flex-direction: column; gap: 11px; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.11); border-radius: 9px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* Blur is expensive and some people get motion-sick from it; both are honoured. */
@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}
