/* ============================================================
   ThermaCore - Barracks Industries design system
   Light institutional control-room palette
   ============================================================ */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/InterVariable.woff2") format("woff2");
}

:root {
  /* neutrals */
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f4f7fb;
  --surface-3: #e9eef5;
  --border: #e2e8f0;
  --border-2: #d3dce7;

  /* ink */
  --ink: #0f1b2d;
  --ink-2: #46566b;
  --ink-3: #7a899d;
  --ink-4: #a6b3c4;

  /* brand blue */
  --brand: #2563eb;
  --brand-2: #1d4ed8;
  --brand-3: #1e40af;
  --brand-tint: #e8effe;
  --brand-tint-2: #d5e3fd;

  /* semantic: green = ok/running, amber = caution, red = alarm/trip */
  --ok: #15803d;   --ok-tint: #e4f5ea;   --ok-bd: #b7e2c5;
  --warn: #b45309; --warn-tint: #fbefdb; --warn-bd: #f0d6a4;
  --alert: #dc2626; --alert-tint: #fdeaea; --alert-bd: #f6c9c9;
  --danger: #b91c1c; --danger-tint: #fbeaea;

  /* effects */
  --focus: 0 0 0 3px rgba(37, 99, 235, .2);
  --sh-xs: 0 1px 2px rgba(15, 27, 45, .06);
  --sh-sm: 0 1px 3px rgba(15, 27, 45, .08), 0 1px 2px rgba(15, 27, 45, .05);
  --sh-md: 0 6px 18px rgba(15, 27, 45, .09), 0 2px 5px rgba(15, 27, 45, .05);
  --sh-lg: 0 18px 44px rgba(15, 27, 45, .16), 0 6px 14px rgba(15, 27, 45, .08);

  --r-xs: 6px; --r-sm: 8px; --r: 10px; --r-lg: 14px; --r-xl: 18px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;

  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.02em; color: var(--ink); }
::selection { background: var(--brand-tint-2); }
.mono { font-family: var(--mono); font-variant-ligatures: none; }

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #c7d3e0; border-radius: 20px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #b0bfd0; background-clip: content-box; }

/* ---------- Brand lockup ---------- */
.lockup { display: flex; align-items: center; gap: 11px; }
.lockup .mark { width: 38px; height: 38px; flex: none; display: block; filter: drop-shadow(0 2px 4px rgba(15,27,45,.16)); }
.lockup .wm { display: flex; flex-direction: column; line-height: 1.05; }
.lockup .wm .prod { font-weight: 700; font-size: 16px; letter-spacing: -0.02em; color: var(--ink); }
.lockup .wm .org { font-weight: 600; font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); margin-top: 3px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border: 1px solid transparent; border-radius: var(--r-sm);
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  background: var(--brand); color: #fff; box-shadow: var(--sh-xs);
  transition: background .16s var(--ease), box-shadow .16s var(--ease), transform .06s var(--ease), border-color .16s;
  white-space: nowrap;
}
.btn:hover { background: var(--brand-2); box-shadow: var(--sh-sm); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn svg { width: 17px; height: 17px; }
.btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--border-2); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); border-color: var(--border-2); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 7px; }
.btn-icon {
  width: 34px; height: 34px; padding: 0; border-radius: 8px; background: transparent;
  color: var(--ink-3); border: 1px solid transparent; box-shadow: none; cursor: pointer;
}
.btn-icon:hover { background: var(--surface-2); color: var(--ink); }
.btn-icon svg { width: 18px; height: 18px; }

