/* ============================================================
   AeroScreen Copilot - Barracks Industries design system
   ============================================================ */

@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: #e9edf3;
  --surface: #ffffff;
  --surface-2: #f4f7fa;
  --surface-3: #eef2f7;
  --border: #e4e9f0;
  --border-2: #d6dee8;

  /* ink */
  --ink: #0f1e30;
  --ink-2: #47566a;
  --ink-3: #8492a3;
  --ink-4: #a9b4c1;

  /* brand steel + signal */
  --brand: #1c5182;
  --brand-2: #17456e;
  --brand-3: #0e3a60;
  --brand-tint: #e9f1f8;
  --brand-tint-2: #d9e8f5;
  --accent: #d97b2e;

  /* semantic */
  --ok: #128a5b;   --ok-tint: #e2f4ec;   --ok-bd: #b6e2cc;
  --warn: #c06f1c; --warn-tint: #fbeedc; --warn-bd: #f0d5ac;
  --danger: #c0392b; --danger-tint: #fbeae8;

  /* effects */
  --focus: 0 0 0 3px rgba(28, 81, 130, .22);
  --sh-xs: 0 1px 2px rgba(15, 30, 48, .06);
  --sh-sm: 0 1px 3px rgba(15, 30, 48, .07), 0 1px 2px rgba(15, 30, 48, .05);
  --sh-md: 0 6px 18px rgba(15, 30, 48, .09), 0 2px 5px rgba(15, 30, 48, .05);
  --sh-lg: 0 18px 44px rgba(15, 30, 48, .17), 0 6px 14px rgba(15, 30, 48, .09);

  --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; }

/* scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #cdd6e1; border-radius: 20px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #b6c2d1; 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,30,48,.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;
}
.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 {
  width: 100%; height: 42px; 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::placeholder { color: var(--ink-4); }
.input:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }

.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;
}
.alert.show { display: flex; }
.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 500px at 78% 8%, rgba(70,140,196,.30), transparent 62%),
    radial-gradient(700px 420px at 12% 96%, rgba(217,123,46,.14), transparent 60%),
    linear-gradient(158deg, #163a5c 0%, #12314e 52%, #0d2740 100%);
  color: #eaf2f9;
}
.login-hero::after {
  content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.045) 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: #9db8ce; }
.login-hero .lockup .mark { filter: drop-shadow(0 4px 10px rgba(0,0,0,.28)); }

.hero-copy { max-width: 440px; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600;
  letter-spacing: .05em; color: #a9c6de; 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: #4bd0a0; box-shadow: 0 0 0 3px rgba(75,208,160,.25); }
.hero-copy h1 { font-size: 33px; line-height: 1.14; color: #fff; letter-spacing: -0.028em; margin-bottom: 14px; }
.hero-copy .lede { color: #b9cee0; 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: #d3e2ee; 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: #8fd3ba; }
.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: #a9c1d5; font-size: 13px; }
.hero-foot { color: #7f9bb2; 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: 372px; }
.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 72% -12%, #eef4fa, transparent 70%), var(--bg); }

.topbar {
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
  background: rgba(255,255,255,.82); 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 .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; }
.chip svg { width: 15px; height: 15px; color: var(--ink-3); }

.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, #2a6ca8, #163a5c); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}

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

/* ---------- Sidebar ---------- */
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.side-head { padding: 16px 16px 10px; display: flex; align-items: center; justify-content: space-between; }
.side-head h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 650; }
.side-search { padding: 2px 14px 10px; position: relative; }
.side-search svg { position: absolute; left: 25px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--ink-4); pointer-events: none; }
.side-search input {
  width: 100%; height: 34px; padding: 0 12px 0 32px; border: 1px solid var(--border); border-radius: 8px;
  font: inherit; font-size: 13px; background: var(--surface-2); color: var(--ink);
}
.side-search input:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); background: #fff; }
.side-list { overflow-y: auto; padding: 4px 10px 14px; flex: 1; }
.side-list .empty-note { color: var(--ink-4); font-size: 12.5px; text-align: center; padding: 20px; }

