/* Synapse support. Same tokens as the store and the launcher: graphite
   surfaces, hairline borders as the only structure, one light accent for the
   single primary action, hover scales instead of lifting. No coloured badges:
   a state is a word with a small monochrome mark next to it. The staff panel
   is a work tool and denser than the player pages. */
:root {
  --font: "Outfit", system-ui, "Segoe UI", sans-serif;
  --bg-0: #0d0d16;
  --bg-1: #11111c;
  --bg-2: #151521;
  --bg-3: #1c1c28;
  --bg-4: #232331;
  --border: #262633;
  --border-hover: #383846;
  --text: #f5f5f7;
  --text-dim: #a0a0aa;
  --text-muted: #6f6f7a;
  --accent: #e5e5ea;
  --accent-hover: #ffffff;
  --on-accent: #14141c;
  --danger: #e5767c;
  --ok: #5ec79a;
  --note: #d9b26a;
  --radius: 10px;
  --radius-lg: 14px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg-0); }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(1200px 520px at 50% -240px, rgba(255, 255, 255, 0.045), transparent 70%), var(--bg-0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, textarea, select { font-family: inherit; }
h1, h2, h3 { text-wrap: balance; }
@keyframes appear { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.topbar-wrap {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(13, 13, 22, 0.8);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
}
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 1440px; margin: 0 auto; padding: 14px 32px; }
body.app-mode .topbar, body.app-mode .tabs-inner { max-width: 1760px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: 17px; }
.brand-sub { font-weight: 400; color: var(--text-muted); padding-left: 10px; border-left: 1px solid var(--border); }
.site-nav { display: flex; gap: 22px; margin-left: auto; margin-right: 8px; font-size: 14px; color: var(--text-dim); }
.site-nav a { text-decoration: none; transition: color 0.2s var(--ease-out); }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); }
@media (max-width: 760px) { .site-nav { display: none; } }
.top-actions { display: flex; align-items: center; gap: 10px; min-width: 0; }
.discord-icon { flex: none; }
.user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; height: 40px; padding: 0 6px; border: 1px solid var(--border); border-radius: 9999px; background: var(--bg-1); }
.user-chip img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; }
.user-name { display: grid; line-height: 1.15; min-width: 0; }
.user-name span { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.user-name small { font-size: 11px; color: var(--text-muted); }
.link-btn { border: 0; background: none; padding: 6px 10px; border-radius: 9999px; font: 400 13px var(--font); color: var(--text-muted); cursor: pointer; transition: color 0.25s var(--ease-out), background-color 0.25s var(--ease-out); }
.link-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
@media (max-width: 520px) { .user-name { display: none; } }

.tabs-bar { border-top: 1px solid var(--border); }
.tabs-inner { display: flex; align-items: center; gap: 4px; max-width: 1440px; margin: 0 auto; padding: 0 22px; overflow-x: auto; scrollbar-width: none; }
.tabs-inner::-webkit-scrollbar { display: none; }
.tabs-inner a { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 12px 10px; font-size: 14px; color: var(--text-dim); text-decoration: none; white-space: nowrap; transition: color 0.2s var(--ease-out); }
.tabs-inner a:hover, .tabs-inner a.active { color: var(--text); }
.tabs-inner a.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.tabs-gap { flex: 1; }
.count { min-width: 18px; padding: 1px 6px; border-radius: 6px; font-size: 12px; font-weight: 500; text-align: center; background: var(--bg-4); color: var(--text); font-variant-numeric: tabular-nums; }

/* ── Page frame ──────────────────────────────────────────────────────────── */
main { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 0 32px 72px; }
main.wide { max-width: 1760px; padding-bottom: 20px; }
@media (max-width: 640px) { main { padding: 0 16px 56px; } .topbar { padding: 12px 16px; } }
.page { animation: appear 0.45s var(--ease-out) backwards; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 40px 0 26px; }
.page-head h1 { margin: 0; font-size: clamp(28px, 3.2vw, 38px); font-weight: 600; letter-spacing: -0.02em; }
.page-head p { margin: 10px 0 0; color: var(--text-dim); font-size: 16px; line-height: 1.6; max-width: 70ch; }
.step { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 500; color: var(--text-muted); }
.crumbs { display: flex; align-items: center; gap: 8px; padding-top: 30px; font-size: 13px; color: var(--text-muted); }
.crumbs a { text-decoration: none; transition: color 0.2s var(--ease-out); }
.crumbs a:hover { color: var(--text); }
.crumbs + .page-head { padding-top: 10px; }

/* Main column and a narrower aside, on the reading pages. */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 40px; align-items: start; }
@media (max-width: 920px) { .layout { grid-template-columns: 1fr; gap: 28px; } }
.aside { display: grid; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-1); position: sticky; top: 132px; }
@media (max-width: 920px) { .aside { position: static; } }
.aside-block { padding: 18px 20px; }
.aside-block + .aside-block { border-top: 1px solid var(--border); }
.aside-block h3 { margin: 0 0 12px; font-size: 13px; font-weight: 500; color: var(--text-muted); }
.aside-block p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text-dim); }
.aside-block .btn { width: 100%; }
.points { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.points li { position: relative; padding-left: 16px; font-size: 14px; line-height: 1.55; color: var(--text-dim); overflow-wrap: anywhere; }
.points li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 5px; height: 5px; border-radius: 1px; background: var(--text-muted); }

