/* ==========================================================================
   MEIDS Demo - customer portal.
   Same family as the MEIDS v3 theme: navy + MEIDS violet, the theme's neutral
   panels and status colours, Segoe/Inter type. Light and dark follow the OS.
   ========================================================================== */

:root {
    --navy: #12306B;
    --violet: #7651E0;
    --violet-deep: #5B3DBA;
    --violet-soft: #EEE8FD;

    --ground: #EEF1F5;
    --panel: #FFFFFF;
    --panel2: #F5F7FA;
    --panel3: #E9EDF3;
    --line: #CDD4DE;
    --line-soft: #E1E6ED;

    --ink: #161C24;
    --ink2: #475262;
    --ink3: #667180;

    --accent: #2D5F8A;
    --accent-soft: #E1EDFA;

    --ok: #14683A;      --ok-bg: #DCEFE3;
    --warn: #7A5000;    --warn-bg: #F8E7BD;
    --block: #A82418;   --block-bg: #F8D9D4;
    --info: #0B4F9E;    --info-bg: #E1EDFA;
    --mute: #4A5563;    --mute-bg: #E7EBF1;

    --shadow: 0 1px 2px rgba(22, 28, 36, .06), 0 6px 18px rgba(22, 28, 36, .06);
    --radius: 10px;
    --radius-sm: 6px;
    --font: "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --mono: "Cascadia Mono", Consolas, "Courier New", monospace;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --violet: #A88BFF;
        --violet-deep: #CDB8FF;
        --violet-soft: #2A2244;

        --ground: #0E1319;
        --panel: #19212B;
        --panel2: #1F2833;
        --panel3: #283340;
        --line: #364353;
        --line-soft: #2A3542;

        --ink: #E9EEF5;
        --ink2: #B6C1CF;
        --ink3: #8E9CAD;

        --accent: #64B0EA;
        --accent-soft: #1C2E40;

        --ok: #5FD095;      --ok-bg: #12301F;
        --warn: #F3C264;    --warn-bg: #3B2E12;
        --block: #FF8A7A;   --block-bg: #40201C;
        --info: #8FCBFF;    --info-bg: #16283A;
        --mute: #AEBBC9;    --mute-bg: #263140;

        --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 22px rgba(0, 0, 0, .35);
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    background: var(--ground);
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0; }
.muted { color: var(--ink3); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }

/* ------------------------------------------------------------------ brand */
.wordmark { height: 34px; width: auto; display: block; }
.wordmark.night { display: none; }
@media (prefers-color-scheme: dark) {
    .wordmark.day { display: none; }
    .wordmark.night { display: block; }
}

/* MEIDS icon sits to the left of the wordmark */
.brand { display: flex; align-items: center; gap: 4px; text-decoration: none; }
.brand-icon { height: 38px; width: auto; display: block; border-radius: 9px; flex: none; }

/* ------------------------------------------------------------------ ATDS credit */
.credit-logo { height: 26px; width: auto; display: block; flex: none; }
.credit-logo.night { display: none; }
@media (prefers-color-scheme: dark) {
    .credit-logo.day { display: none; }
    .credit-logo.night { display: block; }
}
.credit { border-top: 1px solid var(--line); background: var(--panel); margin-top: 32px; }
.credit-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 18px;
    font-size: 13px;
    color: var(--ink3);
}
.credit-brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.credit-brand strong { color: var(--ink2); font-weight: 650; }
.credit-brand:hover strong { color: var(--accent); }
.form-credit {
    display: flex; align-items: center; gap: 8px;
    padding-top: 14px; border-top: 1px solid var(--line-soft);
    font-size: 12px; color: var(--ink3);
}
.form-credit .credit-logo { height: 20px; }

