/* مساعد الفروع · بنك وربة — desktop-first theme */
:root {
  --bg: #f3f2f8;
  --surface: #ffffff;
  --surface-2: #f8f7fc;
  --surface-3: #efedf7;
  --ink: #1a1236;
  --ink-2: #3a3358;
  --muted: #6a6483;
  --line: #e6e3f0;
  --line-2: #d8d4e8;
  --brand: #443895;
  --brand-2: #5a4db8;
  --brand-ink: #ffffff;
  --brand-soft: #efedf9;
  --brand-deep: #160043;
  --lav: #6d74b6;
  --ok: #18794e;      --ok-soft: #e7f5ee;   --ok-line: #b7e0cb;
  --bad: #b42d3a;     --bad-soft: #fcecee;  --bad-line: #f2c3c8;
  --warn: #93600a;    --warn-soft: #fdf4e1; --warn-line: #f0d9a6;
  --user: #2b1d6e;
  --user-ink: #ffffff;
  --shadow-sm: 0 1px 2px rgba(22, 0, 67, .05);
  --shadow: 0 1px 2px rgba(22, 0, 67, .05), 0 6px 20px rgba(22, 0, 67, .06);
  --shadow-lg: 0 2px 4px rgba(22, 0, 67, .06), 0 18px 48px rgba(22, 0, 67, .12);
  --head: "Alexandria", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --body: "IBM Plex Sans Arabic", "Alexandria", "Segoe UI", Tahoma, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0c0918; --surface: #141026; --surface-2: #1a1530; --surface-3: #221c3c; --ink: #efecf9; --ink-2: #d2cde6; --muted: #a29cbb;
  --line: #2a2344; --line-2: #372f56; --brand: #b4adf2; --brand-2: #c7c1f7; --brand-ink: #160043; --brand-soft: #241e48;
  --ok: #5fcf96; --ok-soft: #12291f; --ok-line: #1f4a35; --bad: #f18a92; --bad-soft: #2e161b; --bad-line: #5a2730;
  --warn: #f1c46a; --warn-soft: #2c2311; --warn-line: #574420; --user: #3b2d8a;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); --shadow-lg: 0 18px 48px rgba(0,0,0,.4);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0918; --surface: #141026; --surface-2: #1a1530; --surface-3: #221c3c; --ink: #efecf9; --ink-2: #d2cde6; --muted: #a29cbb;
    --line: #2a2344; --line-2: #372f56; --brand: #b4adf2; --brand-2: #c7c1f7; --brand-ink: #160043; --brand-soft: #241e48;
    --ok: #5fcf96; --ok-soft: #12291f; --ok-line: #1f4a35; --bad: #f18a92; --bad-soft: #2e161b; --bad-line: #5a2730;
    --warn: #f1c46a; --warn-soft: #2c2311; --warn-line: #574420; --user: #3b2d8a;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); --shadow-lg: 0 18px 48px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--body); font-size: 15.5px; line-height: 1.75;
  -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased;
}
button, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { flex: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
textarea:focus-visible, .doc-search:focus-visible { outline: none; }

/* ---------- App shell ---------- */
.app { height: 100dvh; display: grid; grid-template-columns: 284px minmax(0, 1fr); }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

/* ---------- Brand rail ---------- */
.rail {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 22px; padding: 30px 20px 20px;
  background: linear-gradient(180deg, #1f0b5c 0%, #160043 42%, #110034 100%); color: #fff;
}
/* faint brand mark kept off the rail: it clashed with the presenter card */
.rail::after { display: none;
  content: ""; position: absolute; inset-inline-start: -90px; bottom: -40px; width: 420px; height: 230px;
  background: url("brand/warba-logo-white.svg") center / contain no-repeat; opacity: .03; pointer-events: none;
}
.rail > * { position: relative; z-index: 1; }
.rail-brand { display: grid; gap: 18px; padding: 0 6px 22px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.rail-logo { width: 168px; height: auto; display: block; }
.rail-product b { display: block; font-family: var(--head); font-size: 19px; font-weight: 700; line-height: 1.35; }
.rail-product span { display: block; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 255, 255, .55); direction: ltr; text-align: right; }
.rail-sec { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; }
.rail-label { margin: 0 8px 8px; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; color: rgba(255, 255, 255, .5); }
.rail-nav { display: grid; gap: 2px; }
.rnav {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px;
  background: transparent; color: rgba(255, 255, 255, .78); font-size: 14px; text-align: right; transition: background .15s, color .15s;
}
.rnav svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
.rnav > span:not(.n) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.rnav .n { margin-inline-start: auto; font-size: 11.5px; font-weight: 600; min-width: 22px; padding: 0 6px; border-radius: 999px; background: rgba(255, 255, 255, .1); text-align: center; }
.rnav:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.rnav.on { background: rgba(255, 255, 255, .12); color: #fff; }
.rnav.on::before { content: ""; position: absolute; inset-inline-start: -20px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: #a9a2ea; }
[dir="rtl"] .rnav.on::before { border-radius: 3px 0 0 3px; }
.rail-foot { display: grid; gap: 12px; }
.sys { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08); }
.sys b { display: block; font-size: 13px; font-weight: 600; line-height: 1.4; }
.sys span:not(.dot) { display: block; font-size: 12px; color: rgba(255, 255, 255, .6); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #3fd18b; box-shadow: 0 0 0 3px rgba(63, 209, 139, .2); flex: none; }
.presenter-card { display: flex; align-items: center; gap: 10px; padding: 4px 4px; }
.presenter-card .av, .presenter .av {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: #fff; color: var(--brand-deep); font-family: var(--head); font-weight: 700; font-size: 15px;
}
.presenter-card span:not(.av) { display: block; font-size: 11.5px; color: rgba(255, 255, 255, .55); line-height: 1.3; }
.presenter-card b { display: block; font-family: var(--head); font-size: 15px; font-weight: 600; }
.rail-legal { margin: 0; font-size: 11px; color: rgba(255, 255, 255, .42); line-height: 1.6; }

/* ---------- Top bar ---------- */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 76px;
  padding: 12px 28px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand > div { min-width: 0; }
.bar-logo, .brand .sep { display: none; }
.brand .sep { width: 1px; height: 34px; background: rgba(255, 255, 255, .22); flex: none; }
.brand h1 { margin: 0; font-family: var(--head); font-size: 21px; font-weight: 700; line-height: 1.3; color: var(--ink); }
.brand p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); display: flex; gap: 7px; align-items: center; white-space: nowrap; }
.brand p i { font-style: normal; opacity: .45; }
.bar-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--warn);
  background: var(--warn-soft); border: 1px solid var(--warn-line); padding: 3px 11px; border-radius: 999px; white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; background: currentColor; box-shadow: none; }
