/* Catevo Helpdesk viewer: catevo.com's dark night/cream/signal look, tuned for a dense work tool.
   Dependency-free, no JS, system fonts only (the CSP allows no external requests).
   One theme on purpose: catevo.com is dark, so the viewer is dark in every colour scheme. */
:root {
    /* catevo.com brand tokens */
    --night: #071521;
    --night-2: #0a1d2c;
    --night-3: #0f2639;
    --cream: #f2ecdf;
    --mist: #a8b5c3;
    --signal: #f55b49;
    --signal-hover: #ff7766;
    --signal-soft: rgba(245, 91, 73, 0.18);
    --line: rgba(242, 236, 223, 0.14);
    --line-strong: rgba(242, 236, 223, 0.28);
    --panel: rgba(11, 28, 43, 0.8);
    --panel-solid: #0d2234;
    --max: 1180px;

    /* Working colours. Contrast is checked against --panel-solid and --night (WCAG AA). */
    --ink: var(--cream);               /* body text: ~15:1 */
    --muted: var(--mist);              /* secondary text: ~7.7:1 */
    --field-bg: #081827;
    --field-line: #6b7d90;             /* input borders: >= 3:1 against panel and field */
    --link-line: rgba(245, 91, 73, 0.75);
    --danger: #ff8a7a;                 /* ~7:1 on panel */
    --ok-bg: rgba(95, 200, 135, 0.13); --ok-ink: #a6e7bd; --ok-line: rgba(95, 200, 135, 0.45);
    --warn-bg: var(--signal-soft);     --warn-ink: #ffb3a8; --warn-line: rgba(245, 91, 73, 0.5);
    --new-bg: rgba(90, 160, 235, 0.15);  --new-ink: #9cc7ff;  --new-line: rgba(90, 160, 235, 0.45);
    --prog-bg: rgba(243, 199, 107, 0.13); --prog-ink: #f3c76b; --prog-line: rgba(243, 199, 107, 0.45);
    --closed-bg: rgba(168, 181, 195, 0.1); --closed-ink: #b9c4d0; --closed-line: rgba(168, 181, 195, 0.35);
    --mono: ui-monospace, "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;

    color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--night); }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--ink);
    font: 15px/1.55 "Segoe UI", Tahoma, sans-serif;
    background:
        radial-gradient(circle at 85% 0%, rgba(245, 91, 73, 0.09), transparent 22%),
        radial-gradient(circle at 10% 90%, rgba(52, 116, 186, 0.12), transparent 28%),
        linear-gradient(180deg, var(--night) 0%, var(--night-2) 60%, #09131d 100%);
    background-color: var(--night);
    background-attachment: fixed;
}

/* catevo.com's faint blueprint grid */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        linear-gradient(rgba(242, 236, 223, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(242, 236, 223, 0.04) 1px, transparent 1px);
    background-size: 52px 52px;
    opacity: 0.3;
    pointer-events: none;
    z-index: 0;
}

::selection { background: rgba(245, 91, 73, 0.4); color: var(--cream); }

/* ---- Links ---- */
a {
    color: var(--cream);
    text-decoration: underline;
    text-decoration-color: var(--link-line);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}
