/* Devseis Security Assistant: layout follows Devseis Nox (header, empty state with chips, thread, pill composer, sidebar). */
:root { --bg: #f4f6fb; --panel: #fff; --border: #e2e6ee; --text: #171a21; --muted: #666f80; --accent: #ED2939; --accent-dark: #C81E2B;
  --accent-text: #fff; --accent-soft: rgba(237, 41, 57, .08); --accent-border: rgba(237, 41, 57, .35); --bubble-bot: #fff; --bubble-user: #ED2939;
  --input-bg: #fff; --blue: #00A1DE; --ok: #1a7f37; --warn: #9a6700; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #0b0e14; --panel: #11151d; --border: #232a37; --text: #e8ecf4; --muted: #8b94a7;
  --accent: #ff4d5a; --accent-dark: #ED2939; --accent-soft: rgba(255, 77, 90, .14); --accent-border: rgba(255, 77, 90, .4); --bubble-bot: #161c27; --bubble-user: #c81e2b; --input-bg: #1a202b; --ok: #3fb950; --warn: #d29922; } }
:root[data-theme="dark"] { --bg: #0b0e14; --panel: #11151d; --border: #232a37; --text: #e8ecf4; --muted: #8b94a7;
  --accent: #ff4d5a; --accent-dark: #ED2939; --accent-soft: rgba(255, 77, 90, .14); --accent-border: rgba(255, 77, 90, .4); --bubble-bot: #161c27; --bubble-user: #c81e2b; --input-bg: #1a202b; --ok: #3fb950; --warn: #d29922; }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
a { color: var(--blue); }
.hidden { display: none !important; }
.muted { color: var(--muted); } .tiny { font-size: 12px; }
button { font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--border); background: var(--panel); border-top: 3px solid var(--accent); flex-shrink: 0; }
.header-left, .header-actions { display: flex; align-items: center; gap: 6px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-size: 15px; }
.brand img { width: 28px; height: 28px; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text); display: grid; place-items: center; }
.icon-btn:hover { background: var(--accent-soft); }
.audit-btn { background: var(--accent); color: var(--accent-text); border: 0; border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 14px; white-space: nowrap; }
.audit-btn:hover { background: var(--accent-dark); }
.status-bar { padding: 6px 16px; background: var(--accent-soft); border-bottom: 1px solid var(--border); font-size: 13px; }
.status-progress { height: 4px; background: var(--border); border-radius: 99px; overflow: hidden; margin-top: 4px; }
#statusFill { height: 100%; width: 0; background: var(--accent); transition: width .3s; }

main { flex: 1; overflow-y: auto; padding: 18px 14px 8px; }
.empty-state { max-width: 680px; margin: 6vh auto 0; text-align: center; }
.hero-icon img { width: 64px; height: 64px; }
.empty-state h1 { font-size: clamp(24px, 4.5vw, 32px); line-height: 1.2; margin: 10px 0; }
.hero-sub { color: var(--muted); font-size: 17px; margin: 0 auto 20px; max-width: 560px; }
.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 600px; margin: 0 auto; }
@media (max-width: 520px) { .chips { grid-template-columns: 1fr; } }
.chip { text-align: left; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; color: var(--text); font-size: 15px; }
.chip:hover { border-color: var(--accent-border); background: var(--accent-soft); }

