/* USM Community Hub: always dark. */

:root {
    color-scheme: dark;

    --bg: #0b0d11;
    --surface: #161b22;
    --surface-2: #1c2128;
    --surface-3: #21262d;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.12);
    --text: #e6edf3;
    --muted: #8b949e;
    --steel: #384252;
    --navy: #1f2937;

    --accent: #5865f2;
    --accent-hover: #4752c4;
    --accent-soft: rgba(88, 101, 242, 0.14);
    --focus: rgba(88, 101, 242, 0.6);

    --amber-bg: rgba(217, 119, 6, 0.15);
    --amber-text: #fbbf24;
    --amber-border: rgba(217, 119, 6, 0.3);
    --green-bg: rgba(16, 185, 129, 0.15);
    --green-text: #34d399;
    --green-border: rgba(16, 185, 129, 0.3);
    --red-bg: rgba(239, 68, 68, 0.15);
    --red-text: #f87171;
    --red-border: rgba(239, 68, 68, 0.3);
    --blue-text: #a5b4fc;
    --blue-border: rgba(88, 101, 242, 0.35);
    --slate-bg: rgba(148, 163, 184, 0.15);
    --slate-text: #94a3b8;
    --slate-border: rgba(148, 163, 184, 0.2);

    --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.25);
    --radius: 12px;
    --radius-sm: 8px;
    --ease: 150ms ease-in-out;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

/* Layout classes set display, so make sure the hidden attribute always wins. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(1200px 400px at 50% -200px, rgba(88, 101, 242, 0.08), transparent 70%),
        var(--bg);
    color: var(--text);
    font: 15px/1.55 var(--font);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; letter-spacing: -0.01em; line-height: 1.25; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1rem; font-weight: 650; }
h3 { font-size: 0.95rem; font-weight: 600; }
p { margin: 0; }

a { color: var(--accent); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; }
.tabular { font-variant-numeric: tabular-nums; }
.visually-hidden {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Top bar ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 24px;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
    white-space: nowrap;
}

.brand-mark {
    display: block;
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.brand small {
    color: var(--muted);
    font-weight: 500;
    letter-spacing: 0;
}

#account { display: flex; align-items: center; gap: 12px; min-width: 0; }
#account form { margin: 0; }

.account-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.account-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.account-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-email {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--muted);
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.account-email svg { flex-shrink: 0; }

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    background: var(--surface-3);
    flex-shrink: 0;
}

/* ---------- Layout ---------- */

.container { width: 100%; max-width: 820px; margin: 0 auto; padding: 32px 24px 64px; }
.container.wide { max-width: 1180px; }

.stack { display: flex; flex-direction: column; gap: 16px; }

.page-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 24px; }
.eyebrow {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.card-head .count {
    color: var(--muted);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}
.card-body { padding: 8px 20px 20px; }
.card-foot {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.85rem;
}

/* ---------- Landing (signed out) ---------- */

.hero { padding: 40px 32px; text-align: center; }
.hero .brand-mark { width: 72px; height: 72px; margin: 0 auto 20px; }
.hero h1 { margin-bottom: 10px; }
.hero p { max-width: 460px; margin: 0 auto 8px; color: var(--muted); }
.hero .button { margin-top: 20px; }

.requirements {
    display: grid;
    gap: 10px;
    max-width: 460px;
    margin: 24px auto 0;
    padding: 0;
    list-style: none;
    text-align: left;
}
.requirements li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 0.88rem;
}
.requirements svg { flex-shrink: 0; margin-top: 3px; color: var(--accent); }

/* ---------- Notices ---------- */

.notice {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--amber-bg);
    border: 1px solid var(--amber-border);
    border-radius: var(--radius-sm);
    color: var(--text);
}
.notice.success { background: var(--green-bg); border-color: var(--green-border); }
.notice[hidden] { display: none; }

/* ---------- Lists of bans / blacklist ---------- */

.list { display: flex; flex-direction: column; }
.list > .empty { padding: 20px 0 4px; color: var(--muted); }

