/* Atlas palette (atlas_theme): warm olive panels with an amber accent.
   Dark is the default; light applies with data-theme="light", or with Auto on a light device. */
:root {
  --bg: #121410;
  --panel: #1a1d17;
  --raised: #20241d;
  --field: #161a13;
  --hover: #2b3223;
  --text: #e9ece3;
  --muted: #979e8d;
  --subtle: #7a8270;
  --border: rgba(233, 236, 227, 0.08);
  --border-strong: rgba(233, 236, 227, 0.18);
  --accent: #ffc45c;
  --accent-soft: rgba(255, 196, 92, 0.14);
  --on-accent: #171b12;
  --success: #a9cc8c;
  --success-soft: rgba(169, 204, 140, 0.14);
  --warning: #f2cc5b;
  --warning-soft: rgba(242, 204, 91, 0.14);
  --danger: #ff837a;
  --danger-soft: rgba(255, 131, 122, 0.14);
  --info: #8fb8e8;
  --info-soft: rgba(143, 184, 232, 0.14);
  --shadow: rgba(0, 0, 0, 0.35);
  --radius: 6px;
  --radius-lg: 10px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Consolas, monospace;
  --topbar: 56px;
  color-scheme: dark;
}
:root[data-theme='light'] {
  --bg: #f4f2e9;
  --panel: #fffdf5;
  --raised: #fbf9f0;
  --field: #ffffff;
  --hover: #ece8d8;
  --text: #1d2118;
  --muted: #4f5745;
  --subtle: #6b7360;
  --border: rgba(52, 59, 46, 0.14);
  --border-strong: rgba(52, 59, 46, 0.28);
  --accent: #8a5d09;
  --accent-soft: rgba(138, 93, 9, 0.13);
  --on-accent: #ffffff;
  --success: #4f7a2e;
  --success-soft: rgba(79, 122, 46, 0.12);
  --warning: #8f6a00;
  --warning-soft: rgba(181, 137, 0, 0.14);
  --danger: #c4473d;
  --danger-soft: rgba(196, 71, 61, 0.1);
  --info: #2f6aa3;
  --info-soft: rgba(47, 106, 163, 0.1);
  --shadow: rgba(29, 33, 24, 0.14);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f4f2e9;
    --panel: #fffdf5;
    --raised: #fbf9f0;
    --field: #ffffff;
    --hover: #ece8d8;
    --text: #1d2118;
    --muted: #4f5745;
    --subtle: #6b7360;
    --border: rgba(52, 59, 46, 0.14);
    --border-strong: rgba(52, 59, 46, 0.28);
    --accent: #8a5d09;
    --accent-soft: rgba(138, 93, 9, 0.13);
    --on-accent: #ffffff;
    --success: #4f7a2e;
    --success-soft: rgba(79, 122, 46, 0.12);
    --warning: #8f6a00;
    --warning-soft: rgba(181, 137, 0, 0.14);
    --danger: #c4473d;
    --danger-soft: rgba(196, 71, 61, 0.1);
    --info: #2f6aa3;
    --info-soft: rgba(47, 106, 163, 0.1);
    --shadow: rgba(29, 33, 24, 0.14);
    color-scheme: light;
  }
}

/* Base */
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-text-size-adjust: 100%; }
h1 { margin: 0 0 4px; font-size: 1.45rem; line-height: 1.25; }
h2 { margin: 0 0 8px; font-size: 1.15rem; }
h3 { margin: 18px 0 6px; font-size: 1rem; }
code { padding: 1px 5px; background: var(--field); border-radius: 4px; font: 0.9em var(--mono); }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.error { color: var(--danger); }
.lead { margin: 0 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Buttons */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 8px 16px;
  color: var(--text); background: var(--raised); border: 1px solid var(--border-strong); border-radius: var(--radius);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.button:hover:not(:disabled) { background: var(--hover); }
.button:disabled { opacity: 0.6; cursor: default; }
.button.primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.button.primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); }
.button.ghost { background: transparent; }
.button.small { min-height: 32px; padding: 5px 12px; font-size: 0.86rem; }
.button.wide { width: 100%; }
.link { padding: 0; color: var(--accent); background: none; border: 0; font: inherit; text-align: left; text-decoration: underline; cursor: pointer; }

/* Segmented control (theme picker, ticket tabs) */
.segmented { display: inline-flex; flex: none; max-width: 100%; padding: 3px; overflow-x: auto; scrollbar-width: none; background: var(--field); border: 1px solid var(--border); border-radius: 8px; }
.segmented button { min-height: 28px; padding: 3px 12px; color: var(--muted); background: none; border: 0; border-radius: 6px; font: inherit; font-size: 0.86rem; font-weight: 600; cursor: pointer; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed='true'] { color: var(--on-accent); background: var(--accent); }