.section-title { display: flex; align-items: baseline; gap: 10px; margin: 36px 0 12px; font-size: 16px; font-weight: 600; }
.section-title:first-child { margin-top: 0; }
.section-title small { font-size: 13px; font-weight: 400; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ── Status marks ────────────────────────────────────────────────────────── */
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-dim); white-space: nowrap; }
.status svg { flex: none; }
.status.strong { color: var(--text); font-weight: 500; }
.status.quiet { color: var(--text-muted); }
.status.ok { color: var(--ok); font-weight: 500; }
.status.bad { color: var(--danger); font-weight: 500; }
.flags { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--text-muted); }
.flags span { white-space: nowrap; }
.flags .hot { color: var(--danger); }
.flags .gold { color: var(--note); }

/* ── Landing (signed out) ────────────────────────────────────────────────── */
.intro { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 56px; align-items: start; padding: 72px 0 40px; }
@media (max-width: 920px) { .intro { grid-template-columns: 1fr; gap: 36px; padding-top: 48px; } }
.intro h1 { margin: 0 0 16px; font-size: clamp(34px, 4.6vw, 48px); font-weight: 600; letter-spacing: -0.025em; line-height: 1.06; }
.intro > div > p { margin: 0; max-width: 50ch; color: var(--text-dim); font-size: 16px; line-height: 1.65; }
.intro .actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 28px; }
.topic-list { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-1); overflow: hidden; }
.topic-list header { padding: 14px 18px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }
.topic-list div { padding: 13px 18px; display: grid; gap: 3px; }
.topic-list div + div { border-top: 1px solid var(--border); }
.topic-list strong { font-size: 14px; font-weight: 500; }
.topic-list span { font-size: 13px; color: var(--text-dim); }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 8px 0 0; }
@media (max-width: 920px) { .facts { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .facts { grid-template-columns: 1fr; } }
.facts div { padding: 22px 22px 22px 0; }
.facts dt { font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.facts dd { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text-dim); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: 500 14px var(--font);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transform: translateZ(0);
  transition: transform 0.35s var(--ease-out), background-color 0.25s var(--ease-out), border-color 0.25s var(--ease-out), color 0.25s var(--ease-out), opacity 0.25s;
}
.btn:hover { transform: translateZ(0) scale(1.02); }
.btn:active { transform: translateZ(0) scale(0.98); transition-duration: 0.1s; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: rgba(255, 255, 255, 0.015); border-color: var(--border); color: var(--text); }
.btn.ghost:hover { border-color: var(--border-hover); background: rgba(255, 255, 255, 0.045); }
.btn.ghost.danger { color: var(--danger); }
.btn.small { height: 34px; padding: 0 12px; font-size: 13px; }
.btn.big { height: 50px; padding: 0 26px; font-size: 15px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn:disabled:hover, .btn:disabled:active { transform: translateZ(0); }
.btn:focus-visible, .icon-close:focus-visible, .link-btn:focus-visible, .tabs-inner a:focus-visible, .row:focus-visible, .topic:focus-visible, .chip:focus-visible, .icon-btn:focus-visible {
  outline: 2px solid var(--border-hover);
  outline-offset: 2px;
}
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border); background: transparent; color: var(--text-dim); cursor: pointer; transform: translateZ(0); transition: color 0.2s, border-color 0.2s, background-color 0.2s, transform 0.3s var(--ease-out); }
.icon-btn:hover { color: var(--text); border-color: var(--border-hover); transform: translateZ(0) scale(1.04); }
.icon-btn[aria-pressed="true"] { color: var(--note); border-color: rgba(217, 178, 106, 0.45); }