.row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: 0; }

.grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; overflow-wrap: anywhere; }
.row-title { font-weight: 600; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 0.85rem; }
.reason { color: var(--muted); font-size: 0.88rem; }
.reason b { color: var(--text); font-weight: 500; }

.server-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    flex-shrink: 0;
    border: 1px solid var(--border-strong);
    object-fit: cover;
}
.server-icon.placeholder {
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, var(--steel), var(--navy));
    color: var(--text);
    font-weight: 700;
}

.status-panel {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 0 4px;
}
.status-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 12px;
    border: 1px solid var(--slate-border);
    background: var(--slate-bg);
    color: var(--slate-text);
}
.status-icon.clear { background: var(--green-bg); border-color: var(--green-border); color: var(--green-text); }
.status-icon.listed { background: var(--red-bg); border-color: var(--red-border); color: var(--red-text); }

.row-action { flex-shrink: 0; display: flex; align-items: center; gap: 8px; }

/* ---------- Badges ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    padding: 3px 9px;
    border-radius: 6px;
    border: 1px solid var(--slate-border);
    background: var(--slate-bg);
    color: var(--slate-text);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}
.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.badge.pending, .badge.queued { background: var(--amber-bg); border-color: var(--amber-border); color: var(--amber-text); }
.badge.accepted, .badge.processing, .badge.done { background: var(--green-bg); border-color: var(--green-border); color: var(--green-text); }
.badge.denied, .badge.failed, .badge.not_appealable { background: var(--red-bg); border-color: var(--red-border); color: var(--red-text); }

/* ---------- Buttons ---------- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    font: 600 0.92rem/1.2 var(--font);
    text-decoration: none;
    cursor: pointer;
    transition: background var(--ease), border-color var(--ease), transform var(--ease), opacity var(--ease);
}
.button:hover { background: var(--accent-hover); }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: 0.55; cursor: wait; }
.button.small { padding: 7px 14px; font-size: 0.85rem; }
.button.lg { padding: 12px 22px; font-size: 1rem; }

.button.secondary {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text);
}
.button.secondary:hover { background: var(--surface-3); }

.button.danger {
    background: var(--red-bg);
    border-color: var(--red-border);
    color: var(--red-text);
}
.button.danger:hover { background: rgba(239, 68, 68, 0.25); }

.button.success {
    background: var(--green-bg);
    border-color: var(--green-border);
    color: var(--green-text);
}
.button.success:hover { background: rgba(16, 185, 129, 0.25); }

button.link {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--muted);
    font: 500 0.85rem var(--font);
    cursor: pointer;
    transition: color var(--ease), border-color var(--ease), background var(--ease);
}
button.link:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }

/* ---------- Appeal history ---------- */

.history-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    transition: border-color var(--ease);
}
.history-item + .history-item { margin-top: 10px; }
.history-item:hover, .history-item[open] { border-color: var(--border-strong); }

.history-item summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    list-style: none;
    cursor: pointer;
}
.history-item summary::-webkit-details-marker { display: none; }
.history-item summary::after {
    content: "";
    width: 8px;
    height: 8px;
    margin-left: 4px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    margin-top: -4px;
    transform: rotate(45deg);
    transition: transform var(--ease), margin var(--ease);
    flex-shrink: 0;
}
.history-item[open] summary::after { margin-top: 4px; transform: rotate(-135deg); }
.history-item summary .grow { gap: 1px; }