/* ---------- Fields ---------- */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 7px; }
.input, .select, .textarea {
  width: 100%; padding: 0 13px; border: 1px solid var(--border-2); border-radius: var(--r-sm);
  font: inherit; font-size: 14.5px; background: var(--surface); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.input, .select { height: 42px; }
.textarea { padding: 11px 13px; resize: vertical; min-height: 92px; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }

.form-alert {
  display: none; align-items: center; gap: 9px; margin-bottom: 16px; padding: 10px 13px;
  border-radius: var(--r-sm); font-size: 13.5px; font-weight: 500;
  background: var(--danger-tint); color: var(--danger); border: 1px solid #f1cbc6;
}
.form-alert.show { display: flex; }
.form-alert svg { width: 17px; height: 17px; flex: none; }

/* ============================================================
   LOGIN
   ============================================================ */
.login { min-height: 100%; display: grid; grid-template-columns: 1.05fr .95fr; }

.login-hero {
  position: relative; overflow: hidden; padding: 44px 54px;
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(900px 520px at 82% 4%, rgba(76,141,255,.34), transparent 62%),
    radial-gradient(680px 420px at 6% 98%, rgba(37,99,235,.24), transparent 60%),
    linear-gradient(158deg, #1e3a8a 0%, #1b3474 52%, #14275a 100%);
  color: #eaf1ff;
}
.login-hero::after {
  content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 30px 30px;
  -webkit-mask-image: radial-gradient(120% 90% at 60% 30%, #000, transparent 78%);
          mask-image: radial-gradient(120% 90% at 60% 30%, #000, transparent 78%);
}
.login-hero > * { position: relative; z-index: 1; }
.login-hero .lockup .wm .prod { color: #fff; }
.login-hero .lockup .wm .org { color: #9db8ee; }
.login-hero .lockup .mark { filter: drop-shadow(0 4px 10px rgba(0,0,0,.28)); }

.hero-copy { max-width: 460px; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600;
  letter-spacing: .05em; color: #a9c3f4; background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12); padding: 6px 12px; border-radius: 20px; margin-bottom: 22px;
}
.hero-eyebrow .live { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.25); }
.hero-copy h1 { font-size: 33px; line-height: 1.14; color: #fff; letter-spacing: -0.028em; margin-bottom: 14px; }
.hero-copy .lede { color: #bdd0f2; font-size: 15.5px; margin: 0 0 30px; line-height: 1.55; }
.hero-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 15px; }
.hero-points li { display: flex; gap: 13px; align-items: flex-start; color: #d3e0f6; font-size: 14px; }
.hero-points .ic { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.1); color: #93b4f5; }
.hero-points .ic svg { width: 16px; height: 16px; }
.hero-points strong { color: #fff; font-weight: 600; display: block; font-size: 14px; margin-bottom: 1px; }
.hero-points span { color: #a7c0e8; font-size: 13px; }
.hero-foot { color: #7f9bc8; font-size: 12px; display: flex; align-items: center; gap: 8px; }

.login-panel { display: grid; place-items: center; padding: 40px; background: var(--bg); }
.login-card { width: 100%; max-width: 374px; }
.login-card .card-mark { display: none; }
.login-card h2 { font-size: 23px; letter-spacing: -0.025em; }
.login-card .muted { color: var(--ink-2); margin: 6px 0 26px; font-size: 14.5px; }
.login-card .hint { margin-top: 18px; font-size: 12.5px; color: var(--ink-3); text-align: center; }

/* ============================================================
   CONSOLE SHELL
   ============================================================ */
.app { display: grid; grid-template-rows: 60px 1fr; height: 100%;
  background: radial-gradient(1100px 380px at 74% -12%, #eff4fb, transparent 70%), var(--bg); }

.topbar {
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
  background: rgba(255,255,255,.84); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border); z-index: 5;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar .sep { width: 1px; height: 26px; background: var(--border-2); }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px;
  border-radius: 20px; font-size: 12.5px; font-weight: 500; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--border);
}
.chip svg { width: 15px; height: 15px; color: var(--ink-3); }
.chip .live { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); position: relative; }
.chip .live::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; background: var(--ok); opacity: .35; animation: pulse 1.8s var(--ease) infinite; }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.who { display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 12px; border-radius: 22px; }
.who .meta { text-align: right; line-height: 1.2; }
.who .meta strong { font-size: 13.5px; font-weight: 600; }
.who .meta span { display: block; font-size: 11.5px; color: var(--ink-3); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 650; font-size: 13px; color: #fff;
  background: linear-gradient(140deg, #4c8dff, #1d4ed8); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}

.workspace { display: grid; min-height: 0; grid-template-columns: 244px minmax(0, 1fr); }

/* ---------- Nav rail ---------- */
.rail { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; padding: 16px 12px; }
.rail .rail-lab { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-4); font-weight: 700; padding: 4px 10px 10px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 12px; margin-bottom: 3px;
  border-radius: 9px; border: 1px solid transparent; background: transparent; cursor: pointer;
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink-2); text-align: left; transition: background .13s, color .13s;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--brand-tint); color: var(--brand); border-color: var(--brand-tint-2); }
.nav-item .ni { width: 30px; height: 30px; flex: none; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-3); }
.nav-item.active .ni { background: #fff; color: var(--brand); box-shadow: var(--sh-xs); }
.nav-item .ni svg { width: 16px; height: 16px; }
.nav-item .nt { min-width: 0; }
.nav-item .nt b { display: block; font-weight: 650; }
.nav-item .nt span { display: block; font-size: 11.5px; font-weight: 500; color: var(--ink-3); margin-top: 1px; }
.rail-foot { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid var(--border); }
.rail-foot .rf-row { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--ink-3); }
.rail-foot .rf-row svg { width: 14px; height: 14px; color: var(--ink-4); }

/* ---------- View / panel ---------- */
.view { display: none; flex-direction: column; min-height: 0; height: 100%; }
.view.active { display: flex; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 22px; border-bottom: 1px solid var(--border); min-height: 60px; background: transparent;
}
.panel-head h2 { font-size: 15px; }
.panel-head .sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.panel-head .htitle { min-width: 0; }
.head-actions { display: flex; align-items: center; gap: 10px; }
.scope-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border-radius: 20px;
  font-size: 12px; font-weight: 600; color: var(--brand-3); background: var(--brand-tint); border: 1px solid var(--brand-tint-2);
}
.scope-chip svg { width: 14px; height: 14px; }

/* ---------- Chat ---------- */
.chat-body { flex: 1; overflow-y: auto; padding: 22px 26px; display: flex; flex-direction: column; gap: 18px; }
.msg { display: flex; gap: 11px; max-width: 92%; animation: rise .32s var(--ease) both; }
.msg .ava { width: 30px; height: 30px; flex: none; border-radius: 8px; display: grid; place-items: center; }
.msg.assistant .ava { background: linear-gradient(140deg, #4c8dff, #1d4ed8); color: #fff; box-shadow: var(--sh-xs); }
.msg.assistant .ava svg { width: 16px; height: 16px; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg.user .ava { background: var(--surface-3); color: var(--ink-2); font-size: 12px; font-weight: 650; }
.msg .col { min-width: 0; }
.msg .name { font-size: 11.5px; color: var(--ink-3); margin: 0 2px 4px; font-weight: 600; }
.msg.user .name { text-align: right; }
.bubble { padding: 11px 14px; border-radius: 13px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; word-wrap: break-word; }
.msg.assistant .bubble { background: var(--surface); border: 1px solid var(--border); border-top-left-radius: 4px; box-shadow: var(--sh-xs); }
.msg.user .bubble { background: var(--brand); color: #fff; border-top-right-radius: 4px; box-shadow: var(--sh-sm); }

.chat-empty { margin: auto; max-width: 500px; text-align: center; padding: 24px; }
.chat-empty .em-mark { width: 58px; height: 58px; margin: 0 auto 18px; opacity: .95; filter: drop-shadow(0 6px 14px rgba(15,27,45,.16)); }
.chat-empty h3 { font-size: 20px; letter-spacing: -0.02em; }
.chat-empty p { color: var(--ink-2); margin: 8px 0 22px; font-size: 14.5px; }
.suggest { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; }
.suggest button {
  font: inherit; font-size: 13px; color: var(--ink-2); background: var(--surface); cursor: pointer;
  border: 1px solid var(--border-2); border-radius: 20px; padding: 8px 14px; transition: all .14s var(--ease);
}
.suggest button:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-tint); transform: translateY(-1px); box-shadow: var(--sh-xs); }

.composer { padding: 14px 22px 18px; border-top: 1px solid var(--border); }
.composer .box {
  display: flex; align-items: flex-end; gap: 10px; background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--r-lg); padding: 8px 8px 8px 14px; box-shadow: var(--sh-xs); transition: border-color .15s, box-shadow .15s;
}
.composer .box:focus-within { border-color: var(--brand); box-shadow: var(--focus); }
.composer textarea {
  flex: 1; resize: none; border: none; outline: none; background: transparent; font: inherit; font-size: 14.5px;
  color: var(--ink); max-height: 150px; min-height: 26px; padding: 6px 0; line-height: 1.5;
}
.composer .send { width: 38px; height: 38px; padding: 0; border-radius: 10px; flex: none; }
.composer .send svg { width: 18px; height: 18px; }
.composer .foot { text-align: center; font-size: 11.5px; color: var(--ink-4); margin-top: 9px; }

/* ---------- Tool activity + RAG sources ---------- */
.activity { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 6px; }
.act {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  padding: 5px 11px 5px 8px; border-radius: 8px; font-size: 12px; font-weight: 600;
  color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--border);
}
.act svg { width: 14px; height: 14px; color: var(--ink-3); }
.act.danger { color: var(--alert); background: var(--alert-tint); border-color: var(--alert-bd); }
.act.danger svg { color: var(--alert); }
.act .aarg { font-weight: 500; color: var(--ink-3); font-family: var(--mono); font-size: 11px; }
.sources { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sources .slabel { font-size: 11px; font-weight: 600; color: var(--ink-4); text-transform: uppercase; letter-spacing: .05em; margin-right: 2px; }
.src {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--border);
}
.src svg { width: 12px; height: 12px; color: var(--ink-3); }
.src b { font-family: var(--mono); font-weight: 600; font-size: 11px; color: var(--brand-3); }

/* ---------- Plant Overview (twin) ---------- */
.overview { flex: 1; overflow-y: auto; padding: 20px 22px 28px; }
.alarm-banner {
  display: none; align-items: center; gap: 12px; padding: 13px 16px; margin-bottom: 18px; border-radius: var(--r);
  background: var(--alert-tint); border: 1px solid var(--alert-bd); color: var(--danger); box-shadow: var(--sh-xs);
}
.alarm-banner.show { display: flex; animation: rise .3s var(--ease) both; }
.alarm-banner .ab-ic { width: 34px; height: 34px; flex: none; border-radius: 9px; display: grid; place-items: center; background: #fff; color: var(--alert); box-shadow: var(--sh-xs); }
.alarm-banner .ab-ic svg { width: 19px; height: 19px; }
.alarm-banner strong { display: block; font-size: 13.5px; }
.alarm-banner span { font-size: 12.5px; color: #a63b3b; }
.alarm-banner .ab-blink { margin-left: auto; width: 10px; height: 10px; border-radius: 50%; background: var(--alert); animation: blinkdot 1s steps(2, start) infinite; }

.ov-section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-4); font-weight: 700; margin: 4px 2px 11px; }
.ov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 24px; }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 15px 16px; box-shadow: var(--sh-xs); position: relative; overflow: hidden; }
.stat .st-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat .st-label { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.stat .st-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-3); }
.stat .st-ic svg { width: 15px; height: 15px; }
.stat .st-value { font-size: 27px; font-weight: 700; letter-spacing: -0.02em; margin-top: 10px; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat .st-value .u { font-size: 13px; font-weight: 600; color: var(--ink-3); margin-left: 4px; }
.stat .st-sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; }

.stat.alarm { border-color: var(--alert-bd); background: linear-gradient(180deg, var(--alert-tint), var(--surface) 70%); }
.stat.alarm .st-ic { background: #fff; color: var(--alert); }
.stat.alarm .st-value { color: var(--danger); }
.stat.warn { border-color: var(--warn-bd); background: linear-gradient(180deg, var(--warn-tint), var(--surface) 72%); }
.stat.warn .st-value { color: var(--warn); }

/* meter for pressure */
.meter { margin-top: 12px; height: 8px; border-radius: 6px; background: var(--surface-3); position: relative; overflow: hidden; }
.meter .m-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: var(--ok); transition: width .5s var(--ease), background .3s; }
.meter .m-tick { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink-4); opacity: .6; }
.meter .m-tick.trip { background: var(--alert); opacity: .9; }
.meter-legend { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--ink-4); margin-top: 5px; font-variant-numeric: tabular-nums; }

