/* ==========================================================================
   niderle.cz — one stylesheet for the public site and the admin.
   Theme: tokens on :root; dark via [data-theme="dark"] or the OS preference
   when no explicit choice is stored (see js/theme-init.js).
   ========================================================================== */

:root {
    --bg: #f7f7fb;
    --bg-alt: #eef0f7;
    --surface: #ffffff;
    --surface-2: #f3f4f8;
    --text: #161827;
    --text-muted: #5b6075;
    --border: #e1e3ec;
    --border-strong: #c9ccd9;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-soft: #eceafd;
    --accent-text: #ffffff;
    --success: #15803d;
    --success-soft: #e6f6ec;
    --warning: #a16207;
    --warning-soft: #fdf5dc;
    --danger: #c0262d;
    --danger-soft: #fdeaea;
    --shadow: 0 1px 2px rgb(20 22 40 / 0.05), 0 4px 16px rgb(20 22 40 / 0.06);
    --shadow-lg: 0 12px 40px rgb(20 22 40 / 0.12);
    --radius: 14px;
    --radius-sm: 9px;
    --container: 1120px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0e0f17;
        --bg-alt: #141624;
        --surface: #171927;
        --surface-2: #1e2133;
        --text: #e8e9f2;
        --text-muted: #9a9fb8;
        --border: #262a3d;
        --border-strong: #363b54;
        --accent: #8b85ff;
        --accent-hover: #a29dff;
        --accent-soft: #23214a;
        --accent-text: #0e0f17;
        --success: #4ade80;
        --success-soft: #11291b;
        --warning: #facc15;
        --warning-soft: #2b2510;
        --danger: #f87171;
        --danger-soft: #331617;
        --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 16px rgb(0 0 0 / 0.25);
        --shadow-lg: 0 12px 40px rgb(0 0 0 / 0.45);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #0e0f17;
    --bg-alt: #141624;
    --surface: #171927;
    --surface-2: #1e2133;
    --text: #e8e9f2;
    --text-muted: #9a9fb8;
    --border: #262a3d;
    --border-strong: #363b54;
    --accent: #8b85ff;
    --accent-hover: #a29dff;
    --accent-soft: #23214a;
    --accent-text: #0e0f17;
    --success: #4ade80;
    --success-soft: #11291b;
    --warning: #facc15;
    --warning-soft: #2b2510;
    --danger: #f87171;
    --danger-soft: #331617;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 16px rgb(0 0 0 / 0.25);
    --shadow-lg: 0 12px 40px rgb(0 0 0 / 0.45);
    color-scheme: dark;
}

/* ── Base ─────────────────────────────────────────────────────────────── */

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

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

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; margin: 0 0 0.6em; }
h1 { font-size: clamp(2rem, 4vw + 1rem, 3rem); font-weight: 750; }
h2 { font-size: 1.5rem; font-weight: 700; margin-top: 1.8em; }
h3 { font-size: 1.1rem; font-weight: 650; }
section h2:first-child, .card h2:first-child { margin-top: 0; }
p { margin: 0 0 1em; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

img { max-width: 100%; height: auto; display: block; }
code { font-family: var(--mono); font-size: 0.9em; }

.icon { flex-shrink: 0; vertical-align: -0.2em; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .container { padding: 0 24px; } }
.container.narrow { max-width: 780px; }
.center { text-align: center; }

.muted { color: var(--text-muted); }
.lead { font-size: 1.15rem; color: var(--text-muted); max-width: 46em; }
.hint { display: block; color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8rem; font-weight: 650; color: var(--accent); margin-bottom: 0.8em; }
.spacer { flex: 1; }

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; left: 16px; top: -100px; z-index: 100;
    background: var(--accent); color: var(--accent-text); padding: 8px 14px; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 12px; }

/* ── Buttons ──────────────────────────────────────────────────────────── */

