/* Herald's look for herald.hexwork.co.uk and transcripts (layout_herald.php): Hexwork's brand red (#C8102E) and link
   pink (#FF4D6A) on near-black (#09070A), Syne for headings, Geist for text. Standalone, phone first: everything works
   at 320px. The folded-ribbon mark sits on black, so it is drawn with mix-blend-mode: screen to melt into the page. */
:root {
  color-scheme: dark;
  --link: #FF4D6A;
  --link-hi: #FF7A90;
  --red: #C8102E;
  --red-deep: #A50D26;
  --ink: #F6F1F3;
  --muted: #ABA0A6;
  --paper: #09070A;
  --card: #110E13;
  --raised: #19141B;
  --sunk: #0B090D;
  --rule: #2A222C;
  --rule-strong: #43374A;
  --tint: rgba(255, 77, 106, 0.12);
  --bad: #FF6B6B;
  --ok: #4ADE80;
  --warn: #FBBF24;
  --note: #F5B942;
  --note-bg: rgba(245, 185, 66, 0.07);
  --note-line: rgba(245, 185, 66, 0.45);
  --display: "Syne", "Arial Black", system-ui, sans-serif;
  --body: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --focus: 0 0 0 2px var(--paper), 0 0 0 4px var(--link);
  --radius: 12px;
  --hex: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 1rem/1.55 var(--body); color: var(--ink); background: var(--paper); }