/* ── Tables (lists of tickets and applications) ──────────────────────────── */
.table { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-1); overflow: hidden; }
.thead, .row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 190px 120px; gap: 16px; align-items: center; padding: 0 18px; }
.table.apps .thead, .table.apps .row { grid-template-columns: minmax(0, 1fr) 140px 160px; }
.thead { height: 40px; font-size: 12px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.thead span:last-child { text-align: right; }
.row { min-height: 64px; padding-top: 12px; padding-bottom: 12px; text-decoration: none; transition: background-color 0.2s var(--ease-out); }
.row + .row { border-top: 1px solid var(--border); }
a.row:hover { background: rgba(255, 255, 255, 0.025); }
.cell-num { font-size: 14px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.cell-main { min-width: 0; }
.cell-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; }
.cell-sub { margin-top: 3px; font-size: 13px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-time { font-size: 13px; color: var(--text-muted); text-align: right; white-space: nowrap; }
.unread { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
@media (max-width: 720px) {
  .thead { display: none; }
  .row, .table.apps .row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; }
  .row .cell-num { display: none; }
  .row .status { grid-column: 1; }
  .row .cell-time { grid-row: 1; grid-column: 2; }
}

.empty { display: grid; justify-items: start; gap: 8px; padding: 28px; border: 1px dashed var(--border); border-radius: var(--radius-lg); color: var(--text-dim); }
.empty h3 { margin: 0; color: var(--text); font-size: 16px; font-weight: 600; }
.empty p { margin: 0; max-width: 56ch; line-height: 1.6; font-size: 14px; }
.empty .btn { margin-top: 8px; }
.skeleton { height: 64px; background: linear-gradient(100deg, var(--bg-1) 30%, var(--bg-2) 50%, var(--bg-1) 70%) 0 0 / 300% 100%; animation: shimmer 1.8s linear infinite; }
@keyframes shimmer { to { background-position: -150% 0; } }

/* ── Topic and application lists ─────────────────────────────────────────── */
.topics { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-1); overflow: hidden; }
.topic { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 18px 20px; text-decoration: none; transition: background-color 0.2s var(--ease-out); }
.topic + .topic { border-top: 1px solid var(--border); }
a.topic:hover { background: rgba(255, 255, 255, 0.025); }
.topic h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.topic p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--text-dim); }
.topic .side { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.chev { color: var(--text-muted); transition: transform 0.35s var(--ease-out), color 0.2s; }
a.topic:hover .chev { transform: translateX(3px); color: var(--text); }

.apply-type { padding: 24px; display: flex; flex-direction: column; gap: 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-1); }
.apply-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
@media (max-width: 1080px) { .apply-grid { grid-template-columns: 1fr; } }
.apply-type .apply-foot { margin-top: auto; }
.apply-type h3 { margin: 0; font-size: 17px; font-weight: 600; }
.apply-type > p { margin: 0; color: var(--text-dim); font-size: 14px; line-height: 1.6; }
.apply-type .label { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.apply-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding-top: 4px; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form { display: grid; gap: 22px; }
.form-card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-1); padding: 24px; display: grid; gap: 22px; }
.field { display: grid; gap: 8px; }
.field label, .field .label { font-size: 15px; font-weight: 500; }
.field .opt { color: var(--text-muted); font-weight: 400; }
.field .hint { font-size: 12px; color: var(--text-muted); display: flex; justify-content: space-between; gap: 10px; min-height: 16px; }
.input, .textarea, .select { width: 100%; padding: 13px 15px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-0); color: var(--text); font-size: 14px; line-height: 1.55; transition: border-color 0.2s var(--ease-out); }
.textarea { min-height: 128px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:hover, .textarea:hover, .select:hover { border-color: var(--border-hover); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: #55556a; }
.select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a0a0aa' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.form-error { margin: 0; padding: 13px 16px; border-radius: var(--radius); border: 1px solid rgba(229, 118, 124, 0.45); background: rgba(229, 118, 124, 0.08); color: #f3b3b6; font-size: 14px; line-height: 1.5; }
.form-error a { color: var(--text); text-underline-offset: 3px; }
.form-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--text-dim); font-size: 14px; }
.small-muted { font-size: 13px; color: var(--text-muted); }
.check { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

.drop { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px dashed var(--border-hover); border-radius: var(--radius); color: var(--text-dim); font-size: 13px; line-height: 1.5; cursor: pointer; transition: border-color 0.2s, background-color 0.2s; }
.drop:hover, .drop.over { border-color: var(--text-muted); background: rgba(255, 255, 255, 0.02); }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs:empty { display: none; }
.thumb { position: relative; width: 76px; height: 76px; border-radius: 9px; overflow: hidden; border: 1px solid var(--border); background: var(--bg-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.loading::after { content: ""; position: absolute; inset: 0; background: rgba(13, 13, 22, 0.6); }
.thumb button { position: absolute; top: 4px; right: 4px; display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 50%; background: rgba(13, 13, 22, 0.85); color: var(--text); cursor: pointer; }

/* ── Conversation ────────────────────────────────────────────────────────── */
.ticket-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -0.015em; }
.ticket-title .num { color: var(--text-muted); font-weight: 500; }
.thread { display: flex; flex-direction: column; gap: 2px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-1); min-height: 200px; }
.msg { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 8px 10px; border-radius: 10px; transition: background-color 0.2s; animation: fade-in 0.35s var(--ease-out); }
.msg:hover { background: rgba(255, 255, 255, 0.018); }
.msg.cont { padding-top: 0; }
.msg.cont .avatar { visibility: hidden; height: 0; }
.msg.cont .msg-head { display: none; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--bg-3); flex: none; }
.avatar.letter { display: grid; place-items: center; font-size: 14px; font-weight: 600; color: var(--text-dim); }
.msg-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 3px; }
.msg-head strong { font-size: 14px; font-weight: 600; }
.msg-head .role { font-size: 12px; color: var(--text-dim); }
.msg-head time, .msg-head .edited { font-size: 12px; color: var(--text-muted); }
.msg-text { font-size: 15px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; color: #e6e6ec; }
.msg-text a { color: var(--text); text-decoration: underline; text-decoration-color: var(--text-muted); text-underline-offset: 3px; }
.msg.internal { background: rgba(217, 178, 106, 0.045); box-shadow: inset 2px 0 0 var(--note); border-radius: 0 10px 10px 0; margin: 4px 0; }
.msg.internal .role { color: var(--note); }
.msg-tools { display: none; gap: 2px; margin-left: auto; }
.msg:hover .msg-tools { display: flex; }
.msg-tools button { border: 0; background: none; color: var(--text-muted); font: 400 12px var(--font); cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.msg-tools button:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.sys { display: flex; align-items: center; gap: 12px; margin: 10px 0; color: var(--text-muted); font-size: 12px; }
.sys::before, .sys::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.sys.internal { color: var(--note); }
.sys span { max-width: 72%; text-align: center; line-height: 1.5; }
.shots { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.shot { width: 168px; height: 112px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--bg-2); cursor: zoom-in; padding: 0; }
.shot img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease-out); }
.shot:hover img { transform: scale(1.04); }