/* Login / setup */
body.center { display: grid; min-height: 100vh; place-items: center; padding: 16px; }
.corner { position: fixed; top: 12px; right: 12px; }
.card { width: 100%; max-width: 420px; padding: 28px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.login p { margin: 12px 0 20px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 700; }
/* The server icon is a white logo on transparent, so it gets a dark backing to stay visible in light mode. */
.brand img { width: 28px; height: 28px; border-radius: 50%; background: #11141a; }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guild-picker { width: auto; max-width: 260px; min-height: 34px; padding: 4px 8px; font-weight: 700; }
.logo { padding: 2px 7px; color: var(--on-accent); background: var(--accent); border-radius: 5px; font-weight: 800; }

/* Layout */
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: var(--topbar); padding: 8px 20px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.who { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.who img { width: 26px; height: 26px; border-radius: 50%; }
.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); max-width: 1180px; margin: 0 auto; }
.sidebar { position: sticky; top: var(--topbar); align-self: start; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - var(--topbar)); padding: 20px 12px; overflow-y: auto; }
.nav { display: flex; flex-direction: column; gap: 0; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group + .nav-group { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.nav-heading { margin: 0 12px 6px; color: var(--subtle); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; color: var(--muted); background: none; border: 0; border-radius: var(--radius); font: inherit; text-align: left; cursor: pointer; }
.nav-item:hover { color: var(--text); background: var(--hover); }
.nav-item.active { color: var(--text); background: var(--accent-soft); font-weight: 600; }
.nav-item .dot { display: none; width: 7px; height: 7px; margin-left: auto; background: var(--accent); border-radius: 50%; }
.nav-item.dirty .dot { display: block; }
.mobile-nav-wrap { display: none; }
.mobile-theme { display: none; }

/* Settings search */
.search { position: relative; }
.search-input { min-height: 36px; padding: 6px 10px; }
.search-results {
  position: absolute; top: calc(100% + 4px); right: 0; left: 0; z-index: 15; max-height: min(60vh, 420px); margin: 0; padding: 4px;
  overflow-y: auto; list-style: none; background: var(--raised); border: 1px solid var(--border-strong); border-radius: 8px; box-shadow: 0 10px 30px var(--shadow);
}
.search-results li { display: flex; flex-direction: column; padding: 7px 10px; border-radius: var(--radius); cursor: pointer; }
.search-results li.active, .search-results li:hover { background: var(--accent-soft); }
.search-label { font-weight: 600; }
.search-trail { color: var(--muted); font-size: 0.8rem; }
.search-results .search-none { color: var(--muted); cursor: default; }
.search-results .search-none:hover { background: none; }
.flash { animation: flash 1.6s ease-out; border-radius: var(--radius); }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 3px transparent; } }

/* Message previews, drawn like Discord (Discord's own colours, in both themes) */
.preview { margin: 4px 0 16px; border: 1px solid var(--border); border-radius: 8px; }
.preview summary { padding: 8px 12px; color: var(--muted); font-size: 0.86rem; font-weight: 600; cursor: pointer; }
.preview-body { padding: 0 8px 8px; }
.discord { --d-bg: #313338; --d-text: #dbdee1; --d-muted: #949ba4; --d-head: #f2f3f5; --d-embed: #2b2d31; --d-link: #00a8fc;
  padding: 12px 12px 14px; color: var(--d-text); background: var(--d-bg); border-radius: 6px; font: 15px/1.375 'gg sans', 'Noto Sans', var(--font); overflow-wrap: anywhere; }
