/* NRG.Watch helpdesk. System fonts only, no external requests. */
:root {
  --bg: #f4f5f7; --card: #ffffff; --col: #eceef2; --fg: #1a1d23; --muted: #667085; --line: #e1e4ea;
  --accent: #1f6feb; --accent-fg: #ffffff; --accent-soft: #e6effd;
  --ok: #1a8f4c; --ok-bg: #def5e8; --warn: #9a6200; --warn-bg: #fdf0d2; --bad: #c0352b; --bad-bg: #fde4e1;
  --note-bg: #fff8dc; --note-line: #ecd98a; --reply-bg: #eaf2ff; --seg: #e6e9ee; --shadow: 0 6px 24px rgba(16, 24, 40, .18);
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418; --card: #1a1e24; --col: #161a1f; --fg: #e8eaee; --muted: #9aa3b2; --line: #2a3039;
    --accent: #5b9bff; --accent-fg: #0b1220; --accent-soft: #1b2a44;
    --ok: #4cc380; --ok-bg: #153524; --warn: #f0b84d; --warn-bg: #3a2c0f; --bad: #ff7b70; --bad-bg: #40191a;
    --note-bg: #332d12; --note-line: #5b5020; --reply-bg: #172640; --seg: #262c35; --shadow: 0 6px 24px rgba(0, 0, 0, .55);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--fg); font-size: 16px; line-height: 1.4; -webkit-text-size-adjust: 100%; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
#app { height: 100vh; height: 100dvh; }
a { color: var(--accent); }
h1, h2 { margin: 0; }
button, input, select, textarea { font: inherit; font-size: 16px; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.boot { padding: 40px; text-align: center; color: var(--muted); }

/* buttons */
.btn { min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; color: var(--fg); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.big { width: 100%; min-height: 50px; }
.btn.small { min-height: 44px; padding: 0 12px; font-weight: 500; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 44px; height: 44px; border: 0; background: transparent; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: var(--fg); padding: 0; }
.icon-btn:active { background: var(--seg); }
.linkbtn { background: none; border: 0; color: var(--accent); padding: 10px 0; min-height: 44px; font-size: 15px; text-align: left; text-decoration: none; display: inline-flex; align-items: center; }
.seg-group { display: inline-flex; background: var(--seg); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-group.wide { display: flex; width: 100%; }
.seg-group.wide .seg { flex: 1; }
.seg { min-height: 40px; padding: 0 14px; border: 0; background: transparent; border-radius: 8px; font-size: 15px; font-weight: 500; color: var(--muted); }
.seg.on { background: var(--card); color: var(--fg); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }

/* shell */
.shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.topbar { flex: none; background: var(--card); border-bottom: 1px solid var(--line); padding: env(safe-area-inset-top) max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left)); }
.tb-row { display: flex; align-items: center; gap: 4px; min-height: 52px; }
.tb-title { flex: 1; font-size: 22px; font-weight: 700; padding-left: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-icons { display: flex; }
.filter { margin: 0 8px 8px; }
.main { flex: 1; min-height: 0; position: relative; }
.scroll { height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.tabbar { flex: none; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
.tab { flex: 1; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 600; position: relative; padding: 4px 0; }
.tab.on { color: var(--accent); }
.tab.on::before { content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
.tab-l { font-size: 13px; }
.tab-badge { background: var(--seg); color: var(--fg); border-radius: 999px; font-size: 12px; min-width: 20px; padding: 0 6px; line-height: 18px; text-align: center; font-weight: 700; }
.tab-badge.hot { background: var(--accent); color: var(--accent-fg); }
.dnav { display: none; }

/* states */
.state { padding: 48px 24px; text-align: center; color: var(--muted); }
.state-big { font-size: 19px; font-weight: 600; color: var(--fg); }
.state-sub { margin-top: 4px; font-size: 14px; }
.spinner { width: 24px; height: 24px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 10px; }
.spinner.sm { width: 12px; height: 12px; border-width: 2px; margin: 0; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* cards */
ul.cards { list-style: none; margin: 0; padding: 0; }
.list-view { padding-bottom: 24px; }
.list-foot { padding: 8px 16px; }
.list-foot .state { padding-top: 56px; }
.more-btn { width: 100%; }
.card-wrap { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); background: var(--card); }
.swipe-bg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-right: 24px; color: #fff; font-weight: 700; background: var(--ok); opacity: .55; }
.card-wrap.armed .swipe-bg { opacity: 1; }
.card { position: relative; display: flex; align-items: stretch; background: var(--card); touch-action: pan-y; transition: transform .18s ease; }
.card-wrap.swiping .card { transition: none; }
.card-wrap.leaving { transition: opacity .18s; opacity: .0; }
.card-main { flex: 1; min-width: 0; padding: 12px 4px 12px 14px; color: inherit; text-decoration: none; display: block; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.row1 { display: flex; align-items: center; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot.on { background: var(--accent); }
.name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 16px; }
.age { flex: none; font-size: 13px; color: var(--muted); }
.subject { margin: 2px 0 0 17px; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview { margin: 2px 0 0 17px; font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.reason { margin: 2px 0 0 17px; font-size: 13px; color: var(--warn); }
.card.unread .name, .card.unread .subject { font-weight: 700; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0 17px; }
.badges:empty { display: none; }
.check { flex: none; width: 56px; border: 0; background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; border-left: 1px solid var(--line); margin: 8px 0; }
.check:active, .check:hover { color: var(--ok); background: var(--ok-bg); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; line-height: 20px; background: var(--seg); color: var(--muted); white-space: nowrap; }
.badge.neutral { background: var(--seg); color: var(--muted); }
.badge.plain { background: transparent; border: 1px solid var(--line); font-weight: 500; }
.badge.avatar { background: var(--accent-soft); color: var(--accent); min-width: 24px; justify-content: center; padding: 1px 6px; }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.conf-high { background: var(--ok-bg); color: var(--ok); }
.badge.conf-medium { background: var(--warn-bg); color: var(--warn); }
.badge.conf-low { background: var(--bad-bg); color: var(--bad); }
.badge.status-new { background: var(--accent-soft); color: var(--accent); }
.badge.status-answered { background: var(--warn-bg); color: var(--warn); }
.badge.status-done { background: var(--ok-bg); color: var(--ok); }

/* search */
.searchbar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--bg); border-bottom: 1px solid var(--line); color: var(--muted); }
.search-input { flex: 1; min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); padding: 0 12px; }
.search-view .cards { max-width: 900px; margin: 0 auto; }

/* board */
.board { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: 12px; padding: 12px; height: 100%; overflow-x: auto; }
.col { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--col); border-radius: var(--radius); border: 1px solid var(--line); }
.col.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 8px; }
.col-head h2 { font-size: 15px; }
.col-count { font-size: 13px; font-weight: 700; color: var(--muted); background: var(--card); border-radius: 999px; padding: 0 9px; line-height: 22px; }
.col-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px 12px; }
.col-note { text-align: center; color: var(--muted); font-size: 13px; padding: 8px; list-style: none; }
.state-li { list-style: none; }
.board .state { padding: 28px 12px; }
.board .state-big { font-size: 16px; }
.board .card-wrap { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--card); overflow: visible; }
.board .card { border-radius: 10px; }
.board .card-main { padding-right: 12px; padding-bottom: 12px; }
.board .card-wrap:hover { border-color: var(--accent); }
.board .check { position: absolute; right: 2px; bottom: 2px; width: 44px; height: 44px; margin: 0; border: 0; border-radius: 10px; }
.board .card-main .badges { margin-right: 40px; }
.card.dragging { opacity: .45; }
@media (hover: hover) { .board .check { opacity: 0; } .board .card-wrap:hover .check, .board .check:focus-visible { opacity: 1; } }

/* ticket overlay */
.scrim { display: none; }
.overlay { position: fixed; z-index: 30; left: 0; right: 0; top: 0; height: 100vh; height: 100dvh; background: var(--bg); display: flex; flex-direction: column; overflow: hidden; }
.ticket { display: flex; flex-direction: column; height: 100%; min-height: 0; position: relative; }
.ticket.file-over::after { content: "Laat los om bij te voegen"; position: absolute; inset: 8px; border: 3px dashed var(--accent); border-radius: 14px; background: color-mix(in srgb, var(--bg) 80%, transparent); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--accent); z-index: 5; pointer-events: none; }
.t-head { flex: none; background: var(--card); border-bottom: 1px solid var(--line); padding: env(safe-area-inset-top) max(8px, env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left)); }
.t-top { display: flex; align-items: center; gap: 4px; }
.t-title { flex: 1; min-width: 0; }
.t-title h1 { font-size: 17px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.t-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-num { font-weight: 700; }
.t-mail { color: var(--muted); margin-left: 6px; }
.t-cc, .t-reason { font-size: 13px; color: var(--muted); padding: 2px 8px; }
.t-reason { color: var(--warn); }
.t-ctrl { display: flex; gap: 8px; padding: 6px 8px 0; align-items: center; }
.t-tools { min-width: 0; }
.sel, .modal-in, .field input, .field textarea, .field select, .modal-ta { min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); padding: 0 10px; max-width: 100%; }
.sel { flex: 1 1 0; min-width: 0; }
.done-btn { background: var(--ok); border-color: var(--ok); color: #fff; padding: 0 16px; flex: none; }
.t-scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.t-grid { padding: 12px max(12px, env(safe-area-inset-right)) 16px max(12px, env(safe-area-inset-left)); display: block; }
.t-conv, .t-agent { min-width: 0; }
.side-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
.side-box > summary { list-style: none; min-height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; font-weight: 700; cursor: pointer; }
.side-box > summary::-webkit-details-marker { display: none; }
.side-box > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin-left: 10px; transition: transform .15s; }
.side-box[open] > summary::after { transform: rotate(-135deg); }
.side-box > summary > span:first-child { flex: 1; }
.count-pill { background: var(--seg); border-radius: 999px; padding: 0 8px; font-size: 12px; line-height: 20px; color: var(--muted); }
.orders-body { padding: 0 12px 12px; }
.orders-refresh { margin: 0 2px; }
.order { border-top: 1px solid var(--line); padding: 10px 0; font-size: 14px; }
.order.cancelled { opacity: .7; }
.order-top { display: flex; align-items: center; gap: 8px; }
.order-name { font-weight: 700; }
.order-total { margin-left: auto; font-weight: 600; }
.order-sub { color: var(--muted); font-size: 13px; }
.order-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.order-items, .order-refunds { margin: 4px 0; padding-left: 18px; }
.order-ship { margin-top: 4px; }
.rel-list { list-style: none; margin: 0; padding: 0 12px 8px; }
.rel-list a { display: block; padding: 8px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--fg); min-height: 44px; }
.rel-top { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: 14px; }
.rel-top .age { margin-left: auto; }
.rel-sub { display: block; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* messages */
.msg { margin: 0 0 12px; padding: 10px 12px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--muted); max-width: 100%; }
.msg.reply { background: var(--reply-bg); border-left-color: var(--accent); border-color: transparent; border-left-width: 4px; margin-left: 16px; }
.msg.note { background: var(--note-bg); border: 1px dashed var(--note-line); border-left: 4px solid var(--warn); }
.msg.event { background: none; border: 0; text-align: center; color: var(--muted); font-size: 13px; padding: 2px 0; }
.msg.event time { opacity: .8; }
.msg-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 6px; }
.msg-who { font-weight: 700; }
.msg-mail, .msg-time { font-size: 13px; color: var(--muted); }
.msg-time { margin-left: auto; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; }
.msg-atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.thumb { display: block; width: 104px; text-decoration: none; color: var(--muted); font-size: 12px; }
.thumb img { display: block; width: 104px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--seg); }
.thumb span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 6px 0 10px; border-radius: 999px; background: var(--seg); color: var(--fg); text-decoration: none; font-size: 14px; max-width: 100%; }
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.chip-size { color: var(--muted); font-size: 12px; padding-right: 6px; }
.chip-x { width: 36px; height: 36px; border: 0; background: transparent; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; padding: 0; margin-right: -4px; }
.chip-img { width: 24px; height: 24px; border-radius: 4px; object-fit: cover; }
.chip.busy { opacity: .85; padding-right: 10px; }
.orig-wrap { margin-top: 8px; }
.orig { width: 100%; height: 60vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; display: block; }

