/* AiQbiT Mail - dashboard styles
   Palette taken from the AiQbiT emblem: deep navy hull, signal cyan, circuit copper.
   One expressive element - the Brain card, drawn like a circuit trace - everything else stays quiet. */

:root, html[data-theme="dark"] {
  --bg: #08111c;
  --panel: #0d1a29;
  --panel-2: #112136;
  --raise: #172c47;
  --line: rgba(148, 190, 230, .11);
  --line-2: rgba(148, 190, 230, .2);
  --text: #e8f0f7;
  --muted: #93a7bb;
  --faint: #5f778e;
  --cyan: #3cc8e0;
  --cyan-ink: #04202a;
  --cyan-soft: rgba(60, 200, 224, .12);
  --copper: #f0a03c;
  --copper-soft: rgba(240, 160, 60, .13);
  --rose: #f0607a;
  --mint: #4fd69c;
  --violet: #9b8cff;
  --shadow: 0 24px 64px rgba(0, 0, 0, .5);
  --glass: rgba(8, 17, 28, .88);
  color-scheme: dark;
}
html[data-theme="light"] {
  --bg: #eef2f6;
  --panel: #ffffff;
  --panel-2: #f4f7fa;
  --raise: #e5edf5;
  --line: rgba(16, 40, 70, .1);
  --line-2: rgba(16, 40, 70, .18);
  --text: #0f1d2e;
  --muted: #4c6076;
  --faint: #8093a7;
  --cyan: #0a8aa3;
  --cyan-ink: #ffffff;
  --cyan-soft: rgba(10, 138, 163, .09);
  --copper: #c47510;
  --copper-soft: rgba(196, 117, 16, .1);
  --rose: #d33a58;
  --mint: #1f9e6a;
  --violet: #6b58e0;
  --shadow: 0 24px 60px rgba(15, 35, 60, .16);
  --glass: rgba(255, 255, 255, .9);
  color-scheme: light;
}
:root {
  --r-1: 8px;
  --r-2: 12px;
  --r-3: 18px;
  --font: 'Schibsted Grotesk', 'IBM Plex Sans Arabic', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  font-feature-settings: 'tnum' 0;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
html[lang="ar"] body { font-family: 'IBM Plex Sans Arabic', var(--font); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--cyan); }
.hint { color: var(--muted); font-size: .86em; margin: 0; }
.muted { color: var(--faint); }
.grow { flex: 1; }
.mono, .num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
html[dir="rtl"] .flip { transform: scaleX(-1); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.bg-grid { display: none; }
::selection { background: var(--cyan-soft); }

/* ---------- Brain orb: the emblem's colours, slowly turning ---------- */
.orb {
  --s: 30px;
  width: var(--s); height: var(--s); flex-shrink: 0; border-radius: 50%; position: relative; display: inline-block;
  background: conic-gradient(from 20deg, #1b6fd0, var(--cyan), #ffd9a0, var(--copper), #1b6fd0);
  animation: orb-spin 10s linear infinite;
  box-shadow: 0 0 18px rgba(60, 200, 224, .35);
}
.orb i {
  position: absolute; inset: 3px; border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #eafcff 0%, #66e3f3 16%, #1d5fae 55%, #071526 100%);
  animation: orb-breathe 3.4s ease-in-out infinite;
}
.orb.small { --s: 22px; }
.orb.tiny { --s: 12px; box-shadow: none; }
.orb.tiny i { inset: 2px; }
@keyframes orb-spin { to { transform: rotate(360deg); } }
@keyframes orb-breathe { 50% { filter: brightness(1.3); } }
.thinking .orb { animation-duration: 1.2s; box-shadow: 0 0 26px rgba(240, 160, 60, .55); }
@media (prefers-reduced-motion: reduce) { .orb, .orb i { animation: none; } }

/* ---------- brand ---------- */
.brand, .login-brand { display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; }
.brand img, .login-brand img { border-radius: 50%; box-shadow: 0 0 0 1px var(--line-2), 0 6px 18px rgba(30, 110, 200, .3); }
.brand span, .login-brand span { font-size: 1.12rem; font-weight: 500; letter-spacing: -.01em; color: var(--muted); }
.brand b, .login-brand b { font-weight: 800; color: var(--text); letter-spacing: -.02em; }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--line-2); background: var(--panel-2); padding: .62rem 1.05rem; border-radius: var(--r-1);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; font-weight: 600; transition: border-color .15s, background .15s;
}
.btn:hover { border-color: var(--cyan); }
.btn.primary { background: var(--cyan); color: var(--cyan-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .6; cursor: wait; }
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--r-1); border: 1px solid transparent; background: transparent;
  color: var(--muted); display: inline-grid; place-items: center; text-decoration: none; flex-shrink: 0;
}
.icon-btn:hover { color: var(--text); background: var(--panel-2); }
.icon-btn.on, .icon-btn.on i { color: var(--copper); }
.icon-btn.danger:hover { color: var(--rose); }
.icon-btn:disabled { opacity: .3; pointer-events: none; }
.chip {
  border: 1px solid var(--line-2); background: transparent; border-radius: 999px; padding: .34rem .85rem;
  font-size: .86em; display: inline-flex; align-items: center; gap: .45rem; color: var(--text); white-space: nowrap; font-weight: 500;
}
.chip:hover { border-color: var(--cyan); background: var(--cyan-soft); }
.chip.danger:hover { border-color: var(--rose); color: var(--rose); background: transparent; }
.chip.ai i { color: var(--copper); }
.chip.ai:hover { border-color: var(--copper); background: var(--copper-soft); }
.link { background: none; border: 0; color: var(--muted); padding: .3rem 0; display: flex; align-items: center; gap: .7rem; text-align: start; }
.link i { width: 16px; text-align: center; }
.link:hover { color: var(--text); }
.spin { pointer-events: none; }
.spin i { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- login ---------- */
.login { height: 100%; display: grid; place-items: center; padding: 16px; background: radial-gradient(700px 420px at 50% 30%, var(--cyan-soft), transparent 70%); }
.login-card {
  width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line-2);
  border-radius: var(--r-3); padding: 34px 30px 24px; box-shadow: var(--shadow); display: grid; gap: 16px;
}
.login-brand { flex-direction: column; gap: 12px; }
.login-brand span { font-size: 1.5rem; }
.login-sub { text-align: center; margin: -8px 0 4px; color: var(--muted); }
.field { display: grid; gap: 6px; font-size: .88em; color: var(--muted); font-weight: 500; }
.field input, .field textarea, .field select, .row input {
  width: 100%; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r-1);
  padding: .68rem .85rem; color: var(--text); outline: none; font-size: 1rem; font-weight: 400;
}
.field textarea { resize: vertical; line-height: 1.5; }
.field textarea::placeholder, .field input::placeholder { color: var(--faint); }
.field input:focus, .field textarea:focus, .field select:focus, .row input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-soft); }
.login-error { color: var(--rose); min-height: 1.2em; margin: 0; text-align: center; font-size: .9em; white-space: pre-line; }
.login-error:empty { min-height: 0; }
.back-home { justify-self: center; color: var(--faint); text-decoration: none; font-size: .85em; }
.lang-switch { display: flex; justify-content: center; gap: 4px; }
.lang-switch button { border: 1px solid var(--line-2); background: transparent; color: var(--muted); padding: .16rem .55rem; border-radius: 999px; font-size: .74em; font-weight: 600; }
.lang-switch button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- layout ---------- */
.app { height: 100%; display: grid; grid-template-columns: 236px minmax(360px, 430px) 1fr; }
.rail { background: var(--panel); border-inline-end: 1px solid var(--line); padding: 16px 12px 12px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; scrollbar-width: thin; }
.rail .brand { padding: 2px 8px 6px; }
.compose-btn { padding: .78rem; font-size: .98em; }
.folders, .smart { display: grid; gap: 1px; }
.rail-title { color: var(--faint); font-size: .82em; font-weight: 600; padding: 6px 12px 2px; }
.cats summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; }
.cats summary::-webkit-details-marker { display: none; }
.cats summary::after { content: '+'; font-weight: 400; }
.cats[open] summary::after { content: '–'; }
.cats .smart { margin-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: .4rem .7rem; border-radius: var(--r-1); border: 0;
  background: transparent; color: var(--muted); text-align: start; width: 100%; font-weight: 500;
}
.nav-item i { width: 18px; text-align: center; font-size: .92em; }
.nav-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--cyan-soft); color: var(--text); }
.nav-item.active i { color: var(--cyan); }
.nav-item.brainy i { color: var(--copper); }
.badge { font-weight: 700; font-size: .74em; background: var(--raise); color: var(--text); border-radius: 999px; padding: .04rem .48rem; min-width: 22px; text-align: center; font-variant-numeric: tabular-nums; }
.nav-item.active .badge, .badge.hot { background: var(--cyan); color: var(--cyan-ink); }
.badge.copper { background: var(--copper); color: #1b1203; }
.rail-foot { margin-top: auto; display: grid; gap: 0; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.foot-row { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 6px; }
.foot-row .lang-switch { justify-content: flex-start; }
.foot-icons { display: flex; gap: 2px; }
.notify-btn.on { color: var(--cyan); }
.notify-btn.on i { animation: bell-ring .9s ease-in-out 1; transform-origin: 50% 0; }
@keyframes bell-ring { 0%,100% { transform: rotate(0); } 20% { transform: rotate(16deg); } 45% { transform: rotate(-12deg); } 70% { transform: rotate(6deg); } }
.status { display: flex; gap: 14px; font-size: .78em; color: var(--faint); flex-wrap: wrap; }
.st { display: flex; align-items: center; gap: 7px; }
.st em { font-style: normal; }
.st i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.st.on { color: var(--muted); }
.st.on i { background: var(--mint); }

/* auto-reply pill in the rail */
.ar-pill { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--muted); border-radius: var(--r-1); padding: .5rem .7rem; margin-bottom: 6px; font-size: .86em; font-weight: 600; text-align: start; }
.ar-pill:hover { border-color: var(--cyan); color: var(--text); }
.ar-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex-shrink: 0; }
.ar-pill.on { border-color: rgba(79, 214, 156, .45); color: var(--text); }
.ar-pill.on .ar-dot { background: var(--mint); box-shadow: 0 0 0 4px rgba(79, 214, 156, .16); }
.ar-pill.wait .ar-dot { background: var(--copper); }

