/* style.css  -  Owner: Hadeel (هديل)
   Design system for every page: light + dark theme, app colors, text sizes,
   chat backgrounds, mobile first, Arabic (RTL) and English (LTR). */

/* ------------------------------------------------------------------ tokens */
:root {
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, "Noto Sans Arabic", Arial, sans-serif;
  --mono: "IBM Plex Mono", Consolas, "Cascadia Mono", "DejaVu Sans Mono", monospace;

  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --surface-3: #e9eef6;
  --line: #e1e7ef;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #8592a6;

  --primary: #4f46e5;
  --primary-2: #6366f1;
  --primary-soft: #eef0ff;
  --on-primary: #ffffff;
  --bubble-me: #4f46e5;
  --bubble-me-text: #ffffff;
  --bubble-them: #ffffff;
  --chat-bg: #f3f5fa;

  --q: #0ea5a4;          /* quantum   */
  --q-soft: #e0f7f6;
  --backup: #0891b2;
  --backup-soft: #e0f2fe;
  --reserve: #d97706;
  --reserve-soft: #fef3c7;
  --pqc: #ea580c;
  --pqc-soft: #ffedd5;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --ok: #16a34a;

  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px rgba(15, 23, 42, .06);
  --shadow-lg: 0 20px 60px rgba(15, 23, 42, .18);
}

:root[data-theme="dark"] {
  --bg: #0b1020;
  --surface: #121a2e;
  --surface-2: #172138;
  --surface-3: #1e2a45;
  --line: #24314f;
  --text: #e8edf7;
  --text-2: #b4c0d6;
  --text-3: #7b89a4;
  --primary: #7c83ff;
  --primary-2: #8b91ff;
  --primary-soft: #23284d;
  --on-primary: #0b1020;
  --bubble-me: #5b5ff0;
  --bubble-me-text: #ffffff;
  --bubble-them: #1b2640;
  --chat-bg: #0e1528;
  --q-soft: rgba(14, 165, 164, .16);
  --backup-soft: rgba(8, 145, 178, .18);
  --reserve-soft: rgba(217, 119, 6, .18);
  --pqc-soft: rgba(234, 88, 12, .18);
  --danger-soft: rgba(220, 38, 38, .18);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, .5);
}

/* ------------------------------------------------------------------ base */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--text-3); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 10px 16px; cursor: pointer; font-weight: 600;
  background: var(--primary); color: #fff; transition: filter .15s, transform .08s, background .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; padding: 13px 16px; font-size: 16px; }
.btn.soft { background: var(--primary-soft); color: var(--primary); }
.btn.ghost { background: transparent; color: var(--text-2); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; color: var(--text-2);
  display: inline-grid; place-items: center; cursor: pointer; flex: none; transition: background .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn svg { width: 21px; height: 21px; }

.input {
  width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
label.lbl { display: block; font-size: 13.5px; color: var(--text-2); margin: 0 0 6px; font-weight: 600; }

.avatar {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none;
  color: #fff; font-weight: 700; font-size: 17px; position: relative; background: var(--av, #6366f1);
}
.avatar.sm { width: 34px; height: 34px; font-size: 14px; }
.avatar .dot {
  position: absolute; bottom: 1px; inset-inline-end: 1px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--ok); border: 2px solid var(--surface);
}
.avatar.group { background: linear-gradient(135deg, #0ea5a4, #6366f1); }

#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); z-index: 200;
  background: var(--text); color: var(--surface); padding: 11px 18px; border-radius: 12px;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: .25s; max-width: 92vw; font-weight: 500;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* status chips (security mode) */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  font-size: 13px; font-weight: 600; white-space: nowrap; border: 0; cursor: default;
  background: var(--surface-3); color: var(--text-2);
}
button.chip { cursor: pointer; }
.chip .ico { font-size: 14px; }
.chip.quantum { background: var(--q-soft); color: var(--q); }
.chip.quantum_backup { background: var(--backup-soft); color: var(--backup); }
.chip.reserve { background: var(--reserve-soft); color: var(--reserve); }
.chip.pqc { background: var(--pqc-soft); color: var(--pqc); }
.chip.busy { background: var(--primary-soft); color: var(--primary); }
.mode-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); flex: none; }
.mode-dot.quantum { background: var(--q); } .mode-dot.quantum_backup { background: var(--backup); }
.mode-dot.reserve { background: var(--reserve); } .mode-dot.pqc { background: var(--pqc); }

