/* Alpha Watchdog · Support Assistant — styles (design §7). No web fonts, no external assets. */

:root {
  color-scheme: light;
  --bg: #FFFFFF;
  --surface: #F5F7FB;
  --composer: #FFFFFF;
  --composer-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px rgba(15, 23, 42, .06);
  --line: #E3E7EF;
  --ink: #0F172A;
  --muted: #566075;
  --blue: #2453D6;
  --blue-soft: #E8EEFC;
  --warn-bg: #FFF5DE;
  --warn-ink: #704600;
  --ok: #0F7B4B;
  --ok-bg: #E4F5EC;
  --shield: #0B1F3A;
  --eye: #FFFFFF;
  --pupil: #2453D6;
  --send-bg: #0F172A;
  --send-ink: #FFFFFF;
  --menu-shadow: 0 10px 30px rgba(15, 23, 42, .14);
  --col: 720px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* Stronger-than-default curves: built-in easings lack intent (Emil Kowalski). */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

/* True black: when the OS prefers dark and no explicit choice was made, or when toggled. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000;
    --surface: #16181C;
    --composer: #0E0F12;
    --composer-shadow: none;
    --line: #23262D;
    --ink: #F2F4F8;
    --muted: #9BA3B4;
    --blue: #8AABFF;
    --blue-soft: #0E1830;
    --warn-bg: #1E1708;
    --warn-ink: #F2C66B;
    --ok: #5FD39A;
    --ok-bg: #0A2214;
    --shield: #8AABFF;
    --eye: #000000;
    --pupil: #8AABFF;
    --send-bg: #F2F4F8;
    --send-ink: #000000;
    --menu-shadow: none;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #16181C;
  --composer: #0E0F12;
  --composer-shadow: none;
  --line: #23262D;
  --ink: #F2F4F8;
  --muted: #9BA3B4;
  --blue: #8AABFF;
  --blue-soft: #0E1830;
  --warn-bg: #1E1708;
  --warn-ink: #F2C66B;
  --ok: #5FD39A;
  --ok-bg: #0A2214;
  --shield: #8AABFF;
  --eye: #000000;
  --pupil: #8AABFF;
  --send-bg: #F2F4F8;
  --send-ink: #000000;
  --menu-shadow: none;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; }

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: var(--app-h, 100dvh);
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

button, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 50;
  background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px;
  text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 10px; }

/* Icons */
.ico { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico .ico-fill { fill: currentColor; stroke: none; }
.ico-bold { stroke-width: 2.2; }
.ico path[d^="M6 12h.01"] { stroke-width: 3; }
.logo-shield { fill: var(--shield); }
.logo-eye { fill: var(--eye); }
.logo-pupil { fill: var(--pupil); }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10; flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { flex: none; }
.brand-text { min-width: 0; }
.brand-name { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.01em; line-height: 1.25; white-space: nowrap; }
.brand-sub { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.25; }

.tools { display: flex; align-items: center; gap: 8px; flex: none; }
.icon-btn, .text-btn {
  height: 36px; border: 1px solid var(--line); border-radius: 10px; background: transparent;
  color: var(--ink);
  transition: background-color .15s var(--ease-out), border-color .15s var(--ease-out), transform .12s var(--ease-out);
}
.icon-btn { width: 36px; display: grid; place-items: center; padding: 0; }
.text-btn { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.icon-btn:not(:disabled):active, .text-btn:not(:disabled):active { transform: scale(.96); }

.phone-only { display: none; }
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  min-width: 210px; padding: 6px;
  background: var(--composer); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--menu-shadow);
}
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border: 0; border-radius: 8px; background: transparent;
  text-align: left; font-size: 14px;
}
.menu-item { transition: background-color .15s var(--ease-out); }
.menu-item:focus-visible { background: var(--surface); outline-offset: -2px; }

/* Demo notice (outside the scroller, so it never scrolls away) */
.notice {
  position: sticky; top: 0; z-index: 9; flex: none;
  display: flex; justify-content: center; padding: 8px 12px 4px; background: var(--bg);
}
.notice-pill {
  margin: 0; display: inline-flex; align-items: center; gap: 6px;
  background: var(--warn-bg); color: var(--warn-ink);
  border-radius: 999px; padding: 4px 14px;
  font-size: 12.5px; font-weight: 500; line-height: 1.4; text-align: center;
}

/* Scrolling area */
.scroller { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }

/* Welcome */
.welcome {
  min-height: 100%;
  display: flex; flex-direction: column; justify-content: center;
  padding: 24px 16px 20px;
}
.hero { text-align: center; max-width: 560px; margin: 0 auto; }
.hero-title { margin: 0 0 6px; font-size: 22px; font-weight: 650; letter-spacing: -.02em; line-height: 1.3; }
.hero-text { margin: 0 auto; color: var(--muted); max-width: 460px; }