.history-body { padding: 4px 14px 14px; border-top: 1px solid var(--border); }
.qa { padding-top: 12px; }
.qa { margin: 0; }
.qa dt { color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.qa dt + dd + dt { margin-top: 14px; }
.qa dd { margin: 3px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

.response {
    margin-top: 12px;
    padding: 12px 14px;
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--accent-soft);
}
.response p { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Dialog ---------- */

dialog {
    width: min(600px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}
dialog::backdrop {
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
}
dialog[open] { animation: dialog-in 150ms ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@media (prefers-reduced-motion: reduce) { dialog[open] { animation: none; } * { transition: none !important; } }

.dialog-head { padding: 22px 24px 14px; border-bottom: 1px solid var(--border); }
.dialog-head h2 { font-size: 1.15rem; margin-bottom: 6px; }
.dialog-body { padding: 18px 24px 4px; }
.dialog-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px 20px;
}

/* ---------- Forms ---------- */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field-label { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; font-size: 0.9rem; }
.field-label .optional { color: var(--muted); font-weight: 500; }
.counter { white-space: nowrap; color: var(--muted); font-size: 0.78rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.counter.near { color: var(--amber-text); }

textarea, select, input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font: 0.92rem/1.5 var(--font);
    transition: border-color var(--ease), box-shadow var(--ease);
}
textarea { resize: vertical; min-height: 96px; }
textarea:focus, select:focus, input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.error {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--red-border);
    border-radius: var(--radius-sm);
    background: var(--red-bg);
    color: var(--red-text);
    font-size: 0.88rem;
}
.error[hidden] { display: none; }

/* Toggle switch: a real checkbox styled as a switch. */
.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track {
    position: relative;
    width: 40px;
    height: 22px;
    border-radius: 999px;
    background: var(--surface-3);
    border: 1px solid var(--border-strong);
    transition: background var(--ease), border-color var(--ease);
}
.switch .track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--muted);
    transition: transform var(--ease), background var(--ease);
}
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + .track { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Staff (mockups) ---------- */

.staff-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
.staff-layout > *, .inspector > * { min-width: 0; }

.side-nav { padding: 10px; }
.side-nav h3 { padding: 10px 10px 6px; color: var(--muted); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; }
.side-link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    font: 500 0.9rem var(--font);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--ease);
}
.side-link:hover { background: var(--surface-2); }
.side-link[aria-current="page"] { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.side-link .server-icon { width: 26px; height: 26px; border-radius: 7px; font-size: 0.75rem; }
.side-link .count {
    margin-left: auto;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--amber-bg);
    color: var(--amber-text);
    font-size: 0.72rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.tab {
    padding: 6px 12px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    font: 600 0.82rem var(--font);
    cursor: pointer;
    transition: background var(--ease), color var(--ease);
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 var(--border-strong); }

.queue { width: 100%; border-collapse: collapse; }
.queue th {
    padding: 10px 20px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-align: left;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}
.queue td { padding: 12px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.queue tbody tr { cursor: pointer; transition: background var(--ease); }
.queue tbody tr:hover { background: var(--surface-2); }
.queue tbody tr[aria-selected="true"] { background: var(--accent-soft); }
.queue tr:last-child td { border-bottom: 0; }
.user-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-cell .avatar { width: 28px; height: 28px; }
.clip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.inspector { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.section { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.section:last-child { border-bottom: 0; }
.section h3 { margin-bottom: 10px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 0.88rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.timeline li:last-child { border-bottom: 0; }

.confirm {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--red-border);
    border-radius: var(--radius-sm);
    background: var(--red-bg);
}
.confirm > .grow { flex: 1 1 220px; }

.setting { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.setting:last-child { border-bottom: 0; }
.setting-text { max-width: 420px; }
.setting-text p { color: var(--muted); font-size: 0.86rem; margin-top: 3px; }
.setting-control { min-width: 260px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 4px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--surface-2);
    font-size: 0.82rem;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.chip button {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}
.chip button:hover { background: var(--surface-3); color: var(--text); }

/* ---------- Landing page ---------- */

.landing-hero { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px 0 32px; text-align: center; }
.landing-hero .brand-mark { width: 88px; height: 88px; margin-bottom: 8px; }
.landing-hero p { max-width: 460px; margin: 0; }
.landing-hero .button { margin-top: 12px; }
.landing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.landing-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px;
    color: var(--text);
    text-decoration: none;
    transition: transform var(--ease), border-color var(--ease), box-shadow var(--ease);
}
.landing-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.landing-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.landing-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(145deg, var(--steel), var(--navy));
    border: 1px solid var(--border-strong);
}
.landing-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-weight: 700; font-size: 1.05rem; }
.landing-go { margin-top: auto; padding-top: 6px; color: var(--accent); font-size: 0.85rem; font-weight: 600; }
.landing-staff { margin-top: 24px; text-align: center; }
.landing-staff a { color: var(--text); }
.badge.soon { background: var(--slate-bg); border-color: var(--slate-border); color: var(--slate-text); }
.card-foot a { color: var(--text); }

/* Cards fade up into place one after another. */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.landing-hero, .landing-card { animation: rise 400ms ease-out both; }
.landing-card:nth-child(1) { animation-delay: 60ms; }
.landing-card:nth-child(2) { animation-delay: 120ms; }
.landing-card:nth-child(3) { animation-delay: 180ms; }
.container.landing { max-width: 960px; }
@media (prefers-reduced-motion: reduce) { .landing-hero, .landing-card { animation: none; } .landing-card:hover { transform: none; } }

/* ---------- Previews of sections that aren't open yet ---------- */

.soon-notice { margin-bottom: 16px; }
.preview-form fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.preview-form fieldset:disabled { opacity: 0.6; }
.preview-form fieldset:disabled .button { cursor: not-allowed; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; padding-top: 16px; }
.doc-tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
}

/* ---------- Dev tickets ---------- */

.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.form-foot { display: flex; align-items: center; justify-content: flex-end; gap: 14px; flex-wrap: wrap; }
.form-foot .button:disabled { cursor: not-allowed; }

.segmented { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.segmented label { flex: 1; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span {
    display: block;
    padding: 7px 10px;
    border-radius: 7px;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: background var(--ease), color var(--ease);
}
.segmented span:hover { color: var(--text); }
.segmented input:checked + span { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 var(--border-strong); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

.dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 22px 16px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--ease), background var(--ease);
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.dropzone-icon { color: var(--accent); margin-bottom: 4px; }

.attachments { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.attachments:empty { display: none; }
.attachment { display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.attachment.invalid { border-color: var(--red-border); }
.attachment.invalid .small { color: var(--red-text); }
.attachment-thumb { flex-shrink: 0; width: 52px; height: 36px; display: grid; place-items: center; border-radius: 6px; object-fit: cover; background: var(--surface-3); color: var(--muted); }
.attachment .grow { gap: 0; }
.upload-progress { width: 100%; height: 4px; margin-top: 4px; accent-color: var(--accent); }

/* Dev console */
.preview-bar { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; }
.preview-bar .grow { flex: 1 1 320px; }
.preview-as { display: flex; align-items: center; gap: 10px; }
.side-icon { width: 26px; height: 26px; display: grid; place-items: center; flex-shrink: 0; border-radius: 7px; background: var(--surface-3); color: var(--muted); }
.side-link[aria-current="page"] .side-icon { color: var(--text); }
.side-note { padding: 14px 10px 6px; margin-top: 8px; border-top: 1px solid var(--border); }

.ticket-line { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ticket-line .mono { flex-shrink: 0; white-space: nowrap; }
.ticket-line .clip { min-width: 0; }
.clip.wide { max-width: 360px; }
.meta-icon { display: inline-flex; align-items: center; gap: 4px; }
.queue td .meta { margin-top: 3px; align-items: center; }

.badge.cat-bug { background: var(--red-bg); border-color: var(--red-border); color: var(--red-text); }
.badge.cat-application { background: var(--green-bg); border-color: var(--green-border); color: var(--green-text); }
.badge.cat-developer_report { background: var(--amber-bg); border-color: var(--amber-border); color: var(--amber-text); }
.badge.st-open { background: var(--accent-soft); border-color: var(--blue-border); color: var(--blue-text); }
.badge.st-in_progress { background: var(--amber-bg); border-color: var(--amber-border); color: var(--amber-text); }
.badge.st-closed { background: var(--slate-bg); border-color: var(--slate-border); color: var(--slate-text); }
.badge.st-resolved { background: var(--green-bg); border-color: var(--green-border); color: var(--green-text); }
.badge.sev-major, .badge.sev-blocking { background: var(--red-bg); border-color: var(--red-border); color: var(--red-text); }
.badge.sev-minor { background: var(--amber-bg); border-color: var(--amber-border); color: var(--amber-text); }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.media { position: relative; margin: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); cursor: zoom-in; transition: border-color var(--ease); }
.media:hover { border-color: var(--border-strong); }
.media img, .media video { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000; }
.media a { display: block; }
.media figcaption { display: flex; align-items: center; gap: 6px; padding: 7px 10px; font-size: 0.8rem; }
.media figcaption .clip { flex: 1; }
.media-play { position: absolute; top: calc(50% - 34px); left: calc(50% - 20px); width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(4px); }
.play-triangle { width: 0; height: 0; margin-left: 3px; border-style: solid; border-width: 8px 0 8px 13px; border-color: transparent transparent transparent #fff; }

.thread { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.thread-event { padding-left: 42px; }
.thread-event strong { color: var(--text); font-weight: 600; }
.message { display: flex; gap: 12px; }
.message .avatar, .avatar-dot { width: 30px; height: 30px; flex-shrink: 0; }
.avatar-dot { display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); color: var(--muted); }
.message .grow { padding: 10px 14px; border: 1px solid var(--border); border-radius: 0 var(--radius-sm) var(--radius-sm) var(--radius-sm); background: var(--surface-2); }
.message.internal .grow { border-color: var(--amber-border); background: var(--amber-bg); }
.message-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.message-head .badge { padding: 1px 7px; }
.message-head .badge::before { display: none; }
.internal-tag { display: inline-flex; align-items: center; gap: 4px; color: var(--amber-text); font-size: 0.75rem; font-weight: 600; }

.reply { display: flex; flex-direction: column; gap: 10px; }
.reply textarea { min-height: 76px; }
.reply-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.reply-foot .switch { font-size: 0.85rem; }
.reply-foot .switch input:disabled + .track { opacity: 0.6; }
.inline-field { display: flex; gap: 8px; }
.inline-field select { flex: 1; min-width: 0; }
#assignment .field:last-child { margin-bottom: 0; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    .staff-layout, .inspector { grid-template-columns: 1fr; }
    .landing-grid { grid-template-columns: 1fr; }
    .queue .hide-sm { display: none; }
}

@media (max-width: 600px) {
    .topbar { padding: 10px 16px; }
    .field-row { grid-template-columns: 1fr; gap: 0; }
    .card-head { flex-wrap: wrap; }
    .brand small, .account-text, .nav-extra { display: none; }
    .container { padding: 20px 16px 48px; }
    .hero { padding: 28px 20px; }
    .card-head, .card-body, .card-foot, .section, .setting { padding-left: 16px; padding-right: 16px; }
    .row { flex-wrap: wrap; }
    .row-action { width: 100%; padding-left: 56px; }
    .dialog-head, .dialog-body, .dialog-foot { padding-left: 18px; padding-right: 18px; }
    .dialog-foot .button { flex: 1; }
    .setting { flex-direction: column; gap: 12px; }
    .setting-control { min-width: 0; width: 100%; }
    .queue th, .queue td { padding-left: 16px; padding-right: 16px; }
    .clip { max-width: 140px; }
    .clip.wide { max-width: none; white-space: normal; }
    .preview-as .tab { white-space: nowrap; }
    .preview-as { width: 100%; flex-wrap: wrap; }
    .preview-as .tabs { width: 100%; }
    .preview-as .tab { flex: 1; padding-left: 6px; padding-right: 6px; }
    .segmented { flex-wrap: wrap; }
    .segmented label { flex: 1 1 40%; }
}