#thread { max-width: 780px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg.user { justify-content: flex-end; }
.avatar { width: 30px; height: 30px; flex: none; border-radius: 8px; }
.bubble { max-width: min(640px, 88%); padding: 11px 15px; border-radius: 18px; overflow-wrap: anywhere; }
.msg.user .bubble { background: var(--bubble-user); color: #fff; border-bottom-right-radius: 6px; white-space: pre-wrap; }
.msg.bot .bubble { background: var(--bubble-bot); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.bubble p { margin: 0 0 8px; } .bubble p:last-child { margin-bottom: 0; }
.bubble ol, .bubble ul { margin: 6px 0 8px 20px; padding: 0; } .bubble li { margin: 3px 0; }
.bubble code { font: 13px ui-monospace, Menlo, monospace; background: var(--accent-soft); padding: 1px 5px; border-radius: 5px; }
.cite { display: inline-block; font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 0 5px; margin: 0 1px; cursor: pointer; vertical-align: 1px; border: 0; }
.sources { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.source { font-size: 12px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; background: transparent; }
.source.open { border-color: var(--accent-border); color: var(--text); }
.source-text { font-size: 13px; color: var(--muted); border-left: 3px solid var(--accent-border); padding: 4px 10px; margin-top: 8px; }
.note { font-size: 12px; color: var(--warn); margin-top: 8px; }
.typing span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); margin-right: 3px; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.card { border: 1px solid var(--border); background: var(--panel); border-radius: 16px; padding: 14px; }
.card .score { font-size: 30px; font-weight: 800; }
.card .pill { display: inline-block; font-size: 12px; font-weight: 700; border: 1px solid; border-radius: 99px; padding: 0 8px; margin: 2px 4px 2px 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.small-btn { border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 10px; padding: 7px 12px; font-size: 14px; }
.primary-btn { border: 0; background: var(--accent); color: #fff; border-radius: 10px; padding: 8px 14px; font-size: 14px; font-weight: 700; }

#composer { display: flex; align-items: flex-end; gap: 8px; max-width: 812px; width: 100%; margin: 0 auto; padding: 8px 14px 4px; flex-shrink: 0; }
.input-pill { flex: 1; display: flex; background: var(--input-bg); border: 1px solid var(--border); border-radius: 22px; padding: 4px 6px 4px 16px; }
.input-pill:focus-within { box-shadow: 0 0 0 2px var(--accent-border); }
#input { flex: 1; border: 0; outline: 0; resize: none; background: transparent; color: var(--text); font: inherit; max-height: 180px; padding: 9px 0; }
.send-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.send-btn:disabled { opacity: .4; cursor: default; }
.attach { width: 44px; height: 44px; flex: none; }
.disclaimer { text-align: center; font-size: 11.5px; color: var(--muted); margin: 0 0 calc(8px + env(safe-area-inset-bottom)); padding: 0 12px; }

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 9; }
.sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: min(320px, 86vw); background: var(--panel); border-right: 1px solid var(--border); z-index: 10;
  transform: translateX(-102%); transition: transform .2s; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.sidebar.open { transform: none; }
.sidebar-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.sidebar-head h2 { font-size: 16px; margin: 0; }
.sidebar-list { flex: 1; overflow-y: auto; padding: 8px; }
.convo { display: flex; align-items: center; gap: 6px; padding: 9px 10px; border-radius: 10px; cursor: pointer; font-size: 14px; }
.convo:hover, .convo.active { background: var(--accent-soft); }
.convo span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo button { opacity: .5; border: 0; background: transparent; color: var(--text); }
.sidebar-foot { border-top: 1px solid var(--border); padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); font-size: 14px; }
.sidebar-foot .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 20; padding: 16px; }
.modal-card { background: var(--panel); border-radius: 18px; padding: 20px; max-width: 460px; width: 100%; border: 1px solid var(--border); }
.modal-card h2 { margin: 0 0 6px; font-size: 20px; }
.option { display: block; width: 100%; text-align: left; border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 14px; padding: 12px 14px; margin: 10px 0; text-decoration: none; }
.option:hover { border-color: var(--accent-border); }
.option b { display: block; } .option span { color: var(--muted); font-size: 14px; }
.option.recommended { border: 2px solid var(--accent); }
.link-btn { border: 0; background: transparent; color: var(--muted); text-decoration: underline; padding: 6px 0; }
@media (max-width: 560px) { .brand span { display: none; } .audit-btn { padding: 8px 12px; } .hero-sub { font-size: 16px; } }

.ai-chip { border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 999px; padding: 6px 11px; font-size: 13px; white-space: nowrap; }
.ai-chip[data-state="ready"] { border-color: var(--ok); color: var(--ok); }
.ai-chip[data-state="loading"] { border-color: var(--accent-border); color: var(--accent); }
.ai-card { text-align: left; background: var(--panel); border: 2px solid var(--accent-border); border-radius: 16px; padding: 14px 16px; margin: 0 auto 16px; max-width: 600px; font-size: 15px; }
.ai-card .btn-row { margin-top: 10px; }
.quick-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 560px) { .ai-chip { padding: 6px 8px; font-size: 12px; } }