.button {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 42px; padding: 0 18px;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    font: inherit; font-weight: 600; font-size: 0.95rem; line-height: 1.2;
    cursor: pointer; text-decoration: none !important; white-space: nowrap;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
}
.button:active { transform: translateY(1px); }
.button:disabled, .button.is-busy { opacity: 0.6; cursor: default; }
.button-primary { background: var(--accent); color: var(--accent-text); }
.button-primary:hover { background: var(--accent-hover); color: var(--accent-text); }
.button-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.button-secondary:hover { border-color: var(--accent); color: var(--accent); }
.button-ghost { background: transparent; color: var(--text-muted); }
.button-ghost:hover { background: var(--surface-2); color: var(--text); }
.button-danger { background: var(--danger); color: #fff; }
.button-danger:hover { filter: brightness(1.08); color: #fff; }
.button-sm { min-height: 34px; padding: 0 12px; font-size: 0.875rem; }
.button-block { width: 100%; }
.danger-text { color: var(--danger); }
.button-row, .link-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.icon-button {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; padding: 0;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text); cursor: pointer;
}
.icon-button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.icon-button:disabled { opacity: 0.35; cursor: default; }

/* Segmented control: language + theme switches, filters, language tabs. */
.segmented {
    display: inline-flex; padding: 3px; gap: 2px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
}
.segmented > a, .segmented > button {
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    min-width: 34px; height: 30px; padding: 0 9px;
    border: 0; border-radius: 7px; background: transparent;
    color: var(--text-muted); font: inherit; font-size: 0.8rem; font-weight: 650;
    cursor: pointer; text-decoration: none !important;
}
.segmented > a:hover, .segmented > button:hover { color: var(--text); }
.segmented > .active, .segmented > [aria-pressed="true"] {
    background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.segmented-sm > button { height: 26px; min-width: 30px; font-size: 0.75rem; }
.segmented .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warning); }

/* ── Header / navigation ──────────────────────────────────────────────── */

.site-header {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid var(--border);
}
.site-header-inner { display: flex; align-items: center; gap: 16px; min-height: 64px; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; text-decoration: none !important; }
.brand:hover { color: var(--text); }
.brand-mark {
    display: inline-grid; place-items: center; width: 36px; height: 36px;
    border-radius: 10px; background: var(--accent); color: var(--accent-text);
    font-size: 0.9rem; font-weight: 800; letter-spacing: 0.02em;
}

.site-nav-wrap { display: flex; align-items: center; gap: 20px; margin-left: auto; }
.site-nav { display: flex; gap: 4px; }
.site-nav a {
    padding: 8px 12px; border-radius: var(--radius-sm);
    color: var(--text-muted); font-weight: 550; text-decoration: none !important;
}
.site-nav a:hover { color: var(--text); background: var(--surface-2); }
.site-nav a.active { color: var(--accent); background: var(--accent-soft); }
.site-tools { display: flex; align-items: center; gap: 8px; }

.nav-toggle { display: none; margin-left: auto; }

@media (max-width: 860px) {
    .nav-toggle { display: inline-flex; }
    .site-nav-wrap {
        display: none;
        position: absolute; left: 0; right: 0; top: 100%;
        flex-direction: column; align-items: stretch; gap: 16px;
        padding: 16px; background: var(--surface);
        border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg);
    }
    .nav-open .site-nav-wrap { display: flex; }
    .site-nav { flex-direction: column; }
    .site-nav a { padding: 12px; }
    .site-tools { justify-content: space-between; }
}

.site-main { flex: 1; }

.site-footer { border-top: 1px solid var(--border); padding: 28px 0; color: var(--text-muted); font-size: 0.9rem; }
.site-footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.site-footer p { margin: 0; }
.site-footer-links { display: flex; gap: 6px; }
.site-footer-links a {
    display: inline-grid; place-items: center; width: 38px; height: 38px;
    border-radius: var(--radius-sm); color: var(--text-muted);
}
.site-footer-links a:hover { background: var(--surface-2); color: var(--accent); }

/* ── Sections ─────────────────────────────────────────────────────────── */