.conv {
  position: relative; display: flex; gap: 10px; padding: 9px 11px 9px 12px; border-radius: 9px;
  cursor: pointer; margin-bottom: 2px; border: 1px solid transparent; transition: background .13s;
}
.conv:hover { background: var(--surface-2); }
.conv.active { background: var(--brand-tint); }
.conv.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--brand); }
.conv .ci { width: 30px; height: 30px; flex: none; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-3); }
.conv.active .ci { background: #fff; color: var(--brand); box-shadow: var(--sh-xs); }
.conv .ci svg { width: 15px; height: 15px; }
.conv .cbody { min-width: 0; flex: 1; }
.conv .t { font-size: 13.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .s { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }

/* ---------- Panels ---------- */
.panel { display: flex; flex-direction: column; min-height: 0; background: transparent; }
.panel.lane { border-left: 1px solid var(--border); background: var(--surface); }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid var(--border); min-height: 60px;
}
.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; }
.panel-head .htitle h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 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: 88%; 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, #2a6ca8, #163a5c); 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: 460px; text-align: center; padding: 24px; }
.chat-empty .em-mark { width: 62px; height: 62px; margin: 0 auto 18px; opacity: .95; filter: drop-shadow(0 6px 14px rgba(15,30,48,.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 20px 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; }

/* ---------- Lane monitor ---------- */
.lane-tools { padding: 14px 18px 6px; }
.dropzone {
  display: flex; align-items: center; gap: 12px; border: 1.5px dashed var(--border-2); border-radius: var(--r);
  padding: 13px 15px; cursor: pointer; transition: all .15s var(--ease); background: var(--surface-2);
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-tint); }
.dropzone .dz-ic { width: 38px; height: 38px; flex: none; border-radius: 10px; display: grid; place-items: center; background: #fff; color: var(--brand); box-shadow: var(--sh-xs); }
.dropzone .dz-ic svg { width: 19px; height: 19px; }
.dropzone .dz-t { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.dropzone .dz-s { font-size: 12px; color: var(--ink-3); margin-top: 1px; }

.lane-count { font-size: 12px; color: var(--ink-3); }
.lane-body { flex: 1; overflow-y: auto; padding: 12px 18px 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-content: start; align-items: start; }
.scan {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden; cursor: pointer; box-shadow: var(--sh-xs);
  transition: transform .12s var(--ease), box-shadow .12s var(--ease); animation: rise .3s var(--ease) both;
}
.scan:hover { transform: translateY(-3px); box-shadow: var(--sh-md); }
.scan .thumb { position: relative; height: 116px; flex: none; background: #0c1220 center/cover no-repeat; }
.scan .thumb::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px rgba(255,255,255,.04); }
.scan .src { position: absolute; top: 7px; right: 7px; display: inline-flex; align-items: center; gap: 4px; font-size: 9.5px; font-weight: 600; letter-spacing: .04em; color: #d6e2ee; background: rgba(10,16,26,.62); padding: 3px 7px; border-radius: 5px; backdrop-filter: blur(2px); }
.scan .src svg { width: 10px; height: 10px; }
.scan .cap { padding: 9px 11px 11px; }
.scan .cap .st { font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scan .cap .rs { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: .03em; padding: 3px 8px 3px 6px; border-radius: 6px; text-transform: uppercase; }
.badge svg { width: 12px; height: 12px; }
.badge.clear { background: var(--ok-tint); color: var(--ok); }
.badge.suspicious { background: var(--warn-tint); color: var(--warn); }
.badge.unknown, .badge.review { background: var(--surface-3); color: var(--ink-3); }
.scan .thumb .badge { position: absolute; top: 7px; left: 7px; box-shadow: 0 1px 5px rgba(0,0,0,.3); background: rgba(255,255,255,.94); }
.scan .thumb .badge.clear { color: var(--ok); }
.scan .thumb .badge.suspicious { color: var(--warn); }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(10,20,34,.55); backdrop-filter: blur(3px); display: none; place-items: center; z-index: 40; padding: 24px; animation: fade .18s var(--ease); }
.modal-bg.show { display: grid; }
.modal { width: 100%; max-width: 540px; background: var(--surface); border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--sh-lg); animation: rise .24s var(--ease); }
.modal .m-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.modal .m-head h3 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal .m-body { padding: 16px 18px 20px; }
.modal .m-img { width: 100%; border-radius: var(--r); display: block; background: #0c1220; box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); }
.modal .m-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }
.modal .reasons { list-style: none; padding: 0; margin: 15px 0 0; display: grid; gap: 8px; }
.modal .reasons li { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; color: var(--ink-2); }
.modal .reasons li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); margin-top: 7px; flex: none; }

/* ---------- 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(28,81,130,.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 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); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 1120px) {
  .workspace { grid-template-columns: 250px minmax(0, 1fr); }
  .panel.lane { display: none; }
}
@media (max-width: 720px) {
  .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; }
  .sidebar { display: none; }
}