img, svg { max-width: 100%; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--link-hi); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: 1.1; letter-spacing: -0.01em; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.7rem, 5vw, 2.4rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
code, .mono { font-family: var(--mono); font-size: 0.88em; }
code { background: var(--raised); border: 1px solid var(--rule); border-radius: 6px; padding: 1px 6px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 20; padding: 8px 12px; background: var(--raised); color: var(--ink); border-radius: 8px; }
.skip:focus { top: 8px; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.fine { font-size: 0.86rem; color: var(--muted); }
.table-scroll { width: 100%; overflow-x: auto; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 20px; border: 1px solid var(--rule-strong); border-radius: 999px; background: var(--raised); color: var(--ink); font: 600 1rem/1.2 var(--body); text-decoration: none; cursor: pointer; transition: background 0.15s, border-color 0.15s, box-shadow 0.2s, transform 0.15s; white-space: nowrap; }
.btn:hover { background: #241C27; border-color: #5C4C63; color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn[disabled], fieldset[disabled] .btn { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 0 0 1px rgba(255, 77, 106, 0.3), 0 10px 30px -10px rgba(200, 16, 46, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
.btn-primary:hover { background: var(--red-deep); border-color: var(--red-deep); color: #fff; }
.btn-quiet { background: transparent; }
.btn-small { min-height: 36px; padding: 6px 14px; font-size: 0.92rem; }
.btn-big { min-height: 52px; padding: 12px 26px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-danger { background: transparent; border-color: rgba(255, 107, 107, 0.55); color: var(--bad); }
.btn-danger:hover { background: rgba(255, 107, 107, 0.1); border-color: var(--bad); color: var(--bad); }
.btn-danger-solid { background: #D92D3A; border-color: #D92D3A; color: #fff; }
.btn-note { background: var(--note-bg); border-color: var(--note-line); color: var(--note); }
.btn-note:hover { background: rgba(245, 185, 66, 0.14); border-color: var(--note); color: var(--note); }
.btn-discord { background: #5865F2; border-color: #5865F2; color: #fff; }
.btn-discord:hover { background: #4752C4; border-color: #4752C4; color: #fff; }
.bws-dmark { width: 20px; height: 20px; flex-shrink: 0; }
.btn-small .bws-dmark { width: 17px; height: 17px; }

/* ---- Forms ---- */
label { display: block; font-weight: 600; font-size: 0.92rem; margin: 14px 0 6px; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--sunk); border: 1px solid var(--rule-strong); border-radius: 10px; padding: 10px 12px; min-height: 44px; transition: border-color 0.15s, box-shadow 0.15s; }
textarea { resize: vertical; line-height: 1.5; }
input:hover, select:hover, textarea:hover { border-color: #5C4C63; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--link); box-shadow: 0 0 0 3px rgba(255, 77, 106, 0.22); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
input[type="checkbox"], input[type="radio"] { width: 20px; min-height: 20px; height: 20px; accent-color: var(--red); flex-shrink: 0; }
select option { background: var(--card); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset[disabled] input, fieldset[disabled] select, fieldset[disabled] textarea { opacity: 0.7; }
.hd-check { display: flex; align-items: center; gap: 10px; font-weight: 500; margin: 12px 0; }
.hd-form-row { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 640px) { .hd-form-row { grid-template-columns: 1fr 1fr; } }
.hd-form .btn { margin-top: 16px; }

/* ---- Cards, pills, messages, tables ---- */
.hd-card { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px 16px; margin: 0 0 16px; }
@media (min-width: 640px) { .hd-card { padding: 22px; } }
.hd-card > h2:first-child { margin-top: 0; }
.hd-card h2:not(:first-child), .hd-card h3:not(:first-child) { margin-top: 26px; }
.adm-pill { display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 10px 0 9px; border: 1px solid var(--rule-strong); border-radius: 999px; color: var(--muted); font: 600 0.75rem/1 var(--body); white-space: nowrap; }
.flash { padding: 12px 14px; margin: 0 0 16px; background: var(--card); border: 1px solid var(--rule); border-left: 3px solid var(--link); border-radius: 10px; }
.flash-error { border-left-color: var(--bad); }
.flash-ok { border-left-color: var(--ok); }
.list { width: 100%; border-collapse: collapse; }
.list th, .list td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.list thead th { font-size: 0.72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.hd-count { display: inline-block; vertical-align: middle; margin-left: 6px; padding: 2px 10px; border-radius: 999px; background: var(--raised); border: 1px solid var(--rule); color: var(--muted); font: 600 0.8rem/1.5 var(--body); letter-spacing: 0; }
.hd-limit { padding: 12px 14px; border: 1px dashed var(--rule-strong); border-radius: 10px; color: var(--muted); }

/* ---- The in-page confirm dialog (dialog.js) ---- */
.hx-dialog { border: 1px solid var(--rule-strong); border-radius: 16px; background: var(--raised); color: var(--ink); padding: 0; width: min(440px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7); }
.hx-dialog::backdrop { background: rgba(4, 3, 6, 0.75); backdrop-filter: blur(3px); }
.hx-dlg-body { padding: 22px 20px 18px; margin: 0; }
.hx-dlg-title { font: 800 1.15rem/1.3 var(--display); margin: 0 0 8px; }
.hx-dlg-text { color: var(--muted); margin: 0 0 10px; }
.hx-dlg-err { color: var(--bad); font-size: 0.9rem; min-height: 1.2em; margin: 0; }
.hx-dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* ---- The frame ---- */
.hd { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(1100px 520px at 50% -160px, rgba(200, 16, 46, 0.16), transparent 70%), var(--paper); }
.hd-top { position: sticky; top: 0; z-index: 5; background: rgba(9, 7, 10, 0.86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); }
.hd-top-in, .hd-desk-in { max-width: 1240px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hd-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 800 1.35rem/1 var(--display); letter-spacing: -0.02em; }
.hd-brand img { width: 34px; height: 34px; mix-blend-mode: screen; border-radius: 6px; }
.hd-brand b { color: var(--red); font-weight: 800; }
.hd-brand:hover { color: var(--ink); }
.hd-nav { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hd-nav-link { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.95rem; padding: 6px 4px; }
.hd-nav-link.is-here { color: var(--link); }
.hd-me { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.hd-me img, .hd-me-init { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; }
.hd-me-init { display: inline-grid; place-items: center; background: var(--raised); border: 1px solid var(--rule-strong); font-weight: 700; font-size: 0.85rem; }
.hd-me-name { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.92rem; }
.hd-signout { margin: 0; }
@media (max-width: 600px) { .hd-me-name, .hd-nav-link { display: none; } }
.hd-desk-bar { border-top: 1px solid var(--rule); }
.hd-desk-in { padding-top: 0; padding-bottom: 0; flex-wrap: wrap; gap: 0 16px; }
.hd-server { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; padding: 10px 0; min-width: 0; }
.hd-server > span:not(.hd-plan-chip):not(.hd-ginit) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 28ch; }
.hd-server img { width: 28px; height: 28px; border-radius: 8px; }
.hd-plan-chip { display: inline-block; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--rule-strong); color: var(--muted); font: 600 0.72rem/1.4 var(--body); text-transform: uppercase; letter-spacing: 0.06em; vertical-align: middle; }
.hd-plan-chip.is-premium { color: var(--link-hi); border-color: rgba(255, 77, 106, 0.45); background: var(--tint); }
.hd-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; max-width: calc(100% + 32px); }
.hd-tabs::-webkit-scrollbar { display: none; }
.hd-tabs a { flex-shrink: 0; padding: 12px 12px 11px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.94rem; border-bottom: 2px solid transparent; }
.hd-tabs a:hover { color: var(--ink); }
.hd-tabs a.is-here { color: var(--ink); border-bottom-color: var(--red); }
@media (min-width: 860px) { .hd-tabs { margin: 0; padding: 0; } }
.hd-main { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 24px 16px 48px; }
.hd-foot { border-top: 1px solid var(--rule); padding: 18px 16px; text-align: center; color: var(--muted); font-size: 0.88rem; }
.hd-foot p { margin: 0; display: inline-flex; align-items: center; gap: 8px; }
.hd-foot img { mix-blend-mode: screen; }

/* ---- Landing ---- */
.hd-hero { text-align: center; padding: 8px 0 40px; max-width: 780px; margin: 0 auto; }
.hd-hero-mark { width: 200px; height: auto; mix-blend-mode: screen; margin: 0 auto 6px; display: block; }
.hd-kicker { color: var(--link); font: 700 0.8rem/1.2 var(--body); text-transform: uppercase; letter-spacing: 0.14em; margin-bottom: 10px; }
.hd-hero h1 { font-size: clamp(2.3rem, 9vw, 4.2rem); line-height: 0.98; letter-spacing: -0.03em; }
.hd-hero h1 span { color: var(--red); }
.hd-lede { color: var(--muted); font-size: 1.08rem; max-width: 36em; margin: 0 auto 26px; }
.hd-cta { display: flex; flex-direction: column; gap: 12px; align-items: stretch; max-width: 360px; margin: 0 auto; }
@media (min-width: 640px) { .hd-cta { flex-direction: row; justify-content: center; max-width: none; } }
.hd-note { color: var(--muted); font-size: 0.9rem; margin: 18px auto 0; max-width: 34em; }
.hd-features { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 8px 0 44px; }
@media (min-width: 640px) { .hd-features { grid-template-columns: 1fr 1fr; } }
@media (min-width: 980px) { .hd-features { grid-template-columns: repeat(3, 1fr); } }
.hd-feature { background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 120px), var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px 18px 18px; }
.hd-feature-n { display: block; color: var(--red); font: 800 0.8rem/1 var(--mono); margin-bottom: 12px; }
.hd-feature h3 { margin-bottom: 6px; }
.hd-feature p { color: var(--muted); margin: 0; font-size: 0.95rem; }
.hd-plans { max-width: 860px; margin: 0 auto 44px; }
.hd-plans > h2, .hd-steps > h2 { text-align: center; font-size: clamp(1.4rem, 4vw, 1.9rem); margin-bottom: 18px; }
.hd-plan-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .hd-plan-grid { grid-template-columns: 1fr 1fr; } }
.hd-plan-card { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px; }
.hd-plan-card.is-premium { border-color: rgba(255, 77, 106, 0.45); box-shadow: 0 0 0 1px rgba(255, 77, 106, 0.15), 0 20px 50px -30px rgba(200, 16, 46, 0.8); }
.hd-plan-card h3 { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 1.3rem; }
.hd-plan-card h3 span { font: 600 0.9rem/1 var(--body); color: var(--link-hi); }
.hd-plan-card ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.hd-plan-card li { position: relative; padding-left: 22px; color: var(--muted); }
.hd-plan-card li::before { content: ""; position: absolute; left: 2px; top: 0.5em; width: 10px; height: 11px; background: var(--red); clip-path: var(--hex); }
.hd-steps { max-width: 780px; margin: 0 auto; }
.hd-steps ol { list-style: none; counter-reset: s; padding: 0; margin: 0; display: grid; gap: 10px; }
.hd-steps li { counter-increment: s; position: relative; padding: 14px 16px 14px 56px; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); }
.hd-steps li::before { content: counter(s); position: absolute; left: 16px; top: 13px; width: 26px; height: 28px; display: grid; place-items: center; background: var(--red); color: #fff; font: 800 0.9rem/1 var(--display); clip-path: var(--hex); }

/* ---- The server picker and short pages ---- */
.hd-page { max-width: 780px; margin: 0 auto; }
.hd-sub { color: var(--muted); margin-top: -4px; }
.hd-h2 { margin-top: 30px; font-size: 1.15rem; }
.hd-guilds { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 10px; }
.hd-guild { display: grid; grid-template-columns: 48px 1fr; align-items: center; gap: 12px 14px; padding: 14px; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); }
.hd-guild h2 { font-size: 1.08rem; margin: 0 0 2px; overflow-wrap: anywhere; }
.hd-guild p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.hd-guild-act { grid-column: 1 / -1; display: flex; }
.hd-guild-act .btn { flex: 1; }
@media (min-width: 560px) { .hd-guild { grid-template-columns: 48px 1fr auto; } .hd-guild-act { grid-column: auto; } .hd-guild-act .btn { flex: none; } }
.hd-guild.is-new { border-style: dashed; }
.hd-guilds-quiet .hd-guild { background: transparent; }
.hd-gicon { width: 48px; height: 48px; border-radius: 14px; object-fit: cover; background: var(--raised); }
.hd-ginit { display: grid; place-items: center; font: 800 1.2rem/1 var(--display); color: var(--ink); border: 1px solid var(--rule-strong); background: var(--raised); }
.hd-ginit-sm { width: 28px; height: 28px; border-radius: 8px; font-size: 0.9rem; }
.hd-role { color: var(--link-hi); font-weight: 600; }
.hd-fine { color: var(--muted); font-size: 0.88rem; }
.hd-message { max-width: 480px; margin: 24px auto; text-align: center; }
.hd-message img { mix-blend-mode: screen; margin-bottom: 4px; }
.hd-message h1 { font-size: 1.6rem; }
.hd-message p { color: var(--muted); }
.hd-empty h2 { font-size: 1.15rem; }
.hd-empty p { color: var(--muted); margin: 0; }

/* ---- Desk: shared ---- */
.hd-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 14px; }
.hd-head h1 { margin: 0; font-size: clamp(1.5rem, 4vw, 2rem); }
.hd-head .hd-sub { margin: 0; flex-basis: 100%; }
.hd-two { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 960px) { .hd-two { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } }
.hd-two > div > .hd-card:last-child, .hd-two > .hd-card { margin-bottom: 0; }

/* Status and priority marks */
.hd-status, .hd-prio { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 999px; font: 600 0.78rem/1.6 var(--body); border: 1px solid var(--rule-strong); white-space: nowrap; }
.hd-status::before { content: ""; width: 8px; height: 9px; background: currentColor; clip-path: var(--hex); }
.hd-st-new { color: #7CC4FF; border-color: rgba(124, 196, 255, 0.4); background: rgba(124, 196, 255, 0.08); }
.hd-st-open { color: var(--link-hi); border-color: rgba(255, 77, 106, 0.45); background: var(--tint); }
.hd-st-pending { color: var(--warn); border-color: rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.07); }
.hd-st-on_hold { color: #C4B5FD; border-color: rgba(196, 181, 253, 0.4); background: rgba(196, 181, 253, 0.07); }
.hd-st-solved { color: var(--ok); border-color: rgba(74, 222, 128, 0.4); background: rgba(74, 222, 128, 0.07); }
.hd-st-closed { color: var(--muted); }
.hd-prio { color: var(--muted); }
.hd-pr-high { color: var(--warn); border-color: rgba(251, 191, 36, 0.4); }
.hd-pr-urgent { color: #fff; background: var(--red); border-color: var(--red); }
.hd-pr-low { color: var(--muted); }
.hd-tag { display: inline-block; padding: 0 8px; border-radius: 6px; background: var(--raised); border: 1px solid var(--rule); color: var(--muted); font: 500 0.76rem/1.6 var(--mono); }

/* ---- Tickets list ---- */
.hd-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; align-items: end; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 4px 14px 14px; margin-bottom: 16px; }
.hd-f label { margin-top: 10px; font-size: 0.82rem; color: var(--muted); }
.hd-f-q { grid-column: 1 / -1; }
.hd-f-go { grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 12px; }
.hd-f-go .btn { flex: 1; }
@media (min-width: 900px) {
  .hd-filters { grid-template-columns: minmax(200px, 2fr) repeat(4, minmax(0, 1fr)) auto; }
  .hd-filters.has-cats { grid-template-columns: minmax(180px, 2fr) repeat(5, minmax(0, 1fr)) auto; }
  .hd-f-q { grid-column: auto; }
  .hd-f-go { grid-column: auto; }
  .hd-f-go .btn { flex: none; }
}
.hd-tickets { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.hd-trow + .hd-trow { border-top: 1px solid var(--rule); }
.hd-trow-link { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; padding: 14px 16px; color: var(--ink); text-decoration: none; }
.hd-trow-link:hover { background: rgba(255, 255, 255, 0.025); color: var(--ink); }
.hd-tno { font: 600 0.92rem/1.5 var(--mono); color: var(--muted); }
.hd-tmain { display: flex; flex-direction: column; min-width: 0; }
.hd-tsubj { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-tmeta { color: var(--muted); font-size: 0.86rem; overflow-wrap: anywhere; }
.hd-tside { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 0.88rem; }
.hd-assignee { color: var(--ink); }
@media (min-width: 760px) {
  .hd-trow-link { grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; }
  .hd-tside { grid-column: auto; justify-content: flex-end; flex-wrap: nowrap; }
  .hd-assignee { min-width: 9em; text-align: right; }
}
.hd-pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; color: var(--muted); font-size: 0.92rem; }

/* ---- One ticket ---- */
.hd-crumb { margin: 0 0 6px; font-size: 0.9rem; }
.hd-crumb a { text-decoration: none; }
.hd-crumb a::before { content: "\2190  "; }
.hd-thead h1 { font-size: clamp(1.4rem, 4vw, 1.9rem); overflow-wrap: anywhere; margin-bottom: 8px; }
.hd-thead h1 .hd-tno { font: 600 0.75em/1 var(--mono); color: var(--muted); }
.hd-tline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; color: var(--muted); font-size: 0.9rem; margin-bottom: 18px; }
.hd-tgrid { display: grid; grid-template-columns: 1fr; gap: 18px; align-items: start; }
.hd-side { min-width: 0; }
.hd-main:has(.hd-tgrid), body:has(.hd-tgrid) .hd-top-in, body:has(.hd-tgrid) .hd-desk-in { max-width: 1640px; }
@media (min-width: 1000px) {
  .hd-tgrid { grid-template-columns: minmax(0, 1fr) 320px; grid-template-rows: auto 1fr; }
  .hd-convo { grid-column: 1; grid-row: 1 / span 2; }
  .hd-side-l { grid-column: 2; grid-row: 1; }
  .hd-side-r { grid-column: 2; grid-row: 2; }
}
@media (min-width: 1320px) {
  .hd-tgrid { grid-template-columns: 300px minmax(0, 1fr) 300px; grid-template-rows: auto; }
  .hd-side-l { grid-column: 1; grid-row: 1; }
  .hd-convo { grid-column: 2; grid-row: 1; }
  .hd-side-r { grid-column: 3; grid-row: 1; }
}
.hd-answers { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.hd-answers h3, .hd-answers h2 { font: 700 0.78rem/1.4 var(--body); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 8px; }
.hd-answers dl, .hd-details dl, .hd-usage { margin: 0; display: grid; gap: 10px; }
.hd-answers dt, .hd-details dt, .hd-usage dt { font-size: 0.82rem; color: var(--muted); }
.hd-answers dd, .hd-details dd, .hd-usage dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.hd-msgs { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.hd-msg { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 14px 14px; }
.hd-msg.is-staff, .hd-msg.is-herald { border-left: 3px solid var(--red); }
.hd-msg.is-note { background: var(--note-bg); border: 1px dashed var(--note-line); }
.hd-msg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-bottom: 6px; font-size: 0.92rem; }
.hd-msg-at { margin-left: auto; color: var(--muted); font-size: 0.82rem; }
.hd-av { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--raised); border: 1px solid var(--rule-strong); font: 700 0.8rem/1 var(--body); flex-shrink: 0; }
.hd-msg.is-staff .hd-av, .hd-msg.is-herald .hd-av { background: var(--red); border-color: var(--red); color: #fff; }
.hd-msg.is-note .hd-av { background: rgba(245, 185, 66, 0.15); border-color: var(--note-line); color: var(--note); }
.hd-who { font-size: 0.74rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--link-hi); }
.hd-who.is-req { color: var(--muted); }
.hd-note-flag { display: inline-flex; align-items: center; gap: 6px; font: 700 0.74rem/1.6 var(--body); text-transform: uppercase; letter-spacing: 0.06em; color: var(--note); }
.hd-note-flag::before { content: ""; width: 9px; height: 10px; background: currentColor; clip-path: var(--hex); }
.hd-msg-body { overflow-wrap: anywhere; white-space: normal; }
.hd-atts { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.hd-atts li { padding: 4px 10px; border-radius: 8px; background: var(--raised); border: 1px solid var(--rule); font-size: 0.86rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.hd-atts li a::before { content: "\1F4CE  "; }
.hd-compose, .hd-saved { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 4px 14px 14px; margin-bottom: 12px; }
.hd-compose textarea { min-height: 120px; }
.hd-compose-acts { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.hd-compose-reply { display: flex; flex-direction: column; gap: 8px; }
.hd-inline-label { margin: 0; font-weight: 500; color: var(--muted); }
@media (min-width: 720px) {
  .hd-compose-acts { flex-direction: row; justify-content: space-between; align-items: center; }
  .hd-compose-reply { flex-direction: row; align-items: center; }
  .hd-compose-reply select { width: auto; }
  .hd-inline-label { white-space: nowrap; }
}
.hd-compose .fine { margin: 10px 0 0; }
.hd-saved-row { display: flex; gap: 8px; flex-wrap: wrap; }
.hd-saved-row select, .hd-saved-row input { flex: 1 1 180px; min-width: 0; }
.hd-closed-box { padding: 14px 16px; border: 1px dashed var(--rule-strong); border-radius: var(--radius); color: var(--muted); }
.hd-closed-box p { margin: 0; }
.hd-side .hd-card { padding: 4px 16px 16px; }
.hd-side .hd-card h2 { font: 700 0.78rem/1.4 var(--body); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 14px 0 0; }
.hd-props .btn { margin-top: 14px; }
.hd-props .fine { margin: 6px 0 0; }
.hd-acts form + form { border-top: 1px solid var(--rule); margin-top: 14px; }
.hd-acts .btn-block { margin-top: 10px; }
.hd-acts > form:only-child .btn-block:first-child { margin-top: 14px; }
.hd-details dl { margin-top: 10px; }
.hd-links { display: flex; flex-direction: column; gap: 6px; margin: 14px 0 0; font-size: 0.92rem; }
.hd-stars { color: var(--warn); letter-spacing: 2px; }
.hd-history ol { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; font-size: 0.88rem; }
.hd-history li { padding-left: 14px; position: relative; }
.hd-history li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 6px; height: 7px; background: var(--rule-strong); clip-path: var(--hex); }

/* ---- Saved replies, settings, staff, plan ---- */
.hd-replies { list-style: none; margin: 0; padding: 0; }
.hd-reply-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.hd-reply-head h2 { margin: 0; font-size: 1.05rem; font-family: var(--mono); font-weight: 600; letter-spacing: 0; }
.hd-reply-body { margin: 8px 0; color: var(--ink); overflow-wrap: anywhere; }
.hd-reply-acts { display: flex; gap: 8px; }
.hd-reply-acts form { margin: 0; }
.hd-panel { border-top: 1px solid var(--rule); padding-top: 14px; margin-top: 14px; }
.hd-panel h3 { margin-bottom: 4px; }
.hd-buttons { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.hd-pbtn { padding: 6px 12px; border-radius: 6px; font-weight: 600; font-size: 0.88rem; background: #4E5058; color: #fff; }
.hd-pbtn-primary { background: #5865F2; }
.hd-pbtn-success { background: #248046; }
.hd-pbtn-danger { background: #DA373C; }
.hd-pbtn-q { font-weight: 500; opacity: 0.8; font-size: 0.8rem; }
.hd-seats { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.hd-seats li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 10px; background: var(--sunk); }
.hd-seat-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.hd-seats form { margin: 0; }
.hd-usage div { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.hd-usage div:last-child { border-bottom: 0; }
.hd-meter { display: block; height: 6px; border-radius: 99px; background: var(--raised); margin-top: 8px; overflow: hidden; }
.hd-meter span { display: block; height: 100%; background: var(--red); border-radius: 99px; }
.hd-cmp th[scope="row"] { font-weight: 500; }
.hd-cmp .is-mine { color: var(--ink); background: var(--tint); }

/* ---- Transcript ---- */
.hd-transcript { max-width: 820px; margin: 0 auto; }
.hd-tr-head { padding-bottom: 16px; margin-bottom: 18px; border-bottom: 1px solid var(--rule); }
.hd-tr-head h1 { overflow-wrap: anywhere; }
.hd-tr-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--muted); font-size: 0.92rem; margin: 0; }
.hd-staff-view { margin: 14px 0 0; padding: 10px 12px; border: 1px dashed var(--note-line); background: var(--note-bg); border-radius: 10px; color: var(--note); font-size: 0.9rem; }
.hd-day { text-align: center; color: var(--muted); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; margin: 8px 0 2px; display: flex; align-items: center; gap: 12px; }
.hd-day::before, .hd-day::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.hd-tr-foot { border-top: 1px solid var(--rule); padding-top: 14px; }

/* Live updates and @ mentions */
.hd-msg.is-new { animation: hd-new 2.4s ease-out; }
@keyframes hd-new { from { box-shadow: 0 0 0 2px var(--red); } to { box-shadow: 0 0 0 2px transparent; } }
@media (prefers-reduced-motion: reduce) { .hd-msg.is-new { animation: none; outline: 2px solid var(--red); outline-offset: -1px; } }
.hd-mention { color: var(--link); background: var(--tint); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.hd-mention-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; }
.hd-mention-row .fine { margin: 0; }
.hd-suggest { display: inline-block; margin-top: 6px; padding: 4px 10px; border: 1px solid var(--red); border-radius: 999px; background: var(--card); color: var(--ink); font: inherit; font-size: 0.9rem; cursor: pointer; }

/* Categories */
.hd-cat { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 6px; background: var(--raised); border: 1px solid var(--rule-strong); color: var(--ink); font: 600 0.78rem/1.6 var(--body); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.hd-move textarea { min-height: 64px; }
.hd-move .fine { margin: 6px 0 0; }
.hd-move .btn { margin-top: 12px; }
.hd-cats { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; }
.hd-catrow { padding: 12px 14px; border: 1px solid var(--rule); border-radius: 10px; background: var(--sunk); }
.hd-catrow-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.hd-catrow-head h3 { margin: 0; font-size: 1.02rem; overflow-wrap: anywhere; }
.hd-catrow-head .hd-count { margin-left: 0; }
.hd-catrow p { margin: 6px 0 0; overflow-wrap: anywhere; }
.hd-catrow details, .hd-seats details { margin-top: 8px; }
.hd-catrow summary, .hd-seats summary { cursor: pointer; color: var(--link); font-weight: 600; font-size: 0.92rem; min-height: 32px; display: inline-flex; align-items: center; }
.hd-catrow-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.hd-catrow-acts form { margin: 0; }
.hd-catrow-acts .btn { margin-top: 12px; }
.hd-checks { border: 0; padding: 0; margin: 14px 0 0; }
.hd-checks legend { font-weight: 600; font-size: 0.92rem; padding: 0; margin-bottom: 4px; }
.hd-checks .hd-check { margin: 8px 0; overflow-wrap: anywhere; }
.hd-seats li.has-edit { flex-wrap: wrap; }
.hd-seat-edit { flex-basis: 100%; }
.hd-seat-edit form { margin: 0; }
.hd-seat-cats { color: var(--ink); }
.hd-catcard { margin-top: 16px; }

/* ---- Channel and role pickers (Settings, Staff) ---- */
.hd-warn { margin: 8px 0 0; padding: 8px 12px; border: 1px solid rgba(251, 191, 36, 0.45); border-radius: 10px; background: rgba(251, 191, 36, 0.08); color: var(--warn); font-size: 0.88rem; overflow-wrap: anywhere; }
.hd-rolefield > .hd-check { margin: 8px 0; }
.hd-rolepick { display: grid; grid-template-columns: 1fr; gap: 0 14px; max-height: 260px; overflow-y: auto; margin: 4px 0 6px; padding: 4px 12px; border: 1px solid var(--rule); border-radius: 10px; background: var(--sunk); }
@media (min-width: 640px) { .hd-rolepick { grid-template-columns: 1fr 1fr; } }
.hd-rolepick .hd-check { margin: 6px 0; font-size: 0.94rem; min-height: 32px; }
.hd-roledot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; background: var(--role, var(--muted)); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12); }
.hd-roledot.is-plain { background: transparent; box-shadow: inset 0 0 0 2px var(--muted); }
.hd-rolecheck.is-unknown span:last-child { color: var(--warn); }
.hd-rolepick .fine { grid-column: 1 / -1; }

/* ---- Staff > Your signature: the form and a mock of the reply card as Discord draws it (dark theme) ---- */
.hd-sig-grid { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: start; }
@media (min-width: 960px) { .hd-sig-grid { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 28px; } }
.hd-sig-grid .hd-form label:first-of-type { margin-top: 0; }
.hd-sig-preview { margin: 0; min-width: 0; }
.hd-sig-preview figcaption { margin: 0 0 8px; }
.dc-msg { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 14px 14px 16px 12px; background: #313338; border-radius: 10px; color: #dbdee1; font: 400 0.94rem/1.375 "gg sans", var(--body); }
.dc-msg p { margin: 0; }
.dc-bot-av { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--red); color: #fff; font: 800 1rem/1 var(--display); }
.dc-body { min-width: 0; }
.dc-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 6px; }
.dc-name { color: #f2f3f5; font-weight: 600; }
.dc-app { background: #5865f2; color: #fff; border-radius: 4px; padding: 0 4px; font: 600 0.62rem/1.45 var(--body); align-self: center; }
.dc-time { color: #949ba4; font-size: 0.75rem; }
.dc-embed { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; margin-top: 6px; max-width: 520px; padding: 10px 14px 14px 12px; background: #2b2d31; border-left: 4px solid #c8102e; border-radius: 4px; }
.dc-embed-main { min-width: 0; display: grid; gap: 8px; }
.dc-author { display: flex; align-items: center; gap: 8px; color: #f2f3f5; font-weight: 600; font-size: 0.875rem; overflow-wrap: anywhere; }
.dc-author img, .dc-mini { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; }
.dc-mini { display: inline-grid; place-items: center; background: #5865f2; color: #fff; font: 700 0.72rem/1 var(--body); }
.dc-mini-sm { width: 20px; height: 20px; font-size: 0.62rem; }
.dc-title { color: #f2f3f5; font-weight: 700; }
.dc-desc { display: grid; gap: 1em; font-size: 0.875rem; overflow-wrap: anywhere; }
.dc-desc em { color: #b5bac1; }
.dc-field { display: grid; font-size: 0.875rem; }
.dc-fname { color: #f2f3f5; font-weight: 600; }
.dc-thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; }
@media (min-width: 480px) { .dc-thumb { width: 80px; height: 80px; } }
.dc-thumb-text { display: grid; place-items: center; background: #1e1f22; color: #f2f3f5; font: 800 1.4rem/1 var(--display); }
.dc-foot .dc-mini { background: #1e1f22; color: #f2f3f5; }
.dc-foot { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; color: #b5bac1; font-size: 0.75rem; overflow-wrap: anywhere; }
.dc-foot img { width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; }