:root[data-theme='light'] .discord { --d-bg: #ffffff; --d-text: #313338; --d-muted: #5c5e66; --d-head: #060607; --d-embed: #f2f3f5; --d-link: #006ce7; }
@media (prefers-color-scheme: light) { :root:not([data-theme]) .discord { --d-bg: #ffffff; --d-text: #313338; --d-muted: #5c5e66; --d-head: #060607; --d-embed: #f2f3f5; --d-link: #006ce7; } }
.discord a { color: var(--d-link); text-decoration: none; }
.discord-note { margin-bottom: 8px; color: var(--d-muted); font-size: 0.8rem; }
.discord-msg { display: flex; gap: 14px; }
.discord-avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; background: #11141a; }
.discord-body { flex: 1; min-width: 0; }
.discord-head { display: flex; align-items: center; gap: 6px; }
.discord-head strong { color: var(--d-head); font-weight: 600; }
.discord-tag { padding: 0 4px; color: #fff; background: #5865f2; border-radius: 3px; font-size: 0.62rem; font-weight: 700; line-height: 15px; }
.discord-time { color: var(--d-muted); font-size: 0.75rem; }
.discord-content { margin-top: 2px; }
.discord blockquote { margin: 2px 0; padding-left: 10px; border-left: 4px solid #4e5058; }
.discord ul { margin: 2px 0; padding-left: 22px; }
.discord .md-h { margin: 8px 0 2px; color: var(--d-head); }
.discord h3.md-h { font-size: 1.5rem; } .discord h4.md-h { font-size: 1.25rem; } .discord h5.md-h { font-size: 1rem; }
.discord code { padding: 1px 4px; background: var(--d-embed); border-radius: 4px; font: 0.85em var(--mono); }
.discord .mention { padding: 0 2px; color: #c9cdfb; background: rgba(88, 101, 242, 0.3); border-radius: 3px; font-weight: 500; }
:root[data-theme='light'] .discord .mention { color: #505cdc; background: rgba(88, 101, 242, 0.15); }
@media (prefers-color-scheme: light) { :root:not([data-theme]) .discord .mention { color: #505cdc; background: rgba(88, 101, 242, 0.15); } }
.discord .timestamp { padding: 0 2px; background: var(--d-embed); border-radius: 3px; }
.embed { display: grid; gap: 8px; max-width: 520px; margin-top: 4px; padding: 10px 16px 14px 12px; background: var(--d-embed); border-left: 4px solid var(--embed); border-radius: 4px; font-size: 0.875rem; }
.embed-title { color: var(--d-head); font-size: 1rem; font-weight: 600; }
.embed-fields { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.embed-field { flex: 1 1 100%; min-width: 0; }
.embed-field.inline { flex: 1 1 calc(33% - 16px); min-width: 120px; }
.embed-field-name { margin-bottom: 2px; color: var(--d-head); font-weight: 600; }
.embed-image { max-width: 100%; border-radius: 4px; }
.embed.has-thumb { grid-template-columns: minmax(0, 1fr) 80px; }
.embed.has-thumb > :not(.embed-thumb) { grid-column: 1; }
.embed-thumb { grid-row: 1 / span 3; grid-column: 2; width: 80px; height: 80px; border-radius: 4px; object-fit: cover; }
.embed-title a { color: var(--d-link); }
.embed-footer { color: var(--d-muted); font-size: 0.75rem; }
.discord-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.discord-button { padding: 2px 16px; color: #fff; background: #4e5058; border-radius: 3px; font-size: 0.875rem; font-weight: 500; line-height: 28px; }
.discord-button.success { background: #248046; }
.discord-button.primary { background: #5865f2; }
.link-mark { opacity: 0.8; }
.content { min-width: 0; padding: 24px 24px 64px; }
body.has-savebar .content { padding-bottom: 120px; }

/* Form fields */
.group { min-width: 0; margin: 0 0 18px; padding: 16px 18px 6px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.group .group { background: var(--raised); }
legend { padding: 0 6px; font-weight: 700; }
.row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin-bottom: 14px; }
.row-bool { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.row-bool .help { grid-column: 1 / -1; }
.off-note { margin: -4px 0 14px; }
.label { font-size: 0.9rem; font-weight: 600; }
.help { margin: 0; color: var(--subtle); font-size: 0.82rem; }
input[type='text'], input[type='number'], input[type='search'], select, textarea {
  width: 100%; min-height: 38px; padding: 8px 10px; color: var(--text); background: var(--field);
  border: 1px solid var(--border-strong); border-radius: var(--radius); font: inherit;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

.switch { position: relative; display: inline-block; width: 44px; height: 26px; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; pointer-events: none; transition: background 150ms; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; background: var(--text); border-radius: 50%; transition: transform 150ms; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { background: var(--on-accent); transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.color { display: flex; gap: 8px; align-items: center; }
.color input[type='color'] { width: 44px; height: 38px; padding: 2px; background: var(--field); border: 1px solid var(--border-strong); border-radius: var(--radius); }
.color-text { max-width: 140px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { --chip: var(--muted); display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 2px 4px 2px 10px; background: var(--raised); border: 1px solid var(--border-strong); border-left: 3px solid var(--chip); border-radius: 999px; font-size: 0.86rem; }
.chip.missing { color: var(--danger); }
.chip button { width: 24px; height: 24px; padding: 0; color: var(--muted); background: none; border: 0; border-radius: 50%; font-size: 1rem; cursor: pointer; }
.chip button:hover { color: var(--text); background: var(--hover); }
.chip-add { width: auto; max-width: 240px; min-height: 30px; padding: 3px 8px; font-size: 0.86rem; }

/* Lists of entries */
.list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.list .add { align-self: flex-start; }
.item { background: var(--raised); border: 1px solid var(--border); border-radius: 8px; }
.item summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 6px 8px 6px 12px; cursor: pointer; list-style: none; }
.item summary::-webkit-details-marker { display: none; }
.item summary::before { content: '›'; flex: none; color: var(--muted); font-size: 1.1rem; transition: transform 150ms; }
.item[open] summary::before { transform: rotate(90deg); }
.item-title { flex: 1; min-width: 0; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.item-actions { display: flex; flex: none; gap: 4px; }
.icon { width: 32px; height: 32px; color: var(--muted); background: var(--field); border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.95rem; cursor: pointer; }
.icon:hover:not(:disabled) { color: var(--text); background: var(--hover); }
.icon:disabled { opacity: 0.35; cursor: default; }
.icon.danger:hover:not(:disabled) { color: var(--danger); background: var(--danger-soft); }
.item-body { padding: 10px 14px 2px; border-top: 1px solid var(--border); }
.item-body .group { background: var(--panel); }

/* Post a message */
.compose { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.compose-preview { position: sticky; top: calc(var(--topbar) + 16px); display: flex; flex-direction: column; gap: 6px; }
.compose-preview .preview-body { padding: 0; }
.templates { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.notice { margin-bottom: 14px; padding: 10px 14px; background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 8px; }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.counter.over { color: var(--danger); }
.compose-field .item-body { display: grid; gap: 8px; padding: 10px; border-top: 0; }
.compose-field-head { display: flex; gap: 6px; align-items: center; }
.compose-field-head input { flex: 1; min-width: 0; }
.check { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 0.9rem; }
.check input { width: auto; min-height: 0; }
.compose-actions { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 24px; }
.compose-recent-title { margin: 8px 0 12px; font-size: 1.1rem; }
.trow.post-row { cursor: default; }
.trow.post-row:hover { background: var(--panel); border-color: var(--border); }
.post-actions { display: flex; flex: none; flex-wrap: wrap; gap: 6px; }
.button.danger { color: var(--danger); }
.button.danger:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--danger); }

/* FXServer */
.fx { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.fx > * { max-width: 100%; }
.fx-banner { width: 100%; padding: 12px 16px; border: 1px solid var(--border-strong); border-left-width: 4px; border-radius: 8px; font-weight: 600; }
.fx-log { max-height: 40vh; }
.fx-section { width: 100%; margin-top: 8px; }
.fx-section h3 { margin: 0 0 8px; }
.fx-resources-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.fx-resources-head h3 { margin: 0; }
.fx-resources { display: flex; flex-direction: column; gap: 4px; max-height: 60vh; margin-top: 8px; overflow-y: auto; }
.fx-resource { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 6px 4px 12px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.fx-resource-name { flex: 1; min-width: 0; overflow: hidden; font-family: var(--mono); font-size: 0.88rem; text-overflow: ellipsis; white-space: nowrap; }
.state-dot { flex: none; width: 9px; height: 9px; border: 0; border-radius: 50%; }
.state-dot.ok-state { background: var(--success); }
.state-dot.warn-state { background: var(--warning); }
.state-dot.error-state { background: var(--danger); }
.fx-log .line { display: block; padding: 0 6px; border-left: 3px solid transparent; }

/* Status colours: green = good, yellow = slight issue or in progress, red = error */
.ok-state { background: var(--success-soft); border-color: var(--success); }
.warn-state { background: var(--warning-soft); border-color: var(--warning); }
.error-state { background: var(--danger-soft); border-color: var(--danger); }
.fx-banner.busy { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.7; } }
.fx-log .line.ok-state { color: var(--success); }
.fx-log .line.warn-state { color: var(--warning); }
.fx-log .line.error-state { color: var(--danger); }

/* FXServer: console */
.console { height: 60vh; margin: 0 0 8px; padding: 10px 12px; overflow: auto; color: #d9dccf; background: #0c0e0a; border: 1px solid var(--border); border-radius: 8px; font: 0.8rem/1.45 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.console .line { display: block; }
.console .line.error-state { color: #ff8a80; }
.console .line.warn-state { color: #f2cc5b; }
.console-form { display: flex; align-items: center; gap: 8px; }
.console-prompt { color: var(--accent); font: 700 1rem var(--mono); }
.console-input { flex: 1; font-family: var(--mono); }

/* FXServer: players */
.announce-actions select { width: auto; }
.player { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; }
.player-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 12px; }
.player-ping { flex: none; color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.player-form { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 12px 12px; }
.player-form input[type='text'] { flex: 1; min-width: 180px; }
.player-count { width: 90px; }

/* FXServer: health */
.health { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 14px; }
.health-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.health-card h3 { display: flex; align-items: center; gap: 8px; margin: 0; }
.health-card .info { padding: 0; background: none; border: 0; }
.meter-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; font-weight: 600; }
.meter { height: 8px; overflow: hidden; background: var(--field); border: 1px solid var(--border); border-radius: 999px; }
.meter span { display: block; height: 100%; border-radius: 999px; transition: width 400ms; }
.meter .ok-state { background: var(--success); }
.meter .warn-state { background: var(--warning); }
.meter .error-state { background: var(--danger); }

/* Player profiles */
.profile-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 10px; }
.profile-tile { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.profile-tile.ok-state, .profile-tile.warn-state, .profile-tile.error-state { background: var(--panel); border-color: var(--border); }
.profile-tile.ok-state strong { color: var(--success); }
.profile-tile.warn-state strong { color: var(--warning); }
.profile-tile.error-state strong { color: var(--danger); }
.profile-tile strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.profile-table td { white-space: nowrap; }
.detail h4 { margin: 14px 0 6px; font-size: 0.95rem; }
.detail .table-scroll, .detail .profile-tiles, .detail details { width: 100%; }

/* Backstory on a profile */
.backstory { display: flex; flex-direction: column; gap: 10px; width: 100%; padding: 14px 16px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.backstory.older { gap: 8px; padding: 10px 14px; }
.backstory.older summary { color: var(--muted); font-size: 0.9rem; cursor: pointer; }
.backstory-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.backstory-status { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border: 1px solid var(--border-strong); border-radius: 999px; font-size: 0.85rem; font-weight: 600; }
.backstory-status.ok-state { color: var(--success); border-color: var(--success); background: var(--success-soft); }
.backstory-status.warn-state { color: var(--warning); border-color: var(--warning); background: var(--warning-soft); }
.backstory-status.error-state { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.backstory .answer .pre { line-height: 1.55; }
.backstory-note { padding: 8px 12px; border-left: 3px solid var(--border-strong); border-radius: 0 var(--radius) var(--radius) 0; background: var(--raised); font-size: 0.9rem; }
.backstory-note.ok-state { border-left-color: var(--success); }
.backstory-note.error-state { border-left-color: var(--danger); }

/* Characters */
.char-body { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.char-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.vehicle-card { display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 12px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.vehicle-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.plate { padding: 1px 8px; color: #1d2b6b; background: #f4f4ec; border: 1px solid #b8b8a8; border-radius: 4px; font: 700 0.85rem var(--mono); letter-spacing: 0.06em; }
.vehicle-impounded { color: var(--danger); }
.vehicle-forms:empty { display: none; }
.danger-text { color: var(--danger); }

/* Changelog */
.changelog { display: flex; flex-direction: column; gap: 10px; }
.changelog-picks { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.changelog-picks h4 { margin: 8px 0 4px; }
.changelog-picks h4:first-child { margin-top: 0; }
.changelog-list { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; }
.changelog-item { color: var(--text); }
.field-label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 0.88rem; }
.changelog-text { min-height: 220px; font-family: var(--mono); font-size: 0.88rem; }

/* Status page and department site */
.site-page { min-height: 100vh; }
.site-top { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--border); }
.site-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.site-brand img { border-radius: 6px; }
.site-main { display: flex; flex-direction: column; gap: 16px; max-width: 1000px; margin: 0 auto; padding: 20px 16px 48px; }
.site-foot { max-width: 1000px; margin: 0 auto; padding: 0 16px 32px; }
.status-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 18px 20px; border: 1px solid var(--border); border-left-width: 5px; border-radius: var(--radius-lg); font-size: 1.15rem; }
.status-banner.ok-state { border-left-color: var(--success); }
.status-banner.error-state { border-left-color: var(--danger); }
.status-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 10px; }
.status-card { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.status-card strong { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.status-note { display: flex; flex-direction: column; gap: 6px; padding: 14px 18px; background: var(--panel); border: 1px solid var(--border); border-left: 5px solid var(--info); border-radius: var(--radius-lg); }
.status-note.error-state { border-left-color: var(--danger); background: color-mix(in srgb, var(--danger-soft) 60%, var(--panel)); }
.status-note.warn-state { border-left-color: var(--warning); background: color-mix(in srgb, var(--warning-soft) 60%, var(--panel)); }
.status-note.info-state { border-left-color: var(--info); }
.status-note.ok-state { border-left-color: var(--success); }
.status-note p { margin: 0; }
.status-note-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.status-note-update { padding-left: 10px; border-left: 2px solid var(--border-strong); }
.state-dot.info-state { background: var(--info); }
.note-update { padding-left: 10px; border-left: 2px solid var(--border-strong); }
.ok-text { color: var(--success); }
.error-text { color: var(--danger); }
.status-section { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.status-section h2 { margin: 0; font-size: 1.05rem; }
.status-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.status-pcts { display: flex; flex-wrap: wrap; gap: 16px; color: var(--muted); font-size: 0.88rem; }
.status-pcts strong { color: var(--text); font-variant-numeric: tabular-nums; }
.uptime-bars { display: grid; grid-template-columns: repeat(30, 1fr); gap: 3px; height: 38px; }
.uptime-bar { border-radius: 3px; }
.uptime-bar.good { background: var(--success); }
.uptime-bar.warn { background: var(--warning); }
.uptime-bar.bad { background: var(--danger); }
.uptime-bar.none { background: var(--border-strong); }
.uptime-axis { display: flex; justify-content: space-between; }
.spark { width: 100%; height: auto; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 2; }
.spark-area { fill: var(--accent); opacity: 0.12; }
.incidents { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.incidents li { display: flex; align-items: baseline; gap: 8px; }
.dept-tabs { display: flex; gap: 8px; max-width: 1000px; margin: 16px auto 0; padding: 0 16px; overflow-x: auto; }
.dept-tab { --dept: var(--accent); display: flex; flex-direction: column; align-items: flex-start; gap: 0; min-width: 120px; padding: 10px 14px; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-top: 3px solid var(--dept); border-radius: var(--radius); font: inherit; text-align: left; cursor: pointer; }
.dept-tab.active { background: var(--raised); border-color: var(--dept); box-shadow: 0 0 0 1px var(--dept); }
.roster { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.roster th { padding: 8px 10px; color: var(--muted); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-align: left; text-transform: uppercase; border-bottom: 1px solid var(--border-strong); }
.roster td { padding: 8px 10px; vertical-align: middle; border-bottom: 1px solid var(--border); white-space: nowrap; }
.roster tr.on-duty td:first-child { box-shadow: inset 3px 0 0 var(--success); }
.roster select { min-height: 32px; padding: 3px 8px; }
.duty { font-size: 0.85rem; font-weight: 600; }
.duty.on { color: var(--success); }
.duty.online { color: var(--info); }
.duty.off { color: var(--muted); font-weight: 400; }
.hire { padding: 12px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.hire summary { color: var(--accent); font-weight: 600; cursor: pointer; }
.hire .player-form { padding: 10px 0 0; }

/* Audit log */
.audit-list { display: flex; flex-direction: column; gap: 8px; }
.audit-entry { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.audit-entry.ok-state, .audit-entry.warn-state, .audit-entry.error-state { background: var(--panel); border-color: var(--border); }
.audit-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.audit-when { margin-left: auto; }
.audit-kind { padding: 1px 8px; color: var(--muted); background: var(--raised); border: 1px solid var(--border); border-radius: 999px; font-size: 0.75rem; }
.audit-detail { color: var(--text); font-size: 0.9rem; }
.audit-changes summary { color: var(--accent); font-size: 0.88rem; cursor: pointer; }
.table-scroll { overflow-x: auto; }
.diff-table { width: 100%; margin-top: 6px; border-collapse: collapse; font-size: 0.85rem; }
.diff-table th { padding: 4px 8px; color: var(--muted); font-weight: 600; text-align: left; border-bottom: 1px solid var(--border-strong); }
.diff-table td { padding: 5px 8px; vertical-align: top; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.diff-table td:first-child { color: var(--muted); }
.diff-table .from { color: var(--danger); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.diff-table .to { color: var(--success); }

/* Home */
.home-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.home-tile { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); font: inherit; text-align: left; }
button.home-tile { cursor: pointer; }
button.home-tile:hover { background: var(--hover); }
.home-tile.ok-state, .home-tile.warn-state, .home-tile.error-state { background: var(--panel); border-color: var(--border); }
.home-tile.ok-state { box-shadow: inset 3px 0 0 var(--success); }
.home-tile.warn-state { box-shadow: inset 3px 0 0 var(--warning); }
.home-tile.error-state { box-shadow: inset 3px 0 0 var(--danger); }
.home-tile-label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.home-tile strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.home-tile-sub { color: var(--muted); font-size: 0.82rem; }
.home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.home-card { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 16px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.home-card:first-child { grid-column: 1 / -1; }
.home-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.home-card-head h2 { margin: 0; font-size: 1.05rem; }
.home-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.home-link { font-size: 0.88rem; text-decoration: none; }
.home-link:hover { text-decoration: underline; }
.home-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.home-figures > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.home-figures .muted { font-size: 0.82rem; }
.home-figures strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.home-figures .money-fig { color: var(--success); font-size: 1.6rem; }
.home-figures .rolls-fig { color: var(--danger); }
.home-figures .up { color: var(--success); font-size: 0.85rem; font-weight: 600; }
.home-figures .down { color: var(--danger); font-size: 0.85rem; font-weight: 600; }
.split-bar { display: flex; height: 6px; margin-top: 4px; overflow: hidden; border-radius: 999px; }
.home-feed { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 0.9rem; }
.home-feed li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.home-feed-when { margin-left: auto; }
.home-error { grid-column: 1 / -1; }
.chart { position: relative; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-axis { fill: var(--subtle); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { opacity: 0.08; }
.chart-guide { stroke: var(--border-strong); stroke-dasharray: 3 3; }
.chart-dot { stroke: var(--panel); stroke-width: 2; }
.chart-tip { position: absolute; top: 0; display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; background: var(--raised); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 6px 18px var(--shadow); font-size: 0.82rem; pointer-events: none; transform: translateX(-50%); white-space: nowrap; }
.chart-tip span, .chart-legend span { display: flex; align-items: center; gap: 6px; }
.chart-tip i, .chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: -4px; color: var(--muted); font-size: 0.82rem; }
.chart-empty { padding: 30px 0; text-align: center; }
.chart-sub { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; border-top: 1px solid var(--border); }
.home-card.wide { grid-column: 1 / -1; }
.peak-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.peak-layout > div { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.heatmap { display: grid; grid-template-columns: 2.6rem repeat(24, minmax(0, 1fr)); grid-auto-rows: 18px; gap: 3px; width: 100%; min-width: 0; }
.heatmap > span { min-width: 0; }
.heat-hour { align-self: end; overflow: visible; color: var(--subtle); font-size: 0.68rem; line-height: 1; white-space: nowrap; }
.heat-day { align-self: center; color: var(--muted); font-size: 0.75rem; line-height: 1; }
.heat-cell { height: 100%; background: var(--accent); opacity: var(--heat); border-radius: 3px; }
.heat-cell.zero { background: var(--border-strong); opacity: 0.5; }
.heat-cell.empty { background: none; border: 1px dashed var(--border); opacity: 1; }
.hour-bars { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); align-items: end; gap: 3px; height: 150px; }
.hour-axis { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 3px; margin-top: -4px; color: var(--subtle); font-size: 0.68rem; }
.hour-axis span { overflow: visible; white-space: nowrap; }
.hour-bar { display: flex; align-items: end; height: 100%; }
.hour-bar span { display: block; width: 100%; border-radius: 3px 3px 0 0; }
.day-bars { display: grid; grid-template-columns: repeat(14, 1fr); align-items: end; gap: 4px; height: 70px; }
.day-bar { display: flex; align-items: end; height: 100%; }
.day-bar span { display: block; width: 100%; border-radius: 3px 3px 0 0; }

/* FXServer: economy */
.economy { display: flex; flex-direction: column; gap: 14px; }
.economy-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 14px; }
.econ-table-wrap { overflow-x: auto; }
.econ-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.econ-table th { padding: 6px 8px; color: var(--muted); font-size: 0.75rem; font-weight: 600; text-align: left; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border-strong); }
.econ-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.econ-table .num { text-align: right; }
.econ-table .rank { width: 2rem; color: var(--muted); }
.econ-table tbody tr:nth-child(-n + 3) .rank { color: var(--accent); font-weight: 700; }
.econ-name { position: relative; min-width: 9rem; padding: 2px 6px; }
.econ-bar { position: absolute; top: 0; bottom: 0; left: 0; background: var(--bar, var(--accent-soft)); border-radius: 4px; }
.econ-name > span:last-child { position: relative; }
.econ-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px; }
.econ-tile { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--tile, var(--accent)); border-radius: var(--radius-lg); }
.econ-tile.money, .economy-card.money { --tile: var(--success); --bar: var(--success-soft); }
.econ-tile.rolls, .economy-card.rolls { --tile: var(--danger); --bar: var(--danger-soft); }
.econ-tile.items, .economy-card.items { --tile: var(--accent); --bar: var(--accent-soft); }
.econ-tile-label { color: var(--muted); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.econ-tile-value { color: var(--tile); font-size: 1.6rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.econ-tile-line { color: var(--muted); font-size: 0.85rem; }
.economy-card { border-top: 3px solid var(--tile, var(--accent)); }
.econ-heading { margin: 10px 0 -4px; font-size: 1rem; }
.econ-online { color: var(--success); font-size: 0.75rem; font-weight: 600; }

/* Checkbox lists (dashboard page access) */
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; }

/* Browse pages */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar input[type='search'] { flex: 1; width: auto; min-width: 200px; }
.table { display: flex; flex-direction: column; gap: 6px; }
.trow { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 8px; font: inherit; text-align: left; cursor: pointer; }
.trow:hover { background: var(--hover); border-color: var(--border-strong); }
.tnum { flex: none; color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.tmain { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.tmain strong, .tmain span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tside { flex: none; text-align: right; white-space: nowrap; }
.empty { padding: 28px 16px; text-align: center; }
.detail { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.detail > * { max-width: 100%; }
.detail h2 { margin: 6px 0 0; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.info { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; width: 100%; margin: 0; padding: 12px 16px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; }
.info dt { color: var(--muted); }
.info dd { margin: 0; overflow-wrap: anywhere; }
.answer, .records li, .msg { width: 100%; padding: 10px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.transcript { width: 100%; max-height: 70vh; margin: 0; padding: 14px; overflow: auto; color: var(--text); background: var(--field); border: 1px solid var(--border); border-radius: 8px; font: 0.85rem/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.messages, .records { display: flex; flex-direction: column; gap: 8px; width: 100%; margin: 0; padding: 0; list-style: none; }
.msg.bot { background: var(--raised); }
.msg-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.msg .embed { margin-top: 4px; padding: 6px 10px; color: var(--muted); border-left: 3px solid var(--accent); }
.profile-head { display: flex; gap: 14px; align-items: center; }
.profile-head h2 { margin: 0; }
.avatar { flex: none; border-radius: 50%; object-fit: cover; }
.avatar.blank { display: inline-grid; place-items: center; color: var(--on-accent); background: var(--accent); font-weight: 700; }

/* Save bar, toast, dialog */
.savebar {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); left: 16px; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 900px; margin: 0 auto; padding: 12px 16px;
  background: var(--raised); border: 1px solid var(--accent); border-radius: var(--radius-lg); box-shadow: 0 10px 30px var(--shadow);
}
.savebar-actions { display: flex; gap: 8px; }
.toast { position: fixed; top: calc(var(--topbar) + 10px); left: 50%; z-index: 20; width: max-content; max-width: min(640px, calc(100vw - 32px)); max-height: 60vh; overflow-y: auto; white-space: pre-line; padding: 10px 16px; background: var(--raised); border: 1px solid var(--success); border-radius: 8px; box-shadow: 0 10px 30px var(--shadow); transform: translateX(-50%); }
.toast { border-left-width: 4px; }
.toast.ok { border-color: var(--success); }
.toast.warn { border-color: var(--warning); }
.toast.error { border-color: var(--danger); }
dialog { width: min(520px, calc(100vw - 32px)); padding: 22px; color: var(--text); background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); }
dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
.backup-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; margin: 12px 0; padding: 0; overflow-y: auto; list-style: none; }
.backup-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; background: var(--raised); border-radius: var(--radius); }
.dialog-actions { display: flex; justify-content: flex-end; }

/* Tablet and phone */
@media (max-width: 860px) {
  .who span { display: none; }
}
@media (max-width: 780px) {
  :root { --topbar: 52px; }
  .topbar { padding: 8px 12px; }
  .topbar-actions { gap: 6px; }
  #invite, .who, .topbar [data-theme-picker] { display: none; }
  .mobile-theme { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 0 12px 32px; }
  .guild-picker { max-width: 40vw; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .mobile-nav-wrap { position: sticky; top: var(--topbar); z-index: 4; display: flex; gap: 8px; padding: 10px 12px; background: var(--bg); border-bottom: 1px solid var(--border); }
  .mobile-nav-label, #search-mobile { flex: 1; min-width: 0; }
  .search-input { min-height: 38px; }
  .embed-field.inline { flex-basis: 100%; }
  .content { padding: 16px 12px 48px; }
  body.has-savebar .content { padding-bottom: 150px; }
  .group { padding: 14px 12px 4px; }
  .group .group { padding: 12px 10px 2px; }
  .item-body { padding: 10px 10px 2px; }
  .tside { display: none; }
  .economy-grid { grid-template-columns: minmax(0, 1fr); }
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .peak-layout { grid-template-columns: minmax(0, 1fr); }
  .player-row { flex-wrap: wrap; }
  .player-row .post-actions { width: 100%; }
  .console { height: 55vh; font-size: 0.75rem; }
  .toolbar { gap: 8px; }
  .toolbar input[type='search'] { flex-basis: 100%; min-width: 0; }
  .toolbar .segmented { width: 100%; }
  .toolbar .segmented button { flex: 1 0 auto; }
  .home-card { padding: 12px; }
  .home-card-head .segmented { width: 100%; }
  .home-card-head .segmented button { flex: 1; }
  .home-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .heatmap { grid-template-columns: 2rem repeat(24, minmax(0, 1fr)); gap: 2px; grid-auto-rows: 14px; }
  .profile-head { align-items: flex-start; }
  .profile-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fx-resource { flex-wrap: wrap; padding: 8px 10px; }
  .fx-resource-name { flex-basis: 100%; }
  .audit-when { margin-left: 0; }
  .player-ping { display: none; }
  dialog { padding: 16px; }
  .backup-list li { flex-wrap: wrap; }
  .compose { grid-template-columns: minmax(0, 1fr); }
  .compose-preview { position: static; order: 1; }
  .trow.post-row { flex-direction: column; align-items: stretch; }
  .compose-actions .button { flex: 1; }
  .info { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .info dd { margin-bottom: 8px; }
  .savebar { right: 8px; left: 8px; flex-direction: column; align-items: stretch; }
  .savebar-actions .button { flex: 1; }
  /* 16px stops iOS zooming into fields */
  input[type='text'], input[type='number'], input[type='search'], select, textarea { font-size: 16px; }
}
@media (max-width: 420px) {
  .segmented button { padding: 3px 9px; }
  .home-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-tile strong { font-size: 1.1rem; }
  .brand-name { max-width: 34vw; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