.today { font-size: 13px; color: var(--muted); white-space: nowrap; padding-inline: 4px; }
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border: 0; border-radius: 10px;
  background: var(--brand-deep); color: #fff; font-size: 14px; font-weight: 600; white-space: nowrap; transition: background .15s, transform .15s;
}
:root[data-theme="dark"] .btn-primary { background: var(--brand); color: var(--brand-ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { background: var(--brand); color: var(--brand-ink); } }
.btn-primary:hover { background: var(--brand); }
.btn-primary svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.ghost { background: transparent; border: 1px solid var(--line-2); border-radius: 10px; padding: 6px 12px; font-size: 14px; white-space: nowrap; }
.ghost:hover { background: var(--surface-2); }
.ghost-ic { border: 1px solid var(--line-2) !important; width: 40px !important; height: 40px !important; border-radius: 10px !important; }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: block; }
  :root:not([data-theme="light"]) .i-moon { display: none; }
}

/* ---------- Layout ---------- */
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
.chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.scroll { flex: 1; overflow-y: auto; padding: 28px 32px 12px; scroll-behavior: smooth; }
#messages, .welcome { max-width: 920px; margin: 0 auto; }

/* ---------- Welcome ---------- */
.welcome { padding-bottom: 10px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.sec-head h3 { margin: 0; font-family: var(--head); font-size: 18px; font-weight: 700; }
.sec-head span { font-size: 13px; color: var(--muted); }

/* Quick topics — welcome (cards + list) */
.quick { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.qtabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; min-width: 0; }
.qtab {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-width: 0; padding: 14px; border-radius: 14px; text-align: right;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s, background .15s;
}
.qtab:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.qtab .qi {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand);
  transition: background .15s, color .15s;
}
.qtab .qi svg, .qchip svg, .qp-head svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.qtab .qt { display: grid; gap: 2px; min-width: 0; }
.qtab .qt b { font-family: var(--head); font-size: 14px; font-weight: 600; line-height: 1.45; }
.qtab .qt small { font-size: 12px; color: var(--muted); line-height: 1.5; }
.qtab .qn { display: none; }
@media (max-width: 1599px) { #suggestions .qtab .qt small { display: none; } #suggestions .qtab { padding: 14px 14px 12px; } #suggestions .qtab .qt b { font-size: 13.5px; } }
.qtab.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand) inset; }
.qtab.on .qi { background: var(--brand); color: var(--brand-ink); }