/* ------------------------------------------------------------------ top bar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}
.topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 18px;
}
.topbar .portal-name {
    padding-left: 18px;
    border-left: 1px solid var(--line);
    font-weight: 650;
    color: var(--ink2);
    white-space: nowrap;
}
.topbar .spacer { flex: 1; }
.who { text-align: right; line-height: 1.25; }
.who .name { font-weight: 650; }
.who .unit { font-size: 13px; color: var(--ink3); }

.tabs {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs a {
    display: inline-block;
    padding: 10px 14px 11px;
    color: var(--ink2);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--violet-deep); border-bottom-color: var(--violet); }
@media (prefers-color-scheme: dark) { .tabs a.on { color: var(--violet); } }

main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px;
}

/* ------------------------------------------------------------------ building blocks */
.card {
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-pad { padding: 20px 22px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.section-head p { margin-top: 4px; color: var(--ink3); max-width: 70ch; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--panel2);
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { background: var(--panel3); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .tabs a:focus-visible, .post:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--violet) 55%, transparent);
    outline-offset: 2px;
}
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: #0D2550; }
@media (prefers-color-scheme: dark) {
    .btn.primary { background: var(--violet); border-color: var(--violet); color: #120B26; }
    .btn.primary:hover { background: #B9A1FF; }
}
.btn.danger { color: var(--block); }
.btn.small { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn.link { background: none; border-color: transparent; color: var(--accent); padding: 0 6px; }
.btn[disabled] { opacity: .55; cursor: default; }

label.field { display: block; }
label.field > span { display: block; font-size: 13px; font-weight: 650; color: var(--ink2); margin-bottom: 5px; }
input[type=text], input[type=password], input[type=date], input[type=search], input[type=url], select, textarea {
    width: 100%;
    min-height: 40px;
    padding: 8px 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--panel);
    color: var(--ink);
    font: inherit;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
select { padding-right: 28px; }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    white-space: nowrap;
    background: var(--mute-bg);
    color: var(--mute);
}
.pill.s-open { background: var(--info-bg); color: var(--info); }
.pill.s-under-review { background: var(--warn-bg); color: var(--warn); }
.pill.s-planned, .pill.s-in-testing { background: var(--violet-soft); color: var(--violet-deep); }
@media (prefers-color-scheme: dark) { .pill.s-planned, .pill.s-in-testing { color: var(--violet); } }
.pill.s-done, .pill.s-released { background: var(--ok-bg); color: var(--ok); }
.pill.s-not-planned { background: var(--mute-bg); color: var(--mute); }
.pill.cat { background: transparent; border: 1px solid var(--line); color: var(--ink2); }
.pill.staff { background: var(--navy); color: #fff; }
@media (prefers-color-scheme: dark) { .pill.staff { background: var(--violet); color: #120B26; } }

.msg { padding: 10px 14px; border-radius: var(--radius-sm); font-weight: 600; }
.msg.error { background: var(--block-bg); color: var(--block); }
.msg.ok { background: var(--ok-bg); color: var(--ok); }
.msg.info { background: var(--info-bg); color: var(--info); }

.empty { padding: 36px 20px; text-align: center; color: var(--ink3); }

/* ------------------------------------------------------------------ demo tab */
.demo-head { display: flex; gap: 20px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.demo-head .icao { font-family: var(--mono); font-weight: 700; color: var(--violet-deep); }
@media (prefers-color-scheme: dark) { .demo-head .icao { color: var(--violet); } }

.screen {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #0E1319;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}
.screen iframe {
    position: absolute;
    left: 0;
    top: 0;
    width: 1920px;
    height: 1080px;
    border: 0;
    transform-origin: 0 0;
    background: #E9ECF1;
}

/* Full screen: the real browser kind (:fullscreen) or, where that isn't available, filling the window. */
.screen:fullscreen { width: 100vw; height: 100vh; aspect-ratio: auto; border: 0; border-radius: 0; box-shadow: none; }
.screen:-webkit-full-screen { width: 100vw; height: 100vh; aspect-ratio: auto; border: 0; border-radius: 0; box-shadow: none; }
.screen.fs-fallback {
    position: fixed;
    inset: 0;
    z-index: 1000;
    width: auto;
    height: auto;
    aspect-ratio: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}
body.demo-fs-open { overflow: hidden; }

.screen-exit {
    display: none;
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    padding: 8px 14px;
    border: 0;
    border-radius: 999px;
    background: rgba(14, 19, 25, .78);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    opacity: .8;
    transition: opacity .15s;
}
.screen-exit:hover, .screen-exit:focus-visible { opacity: 1; }
.screen:fullscreen .screen-exit, .screen:-webkit-full-screen .screen-exit, .screen.fs-fallback .screen-exit { display: block; }
.demo-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
@media (max-width: 900px) { .demo-pages { grid-template-columns: repeat(2, 1fr); } }
.demo-pages button {
    text-align: left;
    padding: 12px 14px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    background: var(--panel);
    color: var(--ink);
    font: inherit;
    cursor: pointer;
}
.demo-pages button:hover { border-color: var(--violet); }
.demo-pages button.on { border-color: var(--violet); box-shadow: inset 3px 0 0 var(--violet); }
.demo-pages b { display: block; font-size: 14px; }
.demo-pages span { display: block; font-size: 12.5px; color: var(--ink3); margin-top: 2px; line-height: 1.35; }

/* ------------------------------------------------------------------ board */
.board-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
@media (max-width: 980px) { .board-layout { grid-template-columns: 1fr; } }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters select { width: auto; min-width: 150px; }

.post {
    display: block;
    width: 100%;
    text-align: left;
    padding: 16px 18px;
    border: 0;
    border-bottom: 1px solid var(--line-soft);
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
}
.post:last-child { border-bottom: 0; }
.post:hover { background: var(--panel2); }
.post .title { font-weight: 650; font-size: 16px; margin: 6px 0 4px; }
.post .excerpt { color: var(--ink2); white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post .meta { margin-top: 8px; font-size: 13px; color: var(--ink3); display: flex; gap: 14px; flex-wrap: wrap; }

/* Sticky posts and the header above the board */
.post.pinned { background: var(--warn-bg); box-shadow: inset 4px 0 0 var(--warn); }
.post.pinned:hover { background: color-mix(in srgb, var(--warn-bg) 80%, var(--panel2)); }
.pill.sticky { background: var(--warn); color: var(--panel); }
.board-header {
    display: flex; flex-direction: column; gap: 10px;
    padding: 14px 18px; margin-bottom: 4px;
    border-radius: var(--radius); background: var(--info-bg);
    border: 1px solid color-mix(in srgb, var(--info) 30%, transparent);
    box-shadow: inset 4px 0 0 var(--info);
}
.board-header-text { white-space: pre-line; overflow-wrap: anywhere; color: var(--ink); font-size: 15px; }
.board-header-text + .board-header-text { padding-top: 10px; border-top: 1px solid color-mix(in srgb, var(--info) 25%, transparent); }

.thread .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.reply { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--panel2); border: 1px solid var(--line-soft); }
.reply.staff { background: var(--violet-soft); border-color: color-mix(in srgb, var(--violet) 35%, transparent); }
.reply .who-line { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--ink3); margin-bottom: 6px; flex-wrap: wrap; }
.reply .who-line b { color: var(--ink); }
.reply .text { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ releases */
.release {
    padding: 20px 22px;
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.release.draft { border-style: dashed; border-color: var(--line); background: var(--panel2); }
.release .vline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--ink3); }
.release .vline .ver { font-family: var(--mono); font-weight: 700; color: var(--ink2); }
.release h3 { font-size: 17px; margin: 6px 0 8px; }
.release .summary { color: var(--ink2); margin-bottom: 10px; max-width: 80ch; }
.release ul.changes { list-style: none; margin: 0; padding: 0; color: var(--ink2); }
.release ul.changes li { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 5px 0; }
.release ul.changes li + li { border-top: 1px solid var(--line-soft); }
.kind {
    display: inline-block;
    text-align: center;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    background: var(--mute-bg);
    color: var(--mute);
}
.kind.k-new { background: var(--violet-soft); color: var(--violet-deep); }
.kind.k-improved { background: var(--info-bg); color: var(--info); }
.kind.k-fixed { background: var(--ok-bg); color: var(--ok); }
.kind.k-changed { background: var(--warn-bg); color: var(--warn); }
@media (prefers-color-scheme: dark) { .kind.k-new { color: var(--violet); } }
.pill.s-draft { background: var(--mute-bg); color: var(--mute); border: 1px dashed var(--line); }

.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .grid3 { grid-template-columns: 1fr; } }
.change-rows { display: grid; gap: 8px; margin-bottom: 8px; }
.change-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.change-row textarea { min-height: 44px; }
.change-tools { display: flex; gap: 4px; }
@media (max-width: 760px) {
    .change-row { grid-template-columns: 1fr; }
    .change-tools { justify-content: flex-end; }
}

/* ------------------------------------------------------------------ all sites (admins) */
.sites { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.site { display: flex; flex-direction: column; gap: 12px; }
.site .site-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.site .icao { font-family: var(--mono); font-weight: 700; color: var(--violet-deep); font-size: 15px; }
@media (prefers-color-scheme: dark) { .site .icao { color: var(--violet); } }
.site > .row { margin-top: auto; }
.site.staffsite { border-style: dashed; }
.stats { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 6px 22px; }
.stat { display: flex; flex-direction: column; }
.stat b { font-size: 20px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat b.small-val { font-size: 13px; font-weight: 600; line-height: 1.9; }
.stat span { font-size: 12px; color: var(--ink3); }
@media (max-width: 420px) { .stats { grid-template-columns: repeat(2, auto); } }

/* ------------------------------------------------------------------ admin */
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.list th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink3); font-weight: 700; background: var(--panel2); }
table.list tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.temp-pw { font-family: var(--mono); font-size: 18px; font-weight: 700; padding: 10px 14px; background: var(--panel2); border: 1px dashed var(--line); border-radius: var(--radius-sm); user-select: all; }

/* ------------------------------------------------------------------ sign in */
.signin-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
@media (max-width: 860px) { .signin-page { grid-template-columns: 1fr; } .signin-art { display: none; } }
.signin-art {
    background: var(--navy);
    color: #fff;
    padding: 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.signin-art h1 { font-size: 34px; max-width: 16ch; margin-top: 28px; }
.signin-art p { color: #C9D4EA; max-width: 46ch; margin-top: 14px; font-size: 16px; }
.signin-art .grid-mark { position: absolute; right: -60px; bottom: -60px; width: 420px; opacity: .14; }
.signin-art .foot { font-size: 13px; color: #9FB0D3; }
.signin-art .atds-foot { display: flex; align-items: center; gap: 14px; position: relative; line-height: 1.4; }
.signin-art .atds-foot img { height: 68px; width: auto; }
.signin-art .atds-foot strong { color: #fff; font-weight: 650; }
.signin-form .brand { margin-bottom: 22px; }
.signin-form .brand .wordmark { margin-bottom: 0; }
.signin-form .brand-icon { height: 44px; }
.signin-form { display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.signin-form .card { width: 100%; max-width: 400px; padding: 30px 28px; }
.signin-form .wordmark { height: 40px; margin-bottom: 22px; }

/* ------------------------------------------------------------------ phones */
@media (max-width: 640px) {
    .topbar .portal-name, .who { display: none; }
    .topbar-inner, .tabs, main { padding-left: 16px; padding-right: 16px; }
    .topbar-inner { padding-top: 10px; padding-bottom: 10px; }
    .wordmark { height: 28px; }
    .brand-icon { height: 32px; border-radius: 7px; }
    .credit-inner { padding: 12px 16px; }
    h1 { font-size: 21px; }
    .card-pad { padding: 16px; }
    table.list th, table.list td { padding: 8px; }
}

/* keep the ATDS credit at the bottom of short pages */
body:has(> footer.credit) { display: flex; flex-direction: column; min-height: 100vh; }
body:has(> footer.credit) > main { flex: 1 0 auto; width: 100%; }

/* The note shown before the demo goes full screen. */
dialog.fs-help {
    max-width: 440px;
    width: calc(100% - 32px);
    padding: 24px 26px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--ink);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .3);
}
dialog.fs-help::backdrop { background: rgba(14, 19, 25, .55); }
dialog.fs-help h2 { margin: 0 0 8px; font-size: 20px; }
dialog.fs-help p { margin: 0 0 6px; color: var(--ink2); }
dialog.fs-help ul { margin: 0 0 16px; padding-left: 20px; color: var(--ink2); line-height: 1.7; }
dialog.fs-help kbd { font-family: var(--mono); font-size: 13px; padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--panel2); color: var(--ink); }
.fs-help-again { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink2); margin-bottom: 18px; cursor: pointer; }
.fs-help-buttons { justify-content: flex-end; gap: 10px; }

/* The Radar position is a portrait board: the frame turns portrait (capped to the window height)
   and the demo keeps its 1080 x 1920 shape inside it, in full screen as well. */
.screen.portrait { aspect-ratio: 9 / 16; width: auto; height: min(82vh, 1100px); max-width: 100%; margin: 0 auto; align-self: center; }
.screen.portrait:fullscreen { width: 100vw; height: 100vh; aspect-ratio: auto; }
.screen.portrait:-webkit-full-screen { width: 100vw; height: 100vh; aspect-ratio: auto; }
.screen.portrait.fs-fallback { inset: 0; width: 100vw; height: 100vh; max-width: none; aspect-ratio: auto; margin: 0; }
.demo-pages .portrait-tag { display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; color: var(--violet-deep); background: color-mix(in srgb, var(--violet) 14%, transparent); }

/* ------------------------------------------------------------------ documents */
.filters input[type=search] { width: auto; min-width: 240px; flex: 1 1 240px; max-width: 420px; }
input[type=file] {
    width: 100%;
    padding: 8px;
    border: 1px dashed var(--line);
    border-radius: var(--radius-sm);
    background: var(--panel2);
    color: var(--ink2);
    font: inherit;
}
input[type=file]::file-selector-button {
    margin-right: 12px;
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--panel);
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.upload-progress { width: 100%; height: 8px; accent-color: var(--violet); }

/* The file-type tile beside each document. */
.file-badge {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 54px;
    border-radius: 6px;
    background: var(--mute-bg);
    color: var(--mute);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    box-shadow: inset 0 -4px 0 color-mix(in srgb, currentColor 25%, transparent);
}
.file-badge.f-pdf { background: var(--block-bg); color: var(--block); }
.file-badge.f-doc, .file-badge.f-docx, .file-badge.f-dotx, .file-badge.f-rtf, .file-badge.f-odt { background: var(--info-bg); color: var(--info); }
.file-badge.f-xls, .file-badge.f-xlsx, .file-badge.f-xlsm, .file-badge.f-csv, .file-badge.f-ods { background: var(--ok-bg); color: var(--ok); }
.file-badge.f-ppt, .file-badge.f-pptx, .file-badge.f-odp { background: var(--warn-bg); color: var(--warn); }
.file-badge.f-png, .file-badge.f-jpg, .file-badge.f-jpeg, .file-badge.f-gif, .file-badge.f-webp, .file-badge.f-mp4 { background: var(--violet-soft); color: var(--violet-deep); }
@media (prefers-color-scheme: dark) { .file-badge.f-png, .file-badge.f-jpg, .file-badge.f-jpeg, .file-badge.f-gif, .file-badge.f-webp, .file-badge.f-mp4 { color: var(--violet); } }

.doc-folder > .row { margin-bottom: 10px; }
.doc-row, .version, .doc-current { display: flex; gap: 14px; align-items: center; }
.doc-row { padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.doc-row:last-child { border-bottom: 0; }
.doc-main { flex: 1; min-width: 0; }
.doc-title { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 16px; }
.doc-desc { color: var(--ink2); margin-top: 2px; white-space: pre-line; overflow-wrap: anywhere; }
.doc-main .meta { margin-top: 4px; font-size: 13px; color: var(--ink3); display: flex; gap: 4px 14px; flex-wrap: wrap; overflow-wrap: anywhere; }
.doc-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.doc-editor { margin-bottom: 20px; scroll-margin-top: 130px; }
.doc-manage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 980px) { .doc-manage { grid-template-columns: 1fr; } }

.version-list { display: grid; gap: 8px; }
.version { padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--panel2); align-items: flex-start; }
.version .file-badge { width: 36px; height: 42px; font-size: 10px; }
.version-name { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.version-note { color: var(--ink2); margin-top: 4px; white-space: pre-line; overflow-wrap: anywhere; }

.doc-current { padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--panel2); }
.doc-current b { overflow-wrap: anywhere; }
.post.doc-post { display: flex; gap: 14px; align-items: flex-start; }
.post.doc-post .title { margin-top: 4px; }

/* Team workspace folder tree */
.ws-folder { border-bottom: 1px solid var(--line-soft); }
.ws-folder:last-child { border-bottom: 0; }
.ws-folder > summary {
    display: flex; gap: 10px; align-items: center;
    padding: 12px 18px; cursor: pointer; list-style: none; font-weight: 650;
}
.ws-folder > summary::-webkit-details-marker { display: none; }
.ws-folder > summary:hover { background: var(--panel2); }
.ws-folder > summary:focus-visible { outline: 2px solid var(--violet); outline-offset: -2px; }
.ws-caret {
    flex: none; width: 0; height: 0; transition: transform .12s;
    border-left: 6px solid var(--ink3); border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
.ws-folder[open] > summary .ws-caret { transform: rotate(90deg); }
.ws-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ws-count { flex: none; font-size: 13px; font-weight: 400; color: var(--ink3); }
.ws-folder > summary .btn { flex: none; }
.ws-doc { display: flex; align-items: center; border-bottom: 1px solid var(--line-soft); }
.ws-doc:last-child { border-bottom: 0; }
.ws-doc > .post { flex: 1; min-width: 0; border-bottom: 0; }
.ws-doc-actions { flex: none; padding: 0 18px 0 6px; }
.ws-children { margin-left: 22px; border-left: 1px solid var(--line-soft); border-top: 1px solid var(--line-soft); }
@media (max-width: 640px) { .ws-children { margin-left: 10px; } }

@media (max-width: 640px) {
    .doc-row, .doc-current { flex-wrap: wrap; }
    .doc-row .doc-actions, .doc-current .doc-actions { width: 100%; justify-content: flex-start; }
    .version { flex-wrap: wrap; }
    .version .doc-actions { width: 100%; justify-content: flex-start; }
    .filters input[type=search] { max-width: none; }
}

/* ------------------------------------------------------------------ several files / folder upload */
.segmented { display: flex; padding: 3px; gap: 3px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel2); }
.segmented button {
    flex: 1; min-height: 32px; padding: 0 10px; border: 0; border-radius: 4px;
    background: none; color: var(--ink2); font: inherit; font-size: 13px; font-weight: 650; cursor: pointer;
}
.segmented button.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.segmented button:focus-visible { outline: 3px solid color-mix(in srgb, var(--violet) 55%, transparent); outline-offset: 1px; }

.drop-zone {
    padding: 22px 16px; text-align: center;
    border: 2px dashed var(--line); border-radius: var(--radius); background: var(--panel2);
    transition: border-color .12s, background .12s;
}
.drop-zone p + p { margin-top: 2px; }
.drop-zone .row { margin-top: 8px; }
.drop-zone.over { border-color: var(--violet); background: var(--violet-soft); }
.field-help { display: block; margin-top: 4px; font-size: 12.5px; }
label.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--ink2); cursor: pointer; }
label.check input { margin-top: 4px; flex: none; }

.bulk-summary { padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--panel2); }
.bulk-summary > * + * { margin-top: 8px; }
.bulk-folders, .bulk-skipped { margin: 0; padding: 0; list-style: none; font-size: 13px; max-height: 180px; overflow-y: auto; }
.bulk-folders li { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.bulk-folders li .mono { overflow-wrap: anywhere; }
.bulk-folders li .muted { flex: none; }
.bulk-skipped li { padding: 2px 0; overflow-wrap: anywhere; }
.bulk-summary details summary { cursor: pointer; font-size: 13px; color: var(--warn); font-weight: 650; }
.bulk-summary details ul { margin-top: 6px; }

/* App downloads */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 14px; }
.app-card { display: flex; flex-direction: column; gap: 14px; }
.app-head { display: flex; gap: 14px; align-items: flex-start; }
.app-tile {
    flex: none; display: inline-flex; align-items: center; justify-content: center;
    width: 54px; height: 54px; border-radius: 14px;
    background: linear-gradient(145deg, var(--violet), var(--navy)); color: #fff;
    font-size: 12px; font-weight: 800; letter-spacing: .02em;
}
.app-get {
    display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap;
    padding: 14px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--panel2);
}
.app-badge { display: inline-block; line-height: 0; }
.app-badge img { height: 48px; width: auto; }
/* QR codes stay dark-on-white in dark mode too, so phone cameras read them. */
.app-qr { flex: none; width: 132px; height: 132px; padding: 6px; background: #fff; border-radius: var(--radius-sm); }
.app-file { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.app-file .meta { font-size: 13px; color: var(--ink3); display: flex; gap: 4px 14px; flex-wrap: wrap; }
.app-get-main { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
/* Stands in for the official store badge until its file is in wwwroot/img/badges. */
.store-btn {
    display: inline-flex; flex-direction: column; justify-content: center;
    min-width: 150px; height: 48px; padding: 0 16px; border-radius: 9px;
    background: #000; color: #fff; border: 1px solid #A6A6A6; text-decoration: none; line-height: 1.1;
}
.store-btn small { font-size: 11px; }
.store-btn b { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.store-btn:hover { background: #1a1a1a; }
.app-get-main { flex: 1 1 200px; min-width: 0; }
.apk-current {
    display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap;
    padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--panel2);
}
.apk-current .app-qr { width: 110px; height: 110px; }

/* Android install guide (APK cards on the Apps page) */
.install-guide { border-top: 1px solid var(--line-soft); padding-top: 12px; }
.install-guide > summary { cursor: pointer; font-weight: 650; color: var(--accent); }
.install-guide[open] > summary { margin-bottom: 10px; }
.install-guide > p, .install-guide > h4 { margin-top: 10px; }
.install-guide h4 { font-size: 14px; }
.install-steps { margin: 12px 0 0; padding-left: 22px; display: grid; gap: 14px; }
.install-step { padding-left: 4px; }
.install-step > div, .install-step { overflow-wrap: anywhere; }
.install-step { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.install-step img { width: 130px; height: auto; border-radius: 14px; box-shadow: var(--shadow); }
@media (max-width: 420px) { .install-step { grid-template-columns: 1fr; } }
