:root {
    --bg: #f6f8f9;
    --surface: #ffffff;
    --fg: #14212b;
    --muted: #566673;
    --line: #d9e1e6;
    --accent: #0a6a86;
    --accent-fg: #ffffff;
    --ok: #2f7d4f;
    --danger: #b3261e;
    --radius: 10px;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f171d;
        --surface: #16222a;
        --fg: #e4ecf0;
        --muted: #96a8b4;
        --line: #2a3a45;
        --accent: #5cc0dc;
        --accent-fg: #0f171d;
        --ok: #6cc290;
        --danger: #f08b84;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-size: 16px;
    line-height: 1.5;
}

h1 { font-size: 1.5rem; margin: 0 0 4px; }
h1:focus { outline: none; }
p { margin: 0; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 20px;
    padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.brand { font-weight: 700; font-size: 1.2rem; color: var(--accent); text-decoration: none; }

.tabs { display: flex; gap: 4px; }
.tabs a {
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
}
.tabs a.active { background: var(--accent); color: var(--accent-fg); }

.page {
    max-width: 760px;
    margin: 0 auto;
    padding: 20px max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left));
    display: grid;
    gap: 16px;
}

.muted { color: var(--muted); font-size: .92rem; }
.status { font-size: .92rem; color: var(--accent); }

.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    display: grid;
    gap: 8px;
    min-width: 0;
}

.empty { padding: 24px; border: 1px dashed var(--line); border-radius: var(--radius); text-align: center; display: grid; gap: 4px; }

.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.name { overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: .88rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.pill {
    flex-shrink: 0;
    font-size: .78rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--muted);
}
.pill.ok { color: var(--ok); border-color: currentColor; }
.pill.off { color: var(--danger); border-color: currentColor; }

.button {
    appearance: none;
    font: inherit;
    font-weight: 600;
    font-size: .92rem;
    padding: 10px 16px;
    min-height: 44px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--fg);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.button.danger { color: var(--danger); }
.button:disabled { opacity: .5; cursor: default; }
.button:focus-visible, .tabs a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.upload, .publish { align-items: start; justify-items: start; }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

#blazor-error-ui {
    background: #fff4ce;
    color: #3b2f00;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

.logout { margin-left: auto; }
.link {
    appearance: none;
    background: none;
    border: 0;
    font: inherit;
    font-weight: 600;
    color: var(--muted);
    padding: 8px 4px;
    min-height: 44px;
    cursor: pointer;
}

.login {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 16px;
}
.login form { width: 100%; max-width: 360px; gap: 10px; padding: 24px; }
.login h1 { color: var(--accent); }
.login label { font-weight: 600; font-size: .92rem; margin-top: 6px; }
.login input {
    font: inherit;
    padding: 10px 12px;
    min-height: 44px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--fg);
}
.login input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.login .button { margin-top: 10px; }
.error { color: var(--danger); font-size: .92rem; }
