/* Atlantic Squared IT Team Helpdesk
   Type: Jost (geometric, kin to the logo lettering) for display + identifiers,
         Source Sans 3 for reading.
   Signature: the logo's open-bottomed square, used for ticket numbers and the
              active nav marker. Everything else stays quiet. */

:root {
  color-scheme: light;
  --atlantic: #123b4c;
  --atlantic-2: #1a4e63;
  --atlantic-ink: #c9d6dc;
  --brand-gray: #a0a1a5;
  --paper: #eef2f4;
  --surface: #ffffff;
  --surface-2: #f6f8f9;
  --ink: #1c2b33;
  --muted: #5e6c75;
  --faint: #8a979f;
  --line: #d9dfe3;
  --line-soft: #e8ecef;
  --sea: #17706e;
  --sea-hover: #125d5b;
  --sea-soft: #dcefee;
  --signal: #c8642a;
  --signal-soft: #fbe9dd;
  --note: #8a6a12;
  --note-soft: #fbf3dc;
  --bad: #b3372b;
  --bad-soft: #f8e1de;

  --s-open: #2f6fa3;       --s-open-bg: #e2eef8;
  --s-progress: #8c6100;   --s-progress-bg: #f9eccd;
  --s-waiting: #6c5a9e;    --s-waiting-bg: #ece8f6;
  --s-resolved: #2e7d4f;   --s-resolved-bg: #dff0e5;
  --s-closed: #66727a;     --s-closed-bg: #e6eaed;

  --display: 'Jost', 'Futura', 'Century Gothic', 'Avenir Next', sans-serif;
  --text: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --r-sm: 4px;
  --r: 7px;
  --shadow-pop: 0 10px 30px rgba(18, 59, 76, .16), 0 2px 6px rgba(18, 59, 76, .08);
  --rail-w: 236px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --atlantic: #0b2733; --atlantic-2: #133847; --atlantic-ink: #a9bcc5;
    --paper: #111d23; --surface: #17252c; --surface-2: #1c2c34;
    --ink: #e3eaee; --muted: #9aaab3; --faint: #73848d;
    --line: #2b3d46; --line-soft: #233440;
    --sea: #3fb3ae; --sea-hover: #5cc6c1; --sea-soft: #173d3e;
    --signal: #ec8a4e; --signal-soft: #3d2618;
    --note: #e1c46a; --note-soft: #33291a;
    --bad: #ef7b6f; --bad-soft: #3c1f1c;
    --s-open: #7fb5e3; --s-open-bg: #1b3446;
    --s-progress: #e3bb5c; --s-progress-bg: #3a2f14;
    --s-waiting: #b3a5e3; --s-waiting-bg: #2c2843;
    --s-resolved: #7fcf9c; --s-resolved-bg: #193624;
    --s-closed: #a3afb6; --s-closed-bg: #26343b;
    --shadow-pop: 0 10px 30px rgba(0, 0, 0, .45);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--text); }
a { color: var(--sea); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--sea-hover); }
h1, h2, h3 { font-family: var(--display); font-weight: 500; letter-spacing: .005em; margin: 0; }
h1 { font-size: 1.75rem; line-height: 1.2; }
h2 { font-size: 1.05rem; }
code, .mono { font-family: var(--mono); font-size: .86em; }
code { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 3px; padding: 0 .3em; }
kbd { font: 500 .72rem var(--display); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 .4em; color: var(--faint); }
:focus-visible { outline: 2px solid var(--sea); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -3px; }
.ic.xs { width: 14px; height: 14px; vertical-align: -2px; }