/* ---------- list pane ---------- */
.list-pane { position: relative; display: flex; flex-direction: column; min-width: 0; border-inline-end: 1px solid var(--line); background: var(--bg); }
.brain-head { padding: 16px 16px 10px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 8px; align-items: center; }
.brain-head > .ask { grid-column: 1 / -1; }
.brain-head > .only-mobile + .ask { grid-column: 2; }
.ask {
  display: flex; align-items: center; gap: 11px; padding: 6px 6px 6px 8px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--panel); transition: border-color .15s, box-shadow .15s;
}
.ask:focus-within { border-color: var(--cyan); box-shadow: 0 0 0 4px var(--cyan-soft); }
.ask input { flex: 1; border: 0; background: transparent; outline: none; min-width: 0; font-size: .98em; }
.ask input::placeholder { color: var(--faint); }
.ask input::-webkit-search-cancel-button { display: none; }
.ask kbd { font: 600 .72em var(--font); color: var(--faint); border: 1px solid var(--line-2); border-radius: 5px; padding: 0 .4rem; }
.ask-go { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--raise); color: var(--text); display: grid; place-items: center; }
.ask-go:hover { background: var(--cyan); color: var(--cyan-ink); }

/* Brain briefing: what needs attention, each number opens its view */
.briefing { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.briefing:empty { display: none; }
.brief { display: flex; flex-direction: column; align-items: flex-start; gap: 0; padding: .4rem .6rem .42rem; border-radius: var(--r-2); border: 1px solid var(--line); background: var(--panel); min-width: 0; text-align: start; }
.brief b { font-size: 1.22rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.brief span { font-size: .72em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.brief:hover { border-color: var(--line-2); background: var(--panel-2); }
.brief.hot b { color: var(--copper); }
.brief.calm b { color: var(--faint); }
.brief.ar b { color: var(--mint); }
.suggest { grid-column: 1 / -1; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.suggest::-webkit-scrollbar { display: none; }
.hint-chip { border: 1px dashed var(--line-2); background: transparent; color: var(--muted); border-radius: 999px; padding: .26rem .78rem; font-size: .82em; white-space: nowrap; }
.hint-chip:hover { border-style: solid; border-color: var(--cyan); color: var(--text); }

.filter-bar { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; align-items: center; }
.filter-bar .chip { border-color: var(--cyan); background: var(--cyan-soft); }
.filter-bar .link { font-size: .85em; padding: 0 4px; }
.list-head { display: flex; align-items: center; gap: 10px; padding: 6px 16px 10px; border-bottom: 1px solid var(--line); }
.list-head h1 { font-size: 1.28rem; font-weight: 700; letter-spacing: -.015em; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.count { color: var(--faint); font-size: .8em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.list-tools { margin-inline-start: auto; display: flex; }
.list-tools .icon-btn.on { color: var(--cyan); }
.bulk, .trash-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.bulk > span { color: var(--cyan); margin-inline-end: 4px; font-size: .85em; font-weight: 600; }
.trash-bar { color: var(--muted); font-size: .85em; justify-content: space-between; }

.check { position: relative; display: inline-grid; place-items: center; width: 20px; height: 20px; flex-shrink: 0; cursor: pointer; }
.check input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.check span { width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--faint); }
.check input:checked + span { background: var(--cyan); border-color: var(--cyan); box-shadow: inset 0 0 0 3px var(--bg); }

.list { list-style: none; margin: 0; padding: 0 8px 90px; overflow-y: auto; flex: 1; transition: opacity .2s; scrollbar-width: thin; }
.list.loading { opacity: .45; }
.day { position: sticky; top: 0; z-index: 2; padding: 12px 10px 6px; font-size: .78em; font-weight: 700; color: var(--faint); background: var(--bg); }
.item { display: flex; gap: 12px; align-items: flex-start; padding: 11px 10px; border-radius: var(--r-2); cursor: pointer; position: relative; }
.item:hover { background: var(--panel); }
.item.active { background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.item.sel { background: var(--cyan-soft); }
.item .check { margin-top: 10px; opacity: .45; }
.item:hover .check, .item.sel .check { opacity: 1; }
.item.unread::before { content: ''; position: absolute; inset-inline-start: 3px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--cyan); }
.item.prio-high { box-shadow: inset 3px 0 0 var(--copper); }
html[dir="rtl"] .item.prio-high { box-shadow: inset -3px 0 0 var(--copper); }
.item.prio-high.active { box-shadow: inset 3px 0 0 var(--copper), inset 0 0 0 1px var(--line-2); }
.avatar {
  --h: 200; width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  font-weight: 700; font-size: .8em; color: hsl(var(--h) 70% 88%); background: hsl(var(--h) 38% 30%);
}
html[data-theme="light"] .avatar { color: hsl(var(--h) 55% 28%); background: hsl(var(--h) 60% 90%); }
.avatar.lg { width: 46px; height: 46px; font-size: .95em; }
.item-main { flex: 1; min-width: 0; }
.item-top { display: flex; gap: 8px; align-items: baseline; }
.from { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-weight: 500; }
.item.unread .from { color: var(--text); font-weight: 700; }
.vip-ic { color: var(--copper); font-size: .78em; margin-inline-start: 4px; }
.item time { font-size: .78em; color: var(--faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.item.unread time { color: var(--cyan); font-weight: 600; }
.item-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .93em; }
.item.unread .item-sub { color: var(--text); }
.item-meta { display: flex; gap: 9px; align-items: center; margin-top: 5px; color: var(--faint); font-size: .78em; }
.item-meta:empty { display: none; }
.item-meta .note-ic { color: var(--copper); }
.prio-tag { color: var(--copper); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.star { background: none; border: 0; color: var(--faint); padding: 4px; margin-top: 2px; opacity: .45; }
.item:hover .star, .star.on { opacity: 1; }
.star.on, .star:hover { color: var(--copper); }
.list-empty { display: grid; place-items: center; gap: 10px; padding: 60px 20px; color: var(--faint); text-align: center; }
.list-empty i { font-size: 1.8rem; }
.list-empty.error { color: var(--rose); }
.pager { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: .85em; }
.pager:empty { display: none; }

/* category colours */
.cat-personal { --c: #4fd69c; } .cat-work { --c: #3cc8e0; } .cat-customers { --c: #f0a03c; } .cat-invoices { --c: #e8c547; }
.cat-newsletters { --c: #9b8cff; } .cat-notifications { --c: #8ba0b5; } .cat-spam { --c: #f0607a; }
html[data-theme="light"] .cat-personal { --c: #188a5c; } html[data-theme="light"] .cat-work { --c: #0a7f97; }
html[data-theme="light"] .cat-customers { --c: #b5680c; } html[data-theme="light"] .cat-invoices { --c: #9a7b00; }
html[data-theme="light"] .cat-newsletters { --c: #5b49d0; } html[data-theme="light"] .cat-notifications { --c: #5f7286; }
html[data-theme="light"] .cat-spam { --c: #c42f4d; }
.cat { display: inline-flex; align-items: center; gap: 5px; color: var(--c); font-weight: 500; }
.cat i { font-size: .9em; }
.smart .nav-item[class*="cat-"] i { color: var(--c, var(--muted)); }

/* ---------- reader ---------- */
.reader { min-width: 0; display: flex; flex-direction: column; transition: opacity .2s; background: var(--bg); }
.reader.loading { opacity: .5; }
.empty-reader { margin: auto; display: grid; place-items: center; gap: 16px; color: var(--faint); padding: 20px; text-align: center; max-width: 340px; }
.empty-reader img { width: 96px; height: 96px; border-radius: 50%; opacity: .9; box-shadow: 0 18px 50px rgba(30, 110, 200, .25); }
.empty-reader p { margin: 0; }
.reader-bar { display: flex; gap: 6px; align-items: center; padding: 12px 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; background: var(--bg); }
.reader-scroll { overflow-y: auto; padding: 26px clamp(16px, 3.4vw, 44px) 56px; flex: 1; scrollbar-width: thin; }
.reader-scroll > * { max-width: 840px; }
.subject { font-size: 1.6rem; line-height: 1.22; margin: 0 0 18px; font-weight: 700; letter-spacing: -.02em; }
.sender { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 20px; }
.sender-info { flex: 1; min-width: 0; display: grid; gap: 2px; }
.sender-info .addr { color: var(--faint); font-size: .86em; }
.sender-info .small { color: var(--muted); font-size: .86em; overflow-wrap: anywhere; }
.sender-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.vip-btn { border: 1px solid var(--line-2); background: transparent; color: var(--muted); border-radius: 999px; padding: .3rem .7rem; font-size: .82em; display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }
.vip-btn:hover { border-color: var(--copper); color: var(--copper); }
.vip-btn.on { border-color: var(--copper); background: var(--copper-soft); color: var(--copper); }
.cat-select { background: var(--panel); border: 1px solid var(--line-2); border-radius: 999px; padding: .3rem .7rem; color: var(--muted); font-size: .84em; max-width: 170px; }

/* Brain card - the circuit trace: one copper line connects what the Brain found */
.brain-card {
  position: relative; border: 1px solid var(--line-2); border-radius: var(--r-3); padding: 16px 20px 16px 20px; margin-bottom: 20px;
  display: grid; gap: 14px; background: var(--panel);
  box-shadow: 0 1px 0 var(--line), 0 18px 44px rgba(0, 0, 0, .14);
}
.brain-card header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brain-card header b { font-size: .98em; font-weight: 700; }
.intent { font-size: .8em; padding: .18rem .65rem; border-radius: 999px; background: var(--raise); color: var(--text); font-weight: 600; }
.meter { display: inline-flex; align-items: center; gap: 6px; font-size: .78em; color: var(--muted); margin-inline-start: auto; font-weight: 600; }
.meter i { width: 5px; height: 14px; border-radius: 2px; background: var(--raise); }
.meter.lvl-normal i:nth-child(-n+2), .meter.lvl-low i:first-child { background: var(--cyan); }
.meter.lvl-high i { background: var(--copper); }
.meter.lvl-high { color: var(--copper); }
.trace { display: grid; gap: 12px; position: relative; padding-inline-start: 22px; }
.trace::before { content: ''; position: absolute; inset-inline-start: 5px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: linear-gradient(var(--copper), var(--cyan)); opacity: .75; }
.node { position: relative; display: grid; gap: 6px; }
.node::before { content: ''; position: absolute; inset-inline-start: -21px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--panel); border: 2px solid var(--copper); }
.node.cyan::before { border-color: var(--cyan); }
.node > em { font-style: normal; font-size: .78em; font-weight: 700; color: var(--faint); }
.summary { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.summary li { line-height: 1.55; font-size: 1.01em; }
.asks { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.asks li { color: var(--text); padding: .4rem .7rem; border-radius: var(--r-1); background: var(--copper-soft); font-size: .95em; line-height: 1.45; }
.due { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .92em; }
.due.soon { color: var(--copper); }
.tone-neg { color: var(--rose); font-size: .84em; display: inline-flex; gap: 6px; align-items: center; }
.facts { display: flex; flex-wrap: wrap; gap: 6px; }
.fact { display: inline-flex; align-items: center; gap: 7px; padding: .28rem .68rem; border-radius: var(--r-1); background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text); font-size: .88em; text-decoration: none; max-width: 100%; }
.fact span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; unicode-bidi: isolate; }
.fact i { color: var(--cyan); font-size: .9em; }
.fact-amount i { color: var(--copper); }
.fact-code { border-color: var(--copper); background: var(--copper-soft); font-size: 1.05em; font-weight: 700; letter-spacing: .08em; cursor: copy; }
.fact-code i { color: var(--copper); }
a.fact:hover { border-color: var(--cyan); }
.replies { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.reply-chip { border: 1px solid var(--cyan); background: var(--cyan-soft); color: var(--text); border-radius: 999px; padding: .32rem .9rem; font-size: .88em; font-weight: 500; }
.reply-chip:hover { background: var(--cyan); color: var(--cyan-ink); }
.deep { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.ai-out { border-radius: var(--r-2); padding: 12px 14px; background: var(--panel-2); line-height: 1.65; }
.thinking-dots { display: inline-flex; gap: 4px; vertical-align: middle; }
.thinking-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--copper); animation: blink 1s infinite; }
.thinking-dots i:nth-child(2) { animation-delay: .15s; } .thinking-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 50% { opacity: .2; } }

.remote-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r-1); background: var(--copper-soft); color: var(--copper); font-size: .86em; margin-bottom: 10px; }
.remote-bar .link { color: var(--copper); text-decoration: underline; padding: 0; }
.body-frame { width: 100%; border: 1px solid var(--line); border-radius: var(--r-2); background: #fff; min-height: 160px; display: block; }
.atts { margin-top: 16px; display: grid; gap: 6px; }
.atts-title { color: var(--muted); font-size: .85em; }
.att { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--r-1); background: var(--panel); }
.att > i { color: var(--cyan); }
.att-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att > span:not(.att-name) { color: var(--faint); font-size: .8em; }
.note-box { margin-top: 20px; display: grid; gap: 6px; }
.note-box label { color: var(--copper); font-size: .86em; display: flex; gap: 6px; align-items: center; font-weight: 600; }
.note-box textarea { background: var(--copper-soft); border: 1px solid transparent; border-radius: var(--r-1); padding: .7rem .85rem; resize: vertical; outline: none; color: var(--text); }
.note-box textarea:focus { border-color: var(--copper); }

/* ---------- modals ---------- */
.modal { border: 1px solid var(--line-2); border-radius: var(--r-3); background: var(--panel); color: var(--text); padding: 0; width: min(820px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: var(--shadow); }
.modal.small { width: min(520px, calc(100vw - 24px)); }
.modal.settings { width: min(720px, calc(100vw - 24px)); }
.modal::backdrop { background: rgba(4, 9, 16, .6); backdrop-filter: blur(4px); }
.modal form { display: flex; flex-direction: column; max-height: calc(100vh - 34px); }
.modal-head, .tabs, .modal-foot { flex-shrink: 0; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 1.12rem; font-weight: 700; }
.modal-body { padding: 18px 22px; overflow-y: auto; display: grid; gap: 14px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); }
.modal-foot .hint { margin-inline-end: auto; }
.modal-foot .over { color: var(--rose); }
.tabs { display: flex; gap: 2px; padding: 0 14px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; color: var(--muted); padding: .8rem .8rem .7rem; font-weight: 600; font-size: .9em; display: inline-flex; gap: 8px; align-items: center; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--cyan); }
.tabs button[aria-selected="true"] i { color: var(--cyan); }
.tab-panel { display: grid; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.paper { background: #fff; color: #16202c; border-radius: var(--r-2); padding: 16px 20px; box-shadow: inset 0 0 0 1px var(--line); overflow-x: auto; }
.paper:empty { display: none; }
.paper img { max-width: none; }
.paper a { pointer-events: none; }
.paper-frame { width: 100%; height: 520px; border: 0; border-radius: var(--r-2); background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.segmented { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line-2); gap: 2px; justify-self: start; flex-wrap: wrap; }
.segmented button { border: 0; background: transparent; color: var(--muted); padding: .38rem .9rem; border-radius: 999px; font-weight: 600; font-size: .88em; }
.segmented button[aria-pressed="true"] { background: var(--cyan); color: var(--cyan-ink); }
.segmented.small button { padding: .2rem .65rem; font-size: .78em; }
.ar-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ar-state { font-size: .85em; font-weight: 600; color: var(--faint); }
.ar-state.on { color: var(--mint); }
.ar-state.wait { color: var(--copper); }
.preview-head { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.preview-subject { margin: -6px 0 0; font-size: .88em; color: var(--muted); }
.preview-subject b { color: var(--text); font-weight: 600; }
.ar-more { border: 1px solid var(--line); border-radius: var(--r-2); padding: 10px 14px; display: grid; gap: 10px; }
.ar-more[open] { padding-bottom: 14px; }
.ar-more summary { cursor: pointer; font-weight: 600; font-size: .92em; }
.ar-more .btn { justify-self: start; }
.ar-log ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.ar-log li { display: flex; gap: 10px; align-items: baseline; font-size: .86em; padding: 6px 10px; border-radius: var(--r-1); background: var(--panel-2); }
.ar-log li span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-log li time { color: var(--faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ar-log li.empty { background: none; color: var(--faint); padding-inline: 0; }

.compose-fields { display: grid; padding: 4px 20px; }
.compose-fields label { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.compose-fields label > span { width: 64px; color: var(--muted); font-size: .88em; flex-shrink: 0; }
.compose-fields input { border: 0; background: transparent; padding: .72rem 0; outline: none; width: 100%; }
.editor-tools { display: flex; gap: 2px; align-items: center; padding: 8px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.editor-tools .icon-btn { width: auto; min-width: 32px; padding: 0 6px; font-size: .85em; }
.editor { min-height: 240px; max-height: 46vh; overflow-y: auto; padding: 16px 20px; outline: none; line-height: 1.65; }
.editor blockquote { margin: 0 0 0 .8em; padding-inline-start: .8em; border-inline-start: 3px solid var(--line-2); color: var(--muted); }
.editor img { max-width: 100%; }
.drop { margin: 0 20px; padding: 12px; border: 1.5px dashed var(--line-2); border-radius: var(--r-2); color: var(--muted); text-align: center; font-size: .88em; cursor: pointer; }
.drop:hover, .drop.hot { border-color: var(--cyan); color: var(--cyan); }
.files { list-style: none; margin: 8px 20px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.file { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px; border: 1px solid var(--line-2); border-radius: var(--r-1); font-size: .85em; max-width: 100%; }
.file span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.file img { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; }
.file span + span { color: var(--faint); }
.file.fwd { opacity: .75; padding-inline-end: 10px; }
.row { display: flex; gap: 8px; }
.blocklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 50vh; overflow-y: auto; }
.blocklist li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--line-2); border-radius: var(--r-1); }
.blocklist li i { color: var(--rose); }
.blocklist li span { flex: 1; overflow-wrap: anywhere; }
.toggle { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .92em; cursor: pointer; position: relative; }
.toggle.big { color: var(--text); font-weight: 700; font-size: 1em; }
.toggle em { font-style: normal; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle span { width: 40px; height: 23px; border-radius: 999px; background: var(--raise); border: 1px solid var(--line-2); position: relative; flex-shrink: 0; transition: background .2s; }
.toggle span::after { content: ''; position: absolute; top: 2px; inset-inline-start: 2px; width: 17px; height: 17px; border-radius: 50%; background: var(--muted); transition: inset-inline-start .2s, background .2s; }
.toggle input:checked + span { background: var(--cyan); border-color: var(--cyan); }
.toggle input:checked + span::after { background: #fff; inset-inline-start: 19px; }
.toggle input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* signature in the editor, shown on white mail paper */
.editor .aq-sig-wrap:not(:empty) {
  display: inline-block; max-width: 100%; margin: 6px 0 4px; padding: 14px 18px;
  background: #fff; color: #16202c; border-radius: 10px; box-shadow: 0 0 0 1px var(--line); user-select: none; overflow-x: auto;
}
.editor .aq-sig-wrap a { pointer-events: none; }
.editor .aq-sig-wrap img { max-width: none; }
.sig-pick { background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; font: inherit; font-size: .82em; margin-inline-start: 4px; cursor: pointer; }
.sig-pick option { background: var(--panel); color: var(--text); }

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 18px; inset-inline-end: 18px; display: grid; gap: 8px; z-index: 100; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--panel); border: 1px solid var(--line-2); border-inline-start: 3px solid var(--cyan); padding: 10px 14px; border-radius: var(--r-1); box-shadow: var(--shadow); animation: tin .25s ease-out; transition: opacity .4s, transform .4s; }
.toast.ok { border-inline-start-color: var(--mint); }
.toast.err { border-inline-start-color: var(--rose); }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes tin { from { opacity: 0; transform: translateY(10px); } }

.only-mobile { display: none !important; }
.fab {
  position: absolute; bottom: 22px; inset-inline-end: 18px; width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: var(--cyan); color: var(--cyan-ink); font-size: 1.2rem; box-shadow: 0 12px 30px rgba(10, 120, 150, .35);
}

/* ---------- responsive ---------- */
@media (max-width: 1200px) { .app { grid-template-columns: 210px minmax(320px, 380px) 1fr; } }
@media (max-width: 900px) {
  .only-mobile { display: inline-grid !important; }
  .only-desktop { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .rail { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(290px, 84vw); z-index: 50; transform: translateX(-105%); transition: transform .25s; }
  html[dir="rtl"] .rail { transform: translateX(105%); }
  body.drawer .rail { transform: none; box-shadow: var(--shadow); }
  .list-pane, .reader { grid-area: 1 / 1; }
  body[data-mobile="list"] .reader { display: none; }
  body[data-mobile="reader"] .list-pane { display: none; }
  .reader-bar { padding: 10px 12px; }
  .reader-bar .chip { padding: .32rem .6rem; }
  .subject { font-size: 1.3rem; }
  .sender { flex-wrap: wrap; }
  .sender-tools { width: 100%; justify-content: flex-start; }
  .brain-card { padding: 14px 14px; }
  .editor { min-height: 180px; }
  .modal { max-height: calc(100dvh - 16px); }
  .grid-2 { grid-template-columns: 1fr; }
  .paper-frame { height: 440px; }
  .briefing { display: flex; overflow-x: auto; scrollbar-width: none; }
  .briefing::-webkit-scrollbar { display: none; }
  .brief { min-width: 92px; flex-shrink: 0; }
}

/* auto-reply diagnostics */
.ar-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.ar-error { margin: 0; padding: 8px 12px; border-radius: var(--r-1); background: rgba(240, 96, 122, .1); color: var(--rose); font-size: .86em; }
.why { font-size: .78em; font-weight: 600; padding: .08rem .5rem; border-radius: 999px; background: var(--raise); color: var(--muted); white-space: nowrap; }
.why.sent { background: rgba(79, 214, 156, .16); color: var(--mint); }

/* ================================================================ opening splash */
#splash { display: none; }
html[data-splash="1"] body { overflow: hidden; }
html[data-splash="1"] #splash {
  display: grid; place-items: center; align-content: center; gap: 0;
  position: fixed; inset: 0; z-index: 9999; cursor: pointer; overflow: hidden;
  background:
    radial-gradient(60vmax 60vmax at 50% 42%, rgba(27, 111, 208, .28), transparent 60%),
    radial-gradient(40vmax 40vmax at 50% 42%, rgba(60, 200, 224, .12), transparent 70%),
    #050b14;
  transition: opacity .6s ease, transform .6s ease, filter .6s ease;
}
#splash.out { opacity: 0; transform: scale(1.06); filter: blur(6px); }
.sp-sparks { position: absolute; inset: 0; width: 100%; height: 100%; }
.sp-rays {
  position: absolute; left: 50%; top: 42%; width: 160vmax; height: 160vmax; translate: -50% -50%;
  background: repeating-conic-gradient(from 0deg, rgba(127, 243, 255, .07) 0deg 4deg, transparent 4deg 18deg);
  mask: radial-gradient(circle, #000 0 18%, transparent 55%);
  -webkit-mask: radial-gradient(circle, #000 0 18%, transparent 55%);
  opacity: 0;
}
.sp-stage { position: relative; width: min(46vmin, 250px); aspect-ratio: 1; margin-top: -4vh; }
.sp-logo { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; opacity: 0; }
.sp-logo img { width: 100%; height: 100%; display: block; }
.sp-shine {
  position: absolute; inset: -20%; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .0) 40%, rgba(255, 255, 255, .85) 50%, rgba(160, 245, 255, .0) 60%, transparent 65%);
  transform: translateX(-120%);
  mix-blend-mode: screen;
}
.sp-ring {
  position: absolute; inset: -9%; border-radius: 50%; opacity: 0;
  background: conic-gradient(from 0deg, transparent 0 55%, rgba(60, 200, 224, .9) 75%, #fff 80%, rgba(240, 160, 60, .9) 85%, transparent 95%);
  mask: radial-gradient(circle, transparent 0 66%, #000 67% 69%, transparent 70%);
  -webkit-mask: radial-gradient(circle, transparent 0 66%, #000 67% 69%, transparent 70%);
  filter: drop-shadow(0 0 10px rgba(60, 200, 224, .9));
}
.sp-flare {
  position: absolute; inset: -40%; border-radius: 50%; opacity: 0; pointer-events: none;
  background:
    radial-gradient(circle, rgba(255, 255, 255, .95) 0 6%, rgba(127, 243, 255, .55) 14%, rgba(60, 200, 224, .18) 32%, transparent 55%),
    linear-gradient(90deg, transparent 0 46%, rgba(200, 250, 255, .5) 49.6% 50.4%, transparent 54% 100%),
    linear-gradient(0deg, transparent 0 46%, rgba(200, 250, 255, .35) 49.7% 50.3%, transparent 54% 100%);
  mix-blend-mode: screen;
}
.sp-word {
  margin-top: 5vh; font-size: clamp(1.6rem, 5vmin, 2.6rem); letter-spacing: .6em; color: #e8f6ff;
  display: flex; gap: .45em; align-items: baseline; opacity: 0; text-shadow: 0 0 24px rgba(60, 200, 224, .55);
}
.sp-word b { font-weight: 800; background: linear-gradient(90deg, #7ff3ff, #ffffff 45%, #ffd79a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sp-word span { font-weight: 400; color: #93a7bb; }
.sp-tag { margin-top: .9rem; font-size: .72rem; letter-spacing: .42em; color: #5f9fb8; opacity: 0; }

#splash.run .sp-logo { animation: sp-logo-in 1s cubic-bezier(.16, .9, .25, 1) forwards, sp-logo-flash .9s ease-out 1s forwards; }
#splash.run .sp-ring { animation: sp-fade-in .6s ease .25s forwards, sp-spin 1.8s linear infinite; }
#splash.run .sp-shine { animation: sp-shine .75s cubic-bezier(.4, 0, .2, 1) 1s forwards, sp-shine2 .9s cubic-bezier(.4, 0, .2, 1) 2s forwards; }
#splash.run .sp-flare { animation: sp-flare 1.1s cubic-bezier(.1, .8, .3, 1) .95s forwards; }
#splash.run .sp-rays { animation: sp-rays 2.2s ease-out .95s forwards; }
#splash.run .sp-word { animation: sp-word 1s cubic-bezier(.16, .9, .25, 1) 1.15s forwards; }
#splash.run .sp-tag { animation: sp-fade-in .8s ease 1.55s forwards; }

#splash.short .sp-logo, #splash.short .sp-word, #splash.short .sp-tag { animation: sp-fade-in .4s ease forwards; }
#splash.short .sp-ring, #splash.short .sp-flare, #splash.short .sp-rays, #splash.short .sp-shine { animation: none; }

@keyframes sp-logo-in {
  0% { opacity: 0; transform: scale(.5) rotate(-35deg); filter: blur(16px) brightness(.4); }
  60% { opacity: 1; filter: blur(2px) brightness(.9); }
  100% { opacity: 1; transform: scale(1) rotate(0); filter: blur(0) brightness(1); }
}
@keyframes sp-logo-flash {
  0% { filter: brightness(1) drop-shadow(0 0 0 rgba(60, 200, 224, 0)); transform: scale(1); }
  18% { filter: brightness(2.1) saturate(1.3) drop-shadow(0 0 40px rgba(127, 243, 255, .95)); transform: scale(1.06); }
  100% { filter: brightness(1.08) drop-shadow(0 0 22px rgba(60, 200, 224, .55)); transform: scale(1); opacity: 1; }
}
@keyframes sp-spin { to { transform: rotate(360deg); } }
@keyframes sp-fade-in { to { opacity: 1; } }
@keyframes sp-shine { from { transform: translateX(-120%); } to { transform: translateX(120%); } }
@keyframes sp-shine2 { from { transform: translateX(-120%); opacity: .55; } to { transform: translateX(120%); opacity: .55; } }
@keyframes sp-flare {
  0% { opacity: 0; transform: scale(.2) rotate(0); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.5) rotate(25deg); }
}
@keyframes sp-rays { 0% { opacity: 0; transform: rotate(0); } 30% { opacity: 1; } 100% { opacity: .35; transform: rotate(18deg); } }
@keyframes sp-word {
  from { opacity: 0; letter-spacing: .6em; transform: translateY(14px); filter: blur(6px); }
  to { opacity: 1; letter-spacing: .06em; transform: none; filter: blur(0); }
}

/* sound settings */
.tone-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.tone {
  display: flex; align-items: center; gap: 9px; padding: .62rem .7rem; border-radius: var(--r-1);
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--muted); font-weight: 600; font-size: .9em; text-align: start;
}
.tone i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--raise); color: var(--cyan); font-size: .8em; flex-shrink: 0; }
.tone:hover { border-color: var(--cyan); color: var(--text); }
.tone[aria-checked="true"] { border-color: var(--cyan); color: var(--text); background: linear-gradient(135deg, rgba(60, 200, 224, .16), rgba(240, 160, 60, .08)); box-shadow: 0 0 0 1px var(--cyan) inset; }
.tone[aria-checked="true"] i { background: var(--cyan); color: #04202a; }
.tone.playing i { animation: tone-pulse .8s ease-out; }
@keyframes tone-pulse { 0% { box-shadow: 0 0 0 0 rgba(60, 200, 224, .7); } 100% { box-shadow: 0 0 0 12px rgba(60, 200, 224, 0); } }
.field.vol input { accent-color: var(--cyan); padding: 0; }
.field.vol em { font-style: normal; }

/* fingerprint / passkey login */
.passkey-login { display: grid; gap: 10px; }
.or-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85em; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.fp-btn i { font-size: 1.15em; }
.pk-list li i.fa-fingerprint { color: var(--cyan, currentColor); }
.pk-list small { color: var(--muted); }
.pk-list .pk-empty { color: var(--muted); }