.chips {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm);
}
.qchip {
  display: flex; align-items: center; gap: 12px; min-width: 0; padding: 14px 18px; border: 0; background: transparent; text-align: right;
  font-size: 14.5px; line-height: 1.6; color: var(--ink-2); border-bottom: 1px solid var(--line); transition: background .15s, color .15s;
}
.chips .qchip:nth-child(odd) { border-inline-end: 1px solid var(--line); }
.chips .qchip:nth-last-child(-n + 2):nth-child(odd), .chips .qchip:last-child { border-bottom: 0; }
.qchip span { flex: 1; min-width: 0; }
.qchip svg { width: 18px; height: 18px; color: var(--muted); transition: transform .15s, color .15s; }
.qchip:hover { background: var(--surface-2); color: var(--ink); }
.qchip:hover svg { color: var(--brand); transform: translateX(-3px); }

/* ---------- Messages ---------- */
.msg { display: flex; flex-direction: column; margin: 22px 0; }
.msg.user { align-items: flex-start; }
.msg.bot { align-items: stretch; }
.bubble { overflow-wrap: anywhere; }
.msg.user .bubble {
  max-width: min(640px, 86%); padding: 12px 18px; border-radius: 16px; border-start-start-radius: 4px;
  background: var(--user); color: var(--user-ink); box-shadow: var(--shadow-sm);
}
.msg.user .who { font-size: 12px; color: var(--muted); margin: 0 4px 5px; }
.ans-head { display: flex; align-items: center; gap: 10px; margin: 0 2px 8px; font-size: 12.5px; color: var(--muted); }
.ans-head .mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--brand-deep); display: grid; place-items: center; flex: none;
}
.ans-head .mark i { display: block; width: 22px; height: 12px; background: url("brand/warba-logo-white.svg") center / contain no-repeat; }
[data-theme="dark"] .ans-head .mark { box-shadow: 0 0 0 1px var(--line-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ans-head .mark { box-shadow: 0 0 0 1px var(--line-2); } }
.ans-head b { color: var(--ink); font-family: var(--head); font-size: 13.5px; font-weight: 600; }
.msg.bot .bubble {
  padding: 20px 24px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble strong { font-weight: 600; color: var(--ink); }
.msg.user .bubble strong { color: inherit; }
.bubble ul { margin: 4px 0 12px; padding-inline-start: 22px; }
.bubble ul > li { margin: 5px 0; }
.bubble ul > li::marker { color: var(--brand); }
.bubble li.sub { margin-inline-start: 18px; list-style-type: circle; font-size: .96em; color: var(--ink-2); }

.verdict {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; margin: 0 0 16px; border-radius: 12px;
  border: 1px solid; border-inline-start-width: 4px;
}
.verdict .v-ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; }
.verdict .v-ic svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.verdict .v-tx { min-width: 0; }
.verdict small { display: block; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; opacity: .8; line-height: 1.4; }
.verdict b { display: block; font-family: var(--head); font-size: 16.5px; font-weight: 600; line-height: 1.55; color: var(--ink); }
.verdict.ok { background: var(--ok-soft); border-color: var(--ok-line); border-inline-start-color: var(--ok); color: var(--ok); }
.verdict.ok .v-ic { background: var(--ok); }
.verdict.bad { background: var(--bad-soft); border-color: var(--bad-line); border-inline-start-color: var(--bad); color: var(--bad); }
.verdict.bad .v-ic { background: var(--bad); }
.verdict.warn { background: var(--warn-soft); border-color: var(--warn-line); border-inline-start-color: var(--warn); color: var(--warn); }
.verdict.warn .v-ic { background: var(--warn); }
.verdict.fix { background: var(--brand-soft); border-color: var(--line-2); border-inline-start-color: var(--brand); color: var(--brand); }
.verdict.fix .v-ic { background: var(--brand); }
:root[data-theme="dark"] .verdict .v-ic { color: #0c0918; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .verdict .v-ic { color: #0c0918; } }

.bubble ol { list-style: none; margin: 6px 0 14px; padding: 0; counter-reset: step; display: grid; gap: 4px; }
.bubble ol > li { position: relative; counter-increment: step; padding: 8px 44px 8px 12px; border-radius: 10px; }
[dir="ltr"] .bubble ol > li { padding: 8px 12px 8px 44px; }
.bubble ol > li:hover { background: var(--surface-2); }
.bubble ol > li::before {
  content: counter(step); position: absolute; inset-inline-start: 8px; top: 9px; width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-family: var(--head); font-size: 13px; font-weight: 700; line-height: 1;
}
.bubble ol ul { margin: 4px 0 0; padding-inline-start: 18px; }
.bubble ol li.sub { margin-inline-start: 0; }
.bubble p.escalate {
  margin: 12px 0 4px; padding: 11px 14px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--line-2); font-size: 14.5px;
}
.bubble p.escalate strong { color: var(--brand); }

.sources { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.sources .label { width: 100%; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.src {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; text-decoration: none; color: var(--brand);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 9px; padding: 5px 11px; transition: border-color .15s, background .15s;
}
.src svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.src .pg { color: var(--muted); font-weight: 400; }
.src:hover { border-color: var(--brand); background: var(--brand-soft); }
.src.cancelled { color: var(--bad); border-color: var(--bad-line); background: var(--bad-soft); }
.src.cancelled .t { text-decoration: line-through; }

.typing { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); opacity: .35; animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: 1; } }
.error { color: var(--bad); font-size: 14px; }

.msg-actions { display: flex; gap: 4px; margin-top: 12px; }
.act {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; background: transparent; color: var(--muted);
  font-size: 12.5px; padding: 5px 10px; border-radius: 8px;
}
.act:hover { background: var(--surface-2); border-color: var(--line); color: var(--brand); }
.act svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Composer ---------- */
.quick-panel, .composer, .note { max-width: 920px; width: calc(100% - 64px); margin-inline: auto; }
.composer {
  display: flex; flex-direction: column; gap: 4px; margin-top: 8px; padding: 10px 10px 8px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft), var(--shadow); }