/* actuator state tiles */
.state-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 15px 16px; box-shadow: var(--sh-xs); display: flex; align-items: center; gap: 14px; }
.state-ic { width: 46px; height: 46px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-3); }
.state-ic svg { width: 24px; height: 24px; }
.state-ic.on { background: var(--ok-tint); color: var(--ok); }
.state-ic.off { background: var(--alert-tint); color: var(--alert); }
.state-ic .spin { transform-box: fill-box; transform-origin: center; animation: spin 2.4s linear infinite; }
.state-info { min-width: 0; }
.state-info .st-label { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.state-info .st-state { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; margin-top: 3px; }
.state-info .st-state.on { color: var(--ok); }
.state-info .st-state.off { color: var(--alert); }
.state-badge { margin-left: auto; align-self: flex-start; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 9px; border-radius: 20px; }
.state-badge.ok { background: var(--ok-tint); color: var(--ok); border: 1px solid var(--ok-bd); }
.state-badge.warn { background: var(--warn-tint); color: var(--warn); border: 1px solid var(--warn-bd); }
.state-badge.alert { background: var(--alert-tint); color: var(--alert); border: 1px solid var(--alert-bd); }

/* ---------- Logbook ---------- */
.logbook { flex: 1; overflow-y: auto; padding: 20px 22px 28px; display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 1080px) { .logbook { grid-template-columns: 340px minmax(0,1fr); align-items: start; } }
.log-add { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--sh-xs); position: sticky; top: 0; }
.log-add h3 { font-size: 14px; margin-bottom: 4px; }
.log-add .la-sub { font-size: 12.5px; color: var(--ink-3); margin-bottom: 16px; }
.log-list-wrap { min-width: 0; }
.log-list { display: flex; flex-direction: column; gap: 11px; }
.log-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 13px 15px; box-shadow: var(--sh-xs); }
.log-item .li-top { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; }
.li-ref { font-family: var(--mono); font-size: 11.5px; font-weight: 600; color: var(--brand-3); }
.li-cat { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 20px; background: var(--surface-3); color: var(--ink-2); }
.li-when { margin-left: auto; font-size: 11.5px; color: var(--ink-4); }
.log-item .li-body { font-size: 13px; color: var(--ink); line-height: 1.5; }
.log-item .li-auth { font-size: 11.5px; color: var(--ink-3); margin-top: 7px; }