.spinner {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-left-color: transparent;
  animation: spin .8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ login */
.auth {
  min-height: 100%; display: grid; grid-template-columns: 1.1fr 1fr;
}
.auth-hero {
  position: relative; overflow: hidden; color: #fff; padding: 56px;
  background: radial-gradient(900px 500px at 80% 10%, #6366f1 0%, transparent 60%),
              radial-gradient(700px 500px at 10% 90%, #0ea5a4 0%, transparent 55%), #0b1020;
  display: flex; flex-direction: column; justify-content: space-between;
}
.auth-hero h1 { font-size: 40px; line-height: 1.25; margin: 0 0 14px; }
.auth-hero p { color: #c7d2fe; font-size: 17px; max-width: 460px; margin: 0; }
.auth-hero .features { display: grid; gap: 14px; margin-top: 34px; }
.auth-hero .feature { display: flex; gap: 12px; align-items: flex-start; }
.auth-hero .feature .fi { width: 38px; height: 38px; border-radius: 10px; background: rgba(255, 255, 255, .12); display: grid; place-items: center; flex: none; }
.auth-hero .feature b { display: block; }
.auth-hero .feature span { color: #aab4d4; font-size: 14px; }
.orbit { position: absolute; left: -120px; top: 50%; width: 420px; height: 420px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .1); transform: translateY(-50%); }
.orbit::before, .orbit::after { content: ""; position: absolute; inset: 60px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .08); }
.orbit::after { inset: 130px; }
.orbit .e { position: absolute; top: -6px; left: 50%; width: 12px; height: 12px; border-radius: 50%; background: #67e8f9; box-shadow: 0 0 18px #67e8f9; }
.orbit-spin { position: absolute; inset: 0; animation: spin 14s linear infinite; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand-logo { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #6366f1, #0ea5a4); color: #fff; }
.brand-logo svg { width: 22px; height: 22px; }

.auth-panel { display: grid; place-items: center; padding: 32px 20px; background: var(--surface); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { margin: 0 0 4px; font-size: 26px; }
.auth-card p.sub { margin: 0 0 24px; color: var(--text-2); }
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; margin-bottom: 22px; border: 1px solid var(--line); }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 9px; cursor: pointer; color: var(--text-2); font-weight: 600; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.field { margin-bottom: 14px; }
.err { color: var(--danger); min-height: 22px; font-size: 14px; }

/* ------------------------------------------------------------------ app layout */
.app { height: 100%; display: grid; grid-template-columns: 380px 1fr; overflow: hidden; }
.sidebar { background: var(--surface); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side-head { display: flex; align-items: center; gap: 6px; padding: 14px 16px 10px; }
.side-head .brand { flex: 1; }
.me-row { display: flex; align-items: center; gap: 10px; padding: 6px 16px 12px; }
.me-row .name { font-weight: 700; }
.me-row .sub { font-size: 12.5px; color: var(--q); font-weight: 600; }

.tabs { display: flex; gap: 6px; padding: 0 16px 10px; }
.tabs button {
  flex: 1; border: 0; border-radius: 10px; padding: 9px; cursor: pointer; background: transparent;
  color: var(--text-2); font-weight: 600; position: relative;
}
.tabs button.active { background: var(--primary-soft); color: var(--primary); }
.count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 11.5px; font-weight: 700; margin-inline-start: 6px;
}
.search { padding: 0 16px 10px; }
.search .input { background: var(--surface-2); padding: 9px 14px; }
.pane { flex: 1; overflow-y: auto; padding: 0 8px 16px; min-height: 0; }
.section-title { font-size: 12.5px; font-weight: 700; color: var(--text-3); padding: 12px 10px 6px; text-transform: uppercase; }

.list { list-style: none; margin: 0; padding: 0; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; cursor: pointer;
  transition: background .12s;
}
.item:hover { background: var(--surface-2); }
.item.active { background: var(--primary-soft); }
.item .meta { flex: 1; min-width: 0; }
.item .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .sub { font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .end { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.item .actions { display: flex; gap: 6px; }
.small-btn { border: 0; border-radius: 9px; padding: 6px 10px; cursor: pointer; font-weight: 600; font-size: 13px; }
.small-btn.ok { background: var(--ok); color: #fff; }
.small-btn.no { background: var(--surface-3); color: var(--text-2); }

.add-friend { display: flex; gap: 8px; padding: 6px 8px 4px; }
.empty-hint { text-align: center; color: var(--text-3); padding: 24px 18px; font-size: 14px; }
.empty-hint .big { font-size: 34px; display: block; margin-bottom: 6px; }

/* ------------------------------------------------------------------ chat */
.chat { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--chat-bg); }
.chat-empty { margin: auto; text-align: center; max-width: 420px; padding: 24px; color: var(--text-2); }
.chat-empty .glyph { width: 96px; height: 96px; margin: 0 auto 18px; border-radius: 28px; display: grid; place-items: center; background: linear-gradient(135deg, #6366f1, #0ea5a4); color: #fff; box-shadow: var(--shadow-lg); }
.chat-empty .glyph svg { width: 54px; height: 54px; }
.chat-empty h2 { color: var(--text); margin: 0 0 8px; }

.chat-view { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-head {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--surface);
  border-bottom: 1px solid var(--line); min-height: 66px;
}
.chat-head .who { flex: 1; min-width: 0; cursor: pointer; }
.chat-head .title { font-weight: 700; font-size: 16.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .sub { font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back-btn { display: none; }

.key-banner {
  display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px; font-size: 13.5px; font-weight: 600;
  background: var(--primary-soft); color: var(--primary);
}
.messages { flex: 1; overflow-y: auto; padding: 18px 6%; display: flex; flex-direction: column; gap: 4px; }
.bubble-row { display: flex; }
.bubble-row.me { justify-content: flex-start; }
.bubble-row.them { justify-content: flex-end; }
.bubble {
  max-width: min(72%, 560px); padding: 8px 12px 6px; border-radius: 18px; background: var(--bubble-them);
  box-shadow: 0 1px 1px rgba(15, 23, 42, .06); cursor: pointer; position: relative; margin-top: 2px;
}
.bubble-row.me .bubble { background: var(--bubble-me); color: var(--bubble-me-text); border-start-start-radius: 6px; }
.bubble-row.them .bubble { border-start-end-radius: 6px; }
.bubble .from { font-size: 12.5px; font-weight: 700; margin-bottom: 1px; color: var(--sender, var(--primary)); }
.bubble .text { white-space: pre-wrap; word-wrap: break-word; font-size: 15.5px; }
.bubble .foot { display: flex; align-items: center; justify-content: flex-end; gap: 5px; font-size: 11.5px; opacity: .7; margin-top: 2px; }
.bubble .cipher {
  margin-top: 6px; padding-top: 6px; border-top: 1px dashed currentColor; font-family: var(--mono);
  font-size: 11px; direction: ltr; text-align: left; word-break: break-all; opacity: .7;
}
.bubble.locked .text { font-style: italic; opacity: .7; }
.sys { align-self: center; margin: 10px 0; padding: 6px 14px; border-radius: 12px; font-size: 13px; text-align: center; background: var(--surface); color: var(--text-2); box-shadow: 0 1px 1px rgba(15, 23, 42, .05); max-width: 90%; }
.sys.danger { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.sys.ok { background: var(--q-soft); color: var(--q); font-weight: 600; }

.composer { display: flex; gap: 10px; align-items: center; padding: 12px 16px; background: var(--surface); border-top: 1px solid var(--line); }
.composer .input { border-radius: 999px; padding: 12px 18px; }
.send-btn { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--primary); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.send-btn svg { width: 20px; height: 20px; transform: scaleX(-1); }
[dir="ltr"] .send-btn svg { transform: none; }
[dir="rtl"] .back-btn svg { transform: scaleX(-1); }
.send-btn:disabled { opacity: .5; }

/* ------------------------------------------------------------------ security drawer */
.scrim { position: fixed; inset: 0; background: rgba(2, 6, 23, .45); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(440px, 100vw); background: var(--surface); z-index: 50;
  box-shadow: var(--shadow-lg); transform: translateX(-105%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  display: flex; flex-direction: column;
}
[dir="ltr"] .drawer { transform: translateX(105%); }
.drawer.open, [dir="ltr"] .drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; flex: 1; font-size: 17px; }
.drawer-body { overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; }

.status-card { border-radius: 18px; padding: 18px; display: flex; gap: 14px; align-items: flex-start; background: var(--surface-2); }
.status-card .big-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 26px; flex: none; background: var(--surface-3); }
.status-card h4 { margin: 0 0 4px; font-size: 17px; }
.status-card p { margin: 0; color: var(--text-2); font-size: 14px; }
.status-card.quantum { background: var(--q-soft); } .status-card.quantum .big-ico { background: var(--q); color: #fff; }
.status-card.quantum_backup { background: var(--backup-soft); } .status-card.quantum_backup .big-ico { background: var(--backup); color: #fff; }
.status-card.reserve { background: var(--reserve-soft); } .status-card.reserve .big-ico { background: var(--reserve); color: #fff; }
.status-card.pqc { background: var(--pqc-soft); } .status-card.pqc .big-ico { background: var(--pqc); color: #fff; }

.box { border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.box h5 { margin: 0 0 10px; font-size: 14px; color: var(--text-2); }
.layers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.layer { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 12px; background: var(--surface-2); font-size: 14px; }
.layer .n { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--surface-3); color: var(--text-2); flex: none; }
.layer .t { flex: 1; }
.layer .s { font-size: 12.5px; font-weight: 700; }
.layer.active { outline: 2px solid var(--q); background: var(--q-soft); }
.layer.active .n { background: var(--q); color: #fff; }
.layer.active .s { color: var(--q); }
.layer.failed { opacity: .75; }
.layer.failed .s { color: var(--danger); }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fact { background: var(--surface-2); border-radius: 12px; padding: 9px 12px; }
.fact .k { font-size: 12px; color: var(--text-3); }
.fact .v { font-family: var(--mono); font-size: 17px; font-weight: 700; text-align: start; }

.attempt { display: flex; align-items: center; gap: 10px; font-size: 14px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.attempt:last-child { border-bottom: 0; }
.attempt .q { margin-inline-start: auto; font-family: var(--mono); }

details.more { border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--text-2); }
details.more[open] summary { margin-bottom: 12px; }
.lane { position: relative; height: 70px; border-radius: 12px; background: var(--surface-2); overflow: hidden; margin-bottom: 12px; }
.lane .end { position: absolute; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 700; text-align: center; width: 52px; z-index: 2; }
.lane .end .who { font-size: 22px; line-height: 1.2; }
.lane .a { right: 4px; } .lane .b { left: 4px; }
.lane .fiber { position: absolute; top: 50%; right: 58px; left: 58px; height: 2px; background: linear-gradient(90deg, var(--q), var(--primary)); opacity: .35; }
.photon {
  position: absolute; top: calc(50% - 11px); width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--mono); font-weight: 700; font-size: 12px; color: #fff;
  background: var(--primary); box-shadow: 0 0 12px var(--primary); animation: fly 1.5s linear forwards;
}
.photon.x { background: var(--q); box-shadow: 0 0 12px var(--q); }
@keyframes fly { from { right: 58px; opacity: 0; } 12% { opacity: 1; } 88% { opacity: 1; } to { right: calc(100% - 80px); opacity: 0; } }
.chips { display: flex; flex-wrap: wrap; gap: 3px; direction: ltr; }
.chips i { width: 14px; height: 14px; border-radius: 4px; background: var(--surface-3); }
.chips i.k { background: var(--q); } .chips i.e { background: var(--danger); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--text-3); margin: 8px 0 12px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 5px; background: var(--c); vertical-align: -1px; }
.bits { width: 100%; border-collapse: collapse; direction: ltr; font-family: var(--mono); font-size: 13px; margin-bottom: 12px; }
.bits th { text-align: start; font-family: var(--font); font-weight: 600; color: var(--text-3); padding: 3px 6px; white-space: nowrap; }
.bits td { text-align: center; padding: 3px 0; border-bottom: 1px solid var(--line); width: 24px; }
.bits td.k { color: var(--q); font-weight: 700; } .bits td.d { color: var(--text-3); } .bits td.e { color: var(--danger); font-weight: 700; }
.circuit { width: 100%; border-radius: 10px; background: #fff; }
.member { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.member .name { flex: 1; font-weight: 600; }

/* ------------------------------------------------------------------ modal */
.modal-back { position: fixed; inset: 0; background: rgba(2, 6, 23, .5); z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal { width: min(440px, 100%); max-height: 90vh; overflow: auto; background: var(--surface); border-radius: 22px; padding: 22px; box-shadow: var(--shadow-lg); animation: pop .22s ease-out; }
.modal h3 { margin: 0 0 14px; font-size: 19px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; cursor: pointer; }
.pick:hover { background: var(--surface-2); }
.pick input { width: 18px; height: 18px; accent-color: var(--primary); }
.modal .row { display: flex; gap: 10px; justify-content: flex-start; margin-top: 16px; }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }

/* ------------------------------------------------------------------ lab */
body.lab { background: #0a0d14; color: #e6e9f2; }
body.lab { --surface: #121722; --surface-2: #171d2b; --surface-3: #1f2738; --line: #252e42; --text: #e6e9f2; --text-2: #b1bacb; --text-3: #7a849a; --primary: #f43f5e; --primary-soft: rgba(244, 63, 94, .15); }
.lab-top { display: flex; align-items: center; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--line); background: #0d111b; position: sticky; top: 0; z-index: 10; }
.lab-top .brand-logo { background: linear-gradient(135deg, #f43f5e, #7c3aed); }
.lab-top .spacer { flex: 1; }
.lab-grid { display: grid; grid-template-columns: 380px 1fr; gap: 18px; padding: 18px 22px; max-width: 1400px; margin: 0 auto; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.card h3 { margin: 0 0 14px; font-size: 16px; }
.eve-face { font-size: 64px; text-align: center; line-height: 1.1; }
.eve-state { text-align: center; margin: 6px 0 16px; }
.eve-state b { font-size: 20px; display: block; }
.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); margin-bottom: 14px; font-weight: 700; }
.toggle { position: relative; width: 58px; height: 32px; flex: none; }
.toggle input { display: none; }
.toggle span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); cursor: pointer; transition: .2s; }
.toggle span::after { content: ""; position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; }
.toggle input:checked + span { background: var(--primary); }
body.lab .toggle input:checked + span { background: #f43f5e; }
.toggle input:checked + span::after { right: 30px; }
[dir="ltr"] .toggle span::after { right: auto; left: 4px; }
[dir="ltr"] .toggle input:checked + span::after { left: 30px; }
.lab .input, .lab select.input { background: var(--surface-2); color: var(--text); }
.ratio-big { font-family: var(--mono); font-size: 32px; font-weight: 700; color: #f43f5e; text-align: center; }
input[type=range] { width: 100%; accent-color: #f43f5e; }
.presets { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.scenario { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); margin-bottom: 10px; cursor: pointer; border: 1px solid transparent; }
.scenario:hover { border-color: #f43f5e; }
.scenario b { display: block; margin-bottom: 2px; }
.scenario span { font-size: 13.5px; color: var(--text-2); }
.lab-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.lab-tabs button { border: 0; border-radius: 10px; padding: 9px 16px; cursor: pointer; background: var(--surface-2); color: var(--text-2); font-weight: 600; }
.lab-tabs button.active { background: #f43f5e; color: #fff; }
.feed { display: flex; flex-direction: column; gap: 8px; max-height: 62vh; overflow-y: auto; }
.feed-item { padding: 10px 14px; border-radius: 12px; background: var(--surface-2); border-inline-start: 4px solid var(--line); font-size: 14px; }
.feed-item .meta { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--text-3); margin-bottom: 2px; }
.feed-item.caught { border-inline-start-color: var(--danger); }
.feed-item.missed { border-inline-start-color: var(--reserve); }
.feed-item.clean { border-inline-start-color: var(--q); }
.feed-item .cipher { font-family: var(--mono); font-size: 12px; direction: ltr; text-align: left; word-break: break-all; color: #fda4af; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; }
.stat .k { font-size: 12.5px; color: var(--text-3); }
.stat .v { font-family: var(--mono); font-size: 24px; font-weight: 700; }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.charts img { width: 100%; border-radius: 12px; background: #fff; display: block; }
.charts .wide { grid-column: 1 / -1; }
table.list { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.list th, table.list td { padding: 8px; border-bottom: 1px solid var(--line); text-align: start; }
table.list th { color: var(--text-3); font-weight: 600; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { padding: 32px 22px; min-height: auto; }
  .auth-hero h1 { font-size: 28px; }
  .auth-hero .features { display: none; }
  .orbit { display: none; }
  .lab-grid { grid-template-columns: 1fr; padding: 14px; }
  .two, .charts { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .app[data-view="chat"] .sidebar { display: none; }
  .app[data-view="list"] .chat { display: none; }
  .back-btn { display: inline-grid; }
  .messages { padding: 14px 10px; }
  .bubble { max-width: 84%; }
  .composer { padding: 10px; }
}


/* ================================================================== v5 additions */
.me-row { border: 0; background: transparent; width: 100%; text-align: start; cursor: pointer; border-radius: 14px; }
.me-row:hover { background: var(--surface-2); }
.me-text { min-width: 0; }
.avatar.has-emoji { background: var(--surface-3); }
.avatar .emoji { font-size: 24px; line-height: 1; }
.avatar.sm .emoji { font-size: 18px; }

.item .row1, .item .row2 { display: flex; align-items: center; gap: 8px; }
.item .row1 .title { flex: 1; min-width: 0; }
.item .row2 .sub { flex: 1; min-width: 0; }
.item .when { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.item.unread .when { color: var(--primary); font-weight: 700; }
.item.unread .title { font-weight: 700; }
.item.static { cursor: default; }
.item .count { margin: 0; }
.typing-text { color: var(--q); font-weight: 600; font-style: italic; }
.small-btn.chat-btn { background: var(--primary-soft); color: var(--primary); }

.day { align-self: center; margin: 12px 0 6px; position: sticky; top: 4px; z-index: 2; }
.day span { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 600; box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }
.ticks { display: inline-flex; margin-inline-start: 2px; }
.ticks svg { width: 15px; height: 15px; }
.ticks svg + svg { margin-inline-start: -9px; }
.ticks.read { color: #7dd3fc; opacity: 1; }
.bubble-row.them .ticks.read { color: var(--q); }
.edited { font-style: italic; }
.bubble.muted-msg .text { font-style: italic; opacity: .75; }
.sys.warn { background: var(--reserve-soft); color: var(--reserve); font-weight: 600; }

.menu-wrap { position: relative; }
.menu { position: absolute; top: 44px; inset-inline-end: 0; min-width: 190px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 30; display: flex; flex-direction: column; }
.menu.floating { position: fixed; top: 0; left: 0; inset-inline-end: auto; z-index: 90; }
.menu button { border: 0; background: transparent; text-align: start; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-weight: 500; color: var(--text); }
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--danger); }

.edit-bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--primary-soft); color: var(--primary); font-weight: 600; font-size: 13.5px; }
.edit-preview { flex: 1; min-width: 0; color: var(--text-2); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.modal.wide { width: min(560px, 100%); }
.modal-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.modal-title h3 { margin: 0; }
.set-section { border-top: 1px solid var(--line); padding: 14px 0; display: flex; flex-direction: column; gap: 10px; }
.set-section h4 { margin: 4px 0 0; font-size: 14.5px; color: var(--text-2); }
.profile-row { display: flex; gap: 14px; align-items: center; }
.profile-row .avatar { width: 64px; height: 64px; font-size: 26px; }
.profile-row .avatar .emoji { font-size: 34px; }
.handle { font-size: 13px; margin-top: 4px; text-align: start; }
.emoji-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.emoji-pick { aspect-ratio: 1; border-radius: 12px; border: 2px solid transparent; background: var(--surface-2); font-size: 20px; cursor: pointer; display: grid; place-items: center; font-weight: 700; color: var(--text-2); }
.emoji-pick.active { border-color: var(--primary); background: var(--primary-soft); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-weight: 600; cursor: pointer; }
.switch-row small { display: block; font-weight: 400; margin-top: 2px; font-size: 12.5px; }
.toggle { position: relative; width: 58px; height: 32px; flex: none; }
.toggle input { display: none; }
.toggle span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); cursor: pointer; transition: .2s; }
.toggle span::after { content: ""; position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; }
.pw-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.seg { margin-bottom: 0; }

.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text-2); }
.hint { font-size: 13.5px; text-align: center; margin: 0; }
.tech-title { font-weight: 700; color: var(--text-3); font-size: 13px; border-top: 1px dashed var(--line); padding-top: 14px; }
.head-ico { width: 22px; color: var(--primary); display: inline-flex; }

@media (max-width: 760px) {
  .emoji-grid { grid-template-columns: repeat(5, 1fr); }
  .pw-row { grid-template-columns: 1fr; }
  .item .actions { flex-direction: column; }
}

/* v5: login/lab language tools */
.auth-tools { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 18px; }
.auth-tools .btn.ghost { padding: 8px 14px; }
@media (max-width: 640px) { .lab-top .lab-note { display: none; } .lab-top { padding: 12px 14px; } }
/* v5: my messages stay on the right in both languages */
[dir="ltr"] .bubble-row.me { justify-content: flex-end; }
[dir="ltr"] .bubble-row.them { justify-content: flex-start; }
[dir="ltr"] .bubble-row.me .bubble { border-start-start-radius: 18px; border-start-end-radius: 6px; }
[dir="ltr"] .bubble-row.them .bubble { border-start-end-radius: 18px; border-start-start-radius: 6px; }


/* ================================================================== v5.1: appearance */
:root[data-accent="teal"] { --primary: #0d9488; --primary-2: #14b8a6; --primary-soft: #ccfbf1; --bubble-me: #0d9488; }
:root[data-accent="rose"] { --primary: #e11d48; --primary-2: #f43f5e; --primary-soft: #ffe4e6; --bubble-me: #e11d48; }
:root[data-accent="amber"] { --primary: #b45309; --primary-2: #d97706; --primary-soft: #fef3c7; --bubble-me: #b45309; }
:root[data-accent="emerald"] { --primary: #047857; --primary-2: #059669; --primary-soft: #d1fae5; --bubble-me: #047857; }
:root[data-theme="dark"][data-accent="teal"] { --primary: #2dd4bf; --primary-2: #5eead4; --primary-soft: rgba(45, 212, 191, .16); --bubble-me: #0f766e; }
:root[data-theme="dark"][data-accent="rose"] { --primary: #fb7185; --primary-2: #fda4af; --primary-soft: rgba(251, 113, 133, .16); --bubble-me: #be123c; }
:root[data-theme="dark"][data-accent="amber"] { --primary: #fbbf24; --primary-2: #fcd34d; --primary-soft: rgba(251, 191, 36, .16); --bubble-me: #b45309; }
:root[data-theme="dark"][data-accent="emerald"] { --primary: #34d399; --primary-2: #6ee7b7; --primary-soft: rgba(52, 211, 153, .16); --bubble-me: #047857; }
:root[data-fs="s"] body { font-size: 14px; } :root[data-fs="s"] .bubble .text { font-size: 14px; }
:root[data-fs="l"] body { font-size: 16.5px; } :root[data-fs="l"] .bubble .text { font-size: 17.5px; }
:root[data-wall="dots"] .messages { background-image: radial-gradient(color-mix(in srgb, var(--primary) 18%, transparent) 1.2px, transparent 1.4px); background-size: 18px 18px; }
:root[data-wall="waves"] .messages { background-image: repeating-radial-gradient(circle at 0 100%, transparent 0 22px, color-mix(in srgb, var(--primary) 9%, transparent) 22px 24px); }
:root[data-wall="grad"] .messages { background-image: linear-gradient(160deg, color-mix(in srgb, var(--primary) 12%, transparent), transparent 55%, color-mix(in srgb, var(--q) 12%, transparent)); }
.send-btn { background: var(--primary); }

/* ================================================================== v5.1: chat */
.flags { display: inline-flex; gap: 4px; color: var(--text-3); }
.flag svg { width: 14px; height: 14px; display: block; }
.flag.pin { color: var(--primary); }
.count.muted-count { background: var(--text-3); }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--danger-soft); color: var(--danger); vertical-align: 1px; }
.tag.ok { background: var(--q-soft); color: var(--q); }
.head-flags { display: inline-flex; gap: 4px; margin-inline-start: 6px; color: var(--text-3); vertical-align: -2px; }
.head-flags svg { width: 15px; height: 15px; }
#head-avatar { cursor: pointer; }

.bubble-wrap { display: flex; flex-direction: column; align-items: flex-start; max-width: min(72%, 560px); min-width: 0; }
.bubble-row.them .bubble-wrap { align-items: flex-end; }
[dir="ltr"] .bubble-row.me .bubble-wrap { align-items: flex-end; }
[dir="ltr"] .bubble-row.them .bubble-wrap { align-items: flex-start; }
.bubble-wrap .bubble { max-width: 100%; }
.bubble-row.flash .bubble { animation: flash 1.2s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 4px var(--primary-soft), 0 0 0 6px var(--primary); } }
.bubble-row.hit .bubble { outline: 2px dashed color-mix(in srgb, var(--reserve) 70%, transparent); outline-offset: 2px; }
.bubble-row.hit-now .bubble { outline: 3px solid var(--reserve); }

.quote {
  display: block; width: 100%; text-align: start; border: 0; cursor: pointer; margin: 2px 0 6px; padding: 6px 10px;
  border-radius: 10px; background: rgba(15, 23, 42, .06); color: inherit; border-inline-start: 3px solid var(--sender, var(--primary));
  font-size: 13px; max-width: 100%;
}
.bubble-row.me .quote { background: rgba(255, 255, 255, .16); border-inline-start-color: rgba(255, 255, 255, .8); }
:root[data-theme="dark"] .bubble-row.them .quote { background: rgba(255, 255, 255, .06); }
.quote b { display: block; font-size: 12.5px; color: var(--sender, var(--primary)); }
.bubble-row.me .quote b { color: inherit; }
.quote span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; opacity: .85; }

.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: -6px; padding: 0 8px; position: relative; z-index: 1; }
.react { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 1px 7px; font-size: 14px; cursor: pointer; box-shadow: 0 1px 2px rgba(15, 23, 42, .08); color: var(--text-2); }
.react small { font-size: 11.5px; font-weight: 700; }
.react.mine { border-color: var(--primary); background: var(--primary-soft); }
.ftimer svg { width: 12px; height: 12px; display: block; }

.react-row { display: flex; gap: 2px; padding: 2px 2px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; justify-content: space-between; }
.react-row button { font-size: 21px; padding: 4px 6px; border-radius: 10px; line-height: 1.1; }
.react-row button:hover, .react-row button.mine { background: var(--primary-soft); }
.menu.floating { min-width: 230px; }

.search-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.search-bar .input { padding: 8px 12px; }
.search-count { font-size: 12.5px; white-space: nowrap; min-width: 56px; text-align: center; }
.timer-banner { text-align: center; padding: 6px 12px; font-size: 12.5px; font-weight: 600; background: var(--q-soft); color: var(--q); }
.blocked-bar { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px 16px; background: var(--surface); border-top: 1px solid var(--line); font-size: 14px; color: var(--text-2); flex-wrap: wrap; text-align: center; }
.edit-bar[data-mode="reply"] { background: var(--surface-2); color: var(--text-2); border-inline-start: 4px solid var(--primary); }

.composer { align-items: flex-end; }
.composer textarea.input { resize: none; border-radius: 22px; padding: 11px 18px; line-height: 1.45; max-height: 140px; min-height: 46px; overflow-y: auto; }

/* ================================================================== v5.1: chat info drawer */
.profile-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0 6px; }
.profile-card h4 { margin: 10px 0 0; font-size: 19px; }
.profile-card p { margin: 8px 0 2px; color: var(--text-2); max-width: 320px; }
.avatar.xl { width: 84px; height: 84px; font-size: 32px; }
.avatar.xl .emoji { font-size: 46px; }
.avatar.xl .dot { width: 16px; height: 16px; bottom: 4px; }
.avatar.xl svg { width: 38px !important; height: 38px !important; }
.small { font-size: 12.5px; }
.safety .code { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; direction: ltr; }
.safety .code span { text-align: center; padding: 10px 4px; border-radius: 10px; background: var(--surface-2); font-size: 17px; font-weight: 700; letter-spacing: 1px; }
.safety p { margin: 10px 0 0; }
.seg.wrap { flex-wrap: wrap; gap: 4px; }
.seg.wrap button { flex: 1 1 auto; white-space: nowrap; }
.seg button:disabled { opacity: .5; cursor: not-allowed; }
.action-list { display: flex; flex-direction: column; }
.action-list button { border: 0; background: transparent; text-align: start; padding: 10px 6px; border-radius: 10px; cursor: pointer; font-weight: 500; color: var(--text); font-size: 14.5px; }
.action-list button:hover { background: var(--surface-2); }
.action-list button.danger { color: var(--danger); }
.engine-badge { align-self: flex-start; padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--q-soft); color: var(--q); }
.qber-chart { width: 100%; height: auto; display: block; direction: ltr; }
.qber-chart .axis { stroke: var(--line); stroke-width: 1.5; }
.qber-chart .limit { stroke: var(--reserve); stroke-width: 1.5; stroke-dasharray: 5 4; }
.qber-chart .limit-label { fill: var(--reserve); font-size: 11px; font-weight: 700; font-family: var(--mono); }
.qber-chart .tick { fill: var(--text-3); font-size: 10px; font-family: var(--mono); }
.qber-chart .line { fill: none; stroke: var(--primary); stroke-width: 2; opacity: .55; }
.qber-chart circle.good { fill: var(--q); } .qber-chart circle.bad { fill: var(--danger); } .qber-chart circle.warn { fill: var(--reserve); }

/* ================================================================== v5.1: settings */
.modal.settings { width: min(860px, 100%); height: min(680px, 92vh); max-height: 92vh; padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.modal.settings .modal-title { padding: 16px 20px 12px; border-bottom: 1px solid var(--line); margin: 0; }
.settings-wrap { flex: 1; display: grid; grid-template-columns: 210px 1fr; min-height: 0; }
.set-nav { display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; border-inline-end: 1px solid var(--line); overflow-y: auto; background: var(--surface-2); }
.set-nav button { border: 0; background: transparent; text-align: start; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.set-nav button:hover { background: var(--surface-3); }
.set-nav button.active { background: var(--primary-soft); color: var(--primary); }
.set-body { overflow-y: auto; padding: 18px 22px 26px; }
.set-page { display: flex; flex-direction: column; gap: 10px; }
.set-page h4 { margin: 10px 0 0; font-size: 14px; color: var(--text-2); }
.set-page h4:first-child { margin-top: 0; }
.set-page .hint { text-align: start; color: var(--text-3); }
.set-page textarea.input { resize: vertical; min-height: 60px; }
.set-page .switch-row { margin: 0; }
.profile-row .avatar.xl { width: 72px; height: 72px; }
.pw-meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.pw-meter span { display: block; height: 100%; width: 0; border-radius: inherit; transition: width .25s, background .25s; }
.pw-meter[data-s="1"] span { width: 33%; background: var(--danger); }
.pw-meter[data-s="2"] span { width: 66%; background: var(--reserve); }
.pw-meter[data-s="3"] span { width: 100%; background: var(--ok); }
.danger-zone { margin-top: 12px; padding: 14px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); display: flex; flex-direction: column; gap: 8px; }
.danger-zone h4 { color: var(--danger); margin: 0; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--surface); background: var(--sw); cursor: pointer; box-shadow: 0 0 0 1px var(--line); }
.swatch.active { box-shadow: 0 0 0 3px var(--sw); }
.walls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.walls button { border: 2px solid var(--line); background: var(--surface); border-radius: 12px; padding: 6px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; align-items: center; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.walls button.active { border-color: var(--primary); color: var(--primary); }
.walls i { width: 100%; height: 46px; border-radius: 8px; background-color: var(--chat-bg); display: block; }
.wall-dots { background-image: radial-gradient(color-mix(in srgb, var(--primary) 30%, transparent) 1.2px, transparent 1.4px); background-size: 10px 10px; }
.wall-waves { background-image: repeating-radial-gradient(circle at 0 100%, transparent 0 10px, color-mix(in srgb, var(--primary) 18%, transparent) 10px 12px); }
.wall-grad { background-image: linear-gradient(160deg, color-mix(in srgb, var(--primary) 25%, transparent), transparent 55%, color-mix(in srgb, var(--q) 25%, transparent)); }
.list.plain .item { padding: 8px; }
.empty-line { padding: 8px 4px; font-size: 13.5px; }
.device .dev-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-size: 20px; flex: none; }
.info-card { border: 1px solid var(--line); border-radius: 14px; padding: 6px 14px; }
.info-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; }
.info-row + .info-row { border-top: 1px dashed var(--line); }
.info-row > span { font-size: 22px; }
.about-head { display: flex; gap: 14px; align-items: center; }
.brand-logo.big { width: 56px; height: 56px; border-radius: 16px; }
.brand-logo.big svg { width: 34px; height: 34px; }
.about-list { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; }
.about-list dt { color: var(--text-3); font-weight: 600; }
.about-list dd { margin: 0; }
.about-list ul { margin: 0; padding-inline-start: 18px; }

/* login extras */
.pw-help { display: flex; align-items: center; gap: 10px; margin: -6px 0 12px; font-size: 12.5px; color: var(--text-3); }
.pw-help .pw-meter { flex: 1; }
.how-link { color: #c7d2fe; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 760px) {
  .hide-mobile { display: none; }
  .modal-back:has(.modal.settings) { padding: 0; }
  .modal.settings { width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
  .settings-wrap { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .set-nav { flex-direction: row; overflow-x: auto; border-inline-end: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  .set-nav button { padding: 8px 12px; }
  .set-body { padding: 16px; }
  .walls { grid-template-columns: repeat(2, 1fr); }
  .bubble-wrap { max-width: 86%; }
  .chat-head { gap: 8px; padding: 8px 10px; }
  .chat-head .chip { padding: 5px 9px; }
}

/* print (chat report) */
@media print {
  body { background: #fff !important; color: #000; }
  .no-print { display: none !important; }
}

/* lab v5.1 */
.noise-box { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.noise-range { accent-color: #f59e0b; }
input[type=range] { direction: ltr; }
.noise-scale { direction: ltr; display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-3); position: relative; }
.noise-scale .limit { position: absolute; left: 55%; transform: translateX(-50%); color: #f59e0b; font-weight: 700; }
.engine-name { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 12px; font-size: 14px; }
.ok-dot, .bad-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); flex: none; }
.bad-dot { background: var(--danger); box-shadow: 0 0 10px var(--danger); }
.stat-grid.three { grid-template-columns: repeat(3, 1fr); margin: 0; }
.stat-grid.three .v { font-size: 19px; }
.ready-summary { padding: 12px 14px; border-radius: 12px; font-weight: 700; margin-bottom: 12px; }
.ready-summary.good { background: var(--q-soft); color: var(--q); }
.ready-summary.bad { background: var(--reserve-soft); color: var(--reserve); }
.ready-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ready-list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.ready-list li.bad { outline: 1px solid var(--danger); }
.ready-list .small { font-size: 12px; word-break: break-all; }