a:hover { color: #fff; text-decoration-color: var(--signal); text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

/* ---- Typography ---- */
h1, h2, h3, h4 { color: var(--cream); line-height: 1.25; }
h1 { font-size: 1.65rem; font-weight: 650; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: 1.15rem; font-weight: 650; letter-spacing: -0.01em; margin: 1.75rem 0 0.6rem; }
h3 { font-size: 1rem; font-weight: 650; margin: 0; }
h4 { font-size: 0.95rem; font-weight: 650; margin: 1.25rem 0 0.4rem; }
main h3 { margin-top: 1.25rem; margin-bottom: 0.4rem; }
.card > h2:first-child, .card > h3:first-child, .card > h4:first-child { margin-top: 0; }
p { margin: 0 0 0.85rem; }
ul, ol { margin: 0 0 0.85rem; padding-left: 1.4em; }
li + li { margin-top: 0.2rem; }
li::marker { color: var(--mist); }
strong, b { font-weight: 650; color: var(--cream); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
blockquote { margin: 0 0 0.85rem; padding: 0.25rem 0 0.25rem 14px; border-left: 3px solid var(--signal); color: var(--mist); }
small { font-size: 0.85em; }

/* catevo.com's coral, uppercase, wide-tracked label */
.eyebrow { color: var(--signal); font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; margin: 0 0 6px; }

/* ---- Code (the How-to page is documentation-like) ---- */
code, kbd, samp, pre { font-family: var(--mono); font-size: 0.88em; }
code, kbd, samp {
    background: rgba(242, 236, 223, 0.07);
    border: 1px solid var(--line);
    padding: 0.08em 0.35em;
    color: var(--cream);
    overflow-wrap: anywhere;
}
kbd { border-bottom-width: 2px; }
pre {
    background: #050f18;
    color: var(--cream);
    border: 1px solid var(--line);
    border-left: 3px solid var(--signal);
    padding: 12px 14px;
    margin: 0 0 1rem;
    max-width: 100%;
    overflow-x: auto;
    line-height: 1.55;
    white-space: pre;
    tab-size: 4;
}
pre code, pre kbd, pre samp { background: none; border: 0; padding: 0; font-size: 1em; overflow-wrap: normal; }

/* ---- Layout ---- */
.wrap { width: min(var(--max), calc(100% - 32px)); margin: 0 auto; position: relative; z-index: 1; }
main.wrap { flex: 1 0 auto; padding-top: 28px; padding-bottom: 56px; }

.skip-link { position: absolute; left: 16px; top: -48px; z-index: 20; background: var(--signal); color: var(--night); padding: 8px 12px; font-weight: 650; text-decoration: none; }
.skip-link:focus { top: 8px; color: var(--night); }

/* ---- Header (catevo.com's site-nav) ---- */
.topbar {
    position: relative;
    z-index: 5;
    background: var(--night);
    border-bottom: 1px solid rgba(242, 236, 223, 0.08);
}
.topbar-inner { display: flex; align-items: center; gap: 8px 28px; min-height: 64px; flex-wrap: wrap; }

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--cream); text-decoration: none; padding: 6px 0; }
.brand:hover { color: var(--cream); }
.brand-icon { width: 30px; height: 30px; display: block; flex: none; background: url("../images/catevo-mark.svg") center / contain no-repeat; }
.brand-text { display: flex; flex-direction: column; gap: 3px; }
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.05; }
.brand-tagline { font-size: 9.5px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--signal); line-height: 1; }