/* ---------- Handover result card ---------- */
.handover { margin-top: 4px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); box-shadow: var(--sh-xs); overflow: hidden; }
.handover .ho-head { display: flex; align-items: center; gap: 10px; padding: 10px 13px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.handover .ho-head svg { width: 15px; height: 15px; flex: none; color: var(--ink-3); }
.handover .ho-head .ho-t { font-size: 12.5px; font-weight: 650; color: var(--ink-2); }
.handover .ho-badge { margin-left: auto; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 9px; border-radius: 20px; }
.handover .ho-badge.ok { background: var(--ok-tint); color: var(--ok); border: 1px solid var(--ok-bd); }
.handover .ho-badge.alert { background: var(--alert-tint); color: var(--alert); border: 1px solid var(--alert-bd); }
.handover .ho-body { padding: 12px 14px; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; }

/* ---------- utility / motion ---------- */
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.spinner.dark { border-color: rgba(37,99,235,.25); border-top-color: var(--brand); }
.typing { display: inline-flex; gap: 4px; padding: 3px 0; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4); animation: blink 1.3s infinite; }
.typing span:nth-child(2) { animation-delay: .18s; }
.typing span:nth-child(3) { animation-delay: .36s; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 0%, 62%, 100% { opacity: .28; transform: translateY(0); } 34% { opacity: 1; transform: translateY(-2px); } }
@keyframes blinkdot { 0%, 50% { opacity: 1; } 51%, 100% { opacity: .2; } }
@keyframes pulse { 0% { transform: scale(1); opacity: .35; } 70% { transform: scale(2.4); opacity: 0; } 100% { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .login-card .card-mark { display: flex; justify-content: center; margin-bottom: 22px; }
  .workspace { grid-template-columns: 1fr; }
  .rail { display: none; }
}
