/* ==========================================================================
   Rodokmen – sdílené styly aplikace i statických stránek účtu
   Barvy odpovídají Theme/AppTheme.cs
   ========================================================================== */

:root {
    --rk-primary: #6B4E3D;
    --rk-primary-dark: #563E30;
    --rk-primary-soft: #F1E8DF;
    --rk-secondary: #2F5D50;
    --rk-secondary-soft: #E3EFEA;
    --rk-tertiary: #B7793A;
    --rk-bg: #FAF7F2;
    --rk-bg-alt: #F3EEE7;
    --rk-surface: #FFFFFF;
    --rk-text: #2B211B;
    --rk-text-muted: #6E6159;
    --rk-border: #E7DFD5;
    --rk-border-strong: #CDBFB1;
    --rk-danger: #B23A2E;
    --rk-danger-soft: #FBEAE7;
    --rk-warning: #8A5A12;
    --rk-warning-soft: #FBF1DE;
    --rk-success: #2F7A4B;
    --rk-success-soft: #E5F3EA;
    --rk-info: #2E5E8C;
    --rk-info-soft: #E6EEF7;
    --rk-radius: 10px;
    --rk-radius-lg: 14px;
    --rk-shadow: 0 1px 2px rgba(43, 33, 27, .06), 0 4px 16px rgba(43, 33, 27, .05);
    --rk-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
    --rk-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html, body {
    background: var(--rk-bg);
    color: var(--rk-text);
    font-family: var(--rk-sans);
}

a { color: var(--rk-primary); }
a:hover { color: var(--rk-primary-dark); }

:focus-visible {
    outline: 3px solid rgba(47, 93, 80, .45);
    outline-offset: 2px;
}

.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;
}

/* --------------------------------------------------------------------------
   Značka
   -------------------------------------------------------------------------- */
.brand-link {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    text-decoration: none;
    color: var(--rk-text);
}
.brand-link:hover { color: var(--rk-text); }
img.brand-mark { padding: 0; background: none; }
.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border-radius: 10px;
    background: var(--rk-primary);
    color: #fff;
}
.brand-name {
    font-family: var(--rk-serif);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: .01em;
}

/* --------------------------------------------------------------------------
   Rozvržení aplikace (MudBlazor)
   -------------------------------------------------------------------------- */
.app-bar.mud-appbar {
    border-bottom: 1px solid var(--rk-border);
    gap: .75rem;
}
.app-drawer.mud-drawer {
    border-right: 1px solid var(--rk-border);
}
.app-main { min-height: 100vh; }

.page-container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

@media (max-width: 600px) {
    .page-container { padding: 1.25rem 1rem 3rem; }
    .brand-name { display: none; }
    .user-name { display: none; }
}

/* Přepínač prostorů – aktivní prostor je vždy vidět v horní liště */
.space-switcher { min-width: 0; }
.space-switcher-button {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    max-width: 360px;
    padding: .35rem .6rem .35rem .4rem;
    border: 1px solid var(--rk-border);
    border-radius: 999px;
    background: var(--rk-surface);
    color: var(--rk-text);
    cursor: pointer;
    font: inherit;
}
.space-switcher-button:hover { border-color: var(--rk-border-strong); background: var(--rk-bg); }
.space-switcher-text { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; line-height: 1.15; }
.space-switcher-label { font-size: .7rem; color: var(--rk-text-muted); text-transform: uppercase; letter-spacing: .06em; }
.space-switcher-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.switcher-item { display: flex; align-items: center; gap: .6rem; width: 100%; min-width: 240px; }
.switcher-item.current { font-weight: 600; }

@media (max-width: 600px) {
    .space-switcher-label { display: none; }
    .space-switcher-name { max-width: 120px; }
}

.user-button {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .25rem .5rem .25rem .25rem;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--rk-text);
    cursor: pointer;
    font: inherit;
}
.user-button:hover { background: var(--rk-bg-alt); }
.user-name { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.anon-actions { display: flex; gap: .5rem; }
.user-actions { display: flex; align-items: center; gap: .25rem; }
.logout-form { margin: 0; }
.logout-button {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem .75rem;
    border: 1px solid var(--rk-border);
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: .875rem;
    cursor: pointer;
}
.logout-button:hover { background: var(--rk-bg-alt); }
.logout-button:focus-visible, .user-button:focus-visible { outline: 2px solid var(--rk-primary); outline-offset: 2px; }
@media (max-width: 600px) {
    .logout-label { display: none; }
    .logout-button { padding: .45rem; }
}

.menu-form { margin: 0; }
.menu-form-button {
    display: flex;
    align-items: center;
    gap: .75rem;
    width: 100%;
    padding: .5rem 1rem;
    border: none;
    background: transparent;
    color: var(--rk-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.menu-form-button:hover { background: var(--rk-bg-alt); }

/* Navigace v prostoru */
.space-nav { display: flex; flex-direction: column; height: 100%; padding: 1rem .5rem; }
.space-nav-header { display: flex; align-items: center; gap: .75rem; padding: .25rem .75rem 1rem; border-bottom: 1px solid var(--rk-border); margin-bottom: .75rem; }
.space-nav-title { min-width: 0; display: flex; flex-direction: column; gap: .25rem; align-items: flex-start; }
.space-nav-name { font-family: var(--rk-serif); font-weight: 600; font-size: 1.05rem; line-height: 1.25; overflow-wrap: anywhere; }
.space-nav-menu .mud-nav-link { border-radius: 8px; margin: 2px 0; }
.space-nav-menu .mud-nav-link.active { background: var(--rk-primary-soft); color: var(--rk-primary-dark); font-weight: 600; }
.space-nav-footer { margin-top: auto; border-top: 1px solid var(--rk-border); padding-top: .5rem; }

.space-status-banner {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .65rem 1.5rem;
    font-size: .9rem;
    border-bottom: 1px solid var(--rk-border);
}
.space-status-banner.status-archived { background: var(--rk-warning-soft); color: var(--rk-warning); }
.space-status-banner.status-deletionrequested { background: var(--rk-danger-soft); color: var(--rk-danger); }

/* --------------------------------------------------------------------------
   Stránky
   -------------------------------------------------------------------------- */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem 2rem;
    margin-bottom: 2rem;
}
.page-header-text { min-width: 0; max-width: 760px; }
.page-overline {
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--rk-tertiary);
    margin-bottom: .35rem;
}
.page-title {
    font-family: var(--rk-serif);
    font-size: clamp(1.6rem, 2.5vw + 1rem, 2.25rem);
    font-weight: 600;
    line-height: 1.2;
    margin: 0;
    overflow-wrap: anywhere;
}
.page-subtitle { margin: .5rem 0 0; color: var(--rk-text-muted); font-size: 1rem; }
.page-header-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.section { margin-bottom: 2.5rem; }
.section-title {
    font-family: var(--rk-serif);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 1rem;
}
.section-text { margin: 0 0 1rem; color: var(--rk-text-muted); }

.narrow-page { max-width: 640px; margin: 2rem auto; }

.loading-block {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    padding: 4rem 1rem;
    color: var(--rk-text-muted);
}

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    border: 1px dashed var(--rk-border-strong);
    border-radius: var(--rk-radius-lg);
    background: var(--rk-surface);
}
.empty-state-icon {
    display: inline-flex;
    width: 64px; height: 64px;
    align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--rk-primary-soft);
    color: var(--rk-primary);
    margin-bottom: 1rem;
}
.empty-state-title { font-family: var(--rk-serif); font-size: 1.3rem; margin: 0 0 .5rem; }
.empty-state-text { max-width: 520px; margin: 0 auto 1.25rem; color: var(--rk-text-muted); }
.empty-state-actions { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; align-items: center; flex-direction: column; }