.composer { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-1); transition: border-color 0.2s, box-shadow 0.2s; }
.composer:focus-within { border-color: var(--border-hover); }
.composer.note { box-shadow: inset 2px 0 0 var(--note); }
.composer textarea { width: 100%; min-height: 64px; max-height: 320px; resize: none; border: 0; background: transparent; color: var(--text); font-size: 14px; line-height: 1.55; padding: 4px 2px; }
.composer textarea:focus { outline: none; }
.composer textarea::placeholder { color: var(--text-muted); }
.composer-bar { display: flex; align-items: center; gap: 8px; }
.composer-bar .hint { margin-right: auto; font-size: 12px; color: var(--text-muted); }
@media (hover: none), (max-width: 640px) { .composer-bar .hint { visibility: hidden; } }
.closed-note { padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-1); color: var(--text-dim); font-size: 14px; line-height: 1.6; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.closed-note strong { color: var(--text); font-weight: 500; }
.stack { display: grid; gap: 14px; }

.kv { display: grid; gap: 9px; margin: 0; font-size: 13px; }
.kv > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; color: var(--text); }
.answers { display: grid; gap: 14px; margin: 0; }
.answers dt { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.answers dd { margin: 0; font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Quick replies: a small menu above the composer. */
.menu-wrap { position: relative; }
.menu { position: absolute; bottom: calc(100% + 8px); right: 0; z-index: 10; width: 280px; max-height: 320px; overflow-y: auto; padding: 6px; border: 1px solid var(--border-hover); border-radius: 12px; background: var(--bg-3); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45); animation: appear 0.25s var(--ease-out); }
.menu button { display: grid; gap: 2px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); text-align: left; cursor: pointer; font: 500 13px var(--font); }
.menu button small { font-weight: 400; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu button:hover, .menu button:focus-visible { background: rgba(255, 255, 255, 0.06); outline: none; }

/* ── Staff panel ─────────────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 18px 0 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-1); overflow: hidden; }
.stat { padding: 14px 18px; min-width: 0; }
.stat + .stat { border-left: 1px solid var(--border); }
.stat dt { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat dd { margin: 4px 0 0; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat dd small { font-size: 12px; font-weight: 400; color: var(--text-muted); margin-left: 6px; }
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat:nth-child(4) { border-left: 0; }
  .stat:nth-child(n + 4) { border-top: 1px solid var(--border); }
}
@media (max-width: 600px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(odd) { border-left: 0; }
  .stat:nth-child(4) { border-left: 1px solid var(--border); }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--border); }
}

.panel { display: grid; grid-template-columns: 380px minmax(0, 1fr) 340px; height: calc(100vh - 222px); min-height: 560px; margin-top: 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-1); overflow: hidden; }
.panel.two { grid-template-columns: 380px minmax(0, 1fr); height: calc(100vh - 128px); margin-top: 18px; }
.pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.pane + .pane { border-left: 1px solid var(--border); }
.pane-head { padding: 14px; border-bottom: 1px solid var(--border); display: grid; gap: 10px; }
.pane-scroll { flex: 1; overflow-y: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--bg-4) transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: var(--text-dim); font: 500 12px var(--font); cursor: pointer; transition: color 0.2s, border-color 0.2s, background-color 0.2s; }
.chip:hover { color: var(--text); border-color: var(--border-hover); }
.chip.active { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.chip .n { font-variant-numeric: tabular-nums; opacity: 0.7; }
.filters { display: grid; grid-template-columns: 1fr 130px; gap: 8px; }
.filters .input, .filters .select { padding: 8px 12px; font-size: 13px; }
.filters .select { padding-right: 30px; background-position: right 10px center; }
.list-foot { padding: 10px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }

.t-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 10px; padding: 13px 14px; border-bottom: 1px solid var(--border); text-decoration: none; position: relative; transition: background-color 0.2s; }
.t-item:hover { background: rgba(255, 255, 255, 0.025); }
.t-item.active { background: var(--bg-3); }
.t-item.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--accent); }
.t-top { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; font-weight: 500; }
.t-top .avatar { width: 22px; height: 22px; font-size: 11px; }
.t-top span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-time { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.t-sub { grid-column: 1 / -1; font-size: 13px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-meta { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.t-meta .status { font-size: 12px; }
.t-num { color: var(--text-muted); font-variant-numeric: tabular-nums; font-weight: 400; }

.detail-head { padding: 16px 18px; border-bottom: 1px solid var(--border); display: grid; gap: 10px; }
.detail-head h2 { margin: 0; font-size: 18px; font-weight: 600; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 13px; color: var(--text-dim); }
.who { display: inline-flex; align-items: center; gap: 8px; }
.who .avatar { width: 22px; height: 22px; font-size: 11px; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px; display: grid; align-content: start; gap: 14px; scrollbar-width: thin; scrollbar-color: var(--bg-4) transparent; }
.detail-body .thread { border: 0; background: transparent; padding: 0; min-height: 0; }
.detail-foot { padding: 12px 18px 16px; border-top: 1px solid var(--border); }
.detail-foot .composer { background: var(--bg-2); }
.placeholder { flex: 1; display: grid; place-items: center; align-content: center; gap: 6px; text-align: center; color: var(--text-muted); font-size: 14px; padding: 24px; }
.placeholder strong { color: var(--text-dim); font-weight: 500; }
.answers-box { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-2); }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 12px 12px 0; border: 1px solid var(--border); border-radius: 10px; }
.seg button { height: 30px; border: 0; border-radius: 7px; background: none; color: var(--text-dim); font: 500 13px var(--font); cursor: pointer; transition: background-color 0.2s, color 0.2s; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--bg-4); color: var(--text); }
.file { padding: 16px; display: grid; gap: 22px; align-content: start; }
.file h3 { margin: 0 0 10px; font-size: 13px; font-weight: 500; color: var(--text-muted); }
.mini { display: grid; gap: 6px; font-size: 13px; }
.mini > * { padding: 9px 11px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--border); line-height: 1.45; text-decoration: none; display: block; }
.mini a { transition: border-color 0.2s; }
.mini a:hover { border-color: var(--border-hover); }
.mini small { display: block; color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 1px solid var(--border); display: grid; gap: 14px; }
.timeline li { position: relative; font-size: 13px; line-height: 1.45; }
.timeline li::before { content: ""; position: absolute; left: -18px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--bg-1); border: 1px solid var(--text-muted); }
.timeline small { display: block; color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.copy { border: 0; background: none; color: inherit; font: inherit; padding: 0; cursor: copy; text-decoration: underline dotted var(--text-muted); text-underline-offset: 3px; text-align: left; overflow-wrap: anywhere; }

.qa { display: grid; gap: 12px; margin: 0; }
.qa > div { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-2); }
.qa dt { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.qa dd { margin: 0; font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.note { padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: inset 2px 0 0 var(--note); background: var(--bg-2); color: var(--text); font-size: 13px; line-height: 1.55; }

@media (max-width: 1180px) {
  .panel { grid-template-columns: 300px minmax(0, 1fr); }
  .panel > .pane.file-pane { display: none; }
  .panel .file-inline { display: block; }
}
.file-inline { display: none; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-2); }
@media (max-width: 820px) {
  .panel, .panel.two { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .panel.has-detail > .pane.list-pane { display: none; }
  .panel:not(.has-detail) > .pane.detail-pane { display: none; }
  .pane + .pane { border-left: 0; }
  .pane-scroll, .detail-body { overflow: visible; }
  .mobile-back { display: inline-flex !important; }
}
.mobile-back { display: none !important; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; max-width: 1376px; width: calc(100% - 64px); margin: 0 auto; padding: 28px 0 36px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 13px; }
.footer p { margin: 0; }
.footer nav { display: flex; gap: 20px; }
.footer a { text-decoration: none; transition: color 0.25s var(--ease-out); }
.footer a:hover { color: var(--text); }
body.app-mode .footer { display: none; }

/* ── Dialog, lightbox, toasts ────────────────────────────────────────────── */
.sheet { width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-1); color: var(--text); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); }
.sheet[open] { animation: sheet-in 0.4s var(--ease-out); }
.sheet::backdrop { background: rgba(5, 5, 10, 0.62); backdrop-filter: blur(4px); animation: fade-in 0.3s var(--ease-out); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 20px 22px 8px; }
.sheet-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.sheet-body { padding: 6px 22px; display: grid; gap: 14px; }
.sheet-body p { margin: 0; color: var(--text-dim); font-size: 14px; line-height: 1.6; }
.sheet-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px 20px; }
.icon-close { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%; border: 1px solid var(--border); background: transparent; color: var(--text-dim); cursor: pointer; transition: transform 0.3s var(--ease-out), color 0.2s, border-color 0.2s; }
.icon-close:hover { transform: scale(1.04); color: var(--text); border-color: var(--border-hover); }
.lightbox { padding: 0; border: 0; background: transparent; max-width: 94vw; max-height: 92vh; overflow: visible; }
.lightbox::backdrop { background: rgba(5, 5, 10, 0.86); }
.lightbox img { max-width: 94vw; max-height: 92vh; border-radius: 10px; object-fit: contain; }
.lightbox .icon-close { position: fixed; top: 16px; right: 16px; background: rgba(13, 13, 22, 0.8); }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 50; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }
.toast { padding: 12px 16px; border-radius: 12px; border: 1px solid var(--border-hover); background: var(--bg-3); color: var(--text); font-size: 14px; line-height: 1.5; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.4); animation: appear 0.35s var(--ease-out); }
.toast.bad { border-color: rgba(229, 118, 124, 0.55); box-shadow: inset 3px 0 0 var(--danger), 0 14px 40px rgba(0, 0, 0, 0.4); }
.toast.ok { border-color: rgba(94, 199, 154, 0.5); box-shadow: inset 3px 0 0 var(--ok), 0 14px 40px rgba(0, 0, 0, 0.4); }

