/* PureDesk design system. Follows PureFlow's front end (tokens, top bar, cards, light/dark by system
   setting) in PureDesk's own colours: deep navy #10233F and teal #00B8A0. No build step. */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Inter, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", -apple-system, BlinkMacSystemFont, Inter, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", "SF Mono", Consolas, monospace;

  --navy: #10233f;
  --teal: #00b8a0;

  --bg: #f5f8fa;
  --surface: #ffffff;
  --surface-2: #f0f4f7;
  --surface-3: #e4ebf1;
  --ink: #10233f;
  --ink-2: #33475f;
  --muted: #5d6f84;
  --line: #dfe6ec;
  --line-strong: #c5d1dc;

  --accent: #00756a;
  --accent-ink: #ffffff;
  --accent-soft: #e0f5f1;
  --accent-2: #10233f;
  --grad: linear-gradient(135deg, #008a78 0%, #10233f 100%);
  --grad-soft: linear-gradient(135deg, rgba(0, 184, 160, .12), rgba(16, 35, 63, .10));
  --on-grad: #ffffff;
  --glow-a: rgba(0, 184, 160, .13);
  --glow-b: rgba(16, 35, 63, .08);

  --ok: #047857;
  --warn: #b45309;
  --warn-soft: #fff7ed;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ok-soft: #ecfdf5;
  --info-soft: #eff6ff;
  --info: #1d4ed8;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --shadow-xs: 0 1px 2px rgba(16, 35, 63, .06);
  --shadow-sm: 0 1px 2px rgba(16, 35, 63, .05), 0 2px 6px rgba(16, 35, 63, .05);
  --shadow-md: 0 2px 4px rgba(16, 35, 63, .04), 0 8px 20px -4px rgba(16, 35, 63, .10);
  --shadow-lg: 0 4px 8px rgba(16, 35, 63, .04), 0 24px 48px -12px rgba(16, 35, 63, .20);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0a1322;
    --surface: #0f1c2e;
    --surface-2: #142439;
    --surface-3: #1b2e47;
    --ink: #e8eef5;
    --ink-2: #c3cfdc;
    --muted: #8d9db2;
    --line: #1f3350;
    --line-strong: #2b4466;

    --accent: #2dd4bf;
    --accent-ink: #04201c;
    --accent-soft: #0b2e2b;
    --accent-2: #7dd3fc;
    --grad: linear-gradient(135deg, #2dd4bf 0%, #7dd3fc 100%);
    --grad-soft: linear-gradient(135deg, rgba(45, 212, 191, .10), rgba(125, 211, 252, .10));
    --on-grad: #04131f;
    --glow-a: rgba(45, 212, 191, .09);
    --glow-b: rgba(125, 211, 252, .07);

    --ok: #34d399;
    --warn: #fbbf24;
    --warn-soft: #2b2008;
    --danger: #f87171;
    --danger-soft: #2a1215;
    --ok-soft: #0b2a22;
    --info-soft: #10213f;
    --info: #93c5fd;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35), 0 2px 8px rgba(0, 0, 0, .25);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, .3), 0 10px 24px -6px rgba(0, 0, 0, .5);
    --shadow-lg: 0 4px 10px rgba(0, 0, 0, .3), 0 28px 56px -14px rgba(0, 0, 0, .65);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body.public, body.app {
  background:
    radial-gradient(1100px 520px at 12% -12%, var(--glow-a), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, var(--glow-b), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
main:focus { outline: none; }
h1, h2, h3 { font-family: var(--font-display); color: var(--ink); letter-spacing: -.02em; line-height: 1.15; margin: 0 0 .5rem; }
h1 { font-size: 1.9rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 650; }
h3 { font-size: 1.02rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
code, kbd { font-family: var(--mono); font-size: .86em; }
code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: .05rem .35rem; word-break: break-all; }
::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 1rem; top: -3rem; z-index: 100; padding: .5rem .9rem; border-radius: var(--r-sm); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-md); }
.skip-link:focus { top: .6rem; }
.eyebrow { margin: 0 0 .45rem; font-size: .74rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }
[hidden] { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 1rem;
  height: 60px; padding: 0 clamp(16px, 3vw, 32px);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
}
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; font: 700 1.08rem/1 var(--font-display); letter-spacing: -.02em; }
.brand img { width: 28px; height: 28px; border-radius: 8px; }
.brand-2 { color: var(--accent); }
.nav { margin-left: auto; display: flex; align-items: center; gap: .35rem; }
.nav-link { color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .94rem; padding: .45rem .7rem; border-radius: var(--r-sm); transition: background .15s, color .15s; display: inline-flex; align-items: center; gap: .4rem; }
.nav-link:hover, .nav-link[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
.app-nav { margin-left: 1.2rem; }
.user-chip .uname { max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu { margin-left: auto; display: flex; align-items: center; gap: .35rem; }
.user-menu form { margin: 0; }
.user-chip { display: inline-flex; align-items: center; gap: .5rem; padding: .25rem .6rem .25rem .25rem; border-radius: 999px; color: var(--ink-2); font-weight: 600; font-size: .9rem; text-decoration: none; }
.user-chip:hover { background: var(--surface-2); }

/* ---------- Buttons ---------- */
.btn {
  --b-bg: var(--surface); --b-fg: var(--ink); --b-line: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 38px; padding: .5rem 1rem; border-radius: 10px;
  border: 1px solid var(--b-line); background: var(--b-bg); color: var(--b-fg);
  font: 600 .93rem/1.2 var(--font); text-decoration: none; white-space: nowrap; cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), background .15s, border-color .15s, filter .15s;
}
.btn:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong)); transform: translateY(-1px); box-shadow: var(--shadow-sm); text-decoration: none; }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-xs); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { --b-fg: var(--on-grad); border-color: transparent; background: var(--grad); box-shadow: 0 1px 2px rgba(16, 35, 63, .12), 0 6px 16px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { --b-bg: transparent; --b-line: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; box-shadow: none; transform: none; }
.btn-danger { --b-fg: var(--danger); }
.btn-danger:hover { border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); background: var(--danger-soft); }
.btn-sm { min-height: 32px; padding: .35rem .75rem; font-size: .86rem; border-radius: 9px; }
.btn-lg { min-height: 48px; padding: .75rem 1.5rem; font-size: 1.02rem; border-radius: 12px; }
.btn-block { display: flex; width: 100%; }
.link-btn { border: 0; background: none; padding: .35rem .5rem; border-radius: 8px; color: var(--muted); font: 600 .88rem var(--font); cursor: pointer; }
.link-btn:hover { color: var(--ink); background: var(--surface-2); }