/* Avatar prostoru */
.space-avatar {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--space-color) 14%, white);
    color: var(--space-color);
    border: 1px solid color-mix(in srgb, var(--space-color) 25%, white);
}
.space-avatar.sm { width: 30px; height: 30px; border-radius: 9px; }
.space-avatar.sm .mud-icon-root { font-size: 1.1rem; }
.space-avatar.lg { width: 56px; height: 56px; border-radius: 16px; }

/* Role */
.role-chip {
    display: inline-block;
    padding: .1rem .55rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
}
.role-owner { background: #F3E3D3; color: #6B3F1D; border-color: #E6CDB4; }
.role-administrator { background: var(--rk-secondary-soft); color: var(--rk-secondary); border-color: #C9DED6; }
.role-editor { background: var(--rk-info-soft); color: var(--rk-info); border-color: #CBDBEC; }
.role-contributor { background: #F1EAF6; color: #5B3F7A; border-color: #DDD0E8; }
.role-reader { background: var(--rk-bg-alt); color: var(--rk-text-muted); border-color: var(--rk-border); }

.status-pill {
    display: inline-block;
    padding: .05rem .5rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    background: var(--rk-bg-alt);
    color: var(--rk-text-muted);
}
.status-archived { background: var(--rk-warning-soft); color: var(--rk-warning); }
.status-deletionrequested { background: var(--rk-danger-soft); color: var(--rk-danger); }
.invitation-pending { background: var(--rk-info-soft); color: var(--rk-info); }
.invitation-accepted { background: var(--rk-success-soft); color: var(--rk-success); }
.invitation-expired, .invitation-revoked, .invitation-declined { background: var(--rk-bg-alt); color: var(--rk-text-muted); }

/* Karty prostorů */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.space-card {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    padding: 1.25rem;
    border: 1px solid var(--rk-border);
    border-radius: var(--rk-radius-lg);
    background: var(--rk-surface);
    color: var(--rk-text);
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.space-card:hover { color: var(--rk-text); border-color: var(--rk-border-strong); box-shadow: var(--rk-shadow); transform: translateY(-1px); }
.space-card.inactive { opacity: .8; }
.space-card-head { display: flex; gap: .9rem; align-items: center; }
.space-card-titles { display: flex; flex-direction: column; gap: .3rem; align-items: flex-start; min-width: 0; }
.space-card-name { font-family: var(--rk-serif); font-size: 1.2rem; font-weight: 600; margin: 0; overflow-wrap: anywhere; }
.space-card-desc { margin: 0; color: var(--rk-text-muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.space-card-stats { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-top: auto; color: var(--rk-text-muted); font-size: .875rem; align-items: center; }
.space-card-stats span { display: inline-flex; align-items: center; gap: .3rem; }

/* Pozvánky */
.invitation-list { display: flex; flex-direction: column; gap: .75rem; }
.invitation-card.mud-paper { display: flex; gap: 1rem; align-items: center; padding: 1rem 1.25rem; border-color: #CBDBEC; background: #F7FAFD; }
.invitation-card-body { flex: 1; min-width: 0; }
.invitation-card-title { font-weight: 600; font-size: 1.05rem; }
.invitation-card-meta { color: var(--rk-text-muted); font-size: .875rem; }
.invitation-card-actions { display: flex; gap: .5rem; }
.invitation-message {
    margin: .5rem 0 0;
    padding: .5rem .75rem;
    border-left: 3px solid var(--rk-border-strong);
    color: var(--rk-text-muted);
    font-style: italic;
    background: var(--rk-bg);
    border-radius: 0 6px 6px 0;
}
.invitation-hero.mud-paper { padding: 2rem; text-align: center; }
.invitation-hero .page-title { margin: .75rem 0; }

@media (max-width: 600px) {
    .invitation-card.mud-paper { flex-wrap: wrap; }
    .invitation-card-actions { width: 100%; justify-content: flex-end; }
}

/* Statistiky a další kroky */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
}
.stat-card.mud-paper { display: flex; gap: 1rem; align-items: center; padding: 1.1rem 1.25rem; height: 100%; }
.stat-card .mud-icon-root { color: var(--rk-primary); background: var(--rk-primary-soft); border-radius: 10px; padding: .45rem; width: 2.4rem; height: 2.4rem; }
.stat-value { font-family: var(--rk-serif); font-size: 1.6rem; font-weight: 600; line-height: 1.1; }
.stat-value-text { font-size: 1rem; padding: .3rem 0; }
.stat-label { color: var(--rk-text-muted); font-size: .85rem; }
.stat-card-link { text-decoration: none; color: inherit; }
.stat-card-link:hover .stat-card.mud-paper { border-color: var(--rk-border-strong); }

.next-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.next-step.mud-paper { display: flex; gap: 1rem; padding: 1.25rem; align-items: flex-start; }
.next-step p { margin: .25rem 0 .75rem; color: var(--rk-text-muted); font-size: .9rem; }

/* Seznamy členů */
.list-card.mud-paper { overflow: hidden; }
.member-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .9rem 1.25rem;
    border-bottom: 1px solid var(--rk-border);
}
.member-row:last-child { border-bottom: none; }
.member-main { flex: 1; min-width: 0; }
.member-name { font-weight: 600; overflow-wrap: anywhere; }
.member-meta { display: flex; flex-wrap: wrap; gap: .25rem .5rem; color: var(--rk-text-muted); font-size: .85rem; align-items: center; }
.member-extra { font-size: .8rem; color: var(--rk-secondary); margin-top: .15rem; }
.me-badge { font-size: .7rem; font-weight: 600; background: var(--rk-secondary-soft); color: var(--rk-secondary); border-radius: 999px; padding: .05rem .45rem; margin-left: .35rem; vertical-align: middle; }
.menu-placeholder { display: inline-block; width: 48px; }

@media (max-width: 600px) {
    .member-row { flex-wrap: wrap; padding: .9rem 1rem; }
    .member-main { flex-basis: calc(100% - 60px); }
}

/* Formuláře v aplikaci */
.form-card.mud-paper { padding: 1.5rem; max-width: 760px; }
.stack-form { display: flex; flex-direction: column; gap: 1.25rem; }
.form-actions { display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }
.inline-form { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.inline-form .grow { flex: 1 1 260px; }

.picker { border: none; padding: 0; margin: 0; }
.picker legend { font-weight: 600; font-size: .9rem; margin-bottom: .5rem; }
.symbol-grid, .color-grid { display: flex; flex-wrap: wrap; gap: .5rem; }
.symbol-option {
    width: 46px; height: 46px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 12px;
    border: 1px solid var(--rk-border);
    background: var(--rk-surface);
    color: var(--rk-text-muted);
    cursor: pointer;
}
.symbol-option:hover { border-color: var(--rk-border-strong); color: var(--rk-text); }
.symbol-option.selected { border: 2px solid var(--rk-primary); color: var(--rk-primary); background: var(--rk-primary-soft); }
.color-option {
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 3px solid var(--rk-surface);
    box-shadow: 0 0 0 1px var(--rk-border-strong);
    background: var(--swatch);
    cursor: pointer;
}
.color-option.selected { box-shadow: 0 0 0 3px var(--rk-text); }
.space-preview { display: flex; gap: 1rem; align-items: center; padding: 1rem; border-radius: var(--rk-radius); background: var(--rk-bg); }
.space-preview-name { font-family: var(--rk-serif); font-size: 1.15rem; font-weight: 600; }
.space-preview-hint { font-size: .8rem; color: var(--rk-text-muted); }

.danger-zone .form-card.mud-paper { padding: 0; }
.danger-row {
    display: flex;
    gap: 1rem 2rem;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--rk-border);
}
.danger-row:last-child { border-bottom: none; }
.danger-row > div { flex: 1 1 320px; }
.danger-row p { margin: .25rem 0 0; color: var(--rk-text-muted); font-size: .9rem; }

.dialog-title { display: flex; align-items: center; gap: .5rem; font-family: var(--rk-serif); font-weight: 600; font-size: 1.2rem; }
.dialog-text { margin: 0 0 .75rem; }

/* Úvodní stránka */
.landing-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    gap: 3rem;
    align-items: center;
    padding: 3rem 0;
}
.landing-title { font-family: var(--rk-serif); font-size: clamp(2rem, 4vw + 1rem, 3.25rem); line-height: 1.1; margin: 0 0 1rem; }
.landing-lead { font-size: 1.15rem; color: var(--rk-text-muted); max-width: 560px; }
.landing-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.5rem; }
.landing-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1rem; }
.landing-features li {
    display: flex; gap: 1rem; align-items: flex-start;
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--rk-border);
    border-radius: var(--rk-radius-lg);
    background: var(--rk-surface);
}
.landing-features .mud-icon-root { color: var(--rk-secondary); margin-top: .1rem; }
.landing-features strong { display: block; margin-bottom: .2rem; }
.landing-features span { color: var(--rk-text-muted); font-size: .92rem; }

@media (max-width: 900px) {
    .landing-hero { grid-template-columns: 1fr; gap: 2rem; padding: 1rem 0; }
}

/* --------------------------------------------------------------------------
   Statické stránky účtu (Identity) – bez MudBlazor interaktivity
   -------------------------------------------------------------------------- */
.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(1200px 500px at 10% -10%, #F1E8DF 0%, transparent 60%),
        radial-gradient(900px 400px at 110% 110%, #E3EFEA 0%, transparent 60%),
        var(--rk-bg);
}
.auth-brand { margin: 1rem 0 2rem; }
.auth-main { width: 100%; display: flex; justify-content: center; }
.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--rk-surface);
    border: 1px solid var(--rk-border);
    border-radius: 18px;
    box-shadow: var(--rk-shadow);
    padding: 2rem;
}
.auth-title { font-family: var(--rk-serif); font-size: 1.75rem; font-weight: 600; margin: 0 0 .4rem; }
.auth-sub { color: var(--rk-text-muted); margin: 0 0 1.5rem; }
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-links { margin-top: 1.5rem; text-align: center; font-size: .92rem; color: var(--rk-text-muted); }
.auth-links p { margin: .35rem 0; }
.auth-footer { margin-top: auto; padding-top: 2rem; font-size: .8rem; color: var(--rk-text-muted); text-align: center; }
.auth-divider { display: flex; align-items: center; gap: .75rem; margin: 1.5rem 0 1rem; color: var(--rk-text-muted); font-size: .85rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--rk-border); }
.external-logins { display: flex; flex-direction: column; gap: .5rem; }