.nav { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.nav a {
    color: var(--mist);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 8px 10px;
    box-shadow: inset 0 -2px 0 transparent;
}
.nav a:hover { color: var(--cream); box-shadow: inset 0 -2px 0 var(--line-strong); }
.nav a[aria-current="page"] { color: var(--cream); box-shadow: inset 0 -2px 0 var(--signal); }
.nav a.nav-signin { color: var(--cream); border: 1px solid var(--line-strong); box-shadow: none; padding: 6px 14px; }
.nav a.nav-signin:hover { border-color: var(--signal); }

.session { margin-left: auto; display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; min-width: 0; }
.session .who { color: var(--mist); font-size: 0.85rem; overflow-wrap: anywhere; min-width: 0; }
.session button.linklike { font-size: 0.85rem; font-weight: 600; }
.topbar .nav:last-child { margin-left: auto; }

/* ---- Footer (catevo.com's footer-note) ---- */
.site-foot { padding: 22px 0 28px; border-top: 1px solid rgba(242, 236, 223, 0.08); color: var(--mist); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }

/* ---- Page furniture ---- */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1::before { content: ""; display: block; width: 28px; height: 2px; background: var(--signal); margin-bottom: 10px; }
.crumbs { margin: 0 0 10px; font-size: 0.9rem; }
.crumbs a { color: var(--mist); text-decoration: none; }
.crumbs a:hover { color: var(--cream); text-decoration: underline; text-decoration-color: var(--signal); }

/* Panels: square, hairline border, like catevo.com's .panel */
.card {
    background: var(--panel-solid);
    border: 1px solid var(--line);
    padding: 18px 20px;
    margin-bottom: 16px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.14);
    min-width: 0;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { margin: 0; }

/* Narrow cards (sign-in and friends) carry catevo.com's dashed inner frame */
.card.narrow { position: relative; max-width: 460px; margin: 48px auto; padding: 34px 34px 26px; }
.card.narrow::after { content: ""; position: absolute; inset: 12px; border: 1px dashed rgba(242, 236, 223, 0.14); pointer-events: none; }
.card.narrow h1 { margin-bottom: 14px; overflow-wrap: anywhere; }
.card.narrow h1::before { content: ""; display: block; width: 28px; height: 2px; background: var(--signal); margin-bottom: 14px; }
.card.narrow p { color: var(--mist); }
.card.narrow p:last-child, .card.narrow form:last-child { margin-bottom: 0; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- Forms ---- */
input, select, textarea, button { font: inherit; color: inherit; }
label { color: var(--cream); }
.stack > label { font-weight: 600; font-size: 0.9rem; margin-bottom: -2px; }
input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=submit]):not([type=button]),
select, textarea {
    background: var(--field-bg);
    color: var(--cream);
    border: 1px solid var(--field-line);
    border-radius: 0;
    padding: 8px 10px;
    min-width: 0;
    max-width: 100%;
    line-height: 1.4;
}
input::placeholder, textarea::placeholder { color: #8796a6; opacity: 1; }
input:hover:not(:disabled):not([readonly]), select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: var(--mist); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--signal); outline-offset: 0; border-color: var(--signal); }
input[readonly] { background: #050f18; }
input[type=checkbox], input[type=radio] { accent-color: var(--signal); width: 16px; height: 16px; margin: 0; }
textarea { width: 100%; resize: vertical; }
select { padding-right: 6px; }
option { background: var(--panel-solid); color: var(--cream); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; font-weight: 600; font-size: 0.9rem; color: var(--cream); }

/* Buttons: catevo.com's .btn, square and outlined; primary is signal coral with night ink (5.7:1) */
button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(242, 236, 223, 0.04);
    color: var(--cream);
    border: 1px solid var(--line-strong);
    border-radius: 0;
    padding: 8px 16px;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
    cursor: pointer;
}
button:hover, .button:hover { border-color: rgba(242, 236, 223, 0.55); background: rgba(242, 236, 223, 0.08); color: var(--cream); text-decoration: none; }
button.primary, .button.primary { background: var(--signal); border-color: var(--signal); color: var(--night); }
button.primary:hover, .button.primary:hover { background: var(--signal-hover); border-color: var(--signal-hover); color: var(--night); }
button:disabled, button:disabled:hover, .button[aria-disabled=true] {
    background: transparent;
    color: var(--mist);
    border: 1px dashed var(--line-strong);
    cursor: not-allowed;
}
button.linklike {
    display: inline;
    background: none;
    border: 0;
    padding: 0;
    color: var(--cream);
    font-weight: inherit;
    text-decoration: underline;
    text-decoration-color: var(--link-line);
    text-underline-offset: 0.2em;
}
button.linklike:hover { background: none; color: #fff; text-decoration-color: var(--signal); text-decoration-thickness: 2px; }
.linklike.danger, button.linklike.danger { color: var(--danger); font-weight: 600; text-decoration-color: rgba(255, 138, 122, 0.6); }
.linklike.danger:hover { color: #ffb3a8; }
button.danger:not(.linklike) { color: var(--danger); border-color: rgba(255, 138, 122, 0.55); }
form.inline { display: inline; margin: 0; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack > button, .stack > .button { align-self: flex-start; }
.row { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
label.row { gap: 8px; font-weight: 400; cursor: pointer; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.filters input[type=search] { flex: 1 1 240px; }
.filters select { flex: 0 1 auto; max-width: 100%; min-width: 0; }

/* Status tabs: square segments, the active one in signal coral */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--line-strong);
    background: rgba(242, 236, 223, 0.03);
    color: var(--cream);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
}
.tab:hover { color: var(--cream); border-color: rgba(242, 236, 223, 0.55); text-decoration: none; }
.tab.active, .tab.active:hover { background: var(--signal); border-color: var(--signal); color: var(--night); }
.tab .count { font-family: var(--mono); font-size: 0.8rem; color: var(--mist); margin-left: 0; }
.tab.active .count { color: var(--night); }

/* ---- Alerts and badges (signal-pill style: tint, hairline, tracked caps) ---- */
.alert { padding: 10px 14px; margin: 0 0 14px; border: 1px solid; border-left-width: 3px; }
.alert-ok { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-line); border-left-color: #5fc887; }
.alert-error { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); border-left-color: var(--signal); }
.alert a, .alert strong { color: inherit; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border: 1px solid;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    line-height: 1.5;
    white-space: nowrap;
    vertical-align: middle;
}
.badge-ok { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-line); }
.badge-warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.status-new { background: var(--new-bg); color: var(--new-ink); border-color: var(--new-line); }
.status-inprogress { background: var(--prog-bg); color: var(--prog-ink); border-color: var(--prog-line); }
.status-closed { background: var(--closed-bg); color: var(--closed-ink); border-color: var(--closed-line); }
/* Priority: urgent is solid signal coral (night on #f55b49, ~5.7:1), high a coral outline (~9:1 on panel),
   normal and low recede (mist ink, ~7:1). The text label carries the meaning, not the colour alone. */
.priority-urgent { background: var(--signal); color: var(--night); border-color: var(--signal); }
.priority-high { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--signal); }
.priority-normal { background: transparent; color: var(--muted); border-color: var(--line); }
.priority-low { background: transparent; color: var(--muted); border-color: var(--line); border-style: dashed; }