.composer-row { display: flex; align-items: flex-end; gap: 4px; }
.composer-row > * { min-width: 0; }
textarea {
  flex: 1; min-width: 0; width: 100%; resize: none; border: 0; outline: 0; background: transparent; padding: 9px 10px;
  min-height: 44px; max-height: 180px; font-size: 15.5px; line-height: 1.6;
}
textarea::placeholder { color: var(--muted); opacity: .8; }
.composer-foot { display: flex; justify-content: flex-start; padding: 2px 10px 0; font-size: 11.5px; color: var(--muted); }
kbd {
  font-family: inherit; font-size: 10.5px; padding: 0 5px; border-radius: 4px; border: 1px solid var(--line-2); background: var(--surface-2);
  border-bottom-width: 2px; direction: ltr; display: inline-block; line-height: 1.6;
}
.icon-btn {
  flex: none; width: 42px; height: 42px; border-radius: 10px; border: 0; background: transparent; color: var(--muted);
  display: grid; place-items: center; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--brand-soft); color: var(--brand); }
.icon-btn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn[hidden] { display: none; }
#quickBtn.on { background: var(--brand-soft); color: var(--brand); }
.mic.on { background: var(--bad-soft); color: var(--bad); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(180, 45, 58, .15); } }
.send { flex: none; width: 44px; height: 44px; border-radius: 11px; border: 0; background: var(--brand-deep); display: grid; place-items: center; transition: background .15s; }
.send:hover { background: var(--brand); }
:root[data-theme="dark"] .send { background: var(--brand); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .send { background: var(--brand); } }
.send svg { width: 19px; height: 19px; fill: #fff; transform: scaleX(-1); }
:root[data-theme="dark"] .send svg { fill: var(--brand-ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .send svg { fill: var(--brand-ink); } }
.send .i-stop { display: none; }
.composer.busy .send .i-send { display: none; }
.composer.busy .send .i-stop { display: block; transform: none; }
.composer.busy .send { background: var(--bad); }
.send:disabled { opacity: .45; cursor: default; }

.note { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 8px; margin-bottom: 14px; font-size: 12px; color: var(--muted); text-align: center; }
.note svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.note[hidden] { display: none; }
.warn-note { color: var(--warn); }

/* Attachments */
.attach-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 2px 4px; }
.attach-list[hidden] { display: none; }
.att {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 4px 6px 4px 4px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 13px;
}
.att img, .att-ic { width: 34px; height: 34px; border-radius: 7px; object-fit: cover; flex: none; }
.att-ic { display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: 10.5px; font-weight: 700; }
.att-name { min-width: 0; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-size { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.att-x { border: 0; background: transparent; color: var(--muted); width: 24px; height: 24px; border-radius: 6px; font-size: 12px; }
.att-x:hover { background: var(--bad-soft); color: var(--bad); }
.msg-files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.mfile { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; font-size: 13px; padding: 3px 9px; border-radius: 9px; background: rgba(255, 255, 255, .14); }
.mfile span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.mfile.img { padding: 3px 9px 3px 3px; }
.mfile img { width: 40px; height: 40px; object-fit: cover; border-radius: 7px; }
.drop-zone { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: rgba(22, 0, 67, .6); backdrop-filter: blur(3px); }
.drop-zone[hidden] { display: none; }
.drop-zone > div {
  width: min(460px, 100%); padding: 40px 24px; border-radius: 20px; border: 2px dashed rgba(255, 255, 255, .8); color: #fff; text-align: center;
  display: grid; justify-items: center; gap: 6px; background: rgba(22, 0, 67, .7); pointer-events: none;
}
.drop-zone svg { width: 46px; height: 46px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.drop-zone b { font-family: var(--head); font-size: 20px; }
.drop-zone span { opacity: .85; font-size: 14px; }

/* ⚡ panel */
.quick-panel {
  margin-top: 8px; max-height: min(54vh, 460px); overflow-y: auto; padding: 14px 16px 16px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow-lg);
}
.quick-panel[hidden] { display: none; }
.qp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.qp-head b { display: inline-flex; align-items: center; gap: 8px; font-family: var(--head); font-size: 15px; font-weight: 600; }
.qp-head svg { color: var(--brand); }
.quick-panel .qtabs { display: flex; flex-wrap: wrap; gap: 6px; }
.quick-panel .qtab { flex-direction: row; align-items: center; gap: 8px; padding: 6px 12px 6px 10px; border-radius: 999px; box-shadow: none; }
.quick-panel .qtab .qi { width: auto; height: auto; background: none; color: inherit; }
.quick-panel .qtab .qi svg { width: 16px; height: 16px; }
.quick-panel .qtab .qt small { display: none; }
.quick-panel .qtab .qt b { font-family: var(--body); font-size: 13.5px; font-weight: 500; }
.quick-panel .qtab.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); box-shadow: none; }
.quick-panel .qtab.on .qi { background: none; color: inherit; }
.quick-panel .chips { box-shadow: none; background: var(--surface-2); }

.toast {
  position: fixed; bottom: 110px; left: 50%; transform: translateX(-50%); z-index: 60; max-width: calc(100% - 32px);
  background: var(--brand-deep); color: #fff; padding: 10px 18px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow-lg);
}
.toast[hidden] { display: none; }

.print-head { display: none; }
.only-mobile { display: none; }

/* ---------- Medium desktop ---------- */
@media (max-width: 1360px) {
  .app { grid-template-columns: 252px minmax(0, 1fr); }
  .rail-logo { width: 150px; }
  .qtabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .today { display: none; }
}

/* ---------- Tablet / small laptop: rail folds into a branded top bar ---------- */
@media (max-width: 1179px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .bar { background: linear-gradient(120deg, #241066 0%, #160043 70%); border-bottom: 0; color: #fff; min-height: 70px; padding: 10px 22px; }
  .bar-logo { display: block; height: 46px; width: auto; }
  .brand .sep { display: block; }
  .brand h1 { color: #fff; font-size: 19px; }
  .brand p { color: rgba(255, 255, 255, .62); }
  .bar .pill { color: #ffd98a; background: rgba(255, 217, 138, .1); border-color: rgba(255, 217, 138, .3); }
  .bar .ghost, .bar .ghost-ic { border-color: rgba(255, 255, 255, .25) !important; color: #fff; }
  .bar .ghost:hover, .bar .ghost-ic:hover { background: rgba(255, 255, 255, .1); color: #fff; }
  .bar .btn-primary { background: #fff; color: var(--brand-deep); }
  .bar .btn-primary:hover { background: #ecebf7; }
  .qtabs { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 1060px) {
  .qtabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Phone ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .only-mobile { display: inline-block; }
  .bar { padding: 10px 14px; min-height: 60px; gap: 10px; }
  .bar-logo { height: 36px; }
  .brand { gap: 10px; }
  .brand p, .pill, .brand .sep, .hide-sm, .composer-foot { display: none; }
  .brand h1 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .bar-actions { gap: 6px; }
  .bar .ghost { padding: 5px 10px; font-size: 13px; }
  .ghost-ic, .btn-primary { width: 36px !important; height: 36px !important; padding: 0 !important; justify-content: center; }
  .btn-primary { width: 36px; }
  .scroll { padding: 16px 14px 8px; }
  .quick-panel, .composer, .note { width: calc(100% - 28px); }
  .sec-head { margin-top: 22px; flex-direction: column; gap: 0; }
  .sec-head h3 { font-size: 16px; }
  .qtabs { display: flex; overflow-x: auto; scrollbar-width: none; gap: 8px; padding-bottom: 2px; }
  .qtabs::-webkit-scrollbar { display: none; }
  .qtab { flex: none; flex-direction: row; align-items: center; gap: 8px; padding: 7px 12px 7px 8px; border-radius: 999px; }
  .qtab .qi { width: 28px; height: 28px; border-radius: 50%; }
  .qtab .qi svg { width: 16px; height: 16px; }
  .qtab .qt small { display: none; }
  .qtab .qt b { font-size: 13px; white-space: nowrap; }
  .chips { grid-template-columns: minmax(0, 1fr); }
  .chips .qchip:nth-child(odd) { border-inline-end: 0; }
  .chips .qchip:nth-last-child(-n + 2):nth-child(odd) { border-bottom: 1px solid var(--line); }
  .chips .qchip:last-child { border-bottom: 0; }
  .qchip { padding: 12px 14px; font-size: 14px; }
  .msg { margin: 16px 0; }
  .msg.bot .bubble { padding: 16px 16px; }
  .msg.user .bubble { max-width: 92%; }
  .verdict b { font-size: 15.5px; }
  .icon-btn { width: 38px; height: 42px; }
  .att-name { max-width: 120px; }
  .act span { display: none; }
  .act { padding: 6px; }
  .quick-panel { max-height: 50vh; }
  .toast { bottom: 120px; }
  textarea { font-size: 16px; } /* stops iOS zoom on focus */
}
@media (max-width: 380px) {
  .bar-logo { height: 32px; }
}

/* ---------- Print ---------- */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; color: #000; }
  .app { height: auto; display: block; }
  .rail, .bar, .composer, .note, .welcome, .msg-actions, .toast, .drop-zone, .quick-panel { display: none !important; }
  .layout { display: block; }
  .scroll { overflow: visible; padding: 0; }
  .print-head { display: flex; align-items: center; gap: 12px; border-bottom: 2px solid #443895; padding-bottom: 10px; margin-bottom: 14px; font-size: 12px; color: #444; }
  .print-head img { height: 40px; }
  .print-head b { display: block; font-size: 15px; color: #160043; }
  .bubble { box-shadow: none !important; break-inside: avoid; max-width: 100%; }
  .msg.user .bubble { background: #f0eef9 !important; color: #160043 !important; }
  .mfile { background: #fff; border: 1px solid #ccc; }
  .src { color: #443895; }
}