.section { padding: 64px 0; }
.section-tight { padding: 32px 0 64px; }
.section-alt { background: var(--bg-alt); border-block: 1px solid var(--border); }
.section-header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.section-header h2 { margin: 0; }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.link-back { display: inline-flex; align-items: center; gap: 6px; font-size: 0.9rem; font-weight: 550; margin-bottom: 20px; color: var(--text-muted); }

.page-header { padding: 56px 0 8px; }
.page-header h1 { margin-bottom: 0.3em; }

.empty-state {
    padding: 48px 24px; text-align: center; color: var(--text-muted);
    border: 1px dashed var(--border-strong); border-radius: var(--radius);
}

.error-code { font-size: 5rem; font-weight: 800; line-height: 1; margin: 0 0 12px; color: var(--accent); opacity: 0.8; }

/* ── Hero ─────────────────────────────────────────────────────────────── */

.hero {
    padding: 72px 0 64px;
    background:
        radial-gradient(60rem 30rem at 85% -10%, var(--accent-soft), transparent 60%),
        radial-gradient(40rem 24rem at -10% 110%, var(--accent-soft), transparent 60%);
}
.hero-inner { display: grid; grid-template-columns: 1fr auto; gap: 48px; align-items: center; }
.hero-headline { font-size: clamp(1.2rem, 1vw + 1rem, 1.5rem); font-weight: 600; margin-bottom: 0.6em; }
.hero-intro { font-size: 1.1rem; color: var(--text-muted); max-width: 38em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0; }
.stats { display: flex; flex-wrap: wrap; gap: 10px 24px; padding: 0; margin: 0; list-style: none; color: var(--text-muted); font-size: 0.95rem; }
.stats li { display: inline-flex; align-items: center; gap: 8px; }
.stats .icon { color: var(--accent); }

@media (max-width: 760px) {
    .hero { padding: 40px 0 48px; }
    .hero-inner { grid-template-columns: 1fr; gap: 28px; }
    .hero-photo { order: -1; }
    .hero-photo .avatar { --avatar-size: 132px !important; }
}