/* ---- Tables ---- */
table { border-collapse: collapse; }
main table:not([class]) { width: 100%; margin: 0 0 1rem; font-size: 0.92rem; }
main table:not([class]) th, main table:not([class]) td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
main table:not([class]) th { color: var(--mist); font-weight: 600; }
main table:not([class]) td { overflow-wrap: break-word; }
main table:not([class]) td code { overflow-wrap: normal; white-space: nowrap; }
main table:not([class]) tbody tr:last-child td { border-bottom: 0; }

.table-wrap {
    overflow-x: auto;
    background: var(--panel-solid);
    border: 1px solid var(--line);
    max-width: 100%;
    scrollbar-color: #2b4560 transparent;
}
table.tickets { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.tickets th, .tickets td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tickets th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--mist);
    font-weight: 600;
    white-space: nowrap;
    background: rgba(7, 21, 33, 0.55);
}
.tickets tbody tr:hover { background: rgba(242, 236, 223, 0.035); }
.tickets tbody tr:last-child td { border-bottom: 0; }
.tickets td a { text-decoration: none; font-weight: 600; }
.tickets td a:hover { text-decoration: underline; text-decoration-color: var(--signal); }
.tickets td.nowrap a { font-family: var(--mono); font-size: 0.88rem; font-weight: 500; color: var(--cream); }
.tickets td.subject { min-width: 220px; overflow-wrap: anywhere; }
.tickets .email-failed { margin-left: 6px; }

.empty {
    padding: 32px 16px;
    margin: 0 0 16px;
    text-align: center;
    color: var(--muted);
    background: var(--panel);
    border: 1px dashed var(--line-strong);
}