/* ── Shell ─────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; }
.rail { background: var(--atlantic); color: var(--atlantic-ink); display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 11px; color: #fff; text-decoration: none; padding: 2px 6px 20px; }
.brand:hover { color: #fff; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font: 500 .98rem var(--display); letter-spacing: .14em; text-transform: uppercase; }
.brand-sub { font-size: .8rem; color: var(--atlantic-ink); }
.new-btn { display: flex; align-items: center; gap: 8px; justify-content: center; margin: 0 4px 18px; padding: 9px 12px; border-radius: var(--r); background: #fff; color: var(--atlantic); font: 500 .95rem var(--display); text-decoration: none; }
.new-btn:hover { background: #e6f1f1; color: var(--atlantic); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 12px 8px 14px; border-radius: var(--r-sm); color: var(--atlantic-ink); text-decoration: none; font-size: .96rem; }
.nav a:hover { background: var(--atlantic-2); color: #fff; }
.nav a.on { color: #fff; background: var(--atlantic-2); }
/* the notch: the logo's open-bottomed square, marking where you are */
.nav a.on::before, .nav a.on::after { content: ''; position: absolute; right: 12px; top: 50%; width: 9px; }
.nav a.on::before { height: 9px; margin-top: -5px; border: 2px solid #fff; border-bottom: 0; }
.nav a.on::after { height: 2px; margin-top: 4px; background: linear-gradient(to right, #fff 0 33%, transparent 33% 67%, #fff 67%); }
.me { margin-top: auto; display: flex; align-items: center; gap: 6px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.1); }
.me-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: #fff; text-decoration: none; padding: 6px; border-radius: var(--r-sm); }
.me-link:hover { background: var(--atlantic-2); color: #fff; }
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.me-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: .92rem; }
.me-sub { font-size: .78rem; color: var(--atlantic-ink); }
.main { padding: 26px 34px 60px; min-width: 0; }
.banner { margin: -26px -34px 22px; padding: 9px 34px; font-size: .9rem; }
.banner.warn { background: var(--signal-soft); color: var(--ink); border-bottom: 1px solid color-mix(in srgb, var(--signal) 30%, transparent); }

/* ── Primitives ─────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 .92rem var(--text); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--faint); color: var(--ink); }
.btn.primary { background: var(--sea); border-color: var(--sea); color: #fff; }
.btn.primary:hover { background: var(--sea-hover); border-color: var(--sea-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.small { padding: 4px 10px; font-size: .85rem; }
.btn.wide { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .55; cursor: progress; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-sm); border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.small { width: 28px; height: 28px; }
.ghost-light { color: var(--atlantic-ink); }
.ghost-light:hover { background: var(--atlantic-2); color: #fff; }

.avatar { --h: 190; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; flex: none; font: 500 .78rem/1 var(--display); letter-spacing: .03em;
  background: hsl(var(--h) 38% 88%); color: hsl(var(--h) 45% 26%); }
.avatar.sm { width: 26px; height: 26px; font-size: .7rem; }
.avatar.xs { width: 22px; height: 22px; font-size: .62rem; }
@media (prefers-color-scheme: dark) { .avatar { background: hsl(var(--h) 25% 26%); color: hsl(var(--h) 45% 84%); } }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.s-open { background: var(--s-open-bg); color: var(--s-open); }
.s-in_progress { background: var(--s-progress-bg); color: var(--s-progress); }
.s-waiting { background: var(--s-waiting-bg); color: var(--s-waiting); }
.s-resolved { background: var(--s-resolved-bg); color: var(--s-resolved); }
.s-closed { background: var(--s-closed-bg); color: var(--s-closed); }

/* Ticket number in the notched square */
.tkt { position: relative; display: inline-block; padding: 3px 8px 4px; font: 500 .84rem/1.2 var(--display); letter-spacing: .1em; color: var(--atlantic); text-decoration: none; font-variant-numeric: tabular-nums;
  border: 1.5px solid var(--brand-gray); border-bottom: 0; }
.tkt::before, .tkt::after { content: ''; position: absolute; bottom: 0; height: 1.5px; background: var(--brand-gray); width: calc(50% - 4px); }
.tkt::before { left: -1.5px; } .tkt::after { right: -1.5px; }
a.tkt:hover { color: var(--sea); border-color: var(--sea); }
a.tkt:hover::before, a.tkt:hover::after { background: var(--sea); }
.tkt.lg { font-size: 1.05rem; padding: 6px 12px 7px; border-width: 2px; }
.tkt.lg::before, .tkt.lg::after { height: 2px; width: calc(50% - 6px); }
.tkt.lg::before { left: -2px; } .tkt.lg::after { right: -2px; }
.tkt.sm { font-size: .72rem; padding: 1px 5px 2px; }
@media (prefers-color-scheme: dark) { .tkt { color: #d7e3e8; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; }
.card h2 { margin-bottom: 12px; }
.card.flush { padding: 0; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; min-width: 0; }
.field > span { font-size: .84rem; color: var(--muted); font-weight: 600; }
.field em { font-weight: 400; font-style: normal; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; }
textarea { resize: vertical; min-height: 90px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sea); box-shadow: 0 0 0 3px var(--sea-soft); }
select { appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235e6c75' stroke-width='2'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-row.three { grid-template-columns: repeat(3, 1fr); }
.form-foot { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 4px; }
.form-error { background: var(--bad-soft); color: var(--bad); padding: 9px 12px; border-radius: var(--r-sm); margin: 0 0 14px; }
.flash { display: flex; align-items: center; gap: 8px; background: var(--sea-soft); color: var(--sea-hover); padding: 9px 14px; border-radius: var(--r-sm); margin: 0 0 18px; font-weight: 600; }
.hint { font-size: .84rem; color: var(--muted); margin: 4px 0 0; }

/* ── Page head & queue ──────────────────────────────────── */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head.narrow { max-width: 760px; }
.lede { margin: 6px 0 0; color: var(--muted); max-width: 70ch; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: .9rem; margin-bottom: 6px; }
.back:hover { color: var(--sea); }
.search { position: relative; display: flex; align-items: center; width: min(420px, 100%); }
.search .ic { position: absolute; left: 11px; color: var(--faint); }
.search input { padding-left: 36px !important; padding-right: 34px !important; height: 40px; }
.search kbd { position: absolute; right: 10px; }

.tabs-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.status-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.status-tabs a { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .92rem; }
.status-tabs a:hover { background: var(--surface); color: var(--ink); }
.status-tabs a.on { background: var(--atlantic); color: #fff; }
.status-tabs .n { font: 500 .78rem var(--display); color: var(--faint); font-variant-numeric: tabular-nums; }
.status-tabs a.on .n { color: var(--atlantic-ink); }

.volume { position: relative; }
.volume > summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; padding: 6px 12px; border-radius: var(--r-sm); color: var(--muted); font-size: .9rem; }
.volume > summary::-webkit-details-marker { display: none; }
.volume > summary:hover, .volume[open] > summary { background: var(--surface); color: var(--ink); }
.vol-nums b { color: var(--ink); font-family: var(--display); font-weight: 500; }
.volume-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: min(640px, 90vw); display: grid; grid-template-columns: 1fr 1fr; gap: 22px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-pop); }
.volume-pop h3 { display: flex; justify-content: space-between; font-size: .95rem; margin-bottom: 10px; color: var(--muted); }
.volume-pop h3 span { color: var(--ink); font-size: 1.3rem; line-height: 1; }
.vol-cat > summary { list-style: none; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 5px 0; cursor: pointer; font-size: .9rem; }
.vol-cat > summary::-webkit-details-marker { display: none; }
.vol-cat .bar { grid-column: 1 / -1; order: 3; height: 4px; width: var(--w); background: var(--sea-soft); border-radius: 2px; }
.vol-cat[open] .bar, .vol-cat > summary:hover .bar { background: var(--sea); }
.vc-n { font-family: var(--display); font-variant-numeric: tabular-nums; }
.vol-cat ul { list-style: none; margin: 2px 0 8px; padding: 0 0 0 12px; border-left: 2px solid var(--line-soft); }
.vol-cat li { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); padding: 1px 0; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.filters .sel select { width: auto; min-width: 150px; padding-top: 6px; padding-bottom: 6px; font-size: .9rem; background-color: var(--surface); }
.filters.tight { margin: 0; }
.filters .clear { font-size: .9rem; margin-left: 4px; }
.counts-note { margin: -4px 0 12px; }

.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; }
.table-wrap.flat { border: 0; border-radius: 0; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font: 500 .82rem var(--display); letter-spacing: .02em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
th a.sort { color: inherit; text-decoration: none; }
th a.sort:hover { color: var(--ink); }
th a.sort.on { color: var(--ink); }
th a.sort + a.sort { margin-left: 8px; color: var(--faint); }
th a.sort.on::after { content: ' ↓'; } th a.sort.on.asc::after { content: ' ↑'; }

.tickets tbody tr { cursor: pointer; transition: background .12s; }
.tickets tbody tr:hover { background: var(--surface-2); }
.tickets tr.is-urgent td:first-child { box-shadow: inset 3px 0 0 var(--signal); }
.tickets .c-num { width: 1%; padding-right: 4px; }
.tickets td.c-subject { width: 100%; max-width: 0; }
.tickets .subject { color: var(--ink); text-decoration: none; font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tickets tr:hover .subject { color: var(--sea); }
.sub-line { display: flex; gap: 10px; align-items: center; margin-top: 2px; font-size: .86rem; color: var(--muted); flex-wrap: wrap; }
.mb { font-size: .8rem; color: var(--faint); display: inline-flex; gap: 4px; align-items: center; }
.waiting-on-us { color: var(--signal); font-weight: 600; font-size: .8rem; }
.c-status { white-space: nowrap; }
.c-status .pri { display: inline-block; margin-top: 5px; font-size: .8rem; }
.pri { font-size: .88rem; color: var(--faint); }
.pri.p-high { color: var(--signal); font-weight: 600; }
.pri.p-urgent { color: #fff; background: var(--signal); padding: 1px 8px; border-radius: 3px; font-weight: 600; }
.c-cat { font-size: .9rem; color: var(--muted); white-space: nowrap; }
.who { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-size: .92rem; }
.c-when { white-space: nowrap; font-size: .88rem; color: var(--muted); width: 1%; }
.counts { display: flex; gap: 10px; margin-top: 2px; color: var(--faint); font-size: .8rem; }
.counts span { display: inline-flex; gap: 3px; align-items: center; }
tr.row-new { animation: newrow 2.4s ease-out; }
@keyframes newrow { from { background: var(--sea-soft); } to { background: transparent; } }

.empty { text-align: center; padding: 42px 16px; color: var(--muted); }
.empty img { opacity: .5; margin-bottom: 8px; }
.empty-title { font: 500 1.1rem var(--display); color: var(--ink); margin: 0 0 4px; }
.empty p { margin: 0; }
.empty-row:hover { background: transparent !important; cursor: default !important; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 16px; color: var(--muted); font-size: .9rem; }

/* ── Ticket ─────────────────────────────────────────────── */
.ticket-head { display: grid; grid-template-columns: 1fr auto; gap: 4px 20px; margin-bottom: 22px; }
.ticket-head .back { grid-column: 1 / -1; }
.th-title { display: flex; gap: 16px; align-items: center; min-width: 0; }
.th-title h1 { font-size: 1.6rem; overflow-wrap: anywhere; }
.th-meta { grid-column: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin: 10px 0 0; font-size: .92rem; }
.th-meta .who { white-space: normal; }
.th-meta a { color: var(--muted); }
.th-action { grid-row: 2 / span 2; grid-column: 2; align-self: start; }

.ticket-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 26px; align-items: start; }
.timeline { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tl-controls { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .88rem; }
.switch { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.timeline.hide-activity .act { display: none; }

.msg { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.msg > header { display: flex; gap: 11px; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.msg-from { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 0 10px; align-items: baseline; line-height: 1.35; }
.msg-from .addr { color: var(--muted); font-size: .88rem; }
.recips { flex-basis: 100%; color: var(--faint); font-size: .82rem; overflow-wrap: anywhere; }
.msg > header time { color: var(--faint); font-size: .85rem; white-space: nowrap; }
.kind { display: inline-flex; gap: 4px; align-items: center; font-size: .8rem; font-weight: 600; padding: 0 7px; border-radius: 3px; }
.agent-kind { background: var(--sea-soft); color: var(--sea); }
.note-kind { color: var(--note); }
.m-agent { border-left: 3px solid var(--sea); }
.m-note { background: var(--note-soft); border-color: color-mix(in srgb, var(--note) 30%, transparent); border-style: dashed; }
.m-note > header { border-bottom-color: color-mix(in srgb, var(--note) 20%, transparent); }
.msg.is-failed { border-color: var(--bad); }
.send-failed, .send-pending { margin: 0; padding: 7px 16px; font-size: .86rem; background: var(--bad-soft); color: var(--bad); display: flex; gap: 6px; align-items: center; }
.send-pending { background: var(--surface-2); color: var(--muted); }
.msg-body { padding: 14px 16px; }
.m-note .msg-body, .text-body { overflow-wrap: anywhere; }
.mail-frame { display: block; width: 100%; border: 0; height: 120px; background: #fff; border-radius: 3px; }
.expand-frame { margin-top: 8px; border: 0; background: none; color: var(--sea); font: 600 .88rem var(--text); cursor: pointer; padding: 0; }
.msg-files { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 14px; align-items: flex-start; }
.file { display: inline-flex; align-items: center; gap: 8px; max-width: 280px; padding: 6px 10px 6px 6px; border: 1px solid var(--line); border-radius: var(--r-sm); text-decoration: none; color: var(--ink); background: var(--surface-2); font-size: .88rem; }
.file:hover { border-color: var(--sea); color: var(--ink); }
.file img { width: 34px; height: 34px; object-fit: cover; border-radius: 3px; }
.file .ic { margin-left: 4px; color: var(--muted); }
.fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fsize { color: var(--faint); font-size: .8rem; white-space: nowrap; }
.inline-imgs { flex-basis: 100%; font-size: .86rem; color: var(--muted); }
.inline-imgs > summary { cursor: pointer; display: inline-flex; gap: 5px; align-items: center; }
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.thumbs a { display: block; border: 1px solid var(--line); border-radius: 3px; padding: 3px; background: #fff; }
.thumbs img { display: block; height: 52px; max-width: 120px; object-fit: contain; }

.act { display: grid; grid-template-columns: 18px 1fr auto; gap: 10px; align-items: baseline; padding: 0 16px 0 20px; color: var(--muted); font-size: .88rem; position: relative; }
.act .ic { width: 15px; height: 15px; color: var(--faint); align-self: center; }
.act p { margin: 0; }
.act b { color: var(--ink); font-weight: 600; }
.act time { color: var(--faint); font-size: .82rem; white-space: nowrap; }

.composer { margin-top: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.comp-tabs { display: flex; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.comp-tabs button { display: inline-flex; align-items: center; gap: 7px; border: 0; background: none; padding: 11px 16px; font: 600 .92rem var(--text); color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.comp-tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--sea); background: var(--surface); }
.comp-tabs button[data-tab=note][aria-selected=true] { border-bottom-color: var(--note); }
.comp-pane { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.comp-pane[data-pane=note] { background: var(--note-soft); }
.comp-to { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: .92rem; }
.comp-to > span:first-child { color: var(--faint); }
.inline-check { margin-left: auto; display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: .88rem; cursor: pointer; }
.comp-cc { font-size: .9rem; }
.comp-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.comp-foot .btn:last-child { margin-left: auto; }
.after { display: inline-flex; gap: 8px; align-items: center; font-size: .88rem; color: var(--muted); }
.after select { width: auto; padding: 4px 28px 4px 8px; font-size: .88rem; }
.attach { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: .9rem; cursor: pointer; position: relative; }
.attach:hover { color: var(--sea); }
.attach input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.comp-error { margin: 0; color: var(--bad); font-weight: 600; font-size: .9rem; }
.note-btn { background: var(--note); border-color: var(--note); color: #fff; }
.note-btn:hover { filter: brightness(.92); color: #fff; }
@media (prefers-color-scheme: dark) { .note-btn { color: #1b1606; } }

.props { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 14px; }
.props .card { padding: 16px 18px; }
.props .field { margin-bottom: 11px; }
.props details > summary { list-style: none; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.props details > summary::-webkit-details-marker { display: none; }
.props details > summary h2 { margin: 0; }
.props details[open] > summary { margin-bottom: 12px; }
.props details > summary .ic { color: var(--faint); }
.status-select { font-weight: 600; }
.status-select.s-open { color: var(--s-open); } .status-select.s-in_progress { color: var(--s-progress); }
.status-select.s-waiting { color: var(--s-waiting); } .status-select.s-resolved { color: var(--s-resolved); } .status-select.s-closed { color: var(--s-closed); }
.status-select { background-color: var(--surface) !important; }
.saving { opacity: .6; }
.count { font-size: .85rem; color: var(--faint); margin-left: 4px; }
.att-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.att-list li { display: flex; align-items: center; gap: 4px; }
.att-list li > a:first-child { flex: 1; display: flex; gap: 10px; align-items: center; text-decoration: none; color: var(--ink); padding: 4px; border-radius: var(--r-sm); min-width: 0; }
.att-list li > a:first-child:hover { background: var(--surface-2); }
.att-list img, .att-list .ext { width: 36px; height: 36px; border-radius: 3px; object-fit: cover; flex: none; }
.att-list .ext { display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); font: 500 .66rem var(--display); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.att-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.att-meta { font-size: .78rem; color: var(--faint); }
.props .inline-imgs { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.danger { background: transparent; border-style: dashed; text-align: center; padding: 10px; }
.danger-btn { color: var(--bad) !important; }
.danger-btn:hover { background: var(--bad-soft) !important; }

/* ── Mail log / settings ───────────────────────────────── */
.outcome { display: inline-block; font-size: .82rem; font-weight: 600; padding: 1px 8px; border-radius: 3px; white-space: nowrap; }
.outcome.t-good { background: var(--sea-soft); color: var(--sea); }
.outcome.t-muted { background: var(--s-closed-bg); color: var(--s-closed); }
.outcome.t-warn { background: var(--s-progress-bg); color: var(--s-progress); }
.outcome.t-bad { background: var(--bad-soft); color: var(--bad); }
.log td { font-size: .92rem; }
.log .c-subject { max-width: 420px; overflow-wrap: anywhere; }
.log .c-from { max-width: 240px; overflow-wrap: anywhere; }
.log .c-why { color: var(--muted); max-width: 300px; }
.log .c-subject .tkt { margin-left: 4px; }
.details-cell { max-width: 520px; overflow-wrap: anywhere; }

.sub-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin: -6px 0 20px; }
.sub-tabs a { padding: 8px 0; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.sub-tabs a:hover { color: var(--ink); }
.sub-tabs a.on { color: var(--ink); border-bottom-color: var(--atlantic); }
.split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; margin: 18px 0 22px; }
.test-result { margin: 12px 0 0; padding: 9px 12px; border-radius: var(--r-sm); font-weight: 600; }
.test-result.exempt { background: var(--s-closed-bg); color: var(--ink); }
.test-result.ticket { background: var(--sea-soft); color: var(--sea-hover); }
.rules td { vertical-align: middle; }
.rule-field { font-weight: 600; }
.rules code { white-space: pre-wrap; }
.rules .num { font-family: var(--display); font-variant-numeric: tabular-nums; }
tr.paused td, .person-form.paused { opacity: .55; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; align-items: center; white-space: nowrap; }
.edit-rule { position: relative; }
.edit-rule > summary { list-style: none; }
.edit-rule > summary::-webkit-details-marker { display: none; }
.edit-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 10; width: 360px; display: flex; flex-direction: column; gap: 8px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-pop); }
.edit-pop .field-row { gap: 8px; }

.mailbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin: 18px 0; }
.mailbox h2 { display: flex; gap: 8px; align-items: center; font-size: 1rem; overflow-wrap: anywhere; }
.mb-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(86px, 1fr)); gap: 10px; margin: 0 0 6px; }
.mb-stats div { display: flex; flex-direction: column-reverse; }
.mb-stats dt { font-size: .78rem; color: var(--muted); }
.mb-stats dd { margin: 0; font: 500 1.4rem/1.1 var(--display); font-variant-numeric: tabular-nums; }
.mb-stats .bad dd, .mb-stats .bad a { color: var(--bad); }
.subs { list-style: none; margin: 12px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 6px; font-size: .86rem; }
.subs li { display: grid; grid-template-columns: 10px 84px 1fr; gap: 8px; align-items: baseline; color: var(--muted); }
.subs b { color: var(--ink); font-weight: 600; }
.subs .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--s-resolved); align-self: center; }
.subs .bad .dot { background: var(--bad); }
.subs .bad span:last-child { color: var(--bad); }
.actions-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 22px; }
.subs-table tr.legacy { background: var(--s-waiting-bg); }

.add-person { margin-bottom: 16px; }
.add-person > summary { list-style: none; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.add-person > summary::-webkit-details-marker { display: none; }
.add-person > summary h2 { margin: 0; }
.add-person[open] > summary { margin-bottom: 14px; }
.add-person .form-foot { grid-column: 1 / -1; }
.people-head, .person-form { display: grid; grid-template-columns: minmax(160px, 1.1fr) minmax(190px, 1.4fr) minmax(90px, .6fr) 145px 285px 80px 60px; gap: 10px; align-items: center; padding: 8px 14px; }
.people-head { font: 500 .82rem var(--display); color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); border-radius: var(--r) var(--r) 0 0; }
.person-form { border-bottom: 1px solid var(--line-soft); }
.person-form:last-child { border-bottom: 0; }
.person-form input:not([type=checkbox]), .person-form select { padding: 5px 8px; font-size: .9rem; border-color: transparent; background-color: transparent; }
.person-form input:not([type=checkbox]):hover, .person-form select:hover { border-color: var(--line); }
.p-name { display: flex; gap: 8px; align-items: center; }
.p-name input { font-weight: 600; }
.checks { display: flex; gap: 12px; font-size: .88rem; }
.checks label { display: inline-flex; gap: 5px; align-items: center; cursor: pointer; }
.sound-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.sound-opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; }
.sound-opt:hover { background: var(--surface-2); }
.sound-opt span { flex: 1; }
.form-card { max-width: 760px; }
.error-page { text-align: center; max-width: 460px; margin: 12vh auto 0; }
.error-page img { opacity: .55; }
.error-page h1 { margin: 14px 0 8px; }
.error-page p { color: var(--muted); margin: 0 0 20px; }

/* ── Toasts & lightbox ─────────────────────────────────── */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { display: flex; gap: 10px; align-items: center; background: var(--atlantic); color: #fff; padding: 11px 16px; border-radius: var(--r); box-shadow: var(--shadow-pop); font-size: .92rem; max-width: 380px; animation: toast-in .2s ease-out; }
.toast.bad { background: var(--bad); }
.toast a { color: #fff; font-weight: 600; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
.lightbox { border: 0; padding: 0; background: transparent; max-width: 94vw; max-height: 94vh; }
.lightbox::backdrop { background: rgba(10, 30, 40, .82); }
.lightbox img { display: block; max-width: 92vw; max-height: 82vh; margin: 0 auto; background: #fff; border-radius: 4px; }
.lb-bar { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 10px; color: #fff; }
.lb-close { position: fixed; top: 16px; right: 16px; color: #fff; }
.lb-close:hover { background: rgba(255,255,255,.12); color: #fff; }
dialog.confirm { border: 1px solid var(--line); border-radius: var(--r); padding: 22px; max-width: 420px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); }
dialog.confirm::backdrop { background: rgba(10, 30, 40, .5); }
dialog.confirm p { margin: 0 0 18px; }
dialog.confirm .form-foot { margin: 0; }

/* ── Login ─────────────────────────────────────────────── */
.login-body { background: var(--atlantic); min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login { position: relative; width: min(420px, 100%); }
/* the mark, oversized and cropped behind the card */
.login-mark { position: fixed; right: -14vmin; bottom: -14vmin; width: 70vmin; height: 70vmin; border: 9vmin solid rgba(255,255,255,.05); border-bottom: 0; pointer-events: none; }
.login-mark::before, .login-mark::after { content: ''; position: absolute; bottom: 0; height: 9vmin; width: calc(50% + 9vmin - 1.6vmin); background: rgba(255,255,255,.05); }
.login-mark::before { left: -9vmin; } .login-mark::after { right: -9vmin; }
.login-card { position: relative; background: var(--surface); border-radius: 10px; padding: 34px 32px 28px; box-shadow: 0 30px 80px rgba(0,0,0,.35); text-align: center; }
.login-logo { max-width: 100%; height: auto; margin-bottom: 18px; }
.login-card h1 { font-size: 1.15rem; color: var(--muted); font-weight: 400; margin-bottom: 26px; letter-spacing: .04em; }
.login-card .field { text-align: left; }
.btn.ms { padding: 11px 16px; font-size: 1rem; gap: 10px; }
.login-card .small { margin: 14px 0 0; }
@media (prefers-color-scheme: dark) { .login-logo { filter: brightness(1.4); } }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 1180px) {
  .ticket-grid { grid-template-columns: 1fr; }
  .props { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .tickets .c-cat { display: none; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: sticky; top: 0; z-index: 30; height: auto; flex-direction: row; align-items: center; padding: 8px 12px; gap: 8px; overflow-x: auto; }
  .brand { padding: 0; } .brand-text { display: none; }
  .new-btn { margin: 0; padding: 7px 10px; font-size: .88rem; }
  .nav { flex-direction: row; }
  .nav a span { display: none; }
  .nav a { padding: 8px 10px; }
  .nav a.on::before, .nav a.on::after { display: none; }
  .nav a.on { box-shadow: inset 0 -2px 0 #fff; }
  .me { margin: 0 0 0 auto; border: 0; padding: 0; }
  .me-text { display: none; }
  .main { padding: 18px 14px 50px; }
  .banner { margin: -18px -14px 16px; padding: 9px 14px; }
  .split, .field-row, .field-row.three, .volume-pop { grid-template-columns: 1fr; }
  .tickets .c-status, .tickets .c-who { display: none; }
  .ticket-head { grid-template-columns: 1fr; }
  .th-action { grid-row: auto; grid-column: 1; }
  .people-head { display: none; }
  .person-form { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ── Review fixes ── */
.log .c-when .mb { display: block; margin-top: 2px; }
.log .c-from { min-width: 210px; overflow-wrap: anywhere; }
.log .c-subject { min-width: 240px; }
.mb-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mb-stats dt { line-height: 1.25; }
.subs li { grid-template-columns: 8px 78px 1fr; align-items: start; }
.subs .dot { align-self: start; margin-top: 7px; }
@media (max-width: 860px) {
  .tickets thead { display: none; }
  .tickets tbody tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 10px; padding: 12px; border-bottom: 1px solid var(--line-soft); }
  .tickets td { padding: 0; border: 0; }
  .tickets td.c-subject { max-width: none; width: auto; }
  .tickets .subject { white-space: normal; }
  .tickets .c-status { display: block; grid-column: 2; }
  .tickets .c-when { grid-column: 3; grid-row: 1; text-align: right; }
  .msg > header { flex-wrap: wrap; }
  .msg > header time { order: -1; flex-basis: 100%; text-align: right; margin-bottom: -22px; }
}

.fwd-by { display: inline-flex; gap: 5px; align-items: center; font-size: .86rem; color: var(--sea); font-weight: 600; }
.comp-opts { margin-left: auto; display: inline-flex; gap: 16px; flex-wrap: wrap; }
.comp-opts .inline-check { margin-left: 0; }