.avatar {
    --avatar-size: 160px;
    display: inline-grid; place-items: center; flex-shrink: 0;
    width: var(--avatar-size); height: var(--avatar-size);
    border-radius: 50%; overflow: hidden;
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 50%, #ec4899));
    box-shadow: 0 0 0 6px var(--surface), var(--shadow-lg);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-initials { color: #fff; font-weight: 800; font-size: calc(var(--avatar-size) * 0.34); letter-spacing: 0.02em; }

.about-header { display: flex; align-items: center; gap: 32px; flex-wrap: wrap; }
.about-header h1 { margin-bottom: 0.2em; }
.about-header .lead { margin-bottom: 0.3em; }

/* ── Cards ────────────────────────────────────────────────────────────── */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-title { font-size: 1.1rem; margin: 0 0 16px; }
.card-subtitle { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin: 0 0 8px; }
.card-subtitle:not(:first-child) { margin-top: 20px; }

.card-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.card-grid .card + .card { margin-top: 0; }

.app-card { padding: 0; transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s; }
.app-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.app-card-link { display: flex; flex-direction: column; height: 100%; padding: 22px; color: inherit; text-decoration: none !important; }
.app-card-link:hover { color: inherit; }
.app-card-header { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.app-card-header h3 { margin: 0 0 4px; }
.app-card-tagline { color: var(--text-muted); flex: 1; }
.app-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.app-card-more { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 600; font-size: 0.9rem; white-space: nowrap; }

.app-icon {
    --icon-size: 56px;
    display: inline-grid; place-items: center; flex-shrink: 0;
    width: var(--icon-size); height: var(--icon-size);
    border-radius: 22%; overflow: hidden;
    background: var(--accent-soft); color: var(--accent);
    font-weight: 800; font-size: calc(var(--icon-size) * 0.42);
}
.app-icon img { width: 100%; height: 100%; object-fit: cover; }

.badge {
    display: inline-block; padding: 2px 9px; border-radius: 99px;
    background: var(--accent-soft); color: var(--accent);
    font-size: 0.78rem; font-weight: 650;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; list-style: none; }
.chip {
    display: inline-block; padding: 3px 10px; border-radius: 99px;
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text-muted); font-size: 0.8rem; font-weight: 550;
}
.chips-lg .chip { padding: 6px 14px; font-size: 0.9rem; color: var(--text); }

.cta-box {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px;
    padding: 36px; border-radius: calc(var(--radius) + 6px);
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #ec4899));
    color: #fff;
}
.cta-box h2 { margin: 0 0 6px; color: #fff; }
.cta-box p { margin: 0; opacity: 0.9; max-width: 40em; }
.cta-box .button-primary { background: #fff; color: #1f1b4d; }
.cta-box .button-primary:hover { background: #f1f0ff; color: #1f1b4d; }

/* ── Prose (rendered Markdown) ────────────────────────────────────────── */

.prose { font-size: 1.05rem; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: 1.35rem; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: 0.3em 0; }
.prose blockquote { margin: 1em 0; padding: 0.2em 1em; border-left: 3px solid var(--accent); color: var(--text-muted); }
.prose pre { overflow-x: auto; padding: 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.prose table { border-collapse: collapse; width: 100%; }
.prose th, .prose td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }

.services-list ul { list-style: none; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.services-list li {
    margin: 0; padding: 16px 18px 16px 44px; position: relative;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.services-list li::before {
    content: ""; position: absolute; left: 18px; top: 23px;
    width: 10px; height: 10px; border-radius: 3px; background: var(--accent);
}

/* ── App detail ───────────────────────────────────────────────────────── */

.app-hero { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.app-hero h1 { margin-bottom: 0.15em; }
.app-hero .lead { margin-bottom: 0.4em; }

.app-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; }
.app-side { position: sticky; top: 84px; }
@media (max-width: 900px) {
    .app-layout { grid-template-columns: 1fr; }
    .app-side { position: static; order: -1; }
}

.download-recommended {
    display: grid; gap: 8px; padding: 14px; margin-bottom: 18px;
    border-radius: var(--radius-sm); background: var(--accent-soft);
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.download-recommended-label { margin: 0; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
.download-recommended .hint { margin-top: 2px; }
.download-others-title { font-size: 0.95rem; margin: 4px 0 12px; }
.downloads { display: grid; gap: 18px; }
.download-group h3 { font-size: 0.85rem; font-weight: 650; color: var(--text-muted); margin-bottom: 8px; }
.download-group ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.download-button { width: 100%; justify-content: flex-start; min-height: 56px; padding: 8px 14px; white-space: normal; text-align: left; }
.download-button span { display: flex; flex-direction: column; min-width: 0; }
.download-button small { font-weight: 450; opacity: 0.85; font-size: 0.78rem; overflow-wrap: anywhere; }

.link-stack { display: grid; gap: 4px; padding: 12px; }
.link-stack a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text); font-weight: 550; }
.link-stack a:hover { background: var(--surface-2); color: var(--accent); text-decoration: none; }

.screenshots { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.screenshots a { display: block; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow); }
.screenshots img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; transition: transform 0.2s; }
.screenshots a:hover img { transform: scale(1.03); }

.release-notes { font-size: 0.95rem; }

/* ── Forms ────────────────────────────────────────────────────────────── */

.form { display: grid; gap: 18px; }
.form-row { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.field { display: flex; flex-direction: column; min-width: 0; }
.field label, .localized-head label { font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }

input[type="text"], input[type="email"], input[type="url"], input[type="number"], input[type="password"], input:not([type]), select, textarea {
    width: 100%; min-height: 44px; padding: 10px 12px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text);
    font: inherit; font-size: 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
input[aria-invalid="true"], textarea[aria-invalid="true"], .invalid { border-color: var(--danger); }

.field-error { color: var(--danger); font-size: 0.85rem; margin-top: 4px; }
.field-ok { color: var(--success); font-size: 0.85rem; margin-top: 4px; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.checkbox-row { display: flex; flex-wrap: wrap; gap: 12px 28px; }
.checkbox-row label { display: inline-flex; align-items: center; gap: 8px; font-weight: 550; cursor: pointer; }
.checkbox-row input { width: 18px; height: 18px; accent-color: var(--accent); }

.input-with-button { display: flex; gap: 8px; }
.input-with-button input { flex: 1; }

.localized-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.localized-head label { margin: 0; }

/* Honeypot — off-screen rather than display:none, which some bots detect. */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.notice { padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid transparent; }
.notice h2 { display: flex; align-items: center; gap: 10px; margin-top: 0; font-size: 1.25rem; }
.notice-success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.notice-success h2 { color: var(--success); }
.notice-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.notice-warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }

/* ── Admin ────────────────────────────────────────────────────────────── */

.admin-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.admin-sidebar {
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column; gap: 24px;
    padding: 20px 16px; background: var(--surface); border-right: 1px solid var(--border);
}
.admin-nav { display: grid; gap: 2px; }
.admin-nav a {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px;
    border-radius: var(--radius-sm); color: var(--text-muted); font-weight: 550; text-decoration: none !important;
}
.admin-nav a:hover { background: var(--surface-2); color: var(--text); }
.admin-nav a.active { background: var(--accent-soft); color: var(--accent); }
.admin-sidebar-footer { margin-top: auto; display: grid; gap: 10px; justify-items: start; }
.admin-sidebar-footer form { width: 100%; }
.admin-topbar { display: none; }
.admin-content { padding: 32px; max-width: 1080px; width: 100%; }
.admin-content h1 { font-size: 1.75rem; }

@media (max-width: 860px) {
    .admin-shell { grid-template-columns: 1fr; }
    .admin-sidebar {
        display: none; position: fixed; inset: 56px 0 auto 0; height: auto; max-height: calc(100vh - 56px);
        overflow-y: auto; z-index: 40; box-shadow: var(--shadow-lg); border-right: 0; border-bottom: 1px solid var(--border);
    }
    .nav-open .admin-sidebar { display: flex; }
    .admin-sidebar > .brand { display: none; }
    .admin-topbar {
        display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 41;
        height: 56px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); font-weight: 700;
    }
    .admin-topbar .nav-toggle { margin: 0; }
    .admin-content { padding: 20px 16px; }
}

.page-title-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-title-row h1 { margin: 0; }

.stat-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); margin-bottom: 12px; }
.stat-grid .card + .card { margin-top: 0; }
.stat { display: flex; flex-direction: column; gap: 4px; color: var(--text); text-decoration: none !important; }
.stat:hover { border-color: var(--accent); color: var(--text); }
.stat-value { font-size: 2.2rem; font-weight: 800; line-height: 1; }
.stat-label { color: var(--text-muted); font-weight: 550; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th { text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-weight: 650; }
.table th, .table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-new td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }

.status { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 0.78rem; font-weight: 650; white-space: nowrap; }
.status-new { background: var(--accent-soft); color: var(--accent); }
.status-read { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.status-done { background: var(--success-soft); color: var(--success); }

.filter-bar { margin-bottom: 16px; }

.message-header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.message-header h1 { font-size: 1.5rem; margin-bottom: 6px; }
.meta-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 16px 0; font-size: 0.92rem; }
.meta-list dt { color: var(--text-muted); font-weight: 600; }
.meta-list dd { margin: 0; }
.message-body {
    white-space: pre-wrap; overflow-wrap: anywhere; margin: 20px 0;
    padding: 18px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border);
}

.admin-app-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.admin-app-list .card + .card { margin-top: 0; }
.admin-app-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; flex-wrap: wrap; }
.admin-app-info { display: flex; flex-direction: column; flex: 1; min-width: 160px; }
.row-actions { display: inline-flex; gap: 6px; align-items: center; }

.photo-editor { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; margin-bottom: 16px; }
.photo-editor .avatar { box-shadow: var(--shadow); }

.upload-button { position: relative; }
.upload-button input { cursor: pointer; }

.media-editor { display: grid; grid-template-columns: auto 1fr; gap: 32px; }
@media (max-width: 700px) { .media-editor { grid-template-columns: 1fr; } }
.media-icon { display: grid; gap: 12px; justify-items: start; }
.media-shots { display: grid; gap: 14px; justify-items: start; }
.thumb-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); width: 100%; }
.thumb { position: relative; margin: 0; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.thumb img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.thumb-remove { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; }

.confirm { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.confirm-text { font-size: 0.85rem; color: var(--danger); font-weight: 600; }

.save-status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.9rem; font-weight: 600; }
.save-ok { color: var(--success); }
.save-failed { color: var(--danger); }

/* ── Login ────────────────────────────────────────────────────────────── */

.auth-shell { flex: 1; display: grid; place-items: center; padding: 72px 16px 32px; position: relative; }
.auth-tools { position: absolute; top: 16px; right: 16px; display: flex; gap: 8px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 1.6rem; margin-bottom: 0.2em; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

.transfer { margin-top: 24px; }
.transfer > summary { cursor: pointer; font-weight: 650; }
.transfer .hint { margin: 12px 0; }
.transfer .field { margin: 16px 0; }
.transfer textarea { font-family: var(--mono); font-size: 0.85rem; }
.transfer .notice ul { margin: 8px 0 0; padding-left: 1.2em; }

/* Poznámka k nepodepsané aplikaci na Macu */
.mac-note { margin-top: 18px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); font-size: 0.9rem; }
.mac-note > summary { cursor: pointer; font-weight: 600; }
.mac-note p { margin: 10px 0 0; }
.mac-note .hint { margin-top: 10px; }
.mac-note-command { margin: 6px 0 0; padding: 8px 10px; overflow-x: auto; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); font-size: 0.8rem; }