.cards {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
  width: 100%; max-width: 680px; margin: 24px auto 0;
}
.card {
  display: flex; align-items: flex-start; gap: 12px; text-align: left;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--bg); color: var(--ink);
  transition: background-color .15s var(--ease-out), border-color .15s var(--ease-out), transform .12s var(--ease-out);
}
.card:active { transform: scale(.985); }
.card-icon {
  flex: none; width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center; background: var(--blue-soft); color: var(--blue);
}
.card-text { min-width: 0; }
.card-title { display: block; font-size: 14px; font-weight: 600; line-height: 1.35; }
.card-hint { display: block; margin-top: 1px; font-size: 13px; line-height: 1.4; color: var(--muted); }
.hint-short { display: none; }

/* Thread */
.thread {
  max-width: var(--col); margin: 0 auto;
  display: flex; flex-direction: column; gap: 22px;
  padding: 20px 16px 28px;
}
.thread:empty { padding: 0; }

.msg-user {
  align-self: flex-end; max-width: 78%;
  background: var(--surface); border-radius: 18px; padding: 9px 16px;
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
}
.msg-user.masked { color: var(--muted); font-style: italic; }

.msg-bot { display: flex; align-items: flex-start; gap: 12px; }
.avatar {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; background: var(--blue-soft); margin-top: 1px;
}
.msg-body { flex: 1; min-width: 0; padding-top: 2px; }
.msg-p { margin: 0 0 10px; overflow-wrap: anywhere; word-break: break-word; }
.msg-p:last-child { margin-bottom: 0; }
.msg-content > .msg-p:last-of-type { margin-bottom: 0; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 500; line-height: 1.5;
  border-radius: 6px; padding: 1px 8px;
  color: var(--ok); background: var(--ok-bg);
}
.tag-safety { color: var(--blue); background: var(--blue-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  border: 1px solid var(--line); border-radius: 999px; background: transparent;
  padding: 6px 14px; font-size: 13.5px; line-height: 1.4; text-align: left; color: var(--ink);
  transition: background-color .15s var(--ease-out), border-color .15s var(--ease-out), transform .12s var(--ease-out);
}
.chip:active { transform: scale(.97); }

.appear { animation: aw-fade .22s var(--ease-out) both; }
@keyframes aw-fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.dots { display: flex; gap: 5px; padding: 10px 0 6px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .5; animation: aw-dot 1.1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes aw-dot { 0%, 80%, 100% { opacity: .35; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Composer */
.composer-area {
  flex: none; background: var(--bg);
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px));
}
.composer {
  max-width: var(--col); margin: 0 auto;
  display: flex; align-items: flex-end; gap: 8px;
  padding: 7px 7px 7px 18px;
  background: var(--composer); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: var(--composer-shadow);
  transition: border-color .15s var(--ease-out);
}
.composer:focus-within { border-color: var(--blue); outline: 2px solid var(--blue); outline-offset: 1px; }
.composer-input {
  flex: 1; min-width: 0; display: block;
  border: 0; outline: 0; resize: none; background: transparent;
  font-size: 16px; line-height: 1.5; padding: 6px 0; margin: 0;
  max-height: calc(1.5em * 5 + 12px); overflow-y: auto;
}
.composer-input:focus-visible { outline: none; }
.composer-input::placeholder { color: var(--muted); opacity: 1; }
.char-count { align-self: center; font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.send-btn {
  flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%;
  display: grid; place-items: center; padding: 0;
  background: var(--send-bg); color: var(--send-ink);
  transition: opacity .15s var(--ease-out), transform .12s var(--ease-out);
}
.send-btn:not(:disabled):active { transform: scale(.95); }
.send-btn:disabled { opacity: .3; }

.meta {
  max-width: var(--col); margin: 6px auto 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 6px; color: var(--muted); font-size: 12px; line-height: 1.4;
}
.meta-text { margin: 0; min-width: 0; }
.meta-short { display: none; }
.link-btn {
  flex: none; border: 0; background: transparent; padding: 4px 6px; border-radius: 6px;
  color: var(--blue); font-size: 12px; font-weight: 500; white-space: nowrap;
}
.link-btn:active { opacity: .7; }

/* Phone */
@media (max-width: 480px) {
  body { font-size: 15px; }
  .topbar { padding: 8px 12px; }
  .brand-sub { display: none; }
  .desk-only { display: none !important; }
  .phone-only { display: block; }
  .notice { padding: 6px 10px 2px; }
  .notice-pill { font-size: 12px; padding: 3px 12px; }
  .welcome { padding: 14px 12px 10px; }
  .hero-title { font-size: 19px; }
  .hero-text { font-size: 14px; }
  .cards { gap: 8px; margin-top: 16px; }
  .card { padding: 9px 10px; gap: 8px; border-radius: 12px; }
  .card-icon { width: 26px; height: 26px; border-radius: 8px; }
  .card-title { font-size: 13.5px; }
  .card-hint { font-size: 12px; line-height: 1.35; }
  .hint-long { display: none; }
  .hint-short { display: block; }
  .thread { padding: 16px 12px 22px; gap: 18px; }
  .msg-user { max-width: 85%; }
  .msg-bot { gap: 10px; }
  .composer-area { padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 0px)); }
  .composer { padding-left: 14px; }
  .meta-long { display: none; }
  .meta-short { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .dots i { opacity: .7; }
}

/* ---------- "Gotcha" reveal bubble (demo prank on break attempts) ---------- */
.reveal-row .msg-body {
  background: var(--warn-bg);
  color: var(--warn-ink);
  border: 1px solid color-mix(in srgb, var(--warn-ink) 28%, transparent);
  border-radius: 14px;
  padding: 12px 14px;
  margin-top: 2px;
}
.reveal-row .avatar { background: var(--warn-bg); }
.reveal-row .avatar .logo-shield { fill: var(--warn-ink); }
.reveal-row .msg-p { margin: 0 0 8px; }
.reveal-row .msg-p:first-child { font-weight: 650; }
.reveal-row .msg-p:last-child { margin-bottom: 0; }

/* ---------- Simulated network scan (demo) ---------- */
.scan-label {
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--blue); margin-bottom: 6px;
}
.scan-head { font-weight: 650; margin: 0 0 10px; }
.scan-head.done { color: var(--ink); }
.scan-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.scan-dev {
  display: grid; grid-template-columns: 18px 1fr auto; align-items: baseline; gap: 8px;
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  animation: scanIn .24s var(--ease-out) both;
}
@keyframes scanIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .scan-dev { animation: none; } }
.scan-mark { font-size: 13px; line-height: 1.4; }
.scan-ok .scan-mark { color: var(--ok); }
.scan-new .scan-mark { color: var(--warn-ink); }
.scan-alert .scan-mark { color: #C62828; }
.scan-name { font-weight: 550; }
.scan-note { font-size: 12px; color: var(--muted); text-align: right; }
.scan-dev.scan-alert { border-color: color-mix(in srgb, #C62828 45%, var(--line)); }
.scan-dev.scan-alert .scan-note { color: #C62828; }

.scan-alert {
  margin-top: 12px; padding: 12px 14px; border-radius: 12px;
  background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--warn-ink) 30%, transparent);
}
.scan-alert-title { font-weight: 700; color: var(--warn-ink); margin-bottom: 8px; }
.scan-detail { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin-bottom: 12px; }
.scan-k { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); white-space: nowrap; }
.scan-v { font-size: 13px; color: var(--ink); }
.scan-btn {
  border: none; border-radius: 10px; padding: 9px 16px; font-weight: 600; font-size: 13px;
  background: #C62828; color: #fff; cursor: pointer;
  transition: background-color .15s var(--ease-out), transform .12s var(--ease-out);
}
.scan-btn:not(:disabled):active { transform: scale(.97); }
.scan-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.scan-done { margin-top: 2px; }
.scan-done .msg-p { margin: 0; color: var(--ok); font-weight: 550; }
.scan-alert.resolved { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.scan-clear { margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: var(--ok-bg); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.scan-clear .msg-p { margin: 0; color: var(--ink); }

/* ---------- "Run a scan" welcome CTA ---------- */
.hero-cta { display: flex; justify-content: center; margin: 22px 0 20px; }
.scan-cta {
  display: inline-flex; align-items: center; gap: 9px;
  border: none; border-radius: 999px; padding: 11px 22px;
  background: var(--send-bg); color: var(--send-ink);
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08), 0 8px 22px rgba(15, 23, 42, .12);
  transition: transform .12s var(--ease-out), opacity .12s var(--ease-out);
}
:root:not([data-theme="light"]) .scan-cta { box-shadow: none; border: 1px solid var(--line); }
.scan-cta:active { transform: scale(.97); }
.scan-cta:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.scan-cta-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #3FD07E; flex: none;
  box-shadow: 0 0 0 0 rgba(63, 208, 126, .6); animation: scanPulse 1.8s ease-out infinite;
}
@keyframes scanPulse {
  0% { box-shadow: 0 0 0 0 rgba(63, 208, 126, .55); }
  70% { box-shadow: 0 0 0 7px rgba(63, 208, 126, 0); }
  100% { box-shadow: 0 0 0 0 rgba(63, 208, 126, 0); }
}
@media (prefers-reduced-motion: reduce) { .scan-cta-dot { animation: none; } }

/* ---------- Hover states, gated for real pointers (no sticky :hover on touch) ---------- */
@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover, .text-btn:hover,
  .card:hover, .chip:hover, .menu-item:hover { background: var(--surface); }
  .scan-btn:hover { background: #B71C1C; }
  .scan-cta:hover { opacity: .92; }
  .link-btn:hover { text-decoration: underline; text-underline-offset: 2px; }
}