@media (max-width: 480px) {
    .auth-card { padding: 1.5rem 1.25rem; border-radius: 14px; }
}

.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-weight: 600; font-size: .9rem; }
.field-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.field-aside { font-size: .85rem; }
.field-optional { font-weight: 400; color: var(--rk-text-muted); }
.field input[type=text], .field input[type=email], .field input[type=password], .field input:not([type]) {
    font: inherit;
    padding: .7rem .85rem;
    border: 1px solid var(--rk-border-strong);
    border-radius: var(--rk-radius);
    background: var(--rk-surface);
    color: var(--rk-text);
    width: 100%;
    box-sizing: border-box;
}
.field input:focus { outline: none; border-color: var(--rk-secondary); box-shadow: 0 0 0 3px rgba(47, 93, 80, .18); }
.field input:disabled { background: var(--rk-bg-alt); color: var(--rk-text-muted); }
.field input.invalid { border-color: var(--rk-danger); }
.field-hint { font-size: .82rem; color: var(--rk-text-muted); }
.field-ok { color: var(--rk-success); font-weight: 600; }
.field-check { display: flex; align-items: center; gap: .5rem; font-size: .92rem; cursor: pointer; }
.field-check input { width: 1.05rem; height: 1.05rem; accent-color: var(--rk-primary); }
.validation-message { color: var(--rk-danger); font-size: .85rem; }
.validation-errors { color: var(--rk-danger); margin: 0; padding-left: 1.2rem; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .7rem 1.2rem;
    border-radius: var(--rk-radius);
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--rk-primary); color: #fff; }
.btn-primary:hover { background: var(--rk-primary-dark); color: #fff; }
.btn-secondary { background: var(--rk-surface); color: var(--rk-text); border-color: var(--rk-border-strong); }
.btn-secondary:hover { background: var(--rk-bg-alt); color: var(--rk-text); }
.btn-danger { background: var(--rk-danger); color: #fff; }
.btn-danger:hover { background: #932F25; color: #fff; }
.btn-link { background: none; border: none; color: var(--rk-primary); padding: .25rem .4rem; text-decoration: underline; }
.btn-inline { padding: 0; font-weight: 600; font-size: inherit; }
.btn-sm { padding: .4rem .8rem; font-size: .875rem; }
.btn-block { width: 100%; }

.alert { padding: .8rem 1rem; border-radius: var(--rk-radius); margin-bottom: 1rem; border: 1px solid transparent; font-size: .92rem; }
.alert p { margin: .2rem 0; }
.alert ul { margin: .4rem 0 0; }
.alert-success { background: var(--rk-success-soft); color: #22583A; border-color: #C6E3D1; }
.alert-danger { background: var(--rk-danger-soft); color: #8A2A20; border-color: #F0CBC5; }
.alert-warning { background: var(--rk-warning-soft); color: var(--rk-warning); border-color: #EFD9AE; }
.alert-info { background: var(--rk-info-soft); color: #234A70; border-color: #CBDBEC; }

/* Správa účtu */
.manage-shell { min-height: 100vh; background: var(--rk-bg); }
.manage-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: .75rem 1.5rem;
    background: var(--rk-surface);
    border-bottom: 1px solid var(--rk-border);
}
.manage-topbar-actions { display: flex; align-items: center; gap: .5rem; }
.manage-topbar-actions form { margin: 0; }
.manage-body { max-width: 1000px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.manage-title { font-family: var(--rk-serif); font-size: 2rem; margin: 0 0 1.5rem; }
.manage-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 2rem; align-items: start; }
.manage-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.manage-nav a { display: block; padding: .55rem .8rem; border-radius: 8px; color: var(--rk-text); text-decoration: none; }
.manage-nav a:hover { background: var(--rk-bg-alt); }
.manage-nav a.active { background: var(--rk-primary-soft); color: var(--rk-primary-dark); font-weight: 600; }
.manage-content {
    background: var(--rk-surface);
    border: 1px solid var(--rk-border);
    border-radius: var(--rk-radius-lg);
    padding: 1.75rem;
    min-width: 0;
}
.manage-content h2 { font-family: var(--rk-serif); font-size: 1.4rem; margin: 0 0 1.25rem; }
.manage-content h3 { font-family: var(--rk-serif); font-size: 1.1rem; margin: 1.75rem 0 .75rem; }
.manage-form { display: flex; flex-direction: column; gap: 1rem; max-width: 460px; }
.manage-form .btn { align-self: flex-start; }
.button-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.button-row form { margin: 0; }
.simple-table { width: 100%; border-collapse: collapse; }
.simple-table td { padding: .6rem 0; border-bottom: 1px solid var(--rk-border); }
.align-right { text-align: right; }
.steps { padding-left: 1.2rem; }
.steps li { margin-bottom: 1.25rem; }
.shared-key { font-size: 1.05rem; letter-spacing: .05em; background: var(--rk-bg-alt); padding: .3rem .6rem; border-radius: 6px; color: var(--rk-text); }
.otp-uri { word-break: break-all; font-size: .78rem; }
.recovery-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .5rem; }
.recovery-code { background: var(--rk-bg-alt); padding: .4rem .6rem; border-radius: 6px; text-align: center; }

@media (max-width: 760px) {
    .manage-grid { grid-template-columns: 1fr; gap: 1rem; }
    .manage-nav ul { flex-direction: row; flex-wrap: wrap; }
    .manage-content { padding: 1.25rem; }
    .manage-topbar { padding: .75rem 1rem; }
    .manage-body { padding: 1.25rem 1rem 3rem; }
}

/* Blazor chybová lišta */
#blazor-error-ui {
    background: var(--rk-warning-soft);
    color: var(--rk-text);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 2000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 1rem; top: 0.6rem; }

/* ==========================================================================
   Etapa 3 – osoby, vztahy, události, zdroje, rodokmen
   ========================================================================== */

/* Avatar osoby */
.person-avatar {
    display: inline-flex; flex: none; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 50%;
    font-weight: 700; font-size: .85rem; letter-spacing: .02em;
    background: var(--rk-bg-alt); color: var(--rk-text-muted); border: 1px solid var(--rk-border);
}
.person-avatar.size-sm { width: 30px; height: 30px; font-size: .72rem; }
.person-avatar.size-lg { width: 64px; height: 64px; font-size: 1.25rem; }
.person-avatar.gender-female { background: #F6E6E4; color: #8C3B2E; border-color: #EBCFCB; }
.person-avatar.gender-male { background: #E3ECF4; color: #2E4A7D; border-color: #CBDBEC; }
.person-avatar.gender-other { background: #EEEAE4; color: #5F534A; }

.person-link { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--rk-text); min-width: 0; }
.person-link:hover .person-link-name { text-decoration: underline; }
.person-link-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.person-link-name { font-weight: 600; overflow-wrap: anywhere; }
.person-link-meta { font-size: .8rem; color: var(--rk-text-muted); }
.person-link-badge { font-size: .72rem; color: var(--rk-secondary); background: var(--rk-secondary-soft); border-radius: 999px; padding: .05rem .45rem; white-space: nowrap; }

/* Filtry a seznamy */
.filter-bar { display: flex; gap: .75rem 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.25rem; }
.filter-bar .grow { flex: 1 1 280px; }
.filter-select { flex: 0 0 210px; }
.filter-select-wide { flex: 0 1 300px; min-width: 220px; }
.result-count { color: var(--rk-text-muted); font-size: .85rem; margin-bottom: .5rem; }
.pager { display: flex; justify-content: center; margin-top: 1.25rem; }

.person-row {
    display: flex; align-items: center; gap: 1rem; padding: .85rem 1.25rem;
    border-bottom: 1px solid var(--rk-border); text-decoration: none; color: var(--rk-text);
}
.person-row:last-child { border-bottom: none; }
.person-row:hover { background: var(--rk-bg); color: var(--rk-text); }
.person-row-main { flex: 1; min-width: 0; }
.person-row-name { font-weight: 600; }
.person-row-birthname { font-weight: 400; color: var(--rk-text-muted); font-size: .88rem; margin-left: .35rem; }
.person-row-meta { display: flex; flex-wrap: wrap; gap: .2rem 1rem; color: var(--rk-text-muted); font-size: .85rem; }
.person-row-meta span { display: inline-flex; align-items: center; gap: .25rem; }
.row-chevron { color: var(--rk-border-strong); }
.status-incomplete { background: var(--rk-warning-soft); color: var(--rk-warning); }
.status-living { background: var(--rk-success-soft); color: var(--rk-success); }
.status-protected { background: var(--rk-info-soft); color: var(--rk-info); display: inline-flex; align-items: center; gap: .25rem; }

.picker-item { display: flex; align-items: center; gap: .6rem; }
.picker-item-meta { color: var(--rk-text-muted); font-size: .85rem; margin-left: auto; }
.picker-empty { padding: .75rem 1rem; color: var(--rk-text-muted); }

/* Formulář osoby */
.person-form { display: flex; flex-direction: column; gap: 1.25rem; max-width: 860px; }
.person-form .form-card.mud-paper { max-width: none; }
.form-section-title { font-family: var(--rk-serif); font-size: 1.15rem; margin: 0 0 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.radio-row { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-bottom: .75rem; }
.sticky-actions {
    position: sticky; bottom: 0; z-index: 5; background: color-mix(in srgb, var(--rk-bg) 92%, transparent);
    backdrop-filter: blur(4px); padding: .75rem 0; border-top: 1px solid var(--rk-border);
}
.privacy-option { padding: .75rem 1rem; border-radius: var(--rk-radius); background: var(--rk-info-soft); }
.privacy-option p { margin: 0 0 0 2.6rem; }

/* Editor nepřesného data */
.fuzzy-date { border: 1px solid var(--rk-border); border-radius: var(--rk-radius); padding: .75rem 1rem 1rem; margin: 0; }
.fuzzy-date legend { font-weight: 600; font-size: .9rem; padding: 0 .35rem; }
.fuzzy-date-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.fuzzy-date-row + .fuzzy-date-row { margin-top: .5rem; }
.fd-qualifier { flex: 0 0 170px; }
.fd-day { flex: 0 0 90px; }
.fd-month { flex: 0 0 150px; }
.fd-year { flex: 0 0 110px; }
.fd-and { color: var(--rk-text-muted); width: 170px; text-align: right; }
.fuzzy-date-preview { margin-top: .5rem; font-size: .85rem; color: var(--rk-text-muted); }
.fd-error { color: var(--rk-danger); }
@media (max-width: 600px) {
    .fd-qualifier { flex-basis: 100%; }
    .fd-and { width: auto; text-align: left; flex-basis: 100%; }
}

/* Detail osoby */
.breadcrumbs { font-size: .85rem; color: var(--rk-text-muted); margin-bottom: 1rem; }
.breadcrumbs a { color: var(--rk-text-muted); }
.person-header { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.person-header-text { flex: 1 1 280px; min-width: 0; }
.person-header-meta { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .35rem; }
.lifespan { font-size: 1.05rem; color: var(--rk-text-muted); }
.person-tabs .mud-tabs-tabbar { background: transparent; border-bottom: 1px solid var(--rk-border); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 1.25rem; align-items: start; }
.detail-main, .detail-side { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
.detail-card.mud-paper { padding: 1.25rem 1.5rem; }
.card-title { font-family: var(--rk-serif); font-size: 1.15rem; margin: 0 0 1rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; margin: 0; }
.facts dt { color: var(--rk-text-muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.prose { white-space: pre-line; line-height: 1.65; }
.family-section + .family-section { margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px solid var(--rk-border); }
.family-section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem; }
.family-section-head h3 { margin: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--rk-text-muted); }
.family-subhead { font-size: .8rem; color: var(--rk-tertiary); margin: .5rem 0 .2rem; font-weight: 600; }
.family-item { display: flex; align-items: center; gap: .35rem; padding: .3rem 0; }
.family-item .person-link { flex: 1; }
.family-empty { color: var(--rk-text-muted); font-size: .88rem; margin: .2rem 0; }
.uncertain {
    display: inline-flex; width: 20px; height: 20px; border-radius: 50%; align-items: center; justify-content: center;
    background: var(--rk-warning-soft); color: var(--rk-warning); font-weight: 700; font-size: .8rem;
}
.tab-actions { display: flex; justify-content: flex-end; margin-bottom: 1rem; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

/* Časová osa */
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.25rem; border-left: 2px solid var(--rk-border); }
.timeline-item { position: relative; display: grid; grid-template-columns: 170px 1fr; gap: 1rem; padding: 0 0 1.5rem 1.25rem; }
.timeline-item::before {
    content: ""; position: absolute; left: -1.25rem; top: .35rem; transform: translateX(-50%);
    width: 12px; height: 12px; border-radius: 50%; background: var(--rk-surface); border: 3px solid var(--rk-tertiary);
    margin-left: -1px;
}
.timeline-item.kind-birth::before, .timeline-item.kind-childbirth::before { border-color: var(--rk-success); }
.timeline-item.kind-death::before, .timeline-item.kind-burial::before { border-color: var(--rk-text-muted); }
.timeline-item.kind-partnershipstart::before, .timeline-item.kind-partnershipend::before { border-color: #8C3B2E; }
.timeline-date { font-weight: 600; color: var(--rk-text-muted); font-variant-numeric: tabular-nums; }
.timeline-title { font-weight: 600; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.timeline-place { display: flex; align-items: center; gap: .25rem; color: var(--rk-text-muted); font-size: .88rem; margin-top: .2rem; }
.timeline-body .person-link { margin-top: .35rem; }
.timeline-people { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-top: .5rem; }
.event-type { color: var(--rk-tertiary); }
@media (max-width: 600px) {
    .timeline-item { grid-template-columns: 1fr; gap: .15rem; }
}

/* Citace a zdroje */
.citation-row { display: flex; align-items: flex-start; gap: .9rem; padding: .9rem 1.25rem; border-bottom: 1px solid var(--rk-border); }
.citation-row:last-child { border-bottom: none; }
.citation-main { flex: 1; min-width: 0; }
.citation-title { font-weight: 600; overflow-wrap: anywhere; }
.citation-meta { display: flex; flex-wrap: wrap; gap: .25rem .9rem; color: var(--rk-text-muted); font-size: .85rem; align-items: center; margin-top: .15rem; }
.citation-note { font-size: .88rem; margin-top: .3rem; color: var(--rk-text); }

/* Dialogy etapy 3 */
.participants { border: 1px solid var(--rk-border); border-radius: var(--rk-radius); padding: .75rem 1rem; }
.participants-title { font-weight: 600; font-size: .9rem; margin-bottom: .4rem; }
.participant-row { display: flex; align-items: center; gap: .6rem; padding: .2rem 0; }
.participant-name { font-weight: 600; flex: 0 1 auto; min-width: 0; }
.participant-role { flex: 1 1 140px; }
.merge-preview { margin-top: 1rem; padding: .75rem 1rem; border-radius: var(--rk-radius); background: var(--rk-bg); }
.merge-preview ul { margin: 0 0 .5rem; padding-left: 1.2rem; }

/* Rodokmen */
.tree-toolbar { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: center; margin-bottom: .75rem; }
.tree-toolbar > .mud-input-control:first-child, .tree-toolbar > div:first-child { flex: 1 1 260px; }
.tree-depth { flex: 0 0 150px; }
.tree-zoom { display: flex; border: 1px solid var(--rk-border); border-radius: var(--rk-radius); background: var(--rk-surface); }
.tree-nav { display: flex; flex-wrap: wrap; gap: .4rem .5rem; align-items: center; margin-bottom: .75rem; font-size: .88rem; }
.tree-nav-label { display: inline-flex; align-items: center; gap: .2rem; color: var(--rk-text-muted); margin-left: .5rem; }
.tree-nav-label:first-child { margin-left: 0; }
.chip-button {
    border: 1px solid var(--rk-border); background: var(--rk-surface); color: var(--rk-text); border-radius: 999px;
    padding: .2rem .7rem; font: inherit; font-size: .85rem; cursor: pointer;
}
.chip-button:hover { border-color: var(--rk-primary); color: var(--rk-primary); }

.tree-layout { display: block; }
.tree-canvas {
    position: relative; border: 1px solid var(--rk-border); border-radius: var(--rk-radius-lg); overflow: hidden;
    background:
        radial-gradient(circle at 1px 1px, #E9E1D6 1px, transparent 0) 0 0 / 22px 22px,
        var(--rk-surface);
}
.tree-svg { display: block; width: 100%; height: min(72vh, 760px); min-height: 420px; cursor: grab; touch-action: none; user-select: none; }
.tree-svg.is-panning { cursor: grabbing; }
.tree-svg:focus-visible { outline: 3px solid rgba(47, 93, 80, .45); outline-offset: -3px; }

.tree-edge { fill: none; stroke: #9C8B7D; stroke-width: 1.8; }
.edge-parentnonbiological { stroke-dasharray: 7 5; }
.edge-parentunknown { stroke: #BFB2A6; }
.edge-partner { stroke: #8C3B2E; stroke-width: 2.4; }
.edge-partnerinformal { stroke: #8C3B2E; stroke-width: 2; stroke-dasharray: 6 4; }
.edge-partnerended { stroke: #B9A9A3; stroke-width: 2; stroke-dasharray: 2 4; }
.edge-uncertain { stroke-opacity: .55; stroke-dasharray: 2 5; }

.tree-node { cursor: pointer; outline: none; }
.tree-node .node-box { fill: #FFFFFF; stroke: #DCD1C5; stroke-width: 1.2; transition: stroke .15s; }
.tree-node .node-accent { fill: #CFC3B6; }
.tree-node.gender-female .node-accent { fill: #C98478; }
.tree-node.gender-male .node-accent { fill: #7D97BF; }
.tree-node .node-avatar { fill: #F1ECE5; }
.tree-node.gender-female .node-avatar { fill: #F6E6E4; }
.tree-node.gender-male .node-avatar { fill: #E3ECF4; }
.tree-node .node-initials { font: 700 13px var(--rk-sans); fill: #5F534A; }
.tree-node .node-name { font: 600 13.5px var(--rk-sans); fill: var(--rk-text); }
.tree-node .node-meta { font: 400 12px var(--rk-sans); fill: var(--rk-text-muted); }
.tree-node .node-incomplete { fill: var(--rk-tertiary); }
.tree-node:hover .node-box, .tree-node:focus-visible .node-box { stroke: var(--rk-secondary); stroke-width: 2; }
.tree-node.is-focus .node-box { stroke: var(--rk-primary); stroke-width: 2.4; fill: #FFFDF9; }
.tree-node.is-selected .node-box { stroke: var(--rk-secondary); stroke-width: 3; filter: drop-shadow(0 3px 8px rgba(47, 93, 80, .25)); }
.tree-node.is-restricted .node-meta { font-style: italic; }

.tree-truncated { position: absolute; top: .75rem; left: .75rem; right: .75rem; padding: .5rem .75rem; border-radius: 8px; background: var(--rk-warning-soft); color: var(--rk-warning); font-size: .85rem; }
.tree-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; padding: .6rem 1rem; border-top: 1px solid var(--rk-border); background: var(--rk-surface); font-size: .8rem; color: var(--rk-text-muted); }
.tree-legend span { display: inline-flex; align-items: center; gap: .35rem; }

.tree-panel {
    position: absolute; top: 12px; right: 12px; width: 268px; max-height: calc(100% - 72px); overflow: auto;
    border: 1px solid var(--rk-border); border-radius: var(--rk-radius-lg); background: var(--rk-surface);
    padding: 1.1rem 1.1rem 1rem; box-shadow: 0 8px 28px rgba(43, 33, 27, .14);
}
.tree-panel-close { position: absolute !important; top: 6px; right: 6px; }
.tree-panel-head { display: flex; gap: .9rem; align-items: center; margin-bottom: 1rem; }
.tree-panel-name { font-family: var(--rk-serif); font-weight: 600; font-size: 1.15rem; overflow-wrap: anywhere; }
.tree-panel-meta { color: var(--rk-text-muted); font-size: .88rem; }
.tree-panel-actions { display: flex; flex-direction: column; gap: .5rem; }
.tree-panel-sub { margin-top: .5rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--rk-text-muted); }
.tree-panel-grid { display: grid; grid-template-columns: 1fr; gap: .1rem; }
.tree-panel-grid .mud-button-root { justify-content: flex-start; }

@media (max-width: 700px) {
    .tree-panel { position: static; width: auto; max-height: none; box-shadow: none; border-width: 1px 0 0; border-radius: 0; }
    .tree-svg { height: 60vh; min-height: 360px; }
}

/* ==========================================================================
   Etapa 4 – fotografie, dokumenty, kroniky
   ========================================================================== */
.person-photo { object-fit: cover; padding: 0; background: var(--rk-bg-alt); }
.space-photo { object-fit: cover; padding: 0; }

/* Nahrávání */
.dropzone {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem;
    padding: 1.5rem 1rem; border: 2px dashed var(--rk-border-strong); border-radius: var(--rk-radius-lg);
    background: var(--rk-surface); text-align: center; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragging { border-color: var(--rk-secondary); background: var(--rk-secondary-soft); }
.dropzone.busy { opacity: .7; }
.dropzone-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.dropzone-input:disabled { cursor: progress; }
.dropzone-icon { color: var(--rk-secondary); }
.dropzone-title { font-weight: 600; }
.dropzone-hint { font-size: .82rem; color: var(--rk-text-muted); }
.upload-list { list-style: none; margin: .75rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.upload-item { display: flex; align-items: center; gap: .5rem; font-size: .88rem; }
.upload-name { font-weight: 600; overflow-wrap: anywhere; }
.upload-error { color: var(--rk-danger); }
.storage-usage { display: flex; flex-direction: column; gap: .35rem; margin-top: .75rem; font-size: .82rem; color: var(--rk-text-muted); max-width: 520px; }

/* Mřížka médií */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .75rem; }
.media-tile {
    position: relative; display: flex; flex-direction: column; padding: 0; border: 1px solid var(--rk-border);
    border-radius: var(--rk-radius); overflow: hidden; background: var(--rk-surface); cursor: pointer; text-align: left; font: inherit;
    aspect-ratio: 1 / 1.08; transition: box-shadow .15s, border-color .15s;
}
.media-tile:hover, .media-tile:focus-visible { border-color: var(--rk-border-strong); box-shadow: var(--rk-shadow); }
.media-tile.is-selected { border: 3px solid var(--rk-secondary); }
.media-tile img { width: 100%; flex: 1; min-height: 0; object-fit: cover; display: block; background: var(--rk-bg-alt); }
.media-doc-icon { flex: 1; display: flex; align-items: center; justify-content: center; color: #B23A2E; background: #FBF4F2; }
.media-tile-caption { display: flex; flex-direction: column; padding: .4rem .55rem; gap: .05rem; }
.media-tile-title { font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--rk-text); }
.media-tile-date { font-size: .75rem; color: var(--rk-text-muted); }
.picker-grid { max-height: 52vh; overflow: auto; padding: 2px; }

.media-detail { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(280px, 1fr); gap: 1.25rem; }
.media-detail-preview img { width: 100%; max-height: 62vh; object-fit: contain; border-radius: var(--rk-radius); background: #1F1A16; }
.media-doc-preview { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 3rem 1rem; border-radius: var(--rk-radius); background: #FBF4F2; color: #B23A2E; }
.media-detail-meta { display: flex; flex-direction: column; gap: .2rem; margin-top: .6rem; font-size: .82rem; color: var(--rk-text-muted); }
@media (max-width: 800px) { .media-detail { grid-template-columns: 1fr; } }
.cover-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.cover-row .section-text { flex: 1 1 240px; margin: 0; }
.cover-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: var(--rk-radius); border: 1px solid var(--rk-border); }

/* Kroniky – seznam */
.chronicle-card {
    display: flex; flex-direction: column; border: 1px solid var(--rk-border); border-radius: var(--rk-radius-lg); overflow: hidden;
    background: var(--rk-surface); color: var(--rk-text); text-decoration: none; transition: box-shadow .15s, transform .15s;
}
.chronicle-card:hover { color: var(--rk-text); box-shadow: var(--rk-shadow); transform: translateY(-1px); }
.chronicle-cover { height: 150px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #EDE3D7, #F6F1EA); color: var(--rk-primary); }
.chronicle-cover img { width: 100%; height: 100%; object-fit: cover; }
.chronicle-card-body { padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: .5rem; }

/* Editor kroniky */
.chronicle-editor { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.chapter-panel { position: sticky; top: 80px; border: 1px solid var(--rk-border); border-radius: var(--rk-radius-lg); background: var(--rk-surface); padding: 1rem; }
.chapter-panel-title { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--rk-text-muted); margin-bottom: .5rem; }
.chapter-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.chapter-item { display: flex; align-items: center; border-radius: 8px; }
.chapter-item.is-selected { background: var(--rk-primary-soft); }
.chapter-select { flex: 1; display: flex; gap: .45rem; align-items: baseline; padding: .5rem .6rem; border: none; background: none; font: inherit; text-align: left; cursor: pointer; color: var(--rk-text); min-width: 0; }
.chapter-item.is-selected .chapter-select { font-weight: 600; color: var(--rk-primary-dark); }
.chapter-number { color: var(--rk-text-muted); font-variant-numeric: tabular-nums; }
.chapter-title { flex: 1; overflow-wrap: anywhere; }
.chapter-count { font-size: .75rem; color: var(--rk-text-muted); background: var(--rk-bg-alt); border-radius: 999px; padding: 0 .45rem; }
.chapter-rename { display: flex; align-items: center; gap: .25rem; width: 100%; padding: .25rem; }
.chapter-add { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--rk-border); display: flex; flex-direction: column; gap: .25rem; }
.chapter-heading { font-family: var(--rk-serif); font-size: 1.6rem; margin: 0 0 1rem; display: flex; flex-direction: column; }

.block-card { position: relative; border: 1px solid transparent; border-radius: var(--rk-radius); padding: .75rem 1rem; margin-bottom: .25rem; transition: border-color .15s, background .15s; }
.block-card:hover { border-color: var(--rk-border); background: var(--rk-surface); }
.block-card.is-editing { border-color: var(--rk-secondary); background: var(--rk-surface); box-shadow: var(--rk-shadow); margin: .75rem 0; }
.block-actions { position: absolute; top: .35rem; right: .35rem; display: none; gap: 0; background: var(--rk-surface); border: 1px solid var(--rk-border); border-radius: 8px; }
.block-card:hover .block-actions, .block-card:focus-within .block-actions { display: flex; }
@media (hover: none) { .block-actions { display: flex; position: static; width: fit-content; margin-top: .4rem; } }
.block-type-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--rk-secondary); margin-bottom: .5rem; font-weight: 600; }
.block-editor { gap: .9rem; }
.mention-row { max-width: 440px; }
.add-block-bar { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: 1rem; padding: .75rem 1rem; border: 1px dashed var(--rk-border-strong); border-radius: var(--rk-radius); color: var(--rk-text-muted); font-size: .88rem; }
.add-block-bar .chip-button { display: inline-flex; align-items: center; gap: .3rem; }

.block-preview .bp-heading { font-family: var(--rk-serif); font-size: 1.25rem; margin: 0; }
.block-preview .bp-text { margin: 0; white-space: pre-line; line-height: 1.7; }
.block-preview .bp-quote { margin: 0; padding-left: 1rem; border-left: 3px solid var(--rk-primary); font-style: italic; }
.block-preview .bp-quote cite { display: block; font-style: normal; color: var(--rk-text-muted); font-size: .88rem; margin-top: .25rem; }
.block-preview .bp-photo { margin: 0; }
.block-preview .bp-photo img { max-height: 220px; max-width: 100%; border-radius: var(--rk-radius); }
.block-preview figcaption { font-size: .85rem; color: var(--rk-text-muted); font-style: italic; }
.block-preview .bp-chip { margin: 0; display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .75rem; border-radius: 999px; background: var(--rk-bg-alt); }
.block-preview .bp-missing { color: var(--rk-text-muted); font-style: italic; margin: 0; }
.bp-pagebreak { border-top: 2px dashed var(--rk-border-strong); text-align: center; height: 0; margin: .9rem 0; }
.bp-pagebreak span { position: relative; top: -.75rem; background: var(--rk-bg); padding: 0 .5rem; font-size: .75rem; color: var(--rk-text-muted); }
.mention { color: var(--rk-secondary); font-weight: 600; text-decoration: none; border-bottom: 1px dotted currentColor; }
@media (max-width: 900px) {
    .chronicle-editor { grid-template-columns: 1fr; }
    .chapter-panel { position: static; }
}

/* Čtecí zobrazení kroniky */
.reader-toolbar { max-width: 760px; margin: 0 auto 1rem; }
.back-link { display: inline-flex; align-items: center; gap: .3rem; text-decoration: none; color: var(--rk-text-muted); }
.book {
    max-width: 760px; margin: 0 auto; background: #FFFDF9; border: 1px solid var(--rk-border); border-radius: 6px;
    box-shadow: 0 2px 30px rgba(43, 33, 27, .08); padding: clamp(1.5rem, 5vw, 4rem); font-family: var(--rk-serif); font-size: 1.1rem; line-height: 1.75;
}
.book h1, .book h2, .book h3 { font-family: var(--rk-serif); color: var(--rk-primary-dark); line-height: 1.25; }
.book-title-page { text-align: center; padding-bottom: 2.5rem; margin-bottom: 2.5rem; border-bottom: 1px solid var(--rk-border); }
.book-title-page h1 { font-size: clamp(2rem, 5vw, 2.8rem); margin: 1rem 0 .5rem; }
.book-subtitle { color: var(--rk-text-muted); font-size: 1.2rem; margin: 0; }
.book-cover { max-width: 100%; max-height: 420px; margin: 2rem auto 1rem; display: block; border-radius: 4px; }
.book-description { font-style: italic; color: var(--rk-text-muted); max-width: 520px; margin: 1rem auto; }
.book-author { margin-top: 2rem; }
.book-toc { margin-bottom: 3rem; }
.book-toc ol { padding-left: 1.4rem; }
.book-toc a { color: var(--rk-text); }
.book-chapter { margin-bottom: 3.5rem; scroll-margin-top: 90px; }
.book-chapter-number { font-family: var(--rk-sans); font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: var(--rk-tertiary); }
.book-chapter h2 { font-size: 1.9rem; margin: .25rem 0 1.5rem; }
.book p { margin: 0 0 1.1rem; text-align: justify; hyphens: auto; }
.book figure { margin: 2rem 0; text-align: center; }
.book figure img { max-width: 100%; max-height: 560px; border-radius: 4px; }
.book figcaption { font-size: .92rem; font-style: italic; color: var(--rk-text-muted); margin-top: .5rem; }
.book blockquote { margin: 1.5rem 0; padding: .25rem 0 .25rem 1.25rem; border-left: 3px solid var(--rk-primary); font-style: italic; }
.book blockquote cite { display: block; font-style: normal; font-size: .92rem; color: var(--rk-text-muted); }
.book-card { font-family: var(--rk-sans); font-size: .95rem; line-height: 1.55; border: 1px solid var(--rk-border); border-radius: var(--rk-radius); padding: 1rem 1.25rem; margin: 1.5rem 0; background: var(--rk-surface); }
.book-card-row { display: flex; gap: 1rem; align-items: flex-start; }
.book-card-photo { width: 72px; height: 72px; object-fit: cover; border-radius: 50%; }
.book-card-title { font-family: var(--rk-serif); font-size: 1.15rem; font-weight: 600; color: var(--rk-primary-dark); margin-bottom: .35rem; }
.book-card dl { display: grid; grid-template-columns: max-content 1fr; gap: .15rem .9rem; margin: 0; }
.book-card dt { color: var(--rk-text-muted); }
.book-card dd { margin: 0; }
.book-card p { text-align: left; margin: .5rem 0 0; }
.book-timeline { font-family: var(--rk-sans); font-size: .95rem; margin: 1.5rem 0; }
.book-timeline h3 { font-size: 1.15rem; }
.book-timeline ol { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--rk-border); }
.book-timeline li { display: grid; grid-template-columns: 150px 1fr; gap: .75rem; padding: .3rem 0 .3rem 1rem; }
.tl-date { font-weight: 600; color: var(--rk-text-muted); }
.book-break { border: none; border-top: 1px dashed var(--rk-border); margin: 2.5rem 0; }
@media (max-width: 600px) { .book-timeline li { grid-template-columns: 1fr; gap: 0; } }

/* Historie změn */
.audit-row { display: grid; grid-template-columns: 150px 1fr; gap: 1rem; padding: .7rem 1.25rem; border-bottom: 1px solid var(--rk-border); }
.audit-row:last-child { border-bottom: none; }
.audit-time { color: var(--rk-text-muted); font-variant-numeric: tabular-nums; font-size: .88rem; }
.audit-action { font-weight: 600; }
.audit-meta { color: var(--rk-text-muted); font-size: .85rem; overflow-wrap: anywhere; }
@media (max-width: 600px) { .audit-row { grid-template-columns: 1fr; gap: .1rem; } }

/* Profilová fotografie osoby */
.person-avatar.size-xl { width: 112px; height: 112px; font-size: 2rem; }
.profile-photo { position: relative; display: inline-flex; flex: none; }
.profile-photo-button { position: relative; padding: 0; border: none; background: none; border-radius: 50%; cursor: pointer; }
.profile-photo-button:hover .person-avatar, .profile-photo-button:focus-visible .person-avatar { box-shadow: 0 0 0 3px var(--rk-secondary); }
.profile-photo-badge {
    position: absolute; right: 2px; bottom: 2px; display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 50%; background: var(--rk-secondary); color: #fff;
    border: 2px solid var(--rk-surface); box-shadow: var(--rk-shadow);
}
.profile-photo.size-lg .profile-photo-badge { width: 24px; height: 24px; right: -2px; bottom: -2px; }
.profile-photo.size-lg .profile-photo-badge .mud-icon-root { font-size: .95rem; }

/* --------------------------------------------------------------------------
   Správa aplikace (superadmin)
   -------------------------------------------------------------------------- */
.admin-tabs { display: flex; gap: .25rem; flex-wrap: wrap; border-bottom: 1px solid var(--rk-border); margin-bottom: 1.5rem; }
.admin-tab {
    display: inline-flex; align-items: center; gap: .4rem; padding: .6rem .9rem; margin-bottom: -1px;
    color: var(--rk-text-muted); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent;
}
.admin-tab:hover { color: var(--rk-text); }
.admin-tab.active { color: var(--rk-primary); border-bottom-color: var(--rk-primary); }
.admin-table-card.mud-paper { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.admin-table th, .admin-table td { padding: .7rem 1rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rk-border); }
.admin-table th.align-right, .admin-table td.align-right { text-align: right; }
.admin-table thead th { font-size: .78rem; font-weight: 600; color: var(--rk-text-muted); text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.admin-table tbody tr:last-child > * { border-bottom: 0; }
.admin-facts th { width: 220px; color: var(--rk-text-muted); font-weight: 500; }
.admin-link { color: var(--rk-text); font-weight: 600; text-decoration: none; }
.admin-link:hover { color: var(--rk-primary); text-decoration: underline; }
.admin-muted { color: var(--rk-text-muted); font-size: .82rem; }
.admin-badges { display: inline-flex; gap: .3rem; flex-wrap: wrap; }
.admin-pill-super { background: var(--rk-primary-soft); color: var(--rk-primary); }
.admin-pill-danger { background: var(--rk-danger-soft); color: var(--rk-danger); }
.admin-pill-warning { background: var(--rk-warning-soft); color: var(--rk-warning); }
.admin-pill-ok { background: var(--rk-success-soft); color: var(--rk-success); }
@media (max-width: 600px) {
    .admin-table th, .admin-table td { padding: .55rem .6rem; }
    .admin-facts th { width: 40%; }
}
