/* IFM Central Helpdesk — shared styles for the staff app and the helpdesk console.
   Layout: staff app = one full-height chat column (WhatsApp-like);
   console = sidebar | chat | details, collapsing to one pane on small screens. */
:root {
  --bg: #F1F4F4;
  --panel: #FFFFFF;
  --panel-2: #F7F9F9;
  --line: #D9E1E0;
  --line-soft: #EAF0EF;
  --fg: #16211F;
  --muted: #55615E;
  --brand: #0D5C63;
  --brand-2: #0A4A50;
  --brand-ink: #FFFFFF;
  --brand-sub: #CDE4E2;
  --accent: #0D5C63;
  --accent-ink: #FFFFFF;
  --accent-soft: #DFEDEB;
  --chat-bg: #E8EEED;
  --mine: #D6EDE6;
  --mine-line: #B5DACE;
  --theirs: #FFFFFF;
  --theirs-line: #D9E1E0;
  --new-bg: #E3ECFB; --new-fg: #1B4DAA;
  --ok-bg: #DAF0E8; --ok-fg: #0A5A4F;
  --warn-bg: #FFF0DB; --warn-fg: #7A4200; --warn-line: #EBCD9F;
  --bad-bg: #FCE9E7; --bad-fg: #9A2A20;
  --emer: #B71C1C; --emer-ink: #FFFFFF; --emer-soft: #FCE8E8;
  --urg: #B9470B; --urg-ink: #FFFFFF; --urg-soft: #FFF0E3;
  --note-bg: #FFF7DD; --note-fg: #5E4700; --note-line: #EBD58F;
  --scrim: rgba(10, 24, 25, 0.5);
  --toast-bg: #16211F; --toast-fg: #FFFFFF;
  --shadow: 0 8px 28px rgba(10, 30, 32, 0.16);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
  --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D1515; --panel: #142020; --panel-2: #182626; --line: #263535; --line-soft: #1C2A2A;
    --fg: #E2EBE9; --muted: #98A9A6;
    --brand: #0E464B; --brand-2: #0B3A3E; --brand-ink: #FFFFFF; --brand-sub: #B3D3D0;
    --accent: #5BB8B1; --accent-ink: #052220; --accent-soft: #173938;
    --chat-bg: #0F1A1A; --mine: #15372F; --mine-line: #22503F; --theirs: #182626; --theirs-line: #263535;
    --new-bg: #1A2A46; --new-fg: #A8C3F4; --ok-bg: #12392F; --ok-fg: #8CD8C1;
    --warn-bg: #3A2911; --warn-fg: #F1C27A; --warn-line: #5A421F; --bad-bg: #3D1B18; --bad-fg: #F2A399;
    --emer: #D32F2F; --emer-ink: #FFFFFF; --emer-soft: #3A1717;
    --urg: #C65A14; --urg-ink: #FFFFFF; --urg-soft: #3A2414;
    --note-bg: #332B10; --note-fg: #F0D88A; --note-line: #554719;
    --scrim: rgba(0, 0, 0, 0.62); --toast-bg: #E2EBE9; --toast-fg: #0D1515; --shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D1515; --panel: #142020; --panel-2: #182626; --line: #263535; --line-soft: #1C2A2A;
  --fg: #E2EBE9; --muted: #98A9A6;
  --brand: #0E464B; --brand-2: #0B3A3E; --brand-ink: #FFFFFF; --brand-sub: #B3D3D0;
  --accent: #5BB8B1; --accent-ink: #052220; --accent-soft: #173938;
  --chat-bg: #0F1A1A; --mine: #15372F; --mine-line: #22503F; --theirs: #182626; --theirs-line: #263535;
  --new-bg: #1A2A46; --new-fg: #A8C3F4; --ok-bg: #12392F; --ok-fg: #8CD8C1;
  --warn-bg: #3A2911; --warn-fg: #F1C27A; --warn-line: #5A421F; --bad-bg: #3D1B18; --bad-fg: #F2A399;
  --emer: #D32F2F; --emer-ink: #FFFFFF; --emer-soft: #3A1717;
  --urg: #C65A14; --urg-ink: #FFFFFF; --urg-soft: #3A2414;
  --note-bg: #332B10; --note-fg: #F0D88A; --note-line: #554719;
  --scrim: rgba(0, 0, 0, 0.62); --toast-bg: #E2EBE9; --toast-fg: #0D1515; --shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
#app { height: 100%; }
body { background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 15px; line-height: 1.4; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }
.sep { height: 1px; background: var(--line); border: 0; margin: 0; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- controls ---------- */
.btn { min-height: 44px; padding: 0 18px; border-radius: var(--r); border: 1px solid transparent; background: var(--accent); color: var(--accent-ink); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: var(--panel); color: var(--accent); border-color: var(--accent); }
.btn.quiet { background: var(--panel); color: var(--fg); border-color: var(--line); font-weight: 500; }
.btn.danger { background: var(--panel); color: var(--bad-fg); border-color: var(--bad-fg); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.block { width: 100%; }
.icon-btn { flex: none; width: 44px; height: 44px; border-radius: 22px; border: 0; background: transparent; color: inherit; display: inline-grid; place-items: center; }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 17px; }
.icon-btn.filled { background: var(--accent); color: var(--accent-ink); }
.icon-btn:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.icon-btn.filled:hover { background: var(--accent); filter: brightness(1.08); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; background: var(--panel); color: var(--fg); font-size: 16px; }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; line-height: 1.45; }
select.input { padding-right: 32px; }
.pin { font-family: var(--mono); font-size: 22px; letter-spacing: 10px; }
.hint { font-size: 13px; color: var(--muted); line-height: 1.5; }
.msg-err { padding: 10px 12px; border-radius: var(--r); background: var(--bad-bg); color: var(--bad-fg); font-size: 14px; }
.msg-ok { padding: 10px 12px; border-radius: var(--r); background: var(--ok-bg); color: var(--ok-fg); font-size: 14px; }
.msg-warn { padding: 10px 12px; border-radius: var(--r); background: var(--warn-bg); color: var(--warn-fg); font-size: 14px; border: 1px solid var(--warn-line); }
.chip { min-height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.emer[aria-pressed="true"] { background: var(--emer); border-color: var(--emer); color: var(--emer-ink); }
.chip.urg[aria-pressed="true"] { background: var(--urg); border-color: var(--urg); color: var(--urg-ink); }
.chip .x { opacity: .8; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; white-space: nowrap; line-height: 1.5; }
.pill.new { background: var(--new-bg); color: var(--new-fg); }
.pill.logged { background: var(--ok-bg); color: var(--ok-fg); }
.pill.wait { background: var(--warn-bg); color: var(--warn-fg); }
.pill.grey { background: var(--line-soft); color: var(--muted); }
.pill.bad { background: var(--bad-bg); color: var(--bad-fg); }
.pill.emer { background: var(--emer); color: var(--emer-ink); letter-spacing: .04em; }
.pill.urg { background: var(--urg); color: var(--urg-ink); letter-spacing: .04em; }
.pill.fu { background: var(--accent-soft); color: var(--accent); }
.seg { display: flex; padding: 3px; gap: 3px; background: var(--line-soft); border-radius: 10px; }
.seg button { flex: 1; min-height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--accent); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.avatar { flex: none; width: 42px; height: 42px; border-radius: 21px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.avatar.sq { border-radius: 11px; background: var(--brand); color: var(--brand-ink); }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.badge-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.empty { padding: 36px 18px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.5; }
.center { flex: 1; display: grid; place-items: center; padding: 24px; text-align: center; }

/* ---------- top bar ---------- */
.topbar { background: var(--brand); color: var(--brand-ink); display: flex; align-items: center; gap: 10px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); padding-bottom: 8px; padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); }
.topbar .title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar .title strong { font-size: 17px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title span { font-size: 12.5px; color: var(--brand-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alerts-btn { background: transparent !important; color: var(--brand-ink) !important; border-color: rgba(255,255,255,.5) !important; }
.topbar .icon-btn:hover { background: rgba(255,255,255,.14); }
.logo { flex: none; width: 38px; height: 38px; border-radius: 10px; background: var(--brand-ink); color: var(--brand); display: grid; place-items: center; }
.tabs { display: flex; background: var(--brand); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.tab { flex: 1; min-height: 46px; border: 0; background: transparent; color: var(--brand-sub); font-size: 14px; font-weight: 700; border-bottom: 3px solid transparent; display: flex; align-items: center; justify-content: center; gap: 6px; letter-spacing: .02em; }
.tab[aria-selected="true"] { color: var(--brand-ink); border-bottom-color: var(--brand-ink); }
.tab .badge-count { background: var(--brand-ink); color: var(--brand); }

/* ---------- chat ---------- */
.chat { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; background: var(--chat-bg); padding: 12px max(10px, env(safe-area-inset-left, 0px)) 12px max(10px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 6px; }
.day { align-self: center; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--panel); border: 1px solid var(--line-soft); padding: 3px 10px; border-radius: 10px; margin: 6px 0; }
.sysmsg { align-self: center; max-width: 88%; text-align: center; font-size: 12.5px; color: var(--muted); background: var(--line-soft); padding: 5px 12px; border-radius: 12px; }
.mrow { display: flex; }
.mrow.mine { justify-content: flex-end; }
.bubble { position: relative; max-width: min(82%, 560px); min-width: 64px; background: var(--theirs); border: 1px solid var(--theirs-line); border-radius: 12px; padding: 6px 10px 4px; display: flex; flex-direction: column; gap: 3px; text-align: left; color: var(--fg); }
.mrow.mine .bubble { background: var(--mine); border-color: var(--mine-line); }
.bubble.tap { cursor: pointer; }
.bubble .who { font-size: 12px; font-weight: 700; color: var(--accent); }
.bubble .txt { font-size: 15px; line-height: 1.42; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble .meta { align-self: flex-end; display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.quote { border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); border-radius: 6px; padding: 4px 8px; font-size: 13px; display: flex; flex-direction: column; gap: 1px; }
.quote b { font-size: 12px; color: var(--accent); }
.quote span { color: var(--muted); overflow-wrap: anywhere; }
.fwdlabel { font-size: 12px; font-style: italic; color: var(--muted); display: flex; gap: 4px; align-items: center; }
.logged { position: relative; color: var(--fg); text-align: left; display: flex; gap: 10px; align-items: flex-start; background: var(--panel); border: 1.5px solid var(--ok-fg); border-radius: 12px; padding: 9px 12px 5px; max-width: min(86%, 440px); }
.logged .tick { flex: none; width: 28px; height: 28px; border-radius: 14px; background: var(--ok-fg); color: var(--panel); display: grid; place-items: center; }
.logged strong { color: var(--ok-fg); font-size: 15px; }
.note { align-self: stretch; background: var(--note-bg); color: var(--note-fg); border: 1px dashed var(--note-line); border-radius: 10px; padding: 7px 10px; font-size: 13.5px; display: flex; flex-direction: column; gap: 2px; }
.note .meta { align-self: flex-end; font-size: 11px; opacity: .85; }
.actions-inline { display: none; gap: 2px; position: absolute; top: -14px; right: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 1px 4px; box-shadow: var(--shadow); }
.bubble:hover .actions-inline, .post:hover .actions-inline, .logged:hover .actions-inline, .bubble:focus-within .actions-inline, .post:focus-within .actions-inline, .logged:focus-within .actions-inline { display: flex; }
@media (hover: none) { .actions-inline { display: none !important; } }

.composer-wrap { background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.replybar { display: flex; align-items: center; gap: 8px; padding: 8px max(12px, env(safe-area-inset-left, 0px)) 0 max(12px, env(safe-area-inset-left, 0px)); }
.replybar .quote { flex: 1; min-width: 0; }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 8px max(10px, env(safe-area-inset-right, 0px)) 10px max(10px, env(safe-area-inset-left, 0px)); }
.composer textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 160px; resize: none; border-radius: 22px; padding: 11px 16px; line-height: 1.35; overflow-y: auto; }
.composer .icon-btn.filled { width: 46px; height: 46px; border-radius: 23px; }
.quickrow { padding: 8px max(10px, env(safe-area-inset-left, 0px)) 0; }
.qbtn { flex: none; min-height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid var(--line); background: var(--panel); color: var(--accent); font-size: 13px; font-weight: 600; white-space: nowrap; }

/* ---------- posts (jobs) ---------- */
.post { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; }
.post.emer { border: 2px solid var(--emer); background: linear-gradient(var(--emer-soft), var(--emer-soft)) top / 100% 0 no-repeat, var(--panel); }
.post.urg { border: 2px solid var(--urg); }
.post .head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.post .refs { font-family: var(--mono); font-size: 13.5px; font-weight: 600; }
.post .txt { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.post .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.acks { border-top: 1px solid var(--line-soft); padding-top: 7px; font-size: 12.5px; display: flex; flex-direction: column; gap: 3px; }
.acks .done { color: var(--ok-fg); font-weight: 700; }
.acks .waiting { color: var(--warn-fg); }
.thread { flex: 1; min-height: 0; overflow-y: auto; background: var(--chat-bg); padding: 12px max(10px, env(safe-area-inset-right, 0px)) 16px max(10px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 10px; }
.reply-post { align-self: flex-start; max-width: 85%; }

/* ---------- lists ---------- */
.list { flex: 1; min-height: 0; overflow-y: auto; }
.item { width: 100%; display: flex; gap: 11px; align-items: flex-start; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--line-soft); background: var(--panel); text-align: left; color: var(--fg); }
.item:hover { background: var(--panel-2); }
.item[aria-current="true"] { background: var(--accent-soft); }
.item .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item .l1 { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.item .name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .time { flex: none; font-size: 12px; color: var(--muted); }
.item .time.hot { color: var(--accent); font-weight: 700; }
.item .sub { font-size: 12.5px; color: var(--muted); }
.item .pv { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .l3 { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.item .tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.dot { flex: none; width: 10px; height: 10px; border-radius: 5px; background: var(--accent); }
.section-label { padding: 12px 14px 6px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); background: var(--panel); }

/* ---------- overlays ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 640px) { .scrim { align-items: center; padding: 24px; } }
.sheet { width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto; background: var(--panel); border-radius: 18px 18px 0 0; padding: 18px max(18px, env(safe-area-inset-right, 0px)) calc(18px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
@media (min-width: 640px) { .sheet { border-radius: 16px; } }
.sheet.wide { max-width: 640px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.menu-list { display: flex; flex-direction: column; }
.menu-item { min-height: 52px; display: flex; align-items: center; gap: 14px; padding: 0 6px; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; text-align: left; font-size: 15px; color: var(--fg); text-decoration: none; }
.menu-item:last-child { border-bottom: 0; }
.menu-item svg { flex: none; color: var(--muted); }
.share-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.share-btn { min-height: 52px; display: flex; align-items: center; gap: 10px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--fg); font-weight: 600; text-decoration: none; font-size: 14px; text-align: left; }
.share-btn .stile { flex: none; width: 32px; height: 32px; border-radius: 9px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; }
.preview-box { max-height: 150px; overflow-y: auto; white-space: pre-wrap; background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px 12px; font-size: 14px; color: var(--muted); width: 100%; resize: none; }
.toast { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom, 0px)); max-width: calc(100% - 32px); background: var(--toast-bg); color: var(--toast-fg); padding: 11px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); }
.banner { margin: 10px max(10px, env(safe-area-inset-left, 0px)) 0; border-radius: 12px; padding: 12px; display: flex; gap: 10px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); }
.banner .grow { display: flex; flex-direction: column; gap: 4px; }
.offline { background: var(--warn-bg); color: var(--warn-fg); font-size: 13px; text-align: center; padding: 6px 12px; }
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: rise .18s ease-out; }
  .sheet { animation: up .2s ease-out; }
  @keyframes rise { from { transform: translate(-50%, 8px); opacity: 0; } }
  @keyframes up { from { transform: translateY(16px); opacity: .4; } }
}

/* ---------- staff (phone) app ---------- */
.phone { height: 100%; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; background: var(--panel); }
@media (min-width: 600px) { .phone { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }
.form-page { flex: 1; overflow-y: auto; padding: 22px max(20px, env(safe-area-inset-right, 0px)) calc(28px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 16px; }
.hero { background: var(--brand); color: var(--brand-ink); padding: calc(28px + env(safe-area-inset-top, 0px)) max(22px, env(safe-area-inset-right, 0px)) 26px max(22px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 10px; }
.hero h1 { font-size: 25px; font-weight: 700; }
.hero p { color: var(--brand-sub); font-size: 15px; line-height: 1.5; }
.hero .logo { width: 52px; height: 52px; border-radius: 14px; }
.duty-line { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--brand-sub); }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- console (desk) ---------- */
.desk { height: 100%; display: flex; flex-direction: column; }
.desk .topbar { padding-top: 8px; }
.desk-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 330px minmax(0, 1fr) 320px; }
.pane { min-height: 0; min-width: 0; display: flex; flex-direction: column; background: var(--panel); }
.pane.side { border-right: 1px solid var(--line); }
.pane.info { border-left: 1px solid var(--line); overflow-y: auto; }
.pane.main { background: var(--chat-bg); }
.side-top { padding: 12px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.search { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 14px; color: var(--fg); min-height: 38px; }
.pop { position: relative; }
.pop-panel { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: min(300px, 80vw); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.mainhead { display: flex; align-items: center; gap: 10px; padding: 9px 14px; min-height: 60px; background: var(--panel); border-bottom: 1px solid var(--line); }
.mainhead .t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mainhead .t strong { font-size: 15.5px; }
.mainhead .t span { font-size: 12.5px; color: var(--muted); }
.info-body { padding: 14px 16px 24px; display: flex; flex-direction: column; gap: 14px; }
.kv { display: flex; flex-direction: column; gap: 3px; font-size: 14px; }
.kv span { color: var(--muted); overflow-wrap: anywhere; }
.inline { display: flex; gap: 6px; align-items: stretch; }
.inline > .input { flex: 1; min-width: 0; }
.postbox { background: var(--panel); border-top: 1px solid var(--line); padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 8px; }
.postbox textarea { min-height: 84px; max-height: 260px; }
.member { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); }
.member:last-child { border-bottom: 0; }
.box-list { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.pick { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; text-align: left; color: var(--fg); }
.pick:last-child { border-bottom: 0; }
.pick .box { flex: none; width: 20px; height: 20px; border-radius: 5px; border: 2px solid var(--line); display: grid; place-items: center; color: var(--accent-ink); }
.pick[aria-pressed="true"] .box { background: var(--accent); border-color: var(--accent); }
.back, .show-info, .info-back { display: none !important; }
@media (max-width: 1150px) {
  .desk-grid { grid-template-columns: 310px minmax(0, 1fr); }
  .pane.info { display: none; border-left: 0; }
  .desk-grid[data-pane="info"] .pane.main { display: none; }
  .desk-grid[data-pane="info"] .pane.info { display: flex; }
  .show-info, .info-back { display: inline-grid !important; }
}
@media (max-width: 760px) {
  .desk-grid { grid-template-columns: minmax(0, 1fr); }
  .desk-grid .pane { display: none !important; }
  .desk-grid[data-pane="list"] .pane.side { display: flex !important; }
  .desk-grid[data-pane="main"] .pane.main { display: flex !important; }
  .desk-grid[data-pane="info"] .pane.info { display: flex !important; }
  .back { display: inline-grid !important; }
  .desk .counts { display: none; }
  .alerts-btn span { display: none; }
  .alerts-btn { padding: 0 10px; }
  .desk .composer { flex-wrap: wrap; }
  .desk .composer .seg { width: 100% !important; }
  .desk .quickrow { flex-wrap: nowrap; overflow-x: auto; }
  .desk .quickrow .label { display: none; }
}
.counts { display: flex; gap: 6px; flex-wrap: wrap; }
.count-chip { font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 12px; background: var(--brand-2); color: var(--brand-ink); border: 0; }
.count-chip b { font-variant-numeric: tabular-nums; }

/* ---------- admin ---------- */
.admin { flex: 1; min-height: 0; overflow-y: auto; background: var(--bg); }
.admin-inner { max-width: 1240px; margin: 0 auto; padding: 18px max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 16px; }
.admin-tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.admin-tabs button { min-height: 42px; padding: 0 14px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font-weight: 650; white-space: nowrap; }
.admin-tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.tile .n { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile .l { font-size: 13px; color: var(--muted); }
.tile.emer .n { color: var(--emer); }
.tile.urg .n { color: var(--urg); }
.tile.warn .n { color: var(--warn-fg); }
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--panel-2); white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; }

/* ---------- login (console) ---------- */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); background: var(--bg); }
.login-card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.login-card .brandrow { display: flex; align-items: center; gap: 12px; }
.login-card .brandrow .logo { background: var(--brand); color: var(--brand-ink); }