/* agent */
.agent-panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin: 4px 0 12px; }
.agent-panel > summary { list-style: none; min-height: 48px; padding: 0 14px; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.agent-panel > summary::-webkit-details-marker { display: none; }
.agent-title { font-weight: 700; flex: 1; }
.agent-body { padding: 0 14px 12px; font-size: 14px; }
.agent-body p { margin: 0 0 8px; }
.agent-notes { white-space: pre-wrap; }
.agent-sources { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; align-items: center; }
.src { background: var(--seg); border-radius: 6px; padding: 1px 8px; font-size: 12px; }

/* reply box */
.reply { flex: none; background: var(--card); border-top: 1px solid var(--line); padding: 6px max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); box-shadow: 0 -4px 14px rgba(16, 24, 40, .06); }
.kb-open .reply { padding-bottom: 8px; }
.reply-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.save-state { flex: 1; text-align: right; font-size: 12px; color: var(--muted); }
.save-state.error { color: var(--bad); font-weight: 600; }
.reply-ta { width: 100%; display: block; resize: none; min-height: 64px; max-height: 40vh; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg); line-height: 1.4; }
.chips-row { display: flex; flex-direction: column; gap: 6px; padding-bottom: 6px; }
.markers { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.marker { flex: none; min-height: 36px; border: 1px solid var(--warn); background: var(--warn-bg); color: var(--warn); border-radius: 999px; padding: 0 12px; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.marker-k { font-weight: 700; }
.atts { display: flex; flex-wrap: wrap; gap: 6px; }
.markers[hidden], .atts[hidden] { display: none; }
.orders-jump { min-height: 32px; border: 1px solid var(--line); background: var(--card); color: var(--muted); border-radius: 999px; padding: 0 12px; font-size: 13px; margin: 4px 8px 0; }
.orders-jump.has { color: var(--accent, #1d6fe8); border-color: currentColor; font-weight: 600; }
.atts .chip { flex: none; }
.reply-actions { display: flex; gap: 8px; margin-top: 8px; }
.reply-actions .btn { flex: 1; min-height: 48px; }
.reply-hint { font-size: 13px; color: var(--muted); padding-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.reply-hint .linkbtn { padding: 0; min-height: 36px; margin-left: auto; }
.kb-open .t-meta, .kb-open .t-ctrl, .kb-open .t-sub, .kb-open .reply-hint { display: none; }
.kb-open .reply-ta { min-height: 64px; }

/* settings */
.settings { padding: 12px max(12px, env(safe-area-inset-right)) 32px max(12px, env(safe-area-inset-left)); }
.set-wrap { max-width: 720px; margin: 0 auto; }
.set-h1 { font-size: 22px; padding: 4px 0 12px; }
.set-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-top: 12px; }
.set-card h2 { font-size: 16px; margin-bottom: 10px; }
.set-card > p { margin: 0 0 10px; }
.set-card > .btn { margin-top: 4px; }
.field { display: block; margin-bottom: 12px; }
.field-l { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--muted); }
.field-h { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.field input:not([type=checkbox]), .field select, .field textarea { width: 100%; }
.field textarea, .set-card textarea { padding: 10px; width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--card); display: block; margin-bottom: 10px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 16px; }
.rows { list-style: none; margin: 0 0 4px; padding: 0; }
.row { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row.off { opacity: .55; }
.row-main { flex: 1; min-width: 0; }
.row-t { font-weight: 600; overflow-wrap: anywhere; }
.row-s { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.row-btns { display: flex; flex-direction: column; gap: 6px; }
.row.lesson { align-items: flex-start; }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; }
.check-row input { width: 22px; height: 22px; }
.form { display: flex; flex-direction: column; gap: 10px; }
.form .modal-in, .form select { width: 100%; }

/* modal + toast */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-start; justify-content: center; padding: max(env(safe-area-inset-top), 8vh) 12px 12px; overflow-y: auto; }
.modal { width: min(100%, 460px); background: var(--card); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
.modal-title { font-size: 18px; margin-bottom: 12px; }
.modal-body { margin-bottom: 14px; }
.modal-body .muted { margin: 0; font-size: 14px; }
.modal-ta { width: 100%; padding: 10px; display: block; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.modal-actions .btn { flex: 1; }
#toasts { position: fixed; z-index: 60; left: 0; right: 0; bottom: calc(72px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; background: #20242b; color: #fff; border-radius: 12px; padding: 4px 6px 4px 16px; min-height: 48px; box-shadow: var(--shadow); max-width: 520px; animation: pop .18s ease-out; }
.toast.error { background: #a82a21; }
.toast.ok { background: #176e3d; }
.toast.out { opacity: 0; transition: opacity .2s; }
.toast-msg { flex: 1; font-size: 15px; padding: 6px 0; }
.toast-action { min-height: 44px; border: 0; background: transparent; color: #8fc1ff; font-weight: 700; padding: 0 12px; border-radius: 8px; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* login */
.login { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: min(100%, 380px); background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 28px 22px; box-shadow: var(--shadow); text-align: center; }
.login-card h1 { font-size: 20px; margin: 10px 0 20px; }
.login-card .field { text-align: left; }
.login-logo { border-radius: 14px; }
.login-err { color: var(--bad); font-size: 14px; min-height: 20px; margin-bottom: 8px; }

/* phone only / desktop only */
@media (min-width: 900px) {
  .only-phone, .tabbar { display: none !important; }
  .topbar { padding: 0 16px; }
  .tb-row { gap: 16px; }
  .tb-title { flex: none; padding-left: 0; font-size: 20px; }
  .dnav { display: flex; gap: 4px; flex: 1; }
  .dn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 10px; text-decoration: none; color: var(--muted); font-weight: 600; }
  .dn.on { color: var(--accent); background: var(--accent-soft); }
  .filter { margin: 0; order: 2; }
  .topbar { display: flex; align-items: center; }
  .tb-row { flex: 1; }
  .list-view .cards, .search-view .cards { max-width: 820px; margin: 12px auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
  .list-view:not(.search-view) { padding: 0 16px; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 29; background: rgba(10, 14, 20, .35); }
  .overlay { left: auto; width: min(1120px, 94vw); box-shadow: -10px 0 40px rgba(0, 0, 0, .25); border-left: 1px solid var(--line); }
  .t-head { padding: 12px 16px; }
  .t-scroll { overflow: hidden; }
  .t-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; grid-template-rows: minmax(0, 1fr); gap: 0 20px; padding: 16px 20px 0; height: 100%; }
  .t-main { grid-column: 1; grid-row: 1; overflow-y: auto; min-height: 0; padding-bottom: 16px; padding-right: 4px; }
  .t-side { grid-column: 2; grid-row: 1; overflow-y: auto; min-height: 0; padding-bottom: 16px; }
  .sel { flex: 0 1 200px; }
  .t-ctrl { padding-top: 8px; }
  .t-side .side-box > summary { cursor: default; }
  .reply { padding-left: 20px; padding-right: 20px; }
  .reply-ta { max-height: 30vh; }
  #toasts { bottom: 24px; }
  .row-btns { flex-direction: row; }
}
@media (max-width: 899px) {
  .only-desktop { display: none !important; }
  .dnav { display: none !important; }
  .card-wrap:last-child { border-bottom: 0; }
  .t-side { margin-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