/* ---- Ticket detail ---- */
.ticket-subject { overflow-wrap: anywhere; min-width: 0; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
.detail-grid > .card { margin-bottom: 0; }
.side .card:last-child { margin-bottom: 0; }
.side .card h2 { font-size: 12px; font-weight: 600; color: var(--signal); letter-spacing: 0.22em; text-transform: uppercase; margin: 0 0 10px; }
.fields { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; margin: 0; }
.fields dt { color: var(--mist); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; padding-top: 3px; }
.fields dd { margin: 0; overflow-wrap: anywhere; }
.description {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: var(--night);
    border: 1px solid var(--line);
    border-left: 3px solid var(--signal);
    padding: 12px 14px;
}
.detail-grid + .card { margin-top: 16px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li + li { margin-top: 0; }
.event { border-left: 2px solid var(--line-strong); padding: 4px 0 12px 14px; }
.event-status { border-left-color: var(--prog-ink); }
.event-created { border-left-color: var(--signal); }
.event-meta { font-size: 0.82rem; color: var(--muted); }
.note-text { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Ticket attachments: thumbnails in a grid that wraps to fit any width (two across on a 375px phone), each linking to
   the full image. min(…, 100%) keeps a single column from overflowing very narrow screens; names break anywhere. */
.attachments { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr)); gap: 12px; }
.attachments li + li { margin-top: 0; }
.attachment { min-width: 0; }
.attachment a { display: block; text-decoration: none; color: var(--cream); }
.attachment a:hover .attachment-thumb { border-color: var(--signal); }
.attachment-thumb { display: block; width: 100%; max-width: 100%; height: 140px; object-fit: contain; background: var(--field-bg); border: 1px solid var(--line); }
.attachment-name { display: block; margin-top: 6px; font-size: 0.85rem; overflow-wrap: anywhere; word-break: break-word; }
.attachment a:hover .attachment-name { text-decoration: underline; text-decoration-color: var(--signal); }
.attachment-size { display: block; color: var(--muted); font-size: 0.8rem; overflow-wrap: anywhere; }
.attachments-note { margin-bottom: 10px; }

.email-log { list-style: none; margin: 0; padding: 0; }
.email-log li { padding: 8px 0; margin: 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.email-log li:last-child { border-bottom: 0; }

.allowed-emails, .admin-list { margin: 0; padding-left: 20px; }

/* ---- Keys / sites tables (owned by the Sites page; generic here) ---- */
table.keys { width: 100%; border-collapse: collapse; margin: 0.5rem 0; font-size: 0.92rem; }
table.keys th, table.keys td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.keys th { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--mist); font-weight: 600; }
table.keys tbody tr:last-child td { border-bottom: 0; }
.new-key { border-color: var(--ok-line); border-left: 3px solid #5fc887; background: linear-gradient(var(--ok-bg), var(--ok-bg)), var(--panel-solid); }
.new-key input { width: 100%; }
.create-key-form { flex-wrap: wrap; align-items: center; margin-top: 0.75rem; }
.create-key-form input[type=text] { flex: 1 1 12rem; min-width: 0; }

details { margin: 0.75rem 0; }
details > summary { cursor: pointer; color: var(--cream); }
details > summary::marker { color: var(--signal); }
details > summary:hover { color: #fff; }
details[open] > summary { margin-bottom: 6px; }
details.revoked summary { cursor: pointer; }

/* ---- Small screens ---- */
@media (max-width: 760px) {
    .detail-grid { grid-template-columns: 1fr; }
    .fields { grid-template-columns: 1fr; gap: 0; }
    .fields dt { margin-top: 10px; }
    .fields dt:first-child { margin-top: 0; }
    h1 { font-size: 1.35rem; }
    main.wrap { padding-top: 20px; padding-bottom: 40px; }
    .card { padding: 16px; }
    .card.narrow { margin: 24px auto; padding: 28px 24px 22px; }
    .card.narrow::after { inset: 8px; }
    /* Docs tables scroll inside themselves rather than widening the page */
    main table:not([class]) { font-size: 0.86rem; display: block; max-width: 100%; overflow-x: auto; }
    main table:not([class]) td:last-child:not(:first-child) { min-width: 13rem; }
    main table:not([class]) th, main table:not([class]) td { padding: 6px 6px; }
    main table:not([class]) th:first-child, main table:not([class]) td:first-child { padding-left: 0; }

    .topbar-inner { gap: 0 12px; padding: 8px 0 4px; }
    .brand { flex: 1 1 auto; }
    .nav { order: 3; width: 100%; margin: 4px 0 0 -10px; }
    .topbar .nav:last-child { width: auto; order: 0; margin: 0 0 0 auto; }
    .session { order: 4; width: 100%; margin: 0; justify-content: space-between; padding: 6px 0 2px; border-top: 1px solid rgba(242, 236, 223, 0.08); }
}

@media (max-width: 640px) {
    table.keys thead { display: none; }
    table.keys tr { display: block; padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
    table.keys tbody tr:last-child { border-bottom: 0; }
    table.keys td { display: block; border: 0; padding: 0.1rem 0; }

    /* Ticket list: each row becomes a card (reference, status and priority on one line, subject below, then labelled
       details) instead of a 1100px table that scrolls sideways. Cell order is unchanged, so the reference is still the
       first cell. */
    .table-wrap:has(> table.tickets) { overflow-x: visible; }
    table.tickets, .tickets tbody { display: block; }
    .tickets thead { display: none; }
    .tickets tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
    .tickets tbody tr:last-child { border-bottom: 0; }
    .tickets td { display: block; border: 0; padding: 0; min-width: 0; }
    .tickets td.subject { order: 1; flex: 1 1 100%; min-width: 0; font-size: 1rem; margin: 2px 0; }
    .tickets td[data-label] { order: 2; flex: 1 1 100%; font-size: 0.86rem; overflow-wrap: anywhere; white-space: normal; }
    .tickets td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 5.5rem; color: var(--mist); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; }
    .tickets td[data-label] br { display: none; }
    .tickets td[data-label] .small { margin-left: 6px; }
}

@media (min-width: 761px) {
    .topbar { position: sticky; top: 0; background: rgba(7, 21, 33, 0.82); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
}

@media (prefers-reduced-motion: no-preference) {
    a, button, .tab, .nav a, input, select, textarea { transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease; }
}

@media print {
    body { background: #fff; color: #000; }
    body::before, .topbar, .site-foot, form { display: none; }
    .card, .table-wrap { background: #fff; border-color: #ccc; box-shadow: none; }
    a, h1, h2, h3, strong { color: #000; }
}