/* Screenshot gallery (public) */
.screenshots { align-items: start; }
.shot { margin: 0; }
.shot a { display: block; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow); cursor: zoom-in; }
.shot figcaption { margin-top: 8px; font-size: 0.85rem; color: var(--text-muted); }

dialog.lightbox {
    width: 100%; height: 100%; max-width: 100vw; max-height: 100vh; margin: 0; padding: 0;
    border: 0; background: transparent; color: #fff; overflow: hidden;
}
dialog.lightbox[open] { display: grid; place-items: center; }
dialog.lightbox::backdrop { background: rgb(0 0 0 / 0.88); }
.lightbox-figure { margin: 0; display: grid; justify-items: center; gap: 12px; padding: 56px 64px 24px; max-width: 100%; }
.lightbox-image { max-width: min(92vw, 1600px); max-height: calc(100vh - 150px); object-fit: contain; border-radius: var(--radius-sm); background: #111; }
.lightbox-caption { max-width: 80ch; text-align: center; font-size: 0.95rem; color: #e6e7ef; }
.lightbox-btn {
    position: absolute; display: grid; place-items: center; width: 44px; height: 44px;
    border: 0; border-radius: 50%; background: rgb(255 255 255 / 0.14); color: #fff;
    font-size: 1.8rem; line-height: 1; cursor: pointer;
}
.lightbox-btn:hover { background: rgb(255 255 255 / 0.28); }
.lightbox-btn[hidden] { display: none; }
.lightbox-close { top: 14px; right: 14px; }
.lightbox-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 14px; top: 50%; transform: translateY(-50%); }
@media (max-width: 640px) {
    .lightbox-figure { padding: 56px 8px 16px; }
    .lightbox-prev, .lightbox-next { top: auto; bottom: 14px; transform: none; }
}

/* Screenshot list in the admin */
.shot-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 12px; width: 100%; }
.shot-item { display: grid; grid-template-columns: 160px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.shot-item img { width: 160px; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.shot-actions { display: flex; gap: 6px; }
@media (max-width: 700px) {
    .shot-item { grid-template-columns: 1fr; }
    .shot-item img { width: 100%; }
}

