/* B24 Mail web: light look modelled on the new Outlook. White panels on a soft grey canvas,
   thin dividers, Inter, black accents (no blue), flat rows instead of cards. */
:root {
  --bg: #eef0f4; --surface: #ffffff; --panel: #f5f6f8; --panel2: #eceef2; --hover: #f4f5f8; --sel: #ecebfd;
  --line: #e3e5ea; --line2: #cfd3da; --text: #0f1115; --muted: #525866; --dim: #8a909c;
  --accent: #5145d6; --accent-soft: #eeedfc; --accent-ink: #3b30b8; --on-accent: #ffffff; --ink: #14161b;
  --warm: #c2610f; --bad: #c42b1c; --good: #237b4b;
  --r: 12px; --shadow: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04); --pop: 0 12px 32px rgba(16,24,40,.16), 0 0 0 1px rgba(16,24,40,.06);
  --font: "Inter", -apple-system, system-ui, sans-serif; --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01", "ss03"; letter-spacing: -0.006em; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
input, textarea, select { background: var(--surface); border: 1px solid var(--line2); border-radius: 8px; padding: 9px 11px; outline: none; width: 100%; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
[hidden] { display: none !important; }
a { color: var(--text); }
.muted { color: var(--muted); } .dim { color: var(--dim); } .grow { flex: 1; } .err { color: var(--bad); min-height: 1em; }
.mono { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.aurora { display: none; }
.glass { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }

/* buttons */
.btn { padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line2); background: var(--surface); white-space: nowrap; font-weight: 500; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--hover); border-color: #c6c6c6; }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-ink); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: 13px; border-radius: 7px; }
.btn:disabled { opacity: .45; cursor: default; }
.ib { width: 32px; height: 32px; border-radius: 7px; display: inline-grid; place-items: center; color: var(--muted); position: relative; flex: none; }
.ib:hover, .ib.on { background: var(--panel2); color: var(--text); }
.ib b { position: absolute; top: 1px; right: 1px; font-size: 9px; background: var(--warm); color: #fff; border-radius: 8px; padding: 0 4px; line-height: 14px; }
.ib b:empty { display: none; }
.kbd { font: 11px var(--mono); width: auto; padding: 0 8px; }
.btn:active, .rbtn:active:not(:disabled), .ib:active, .chip:active { transform: scale(.97); }

/* lock */
.lock { position: fixed; inset: 0; display: grid; place-items: center; z-index: 50; background: var(--bg); }
.lock-card { width: min(360px, 90vw); padding: 36px 28px; display: grid; gap: 14px; text-align: center; box-shadow: var(--pop); border: 0; }
.lock-card h1 { margin: 0; font-weight: 650; letter-spacing: -.02em; }
.lock-card p { margin: 0; }
.orb { width: 56px; height: 56px; margin: 0 auto 6px; border-radius: 16px; background: var(--accent); box-shadow: 0 8px 24px rgba(81,69,214,.3); position: relative; }
.orb::after { content: "✉"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 24px; }
.orb.small { width: 18px; height: 18px; border-radius: 50%; margin: 0; background: none; border: 2px solid var(--line2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.orb.small::after { content: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* layout */
.app { position: relative; display: grid; grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr);
  height: 100dvh; gap: 8px; padding: 0 8px 8px; }
.app.wide { grid-template-columns: minmax(0, 1fr); }
.app.wide .list-pane { display: none; }
.rail { display: none !important; }

/* ribbon: page tabs on top, one row of mail actions below */
.ribbon { grid-column: 1 / -1; margin: 0 -8px; padding: 0 14px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--surface); }
.rtop { display: flex; align-items: center; gap: 18px; height: 48px; }
.rlogo { font: 700 15px var(--font); letter-spacing: -.02em; color: var(--text); white-space: nowrap; }
.rlogo span { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 11px; margin-right: 6px; vertical-align: middle; }
.rtabs { display: flex; gap: 2px; height: 100%; }
.rtab { position: relative; padding: 0 12px; font-weight: 500; color: var(--muted); }
.rtab:hover { color: var(--text); }
.rtab.on { color: var(--text); font-weight: 650; }
.rtab.on::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }
.ractions { display: flex; align-items: center; gap: 2px; padding: 6px 0 8px; overflow-x: auto; scrollbar-width: none; }
.ractions::-webkit-scrollbar { display: none; }
.rbtn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 8px; color: var(--text); font-size: 13px; font-weight: 500; white-space: nowrap; flex: none; }
.rbtn svg { width: 17px; height: 17px; flex: none; color: var(--muted); }
.rbtn:hover:not(:disabled) { background: var(--hover); }
.rbtn:hover:not(:disabled) svg { color: var(--text); }
.rbtn:disabled { opacity: .38; cursor: default; }
.rnew { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 8px; color: var(--text); font-size: 13px; font-weight: 600; flex: none; }
.rnew:hover { background: var(--hover); }
.rnew svg { width: 17px; height: 17px; color: var(--muted); }
.rsep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; flex: none; }
.copilot { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px 0 6px; border-radius: 17px; font-size: 13px; font-weight: 600; flex: none;
  border: 1px solid var(--line2); background: var(--surface); }