/* ── Notices: one line that says what is going on, in plain words ───────── */
.notice { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--bg-1); font-size: 15px; line-height: 1.55; color: var(--text); }
.notice svg { flex: none; margin-top: 3px; }
.notice p { margin: 0; }
.notice small { display: block; margin-top: 2px; font-size: 13px; color: var(--text-dim); }
.notice.ok { border-color: rgba(94, 199, 154, 0.4); background: rgba(94, 199, 154, 0.07); }
.notice.ok svg { color: var(--ok); }
.notice.bad { border-color: rgba(229, 118, 124, 0.45); background: rgba(229, 118, 124, 0.07); }
.notice.bad svg { color: var(--danger); }
.notice.wait svg { color: var(--text-dim); }

/* ── Home and the big choices ────────────────────────────────────────────── */
.hello { padding: 48px 0 28px; }
.hello h1 { margin: 0; font-size: clamp(30px, 3.6vw, 42px); font-weight: 600; letter-spacing: -0.02em; }
.hello p { margin: 10px 0 0; font-size: 17px; color: var(--text-dim); }
.big-choices, .choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1080px) { .big-choices, .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .big-choices, .choices { grid-template-columns: 1fr; } }
.choice { position: relative; display: flex; flex-direction: column; gap: 8px; min-height: 172px; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-1); text-decoration: none; transform: translateZ(0); transition: border-color 0.25s var(--ease-out), background-color 0.25s var(--ease-out), transform 0.4s var(--ease-out); }
a.choice:hover { border-color: var(--border-hover); background: var(--bg-2); transform: translateZ(0) scale(1.012); }
.choice h2, .choice h3 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.choice p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--text-dim); }
.choice .examples { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.choice .go { margin-top: auto; padding-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; font-weight: 500; }
.choice .go .chev { color: var(--text-dim); }
a.choice:hover .go .chev { transform: translateX(3px); color: var(--text); }
.choice.main { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.choice.main p, .choice.main .go .chev { color: #3a3a46; }
a.choice.main:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.choice .note-line { font-size: 13px; color: var(--text-dim); }

.how { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-1); }
.how div { padding: 18px 22px; }
.how div + div { border-left: 1px solid var(--border); }
.how b { display: block; font-size: 13px; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }
.how span { font-size: 15px; line-height: 1.5; }
@media (max-width: 760px) { .how { grid-template-columns: 1fr; } .how div + div { border-left: 0; border-top: 1px solid var(--border); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── Who else is on a ticket ─────────────────────────────────────────────── */
.viewers { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--note); }
.viewers::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--note); flex: none; }
.viewers.typing::before { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.viewing { font-size: 12px; color: var(--note); }

/* ── Team statistics ─────────────────────────────────────────────────────── */
.scroll-x { overflow-x: auto; border-radius: var(--radius-lg); }
.table.team { min-width: 860px; }
.table.team .thead, .table.team .row { grid-template-columns: minmax(0, 1.7fr) repeat(6, minmax(0, 1fr)); }
.table.team .thead span:not(:first-child), .table.team .row > span { text-align: right; }
.table.team .row > span { font-size: 14px; font-variant-numeric: tabular-nums; }
.table.team .row > span.dim { color: var(--text-muted); }
.member { display: grid; gap: 2px; min-width: 0; }
.member strong { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member small { font-size: 12px; color: var(--text-muted); }
.member small .warn { color: var(--note); }
.filters-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }

/* ── Quick reply editor ──────────────────────────────────────────────────── */
.reply-list { display: grid; gap: 12px; }
.reply-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 16px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-1); }
.reply-row .fields { display: grid; gap: 10px; }
.reply-row .tools { display: flex; flex-direction: column; gap: 6px; }
.reply-row .textarea { min-height: 88px; }
.save-bar { position: sticky; bottom: 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; padding: 12px 14px; border: 1px solid var(--border-hover); border-radius: var(--radius-lg); background: rgba(21, 21, 33, 0.92); backdrop-filter: blur(10px); }
.save-bar .small-muted { margin-right: auto; }
.save-bar .dirty { color: var(--note); }
@media (max-width: 640px) { .reply-row { grid-template-columns: 1fr; } .reply-row .tools { flex-direction: row; } }