/* ---------- Forms ---------- */
label { display: grid; gap: .35rem; font-weight: 600; font-size: .9rem; color: var(--ink-2); }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=url], input[type=number], input[type=date], textarea, select {
  width: 100%; font: 400 .95rem/1.4 var(--font); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px;
  padding: .6rem .8rem; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 5rem; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 1rem; height: 1rem; margin: 0; }
label small, .hint { font-weight: 400; color: var(--muted); font-size: .84rem; }
.stack { display: grid; gap: 1rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field-row.three { grid-template-columns: 1fr 1fr 12rem; }
.inline-form { display: flex; align-items: flex-end; gap: .8rem; flex-wrap: wrap; }
.inline-form label { flex: 1 1 14rem; max-width: 22rem; }
.field-error { color: var(--danger); font-weight: 500; font-size: .85rem; }
.code-input { font-family: var(--mono) !important; letter-spacing: .3em; font-size: 1.2rem !important; text-align: center; }

/* ---------- Feedback ---------- */
.alert, .notice, .info { display: flex; gap: .6rem; align-items: flex-start; padding: .75rem .95rem; border-radius: var(--r); font-weight: 500; margin: 0 0 1rem; }
.alert { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent); }
.notice { background: var(--ok-soft); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent); }
.info { background: var(--info-soft); color: var(--info); border: 1px solid color-mix(in srgb, var(--info) 22%, transparent); }
.pill {
  display: inline-flex; align-items: center; gap: .35rem; padding: .14rem .55rem; border-radius: 999px;
  font-size: .76rem; font-weight: 700; letter-spacing: .01em; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap;
}
.pill.accent { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.pill.danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.pill.off { color: var(--muted); }
.status-dot { width: .6rem; height: .6rem; border-radius: 50%; display: inline-block; background: var(--muted); flex: none; }
.status-dot.online { background: #10b981; box-shadow: 0 0 0 3px color-mix(in srgb, #10b981 22%, transparent); }
.status-dot.away { background: #f59e0b; }
.status-dot.offline { background: var(--line-strong); }
.avatar {
  display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%;
  font: 700 .78rem/1 var(--font); color: #fff; letter-spacing: .02em;
  background: linear-gradient(135deg, #00a08b, #10233f);
}
.avatar.sm { width: 28px; height: 28px; font-size: .7rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 1.2rem 1.4rem; }

/* ---------- Page layout ---------- */
.page { width: min(1180px, 100%); margin: 0 auto; padding: 2.2rem clamp(16px, 3vw, 32px) 4rem; }
.page.narrow { width: min(760px, 100%); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.2rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.page-head h1 { margin: 0; font-size: 1.8rem; }
.page-head .sub { margin: .35rem 0 0; color: var(--muted); }
.page-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.section { margin-bottom: 1.2rem; }
.section h2 { font-size: 1.1rem; margin: 0 0 .8rem; }
.card-pad-title { padding: 1.1rem 1.4rem .2rem; }
.crumbs { margin: 0 0 .3rem; font-size: .86rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.tile { color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s var(--ease); }
.tile:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: var(--shadow-md); transform: translateY(-1px); text-decoration: none; }
.tile h2 { font-size: 1.05rem; margin: 0 0 .3rem; }
.tile p { margin: 0; }
.action-list { display: grid; }
.action-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 0; border-top: 1px solid var(--line); margin: 0; }
.action-row:first-child { border-top: 0; padding-top: 0; }
.action-row p { margin: .2rem 0 0; font-size: .88rem; }
.footer { border-top: 1px solid var(--line); padding: 1.6rem clamp(16px, 3vw, 32px); color: var(--muted); font-size: .88rem; }
.footer-inner { width: min(1180px, 100%); margin: 0 auto; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: center; }
.footer a { color: var(--muted); text-decoration: none; margin-left: 1rem; }
.footer a:hover { color: var(--ink); }
.footer .brand { font-size: .95rem; margin-left: 0; }
.footer .brand img { width: 22px; height: 22px; border-radius: 6px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: .6rem .9rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: .65rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }

/* ---------- Public: home ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: clamp(2rem, 5vw, 4rem); align-items: center; padding: clamp(2rem, 6vw, 4.5rem) 0 clamp(2rem, 5vw, 3.5rem); }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 750; letter-spacing: -.035em; line-height: 1.05; margin-bottom: 1.1rem; }
.lead { font-size: clamp(1.02rem, 1.6vw, 1.15rem); color: var(--muted); line-height: 1.6; max-width: 36rem; }
.hero .actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.6rem; }
.hero-points { display: flex; gap: 1.2rem; flex-wrap: wrap; margin: 1.5rem 0 0; padding: 0; list-style: none; color: var(--muted); font-size: .9rem; font-weight: 500; }
.hero-points li::before { content: "✓"; color: var(--ok); font-weight: 700; margin-right: .4rem; }
.chat-preview { width: min(380px, 100%); justify-self: center; border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); padding: 0 0 1rem; overflow: hidden; display: grid; gap: .6rem; }
.chat-preview-head { display: flex; align-items: center; gap: .55rem; padding: .9rem 1.1rem; font-weight: 700; color: #fff; background: var(--grad); }
.chat-preview-head .dot { width: .55rem; height: .55rem; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, .3); }
.chat-preview .bubble { max-width: 80%; padding: .55rem .8rem; border-radius: 14px; font-size: .92rem; margin: 0 1rem; }
.chat-preview .bubble.them { background: var(--surface-2); color: var(--ink); border-bottom-left-radius: 4px; }
.chat-preview .bubble.me { justify-self: end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.chat-preview-input { margin: .3rem 1rem 0; padding: .6rem .8rem; border-radius: 10px; border: 1px solid var(--line-strong); color: var(--muted); font-size: .9rem; }
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.1rem; margin: 1rem 0 3rem; }
.feature { padding: 1.5rem; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.feature h2 { font-size: 1.08rem; margin-bottom: .4rem; }
.feature p { margin: 0; color: var(--muted); }

/* ---------- Auth & message pages ---------- */
.auth { min-height: calc(100vh - 60px); display: grid; place-items: center; padding: 2.5rem 16px 4rem; }
.auth-card { width: min(440px, 100%); padding: 2.2rem 2rem; border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
.auth-card.wide { width: min(560px, 100%); }
.auth-card h1 { font-size: 1.6rem; }
.auth-card .sub { color: var(--muted); margin-bottom: 1.4rem; }
.auth-foot { margin: 1.3rem 0 0; padding-top: 1.1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.qr { display: grid; place-items: center; padding: 1rem; background: #fff; border-radius: var(--r); border: 1px solid var(--line); width: fit-content; margin: 0 auto 1rem; }
.qr svg { width: 200px; height: 200px; display: block; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem 1rem; font-family: var(--mono); font-size: 1rem; padding: 1rem; background: var(--surface-2); border-radius: var(--r); margin: 0 0 1rem; }

.steps { margin: 0 0 1.2rem; padding-left: 1.2rem; color: var(--ink-2); display: grid; gap: .45rem; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr; }
  .field-row, .field-row.three { grid-template-columns: 1fr; }
  .action-row { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 560px) {
  .hide-sm { display: none !important; }
  .page { padding-top: 1.4rem; }
  .auth-card { padding: 1.6rem 1.3rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Inbox ---------- */
body.inbox-page { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body.inbox-page main { flex: 1; min-height: 0; }
.status-control { display: inline-flex; align-items: center; gap: .45rem; margin: 0; font-weight: 600; }
.status-control select { width: auto; padding: .3rem 1.8rem .3rem .6rem; font-size: .88rem; }
.status-note { font-size: .82rem; color: var(--warn); }
.inbox { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; height: 100%; min-height: 0; }
.inbox-lists { border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto; padding: .8rem .8rem 2rem; }
.tabs { display: flex; gap: .3rem; padding: .2rem; background: var(--surface-2); border-radius: var(--r-sm); margin-bottom: .8rem; }
.tab { flex: 1; border: 0; background: transparent; border-radius: 6px; padding: .42rem .6rem; font: 600 .9rem var(--font); color: var(--ink-2); cursor: pointer; }
.tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs); }
.conn-note { margin: 0 0 .8rem; padding: .5rem .7rem; border-radius: var(--r-sm); background: var(--warn-soft); color: var(--warn); font-size: .85rem; }
.list-title { display: flex; align-items: center; gap: .45rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1rem .3rem .4rem; }
.count { display: inline-grid; place-items: center; min-width: 1.4rem; height: 1.4rem; padding: 0 .35rem; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); font-size: .74rem; letter-spacing: 0; }
.chat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .25rem; }
.chat-item { width: 100%; text-align: left; border: 1px solid transparent; background: transparent; border-radius: var(--r-sm); padding: .6rem .7rem; cursor: pointer; color: var(--ink); font: inherit; }
.chat-item:hover { background: var(--surface-2); }
.chat-item.current { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.chat-item-body { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.chat-item-top { display: flex; align-items: center; gap: .5rem; }
.chat-item-top strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item-time { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.chat-item-sub { font-size: .82rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.chat-item-preview { font-size: .85rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unread-badge { min-width: 1.35rem; height: 1.35rem; padding: 0 .35rem; border-radius: 999px; background: var(--danger); color: #fff; font-size: .74rem; font-weight: 700; display: inline-grid; place-items: center; }
.empty-note { margin: .3rem .7rem .6rem; color: var(--muted); font-size: .88rem; }
.closed-filter { display: flex; align-items: center; gap: .5rem; margin: 0 .3rem .8rem; font-weight: 600; }
.closed-filter select { width: auto; }

.inbox-chat { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.chat-empty { flex: 1; display: grid; place-items: center; color: var(--muted); padding: 2rem; text-align: center; }
.chat-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; padding: .9rem 1.2rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.chat-head-text { flex: 1; min-width: 0; }
.chat-head h1 { font-size: 1.25rem; margin: 0; }
.chat-head h1:focus { outline: none; }
.chat-head .sub { margin: .15rem 0 0; color: var(--muted); font-size: .88rem; }
.chat-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.chat-back { display: none; }
.chat-confirm { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .7rem 1.2rem; background: var(--danger-soft); border-bottom: 1px solid var(--line); }
.chat-confirm p { margin: 0 auto 0 0; font-weight: 600; }
.chat-view > .alert { margin: .8rem 1.2rem 0; }
.chat-details { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: 0; padding: .8rem 1.2rem; border-bottom: 1px solid var(--line); font-size: .88rem; }
.chat-details dt { color: var(--muted); font-weight: 600; }
.chat-details dd { margin: 0; overflow-wrap: anywhere; }
.thread { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 1rem 1.2rem; display: flex; flex-direction: column; gap: .7rem; }
.thread .msg { display: flex; flex-direction: column; max-width: min(80%, 640px); }
.thread .msg.visitor { align-self: flex-start; }
.thread .msg.staff { align-self: flex-end; align-items: flex-end; }
.thread .msg.notice { align-self: center; text-align: center; max-width: 90%; }
.thread .bubble { padding: .55rem .85rem; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.thread .msg.visitor .bubble { background: var(--surface-2); border-bottom-left-radius: 4px; }
.thread .msg.staff .bubble { background: var(--surface-3); border-bottom-right-radius: 4px; }
.thread .msg.staff.me .bubble { background: var(--accent); color: var(--accent-ink); }
.thread .msg.staff.me .bubble a { color: inherit; }
.thread .msg.notice .bubble { background: transparent; color: var(--muted); font-size: .86rem; padding: 0 .5rem; }
.thread .meta { font-size: .76rem; color: var(--muted); margin-top: .2rem; }
.thread .meta .failed { color: var(--danger); }
.typing-note { margin: 0; padding: 0 1.2rem; min-height: 1.4em; font-size: .85rem; color: var(--muted); }
.chat-composer { display: flex; gap: .6rem; align-items: flex-end; padding: .8rem 1.2rem 1rem; border-top: 1px solid var(--line); background: var(--surface); }
.chat-composer textarea { flex: 1; min-height: 2.8rem; max-height: 10rem; resize: vertical; }
.readonly-note { margin: 0; padding: .8rem 1.2rem 1rem; border-top: 1px solid var(--line); }

@media (max-width: 760px) {
  .inbox { grid-template-columns: 1fr; }
  .inbox-lists { border-right: 0; }
  .inbox .inbox-chat { display: none; }
  .inbox.show-chat .inbox-lists { display: none; }
  .inbox.show-chat .inbox-chat { display: flex; }
  .chat-back { display: inline-flex; }
  .status-control select { padding-right: 1.4rem; }
}

/* Inbox: transfer requests, release and assignment */
.inbox-notice { margin: 0 0 .8rem; padding: .5rem .7rem; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--ink); font-size: .85rem; }
.chat-item-note { font-size: .8rem; color: var(--warn); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-offer { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .7rem 1.2rem; background: var(--warn-soft); border-bottom: 1px solid var(--line); }
.chat-offer-text { flex: 1; min-width: 12rem; }
.chat-offer-text p { margin: 0; }
.chat-offer-text p:first-child { font-weight: 600; }
.offer-note { margin-top: .2rem !important; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-2); }
.field-help { display: block; margin-top: .35rem; color: var(--muted); font-size: .84rem; font-weight: 400; }
.snippet { margin: 0; padding: .8rem 1rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.snippet code { background: none; border: 0; padding: 0; font-size: .86rem; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .9rem 1rem; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.2rem; margin: 0; }
.details dt { color: var(--muted); font-weight: 600; }
.details dd { margin: 0; overflow-wrap: anywhere; }
.block { display: block; }
.card-pad-note { padding: 0 1.4rem .6rem; margin: 0; }
.review-thread { padding-bottom: 1.4rem; }
.live-updated { margin: 0 0 .8rem; }
.report-period { font-size: 1.15rem; margin: 1.6rem 0 .8rem; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.stat { display: flex; flex-direction: column; gap: .2rem; }
.stat-value { font-size: 1.9rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: .88rem; font-weight: 500; }
.report-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; align-items: start; }
.report-columns .section { margin-bottom: 0; }
code.secret { word-break: break-all; user-select: all; }
.tab-count { display: inline-grid; place-items: center; min-width: 1.3rem; height: 1.3rem; padding: 0 .3rem; margin-left: .2rem; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .72rem; }
.tab-count[hidden] { display: none; }
.message-body { flex: 1; min-height: 0; overflow-y: auto; }
.message-text { margin: 0; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.message-body .thread { flex: none; overflow: visible; }
.message-chat-title { margin: 1rem 1.2rem 0; }
.countdown { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.chat-hand { display: flex; flex-direction: column; gap: .6rem; padding: .8rem 1.2rem; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.chat-hand .hand-title { margin: 0; font-size: 1rem; }
.chat-hand label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; max-width: 36rem; }
.chat-hand label[hidden] { display: none; }
.chat-hand textarea { resize: vertical; }
.hand-actions { display: flex; gap: .5rem; }
.handover-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.handover-list li { display: flex; flex-direction: column; }
.handover-note { color: var(--ink-2); white-space: pre-wrap; }