.copilot:hover { background: var(--hover); }
.copilot.on { background: var(--accent-soft); border-color: #cfcaf7; color: var(--accent-ink); }
.copilot-orb { width: 24px; height: 24px; border-radius: 50%; background: conic-gradient(from 200deg, #5145d6, #a678e8, #3fb5a6, #e79a4a, #5145d6); }
#moveMenu { min-width: 160px; }
@media (max-width: 1250px) { .rbtn span { display: none; } .rbtn { padding: 0 8px; } }

/* list pane */
.list-pane { min-width: 0; display: flex; flex-direction: column; min-height: 0; position: relative; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 8px 0 0; }
.lh { display: flex; align-items: center; gap: 2px; padding: 2px 10px 6px 12px; }
.title-btn { font-size: 18px; font-weight: 650; letter-spacing: -.02em; padding: 2px 6px; border-radius: 6px; }
.title-btn:hover { background: var(--hover); }
.fcount { font-size: 11px; font-weight: 650; color: var(--accent-ink); background: var(--accent-soft); border-radius: 9px; padding: 1px 6px; vertical-align: 3px; letter-spacing: 0; }
.menu { position: absolute; z-index: 20; padding: 4px; min-width: 210px; background: var(--surface); border: 0; box-shadow: var(--pop); border-radius: 8px; }
.menu button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 5px; text-align: left; }
.menu button:hover, .menu button.on { background: var(--hover); }
.menu button.on { font-weight: 600; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu .n { margin-left: auto; color: var(--muted); font-size: 12px; }
#folderMenu { top: 42px; left: 10px; } #filterMenu { top: 200px; right: 8px; }

/* brief (shown in the empty reading pane, and above the stories on phones) */
.brief { margin: 0 10px 10px; padding: 16px 18px; position: relative; background: var(--panel); border: 1px solid var(--line); }
.brief h3 { margin: 6px 0 8px; font-size: 16px; font-weight: 650; letter-spacing: -.015em; }
.brief ul { margin: 0; padding-left: 18px; color: var(--muted); }
.brief .x { position: absolute; top: 8px; right: 8px; }

/* stories */
.stories-wrap { position: relative; min-width: 0; width: 100%; overflow: hidden; border-bottom: 1px solid var(--line); }
.stories { display: flex; gap: 10px; overflow-x: auto; padding: 6px 14px 12px; scrollbar-width: none; cursor: grab; }
.stories::-webkit-scrollbar { display: none; }
.sarrow { position: absolute; top: 18px; z-index: 3; width: 26px; height: 26px; border-radius: 50%; background: var(--surface); box-shadow: var(--pop); color: var(--text); font-size: 17px; line-height: 1; display: grid; place-items: center; }
.sarrow.l { left: 4px; } .sarrow.r { right: 4px; }
.story { flex: none; width: 58px; display: grid; justify-items: center; gap: 4px; padding: 4px 0 2px; border-radius: 10px; }
.story:hover { background: var(--hover); }
.story .ring { width: 48px; height: 48px; border-radius: 50%; padding: 2px; background: transparent; position: relative; display: grid; box-shadow: inset 0 0 0 1.5px var(--line2); }
.story.has .ring { box-shadow: inset 0 0 0 2px var(--accent); }
.story.on { background: var(--accent-soft); }
.story.on .ring { box-shadow: inset 0 0 0 2px var(--accent); }
.story .av { position: relative; width: 100%; height: 100%; border-radius: 50%; border: 2px solid var(--surface); display: grid; place-items: center; font: 650 15px var(--font); color: #fff; overflow: hidden; }
.story:not(.has) .av { filter: saturate(.3); opacity: .75; }
.story .badge { position: absolute; z-index: 2; top: -4px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff;
  font: 700 10.5px/18px var(--font); text-align: center; box-shadow: 0 0 0 2px var(--surface); }
.story .badge.warm { background: var(--warm); }
.story .nm { max-width: 56px; font-size: 11.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.2; }
.story .br { font-size: 9.5px; font-weight: 500; color: var(--dim); margin-top: -3px; }
.story:not(.has) .nm { color: var(--muted); font-weight: 500; }
.story.on .nm { color: var(--accent-ink); }

/* search, filters, bulk bar */
.search { display: flex; align-items: center; gap: 6px; padding: 0 4px 0 12px; margin: 10px 10px 6px; background: var(--panel); border: 1px solid transparent; border-radius: 8px; transition: border-color .12s, background .12s; }
.search:focus-within { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { border: 0; background: none; padding: 7px 2px; box-shadow: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 10px; }
.chips:empty { display: none; }
.chip { padding: 3px 10px; border-radius: 14px; border: 1px solid var(--line2); background: var(--surface); font-size: 12px; color: var(--muted); white-space: nowrap; }
.chip:hover { color: var(--text); border-color: #bdbdbd; }
.chip.on { background: var(--accent-soft); color: var(--accent-ink); border-color: #cfcaf7; font-weight: 600; }
.chips .chip { margin-bottom: 6px; }
.bulk { display: flex; gap: 6px; align-items: center; padding: 6px 8px; margin: 0 10px 6px; flex-wrap: wrap; background: var(--panel); }

/* email list: Outlook rows: sender + time, subject, one-line preview */
.list { flex: 1; overflow-y: auto; padding: 0 0 30px; }
.day { font-size: 12px; font-weight: 650; color: var(--muted); padding: 14px 18px 6px; background: var(--surface); position: sticky; top: 0; z-index: 1; }
.row-wrap { position: relative; overflow: hidden; }
.row-under { position: absolute; inset: 0; display: flex; justify-content: space-between; align-items: center; padding: 0 22px; font-weight: 600; opacity: 0; background: var(--panel); }
.row-wrap.swiping .row-under { opacity: 1; }
.row-under .l { color: var(--warm); } .row-under .r { color: var(--bad); }
.row { position: relative; padding: 11px 16px 12px 18px; cursor: pointer; touch-action: pan-y; user-select: none; background: var(--surface);
  border-bottom: 1px solid var(--line); transition: background .1s, transform .2s; }
.row::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: transparent; }
.row:not(.read)::before { background: var(--accent); }
.row:hover { background: var(--hover); }
.row.open { background: var(--sel); }
.row.open::before { background: var(--accent); top: 0; bottom: 0; border-radius: 0; }
.row.sel { background: #e3e1fb; }
.row .top { display: flex; align-items: center; gap: 12px; }
.av { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 650; font-size: 13px; color: #fff; }
.row .who { font-weight: 700; font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .acct { font-size: 11.5px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { margin-left: auto; display: flex; gap: 6px; align-items: center; color: var(--dim); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row:not(.read) .meta { color: var(--accent-ink); font-weight: 650; }
.row .subj { margin: 6px 0 2px 48px; font-weight: 650; font-size: 13.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .snip { margin-left: 48px; color: var(--muted); font-size: 13px; line-height: 1.45; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.row .tagline { display: flex; gap: 6px; margin: 7px 0 0 48px; flex-wrap: wrap; }
.row.read .who { font-weight: 550; }
.row.read .subj { font-weight: 500; color: #2c313b; }
.tag { font-size: 10.5px; font-weight: 600; padding: 1px 8px; border-radius: 10px; background: var(--panel2); color: var(--muted); }
.tag.urgent { color: var(--warm); background: #fdf0e3; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.flag { color: var(--bad); }
.row.compact { padding: 8px 16px 8px 18px; }
.row.compact .av { width: 26px; height: 26px; font-size: 10px; }
.row.compact .subj { margin: 0; flex: 1; min-width: 0; font-size: 13px; }
.row.compact .who { width: 140px; flex: none; font-size: 13px; }
.empty { text-align: center; color: var(--muted); padding: 50px 20px; }
.more { width: 100%; padding: 12px; color: var(--accent-ink); font-weight: 600; }
.more:hover { background: var(--hover); }

/* hover quick actions */
.row .qa { position: absolute; top: 8px; right: 10px; display: flex; gap: 1px; padding: 2px; border-radius: 7px; background: var(--surface); box-shadow: var(--pop);
  opacity: 0; transition: opacity .12s; pointer-events: none; }
.row:hover .qa { opacity: 1; pointer-events: auto; }
.row .qa button { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 5px; color: var(--muted); }
.row .qa button:hover { background: var(--hover); color: var(--text); }
.row .qa button[data-qa="trash"]:hover { color: var(--bad); }
.row .qa svg { width: 16px; height: 16px; }
.row.compact .qa { top: 50%; transform: translateY(-50%); }
@media (hover: none) { .row .qa { display: none; } }

/* loading placeholders */
.skel { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.skel-av { width: 34px; height: 34px; border-radius: 50%; flex: none; }
.skel-lines { flex: 1; display: grid; gap: 7px; }
.skel-lines i { display: block; height: 9px; border-radius: 5px; }
.skel-lines i:nth-child(1) { width: 40%; } .skel-lines i:nth-child(2) { width: 80%; } .skel-lines i:nth-child(3) { width: 60%; }
.skel-av, .skel-lines i { background: linear-gradient(90deg, #eee, #f7f7f7, #eee); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* reading pane */
.main { min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); }
.pane { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 28px 50px; }
.pane-head { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; min-height: 50px; }
.pane-head h2 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.02em; }
.hero { height: 100%; display: grid; place-items: center; text-align: center; color: var(--muted); }
.hero-in { width: min(540px, 90%); }
.hero .brief { text-align: left; margin: 0 0 16px; padding: 22px 24px; box-shadow: var(--shadow); background: var(--surface); }
.hero .brief h3 { font-size: 19px; margin: 8px 0 12px; }
.hero .brief ul { display: grid; gap: 6px; font-size: 14px; }
.hero .orb { margin-bottom: 18px; }
.subject { font-size: 22px; font-weight: 650; letter-spacing: -.02em; margin: 0 0 16px; line-height: 1.25; }
.from { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.from .av { width: 40px; height: 40px; }
.atts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.att { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 8px; font-size: 13px; }
.att a { text-decoration: none; font-weight: 500; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.replied { display: flex; align-items: center; gap: 8px; padding: 9px 14px; margin-bottom: 14px; color: var(--muted); font-size: 13px; cursor: pointer; background: var(--panel); border-color: transparent; }
.replied:hover { color: var(--text); background: var(--panel2); }
.ai-card { padding: 16px 18px; margin-bottom: 14px; position: relative; background: var(--panel); border-color: var(--line); }
.ai-card .lbl { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; color: var(--muted); }
.ai-card h4 { margin: 0 0 8px; font-size: 15px; font-weight: 650; }
.ai-card ul { margin: 0 0 8px; padding-left: 18px; color: #333; }
.kv { display: flex; gap: 8px; font-size: 13px; margin-top: 4px; }
.kv b { color: var(--muted); font-weight: 500; min-width: 66px; }
.mailframe { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; min-height: 300px; display: block; }
.ideas { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0; }
.chat { display: grid; gap: 10px; margin: 14px 0; }
.msg { padding: 9px 13px; border-radius: 12px; max-width: 86%; white-space: pre-wrap; }
.msg.me { justify-self: end; background: var(--panel2); }
.msg.ai { justify-self: start; }
.draft { padding: 14px 16px; white-space: pre-wrap; border-left: 3px solid var(--accent); background: var(--panel); }
.askbar { display: flex; gap: 8px; align-items: flex-end; padding: 6px 6px 6px 10px; position: sticky; bottom: 0; margin-top: 12px; background: var(--surface); border: 1px solid var(--line2); border-radius: 10px; box-shadow: var(--shadow); }
.askbar:focus-within { border-color: var(--accent); }
.askbar textarea { border: 0; background: none; resize: none; min-height: 38px; max-height: 160px; box-shadow: none; padding: 8px 2px; }
.thinking { display: flex; gap: 10px; align-items: center; color: var(--muted); padding: 8px 0; }

/* assistant (page and side panel) */
.asst { max-width: 760px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; min-height: 100%; }
.asst #thread { flex: 1; }
.asst #starters { margin: 8px 0 10px; }
.asst .askbar { margin-top: auto; z-index: 2; }
.asst .msg.ai { max-width: 100%; padding: 2px 0; line-height: 1.65; }
.pane:has(> .asst) { padding-bottom: 14px; }
.action { padding: 14px 16px; margin: 8px 0; background: var(--panel); }
.action .k { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.action pre { white-space: pre-wrap; font: inherit; color: #333; margin: 8px 0; max-height: 220px; overflow: auto; }
.action .bar { display: flex; gap: 8px; margin-top: 10px; }
.action.done { opacity: .55; }
.mention-pop { position: absolute; bottom: 100%; left: 0; right: 0; margin-bottom: 6px; max-height: 260px; overflow: auto; }
.task { display: flex; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.task.done { opacity: .5; text-decoration: line-through; }
.check { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line2); flex: none; margin-top: 2px; }
.check:hover { border-color: var(--accent); }
.task.done .check { background: var(--accent); border-color: var(--accent); }
.assist-panel { display: none; min-height: 0; overflow: hidden; flex-direction: column; background: var(--surface); box-shadow: var(--shadow); border: 0; }
.app.assist { grid-template-columns: minmax(300px, 400px) minmax(0, 1fr) minmax(320px, 400px); }
.app.assist.wide { grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); }
.app.assist .assist-panel { display: flex; }
.assist-panel .pane { padding: 14px 14px 16px; }
.assist-panel .pane-head h2 { font-size: 15px; }
.assist-panel .msg { max-width: 100%; }

/* calendar */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-cell { min-height: 100px; padding: 6px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 12px; overflow: hidden; }
.cal-cell b { font-weight: 600; }
.cal-cell.today b { background: var(--accent); color: #fff; border-radius: 50%; display: inline-grid; place-items: center; width: 22px; height: 22px; }
.cal-cell.out { background: var(--panel); color: var(--dim); }
.cal-dow { font-size: 11px; font-weight: 600; color: var(--muted); text-align: center; padding: 6px 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ev { display: block; width: 100%; text-align: left; padding: 2px 7px; margin-top: 4px; border-radius: 4px; background: var(--panel2); border-left: 3px solid var(--line2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev:hover { background: var(--sel); }
.ev.join { border-left-color: var(--accent); font-weight: 600; }
.agenda .ev { padding: 12px 14px; white-space: normal; border-radius: 8px; margin-bottom: 8px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); }
.seg { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--panel2); }
.seg button { padding: 4px 12px; border-radius: 6px; color: var(--muted); font-size: 13px; font-weight: 500; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }

/* vault, contacts, settings */
.items { display: grid; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item:hover { background: var(--hover); }
.item .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.crumbs { display: flex; gap: 4px; align-items: center; margin-bottom: 12px; color: var(--muted); flex-wrap: wrap; }
.crumbs button:hover { color: var(--text); text-decoration: underline; }
.section { margin-bottom: 28px; }
.section h3 { font-size: 12px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.sig { display: grid; gap: 6px; margin-bottom: 14px; }

/* compose sheet */
.sheet { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.28); display: grid; place-items: center; padding: 16px; }
.sheet-card { width: min(760px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; box-shadow: var(--pop); border: 0; }
.sheet-card .pane { padding: 6px 20px 20px; }
.field { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.field label { width: 54px; color: var(--muted); font-size: 13px; flex: none; }
.field input, .field select { border: 0; background: none; padding: 10px 2px; border-radius: 0; box-shadow: none; }
.body { min-height: 260px; border: 0; background: none; resize: vertical; padding: 14px 2px; line-height: 1.6; box-shadow: none !important; }
.aibox { display: flex; gap: 8px; align-items: center; padding: 4px 4px 4px 12px; margin-top: 12px; position: relative; background: var(--panel); border-color: transparent; }
.aibox:focus-within { background: var(--surface); border-color: var(--accent); }
.aibox input { border: 0; background: none; box-shadow: none; }
.sugg { position: absolute; left: 0; right: 0; top: 100%; margin-top: 6px; z-index: 5; }
.filebar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.foot { display: flex; gap: 8px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* command bar + toast */
.cmdk { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.25); display: grid; justify-items: center; align-items: start; padding-top: 14vh; }
.cmd-card { width: min(620px, 92vw); padding: 6px; box-shadow: var(--pop); border: 0; }
.cmd-card input { border: 0; font-size: 16px; padding: 12px; box-shadow: none; }
.cmd-card button { display: flex; width: 100%; gap: 12px; padding: 9px 12px; border-radius: 6px; text-align: left; }
.cmd-card button:hover, .cmd-card button.on { background: var(--hover); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; padding: 9px 10px 9px 16px; display: flex; gap: 12px; align-items: center;
  background: #1b1b1b; color: #fff; border: 0; box-shadow: var(--pop); animation: rise .2s ease-out; }
.toast .btn { background: transparent; color: #fff; border-color: #555; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* scrollbars */
.list, .pane { scrollbar-width: thin; scrollbar-color: #cfcfcf transparent; }
.list::-webkit-scrollbar, .pane::-webkit-scrollbar { width: 8px; }
.list::-webkit-scrollbar-thumb, .pane::-webkit-scrollbar-thumb { background: #d2d2d2; border-radius: 8px; }

/* phones: one column, bottom tab bar */
.back { display: none; }
.rb { width: auto; flex: 1; padding: 7px 0 5px; border-radius: 8px; color: var(--muted); display: grid; justify-items: center; gap: 1px; font-size: 16px; }
.rb span { font-size: 10px; }
.rb.on { color: var(--accent-ink); background: var(--accent-soft); }
.compose-btn { color: #fff; background: var(--accent); }
@media (max-width: 900px) {
  .app, .app.wide { grid-template-columns: minmax(0, 1fr); padding: 0 0 64px; gap: 0; }
  .ribbon { grid-column: 1; margin: 0; }
  .rgroup .rname { display: none; }
  .rail { display: flex !important; position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; flex-direction: row; justify-content: space-around;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); border-radius: 0; border: 0; border-top: 1px solid var(--line); background: var(--surface); }
  .rail .logo, .rail .grow { display: none; }
  .list-pane, .main { border-radius: 0; box-shadow: none; }
  .list-pane { height: calc(100dvh - 64px); }
  .main { display: none; }
  .app.reading .list-pane, .app.wide .list-pane { display: none; }
  .app.reading .main, .app.wide .main { display: flex; height: calc(100dvh - 64px); }
  .pane { padding: 16px 16px 60px; }
  .back { display: inline-grid; }
  .cal-cell { min-height: 64px; padding: 4px; }
  .cal-cell .ev { font-size: 10px; padding: 1px 4px; }
  .app.assist .assist-panel { position: fixed; inset: 0 0 64px 0; z-index: 20; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Stories sit at the very top of the list, above the folder name */
.list-pane { padding-top: 0; }
.list-pane > .stories-wrap { border-bottom: 1px solid var(--line); padding-top: 8px; }
.list-pane > .stories-wrap + .lh { padding-top: 8px; }
.stories-wrap:has(> .stories:empty) { display: none; }   /* other folders have no stories */

/* Compact stories strip: smaller circles, one label line, less height */
.list-pane > .stories-wrap { padding-top: 6px; }
.stories { gap: 4px; padding: 2px 10px 8px; }
.story { width: 52px; gap: 3px; padding: 4px 0 3px; }
.story .ring { width: 40px; height: 40px; padding: 1.5px; }
.story .av { font-size: 13px; border-width: 1.5px; }
.story .badge { min-width: 16px; height: 16px; font-size: 9.5px; line-height: 16px; top: -3px; right: -5px; padding: 0 4px; }
.story .nm { max-width: 50px; font-size: 10.5px; }
.story .br { display: none; }
.sarrow { top: 14px; width: 22px; height: 22px; font-size: 15px; }
/* In the reading pane the ask box sits at the end of the email, not floating over it */
#rp > .askbar { position: static; margin-top: 18px; }

/* Settings, iOS style: grouped rounded lists, coloured icon tiles, switches, sub-pages */
.st { max-width: 680px; margin: 0 auto; padding-bottom: 30px; }
.st-profile { display: flex; align-items: center; gap: 14px; padding: 16px; margin: 4px 0 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.st-profile .av { width: 52px; height: 52px; font-size: 18px; }
.st-h { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--dim); margin: 22px 16px 7px; }
.st-g { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.st-f { font-size: 12.5px; color: var(--dim); margin: 7px 16px 0; line-height: 1.45; }
.st-r { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 14px; position: relative; }
.st-r + .st-r::before { content: ""; position: absolute; top: 0; left: 52px; right: 0; height: 1px; background: var(--line); }
.st-r.st-col { display: block; padding: 10px 14px; }
.st-r.st-col + .st-r::before, .st-r + .st-r.st-col::before { left: 14px; }
.st-r[data-go] { cursor: pointer; }
.st-r[data-go]:hover { background: var(--hover); }
.st-ic { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; flex: none; }
.st-ic svg { width: 16px; height: 16px; }
.st-l { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; font-weight: 500; }
.st-l .av { width: 30px; height: 30px; font-size: 11px; }
.st-sub { font-size: 12px; font-weight: 400; }
.st-v { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; flex: none; }
.st-chev { color: #b8bcc5; font-size: 20px; line-height: 1; margin-left: 2px; }
.st-sel { width: auto; border: 0; background: transparent; color: var(--muted); padding: 4px 2px; text-align: right; cursor: pointer; box-shadow: none !important; max-width: 260px; }
.st-sel:hover { color: var(--text); }
.st-badge { background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 7px; }
.st-kbd { font: 600 12px var(--font); background: var(--panel2); border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 6px; padding: 2px 8px; color: var(--text); }
.st-save { margin: 16px 0 0; width: 100%; padding: 11px; }
.st textarea, .st input { border: 0; padding: 4px 0; background: transparent; box-shadow: none !important; resize: vertical; }
.st-back { color: var(--accent-ink); font-weight: 600; font-size: 15px; margin-right: 8px; }
.st-back:hover { text-decoration: underline; }
/* iOS switch */
.sw { position: relative; width: 46px; height: 28px; flex: none; cursor: pointer; }
.sw input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.sw i { position: absolute; inset: 0; border-radius: 14px; background: #d9dbe1; transition: background .2s; pointer-events: none; }
.sw i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s; }
.sw input:checked + i { background: #34c759; }
.sw input:checked + i::after { transform: translateX(18px); }
.sw input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- One look for every page (Settings, Calendar, Vault, Contacts, Assistant) ---- */
/* Pages use the full width of the window, with the same padding and grey canvas behind white groups */
.app.wide .main { background: var(--panel); }
.app.wide .pane { padding: 24px 32px 40px; }
.app.wide .pane-head { background: var(--surface); }
.pane-head h2 { font-size: 20px; }

/* Settings: groups flow into two or three columns on wide screens */
.st { max-width: none; margin: 0; }
.st-sec { break-inside: avoid; margin-bottom: 22px; }
.st-sec .st-h { margin-top: 0; }
.st.st-cols { columns: 3 380px; column-gap: 24px; }
.st-wide { column-span: all; margin: 0 0 24px; }
.st:not(.st-cols) { max-width: 820px; }

/* Vault and Contacts: the same white rounded group with inset dividers */
.items { gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.item { min-height: 54px; padding: 9px 16px; border: 0; border-radius: 0; background: transparent; position: relative; }
.item + .item::before { content: ""; position: absolute; top: 0; left: 58px; right: 0; height: 1px; background: var(--line); }
.item:hover { background: var(--hover); }
.item .av { width: 30px; height: 30px; font-size: 11px; }
.item .nm b { font-weight: 600; }
.crumbs { font-weight: 500; margin: 0 4px 12px; }
.crumbs button { color: var(--accent-ink); }
.pane-head input { width: 260px !important; background: var(--panel); border-color: transparent; border-radius: 9px; }
.pane-head input:focus { background: var(--surface); border-color: var(--accent); }

/* Calendar: grid in a white rounded card, agenda as a grouped list */
.app.wide .cal-grid { background: var(--surface); border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.cal-cell:nth-child(7n) , .cal-dow:nth-child(7n) { border-right: 0; }
.agenda { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.agenda .ev { margin: 0; border: 0; border-radius: 0; border-left: 3px solid var(--accent); background: transparent; padding: 12px 16px; }
.agenda .ev + .ev { border-top: 1px solid var(--line); }
.agenda .ev:hover { background: var(--hover); }
.section h3 { margin: 0 4px 8px; }

/* Assistant: wider conversation, starters as a grouped list */
.app.wide .asst { max-width: 980px; }
.asst #starters { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.asst #starters:empty { display: none; }
.asst #starters .chip { border: 0; border-radius: 0; padding: 13px 16px; text-align: left; font-size: 13.5px; color: var(--text); font-weight: 500; background: transparent; }
.asst #starters .chip:hover { background: var(--hover); }
.asst #starters .chip + .chip { border-left: 1px solid var(--line); }
.asst .askbar { border-radius: 14px; }
.msg.me { background: var(--accent-soft); color: var(--accent-ink); }
.action { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
#taskPanel .ai-card { background: var(--surface); border-radius: 14px; }
/* Empty Assistant: a friendly prompt above the suggestions */
.asst #thread:empty { display: grid; place-items: end start; min-height: 40vh; }
.asst #thread:empty::before { content: "How can I help with your mail today?"; font-size: 26px; font-weight: 650; letter-spacing: -.02em; color: var(--text); padding: 0 4px 8px; }
.assist-panel .asst #thread:empty::before { font-size: 18px; }
/* Right-click menu for selected text */
.ctx-menu { position: fixed; z-index: 70; min-width: 230px; }
.ctx-menu svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.ctx-menu .n { font-size: 11px; color: var(--accent-ink); background: var(--accent-soft); border-radius: 8px; padding: 1px 7px; }
.g-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 11px; font-weight: 600; }
.lock-card #pwBox:not([hidden]) { border-top: 1px solid var(--line); padding-top: 14px; }
.st-code { font: 12px var(--mono); background: var(--panel2); border-radius: 6px; padding: 3px 8px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
