/* ============================================================
   «Родословная» — оформление приложения.
   Палитра: пергамент, глубокий хвойный зелёный, старое золото.
   ============================================================ */

:root {
    --paper: #faf7f1;
    --paper-2: #f3ede3;
    --surface: #ffffff;
    --ink: #1f2320;
    --ink-soft: #4a524c;
    --muted: #837b6f;
    --line: #e2dacd;

    --brand: #2f5d50;
    --brand-dark: #1d3c33;
    --brand-light: #4d8574;
    --accent: #b8873c;
    --accent-light: #e2c48c;

    --danger: #a63636;
    --success: #3d7a52;

    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(31, 35, 32, .05), 0 8px 24px rgba(31, 35, 32, .07);
    --shadow-lg: 0 2px 6px rgba(31, 35, 32, .08), 0 22px 48px rgba(31, 35, 32, .14);

    --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
    --sans: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html, body {
    font-family: var(--sans);
    background: var(--paper);
    color: var(--ink);
    font-size: 16px;
    line-height: 1.6;
    scroll-behavior: smooth;
}

h1, h2, h3, h4, .serif {
    font-family: var(--serif);
    color: var(--brand-dark);
    letter-spacing: -.01em;
    font-weight: 700;
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    color: var(--brand-dark);
    text-decoration: underline;
}

.text-muted-2 { color: var(--muted); }

/* ---------- Кнопки ---------- */

.btn {
    border-radius: 999px;
    font-weight: 600;
    padding: .55rem 1.35rem;
    border: 1px solid transparent;
    transition: transform .12s ease, box-shadow .2s ease, background-color .2s ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary,
.btn-primary:focus {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.btn-primary:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    color: #fff;
}

.btn-accent {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-accent:hover {
    background: #a3762f;
    border-color: #a3762f;
    color: #fff;
}

.btn-outline-brand {
    border-color: var(--brand);
    color: var(--brand);
    background: transparent;
}

.btn-outline-brand:hover {
    background: var(--brand);
    color: #fff;
}

.btn-ghost {
    border-color: var(--line);
    background: var(--surface);
    color: var(--ink-soft);
}

.btn-ghost:hover {
    border-color: var(--brand-light);
    color: var(--brand-dark);
}

.btn-danger-soft {
    border-color: #eec7c7;
    background: #fbeaea;
    color: var(--danger);
}

.btn-danger-soft:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

.btn-sm { padding: .3rem .85rem; font-size: .85rem; }

/* ---------- Формы ---------- */

.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    padding: .6rem .85rem;
    background: var(--surface);
    color: var(--ink);
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand-light);
    box-shadow: 0 0 0 3px rgba(77, 133, 116, .18);
}

.form-floating > label { color: var(--muted); }

label, .form-label { font-weight: 600; color: var(--ink-soft); font-size: .92rem; }

.validation-message, .text-danger { color: var(--danger); font-size: .875rem; }

/* ---------- Карточки и панели ---------- */

.card, .panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel { padding: 1.5rem; }

.panel-title {
    font-family: var(--serif);
    font-size: 1.15rem;
    color: var(--brand-dark);
    margin: 0 0 1rem;
    padding-bottom: .6rem;
    border-bottom: 1px solid var(--line);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: var(--paper-2);
    border: 1px solid var(--line);
    color: var(--ink-soft);
    border-radius: 999px;
    padding: .15rem .7rem;
    font-size: .8rem;
    font-weight: 600;
}

.chip-accent { background: #fdf4e4; border-color: var(--accent-light); color: #8a5f1c; }
.chip { white-space: nowrap; }

.chip-danger { background: #fbeaea; border-color: #eec7c7; color: var(--danger); }
.chip-success { background: #e9f4ed; border-color: #c3e0cf; color: var(--success); }

.alert { border-radius: var(--radius-sm); border: 1px solid var(--line); }

/* ---------- Аватары ---------- */

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--brand-light), var(--brand-dark));
    color: #fff;
    font-family: var(--serif);
    font-weight: 700;
    border-radius: 50%;
    object-fit: cover;
    flex: none;
    overflow: hidden;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-female { background: linear-gradient(135deg, #b98c76, #8a5c46); }
.avatar-unknown { background: linear-gradient(135deg, #9c9a94, #6c6a64); }

.avatar-xs { width: 32px; height: 32px; font-size: .75rem; }
.avatar-sm { width: 44px; height: 44px; font-size: .9rem; }
.avatar-md { width: 64px; height: 64px; font-size: 1.15rem; }
.avatar-lg { width: 132px; height: 132px; font-size: 2.4rem; }

/* ============================================================
   Лендинг
   ============================================================ */

.landing { background: var(--paper); }

.landing-header {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
    background: rgba(250, 247, 241, .88);
    border-bottom: 1px solid var(--line);
}

.landing-header .inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: .85rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-family: var(--serif);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--brand-dark);
    text-decoration: none;
}

.brand:hover { text-decoration: none; color: var(--brand); }

.brand-mark { width: 34px; height: 34px; flex: none; }

.landing-nav {
    display: flex;
    gap: 1.6rem;
    margin-left: auto;
    font-size: .95rem;
    font-weight: 600;
}

.landing-nav a { color: var(--ink-soft); }
.landing-nav a:hover { color: var(--brand); text-decoration: none; }

.landing-actions { display: flex; gap: .6rem; align-items: center; flex-shrink: 0; }

/* Подписи кнопок и пунктов меню не переносим: иначе шапка лендинга растёт в две строки. */
.landing-actions .btn, .landing-nav a { white-space: nowrap; }

.hero {
    position: relative;
    overflow: hidden;
    padding: 5.5rem 1.5rem 4.5rem;
    background:
        radial-gradient(1000px 420px at 78% -10%, rgba(184, 135, 60, .16), transparent 65%),
        radial-gradient(760px 420px at 8% 0%, rgba(47, 93, 80, .14), transparent 60%);
}

.hero-inner {
    max-width: 1180px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    gap: 3.5rem;
    align-items: center;
}

.hero h1 {
    font-size: clamp(2.4rem, 5vw, 3.9rem);
    line-height: 1.08;
    margin-bottom: 1.2rem;
}

.hero h1 em { font-style: italic; color: var(--accent); }

.hero-lead {
    font-size: 1.15rem;
    color: var(--ink-soft);
    max-width: 34rem;
    margin-bottom: 2rem;
}

.hero-cta { display: flex; flex-wrap: wrap; gap: .8rem; }

.eyebrow {
    display: inline-block;
    font-size: .78rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 1rem;
}

.hero-art {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
}

.hero-art svg { width: 100%; height: auto; display: block; }

.stats-band {
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--paper-2);
}

.stats-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 2.2rem 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.25rem 1rem;
    text-align: center;
}

.stat-value {
    font-family: var(--serif);
    font-size: 2.3rem;
    font-weight: 700;
    color: var(--brand-dark);
    line-height: 1;
}

.stat-label {
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    margin-top: .45rem;
    font-weight: 600;
}

.section { max-width: 1180px; margin: 0 auto; padding: 5rem 1.5rem; }

.section-head { max-width: 46rem; margin-bottom: 3rem; }
.section-head h2 { font-size: clamp(1.8rem, 3.4vw, 2.5rem); margin-bottom: .8rem; }
.section-head p { color: var(--ink-soft); font-size: 1.05rem; margin: 0; }

/* Карточек возможностей стало шесть: раскладку задаём подстройкой под ширину,
   а не фиксированным числом колонок. */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }

.feature {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 2rem 1.75rem;
    box-shadow: var(--shadow);
    transition: transform .18s ease, box-shadow .18s ease;
}

.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.feature-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(47, 93, 80, .12), rgba(184, 135, 60, .18));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand);
    margin-bottom: 1.1rem;
}

.feature h3 { font-size: 1.2rem; margin-bottom: .55rem; }
.feature p { color: var(--ink-soft); margin: 0; font-size: .97rem; }

.steps { counter-reset: step; display: grid; gap: 1.2rem; }

.step {
    display: flex;
    gap: 1.2rem;
    align-items: flex-start;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.35rem 1.5rem;
}

.step-num {
    counter-increment: step;
    font-family: var(--serif);
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    background: var(--brand);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    flex: none;
}

.step-num::before { content: counter(step); }
.step h3 { font-size: 1.05rem; margin: 0 0 .25rem; }
.step p { margin: 0; color: var(--ink-soft); font-size: .95rem; }

.cta-band {
    background: linear-gradient(135deg, var(--brand-dark), var(--brand));
    color: #fff;
    border-radius: 24px;
    padding: 3.5rem 2.5rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.cta-band h2 { color: #fff; font-size: clamp(1.8rem, 3.4vw, 2.4rem); margin-bottom: .8rem; }
.cta-band p { color: rgba(255, 255, 255, .82); max-width: 38rem; margin: 0 auto 2rem; }

/* ============================================================
   Внутренние страницы
   ============================================================ */

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.app-header { background: var(--brand-dark); color: #fff; position: sticky; top: 0; z-index: 40; }

.app-header .inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: .7rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.4rem;
}

.app-header .brand { color: #fff; font-size: 1.1rem; }
.app-header .brand:hover { color: var(--accent-light); }

/* Разделов много, и на средней ширине перенос строк раздувал шапку на пол-экрана,
   утаскивая подвал далеко за пределы окна. Поэтому меню не переносится, а прокручивается. */
.app-nav {
    display: flex;
    gap: .3rem;
    margin-left: 1rem;
    flex-wrap: nowrap;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.app-nav::-webkit-scrollbar { display: none; }
.app-nav a { white-space: nowrap; }

.app-nav a {
    color: rgba(255, 255, 255, .78);
    padding: .4rem .9rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: .93rem;
}

.app-nav a:hover { color: #fff; background: rgba(255, 255, 255, .1); text-decoration: none; }
.app-nav a.active { color: var(--brand-dark); background: var(--accent-light); }

.app-user { margin-left: auto; display: flex; align-items: center; gap: .75rem; flex-shrink: 0; }
.app-user .name { color: #fff; font-size: .9rem; font-weight: 600; }

.app-user .logout {
    background: none;
    border: 1px solid rgba(255, 255, 255, .3);
    color: rgba(255, 255, 255, .85);
    border-radius: 999px;
    padding: .3rem .9rem;
    font-size: .85rem;
    cursor: pointer;
}

.app-user .logout:hover { background: rgba(255, 255, 255, .12); color: #fff; }

.app-body { flex: 1; max-width: 1320px; width: 100%; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

.page-title { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.75rem; }
.page-title h1 { font-size: 1.9rem; margin: 0; }
.page-title .spacer { margin-left: auto; }

/* ---------- Таблицы ---------- */

.table-wrap {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    /* Широкие таблицы должны прокручиваться внутри себя, а не обрезаться и не растягивать страницу. */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow);
    max-width: 100%;
}

table.data { min-width: 640px; }

table.data { width: 100%; border-collapse: collapse; }

table.data th {
    text-align: left;
    font-size: .78rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--paper-2);
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

table.data td { padding: .8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: #fbf9f5; }

/* ---------- Список людей ---------- */

.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 1rem; }

.person-card {
    display: flex;
    gap: .9rem;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .9rem 1rem;
    color: inherit;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.person-card:hover {
    text-decoration: none;
    color: inherit;
    border-color: var(--brand-light);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.person-card .name { font-weight: 600; line-height: 1.3; }
.person-card .years { font-size: .84rem; color: var(--muted); }

/* ---------- Карточка человека ---------- */

.person-hero {
    display: flex;
    gap: 1.75rem;
    align-items: flex-start;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.person-hero h1 { font-size: 2rem; margin: 0 0 .4rem; }
.person-hero .subtitle { color: var(--muted); margin-bottom: 1rem; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .9rem 2rem; }
.fact-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.fact-value { font-size: .98rem; }

.relations-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }

.relation-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }

.relation-list a {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .45rem .55rem;
    border-radius: var(--radius-sm);
    color: inherit;
}

.relation-list a:hover { background: var(--paper-2); text-decoration: none; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }

.gallery figure { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.gallery img { width: 100%; height: 150px; object-fit: cover; display: block; }
.gallery figcaption { padding: .5rem .65rem; font-size: .82rem; color: var(--muted); }

/* ---------- Дерево ---------- */

.tree-toolbar {
    display: flex;
    gap: .75rem;
    align-items: center;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .85rem 1rem;
    margin-bottom: 1.25rem;
}

.tree-scroll {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    overflow-x: auto;
}

.tree, .tree ul { list-style: none; margin: 0; padding: 0; }

.tree ul { margin-left: 1.35rem; padding-left: 1.35rem; border-left: 2px solid var(--line); }

.tree li { position: relative; padding: .3rem 0; }

.tree li::before {
    content: "";
    position: absolute;
    left: -1.35rem;
    top: 1.55rem;
    width: 1.15rem;
    height: 2px;
    background: var(--line);
}

.tree > li::before { display: none; }

.node {
    display: flex;
    align-items: center;
    gap: .7rem;
    flex-wrap: wrap;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .35rem .9rem .35rem .4rem;
    width: fit-content;
    max-width: 100%;
}

.node.is-focus { border-color: var(--accent); background: #fdf6e9; box-shadow: 0 0 0 3px rgba(184, 135, 60, .18); }
.node .person-link { display: flex; align-items: center; gap: .55rem; color: inherit; }
.node .person-link:hover { text-decoration: none; color: var(--brand-dark); }
.node .name { font-weight: 600; font-size: .95rem; }
.node .years { font-size: .82rem; color: var(--muted); }

.node .spouse {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding-left: .7rem;
    margin-left: .3rem;
    border-left: 1px solid var(--line);
    font-size: .88rem;
    color: var(--ink-soft);
}

.node .spouse::before { content: "⚭"; color: var(--accent); font-size: 1rem; }

.toggle {
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--muted);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: .7rem;
    cursor: pointer;
    flex: none;
    padding: 0;
    line-height: 1;
}

.toggle:hover { border-color: var(--brand-light); color: var(--brand); }

.ancestors { display: flex; gap: 1.25rem; overflow-x: auto; padding-bottom: .5rem; }
.ancestor-col { display: flex; flex-direction: column; justify-content: space-around; gap: .5rem; min-width: 190px; }

.ancestor-cell {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: .5rem .7rem;
    font-size: .88rem;
    color: inherit;
    display: block;
}

.ancestor-cell:hover { text-decoration: none; border-color: var(--brand-light); }
.ancestor-cell.empty { opacity: .35; font-style: italic; }
.ancestor-cell .years { color: var(--muted); font-size: .8rem; }

/* Пустой слот, который можно заполнить */
.ancestor-cell-add {
    width: 100%;
    text-align: left;
    border-style: dashed;
    background: transparent;
    color: var(--brand);
    font-weight: 600;
    cursor: pointer;
}

.ancestor-cell-add:hover {
    background: #f2f7f4;
    border-color: var(--brand);
    border-style: solid;
}

.ancestor-cell-add .years { font-weight: 400; }

/* ---------- Формы Identity ---------- */

.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--paper); }

.auth-aside {
    background: linear-gradient(150deg, var(--brand-dark), var(--brand) 65%, #3d7a68);
    color: #fff;
    padding: 3.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.auth-aside h2 { color: #fff; font-size: 2.1rem; line-height: 1.2; }
.auth-aside p { color: rgba(255, 255, 255, .8); max-width: 28rem; }
.auth-aside .brand { color: #fff; }

/* Колонка, а не строка: под карточкой входа идёт подвал со ссылками на документы. */
.auth-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
}

.auth-card { width: 100%; max-width: 27rem; }
.auth-card h1 { font-size: 1.9rem; margin-bottom: .4rem; }
.auth-card .lead-sm { color: var(--muted); margin-bottom: 1.8rem; }
.auth-card .form-floating { margin-bottom: 1rem; }
.auth-links { margin-top: 1.5rem; display: grid; gap: .5rem; font-size: .92rem; }

/* ---------- Настройки профиля ---------- */

.manage-layout { display: grid; grid-template-columns: 240px 1fr; gap: 2rem; align-items: start; }

.manage-nav { display: grid; gap: .2rem; }

.manage-nav a { padding: .55rem .85rem; border-radius: var(--radius-sm); color: var(--ink-soft); font-weight: 600; font-size: .93rem; }
.manage-nav a:hover { background: var(--paper-2); text-decoration: none; }
.manage-nav a.active { background: var(--brand); color: #fff; }

/* ============================================================
   Лента событий
   ============================================================ */

.feed-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1.5rem;
    align-items: start;
}

.feed-main { display: grid; gap: 1.25rem; min-width: 0; }
.feed-side { position: sticky; top: 5rem; }

.feed-section {
    font-size: 1.15rem;
    margin: .5rem 0 -.25rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--line);
}

.event-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.4rem;
}

.event-head { display: flex; align-items: flex-start; gap: .8rem; margin-bottom: .75rem; }
.event-author { font-weight: 600; }
.event-meta { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-top: .2rem; }
.event-title { font-size: 1.25rem; margin: 0 0 .5rem; }

.event-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.65;
}

.event-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: .6rem;
    margin-top: 1rem;
}

.event-photos.single { grid-template-columns: minmax(0, 420px); }

.event-photo {
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: none;
    cursor: zoom-in;
    display: block;
}

.event-photo img { width: 100%; height: 190px; object-fit: cover; display: block; }
.event-photos.single .event-photo img { height: auto; max-height: 420px; object-fit: contain; background: var(--paper-2); }
.event-photo:hover { border-color: var(--brand-light); }

.event-comments { margin-top: 1.1rem; padding-top: .9rem; border-top: 1px solid var(--line); }

.comments-title {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: .7rem;
}

.comment { display: flex; gap: .6rem; padding: .5rem 0; }
.comment-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.comment-author { font-weight: 600; font-size: .92rem; }
.comment-date { color: var(--muted); font-size: .8rem; }
.comment-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .95rem; }

.comment-delete {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: .8rem;
    padding: 0 .2rem;
    line-height: 1;
}

.comment-delete:hover { color: var(--danger); }

.comment-form { margin-top: .75rem; }

/* ---------- Редактор сообщений ---------- */

.message-editor { position: relative; }
.message-editor textarea { resize: vertical; }

.editor-bar { display: flex; align-items: center; gap: .5rem; margin-top: .4rem; }

.emoji-toggle {
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .2rem .7rem;
    font-size: .85rem;
    color: var(--ink-soft);
    cursor: pointer;
}

.emoji-toggle:hover { border-color: var(--brand-light); color: var(--brand-dark); }
.editor-counter { margin-left: auto; font-size: .78rem; color: var(--muted); }
.editor-counter.is-low { color: var(--danger); }

.emoji-picker {
    margin-top: .5rem;
    padding: .75rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    max-height: 260px;
    overflow-y: auto;
}

.emoji-group + .emoji-group { margin-top: .6rem; }

.emoji-group-title {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: .3rem;
}

.emoji-row { display: flex; flex-wrap: wrap; gap: .15rem; }

.emoji {
    background: none;
    border: none;
    border-radius: 8px;
    font-size: 1.3rem;
    line-height: 1;
    padding: .25rem;
    cursor: pointer;
}

.emoji:hover { background: var(--paper-2); }

/* ---------- Форма события ---------- */

.composer-previews { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .7rem; }

.composer-preview { position: relative; width: 110px; height: 110px; }

.composer-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
}

.composer-preview button {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--danger);
    cursor: pointer;
    line-height: 1;
    font-size: .75rem;
    padding: 0;
}

/* ---------- Просмотр снимка ---------- */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(20, 22, 20, .88);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    cursor: zoom-out;
    outline: none;
}

.lightbox-figure {
    margin: 0;
    max-width: min(1100px, 100%);
    max-height: 100%;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    cursor: default;
}

.lightbox-figure img {
    max-width: 100%;
    max-height: calc(100vh - 9rem);
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: #000;
}

.lightbox-figure figcaption {
    color: rgba(255, 255, 255, .8);
    font-size: .9rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.lightbox-figure .counter { color: rgba(255, 255, 255, .55); }

.lightbox-close,
.lightbox-nav {
    position: absolute;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .25);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.lightbox-close { top: 1.2rem; right: 1.2rem; width: 40px; height: 40px; font-size: 1rem; }
.lightbox-nav { top: 50%; transform: translateY(-50%); width: 46px; height: 46px; font-size: 1.8rem; line-height: 1; }
.lightbox-nav.prev { left: 1.2rem; }
.lightbox-nav.next { right: 1.2rem; }
.lightbox-close:hover, .lightbox-nav:hover { background: rgba(255, 255, 255, .25); }

.zoomable { cursor: zoom-in; border: none; background: none; padding: 0; }

/* ---------- Разметка текста ---------- */

.markdown-body { line-height: 1.65; overflow-wrap: anywhere; }
.markdown-body > :first-child { margin-top: 0; }
.markdown-body > :last-child { margin-bottom: 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { font-size: 1.15rem; margin: 1.1rem 0 .5rem; }
.markdown-body p { margin: 0 0 .8rem; }
.markdown-body ul, .markdown-body ol { margin: 0 0 .8rem; padding-left: 1.4rem; }
.markdown-body li { margin-bottom: .25rem; }

.markdown-body blockquote {
    margin: 0 0 .8rem;
    padding: .4rem 0 .4rem 1rem;
    border-left: 3px solid var(--accent-light);
    color: var(--ink-soft);
}

.markdown-body code {
    background: var(--paper-2);
    padding: .1rem .35rem;
    border-radius: 5px;
    font-size: .9em;
}

.markdown-body table { border-collapse: collapse; margin-bottom: .8rem; }
.markdown-body th, .markdown-body td { border: 1px solid var(--line); padding: .35rem .6rem; }
.markdown-body img { max-width: 100%; height: auto; }

.editor-tools { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: .4rem; }

.editor-tools button {
    min-width: 34px;
    height: 30px;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 7px;
    color: var(--ink-soft);
    cursor: pointer;
    font-size: .9rem;
    padding: 0 .4rem;
}

.editor-tools button:hover { border-color: var(--brand-light); color: var(--brand-dark); }

.editor-preview {
    border: 1px dashed var(--line);
    border-radius: var(--radius-sm);
    padding: .8rem 1rem;
    background: var(--paper);
    min-height: 6rem;
}

.editor-help { font-size: .8rem; color: var(--muted); margin: .4rem 0 0; }
.editor-help code { background: var(--paper-2); padding: 0 .25rem; border-radius: 4px; }

/* ---------- Выбор человека поиском ---------- */

.person-picker { position: relative; }

.picker-chosen {
    display: flex;
    align-items: center;
    gap: .5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: .4rem .6rem;
    background: var(--surface);
}

.picker-chosen .name { font-weight: 600; }
.picker-chosen .years { color: var(--muted); font-size: .85rem; }

.picker-clear {
    margin-left: auto;
    border: none;
    background: none;
    color: var(--muted);
    cursor: pointer;
    font-size: .85rem;
}

.picker-clear:hover { color: var(--danger); }

.picker-results {
    margin-top: .35rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow);
    max-height: 260px;
    overflow-y: auto;
}

.picker-item {
    display: flex;
    align-items: center;
    gap: .55rem;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-bottom: 1px solid var(--line);
    padding: .45rem .6rem;
    cursor: pointer;
    font-size: .93rem;
}

.picker-item:last-child { border-bottom: none; }
.picker-item:hover { background: var(--paper-2); }
.picker-item .name { font-weight: 600; }
.picker-item .years { color: var(--muted); font-size: .85rem; }

.picker-empty, .picker-hint { padding: .5rem .6rem; color: var(--muted); font-size: .85rem; }
.picker-hint { padding-left: 0; }

/* ---------- Граф родословной ---------- */

.graph-scroll {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: auto;
    max-height: 75vh;
    padding: 1rem;
    -webkit-overflow-scrolling: touch;
}

/* Холст графа шире экрана намеренно — его прокручивают, а не ужимают. */
/* Ширину холста задаёт разметка: либо натуральный размер с прокруткой вбок,
   либо «вместить» — тогда 100% ширины контейнера. Узкая ветвь в любом случае
   растягивается на всю ширину, чтобы не жаться к левому краю. */
/* max-width: none обязателен: общее правило svg { max-width: 100% } иначе
   ужимает холст обратно в ширину контейнера, и заданный размер не работает. */
.graph-canvas { display: block; height: auto; min-width: 100%; max-width: none; }

.graph-node { cursor: pointer; }
.graph-node rect { transition: filter .15s ease, stroke .15s ease; }
.graph-node:hover rect { filter: brightness(.965); stroke: var(--brand-light); }
.graph-node:focus { outline: none; }
.graph-node:focus rect { stroke: var(--accent); stroke-width: 2.5; }
.graph-node.is-focus rect { filter: drop-shadow(0 2px 6px rgba(31, 35, 32, .18)); }

.graph-surname { font-size: 14px; font-weight: 700; fill: #1d3c33; font-family: Georgia, serif; }
.graph-name { font-size: 12.5px; fill: #1f2320; font-family: inherit; }
.graph-years { font-size: 11px; fill: #837b6f; font-family: inherit; }

/* Панель управления ветвью: слева — кто в центре, справа — переход к другому человеку. */
.graph-bar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto minmax(200px, 260px);
    gap: 1rem 1.25rem;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: .9rem 1.1rem;
    margin-bottom: .75rem;
}

.graph-focus { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; min-width: 0; }
.graph-focus strong { font-family: var(--serif); font-size: 1.05rem; color: var(--brand-dark); }

.graph-focus-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--muted);
    font-weight: 600;
}

.graph-controls { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }

.graph-range { display: flex; align-items: center; gap: .45rem; font-size: .88rem; color: var(--muted); }
.graph-range input[type="range"] { width: 92px; accent-color: var(--brand); }
.graph-range b { color: var(--ink); min-width: .8rem; text-align: center; }

/* Легенда: без неё цвета и типы линий приходится угадывать. */
.graph-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem 1.25rem;
    align-items: center;
    font-size: .85rem;
    color: var(--ink-soft);
    margin-bottom: .75rem;
    padding: 0 .25rem;
}

.graph-legend .dot { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: .35rem; }
.graph-legend .dot-male { background: #eef4f1; border: 1px solid #bcd2c9; }
.graph-legend .dot-female { background: #faf1ec; border: 1px solid #e3cabb; }

.graph-legend .line { display: inline-block; width: 20px; height: 0; margin-right: .35rem; vertical-align: middle; }
.graph-legend .line-parent { border-top: 2px solid #c6bba6; }
.graph-legend .line-marriage { border-top: 2px dashed #c9a468; }

.zoom-controls { display: flex; align-items: center; gap: .35rem; }
.zoom-value { font-size: .85rem; color: var(--muted); min-width: 3.2rem; text-align: center; }

/* ---------- Браки ---------- */

.marriage-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }

.marriage-item {
    border: 1px solid var(--line);
    border-left: 3px solid var(--line);
    border-radius: var(--radius-sm);
    padding: .7rem .9rem;
    background: var(--paper);
}

.marriage-item.is-active { border-left-color: var(--brand); background: #f6faf8; }

.marriage-main { display: flex; align-items: flex-start; gap: 1rem; }
.marriage-main > div:first-child { flex: 1; min-width: 0; }
.marriage-partner { font-weight: 600; }
.marriage-meta { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-top: .25rem; font-size: .88rem; }

.marriage-form {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px dashed var(--line);
    border-radius: var(--radius-sm);
    background: var(--paper);
}

/* ---------- Журнал ---------- */

.audit-details { color: var(--ink-soft); font-size: .88rem; max-width: 34rem; overflow-wrap: anywhere; }

/* ---------- Служебное ---------- */

.empty-state { text-align: center; padding: 3.5rem 1.5rem; color: var(--muted); }
.empty-state h3 { color: var(--ink-soft); }

#blazor-error-ui {
    color: #fff;
    background: var(--danger);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
    display: none;
    left: 0;
    padding: .8rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 1rem; top: .75rem; }
#blazor-error-ui a { color: #fff; text-decoration: underline; }

.loading-dots { color: var(--muted); font-style: italic; }

/* ============================================================
   Адаптив
   ============================================================ */

/* Ничто не должно расталкивать страницу вширь. */
html, body { max-width: 100%; overflow-x: hidden; }
img, svg, video { max-width: 100%; }

@media (max-width: 1100px) {
    .feed-layout { grid-template-columns: 1fr; }
    .feed-side { position: static; }
}

@media (max-width: 1024px) {
    .hero-inner { grid-template-columns: 1fr; }
    .hero-art { order: -1; }
    .feature-grid { grid-template-columns: 1fr 1fr; }
    .stats-inner { grid-template-columns: repeat(3, 1fr); row-gap: 1.75rem; }
    .auth-page { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .manage-layout { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
    .app-header .inner { flex-wrap: wrap; gap: .6rem 1rem; padding: .6rem 1rem; }
    .app-nav { order: 3; width: 100%; margin-left: 0; padding-bottom: .2rem; }
    .app-user { margin-left: auto; }
    .app-body { padding: 1.25rem 1rem 3rem; }

    .page-title { gap: .6rem; }
    .page-title h1 { font-size: 1.5rem; }
    .page-title .spacer { display: none; }

    .panel { padding: 1.1rem; }
    .person-hero { padding: 1.1rem; gap: 1rem; }
    .person-hero h1 { font-size: 1.5rem; }
    .person-hero > div { min-width: 0 !important; }

    .facts { grid-template-columns: 1fr; gap: .8rem; }
    .relations-grid { grid-template-columns: 1fr; }
    .people-grid { grid-template-columns: 1fr; }

    /* Панели инструментов на узком экране — в столбик, иначе поля наезжают друг на друга. */
    .tree-toolbar { flex-direction: column; align-items: stretch; }
    .tree-toolbar > * { max-width: none !important; width: 100%; }
    .tree-toolbar .zoom-controls { width: auto; justify-content: space-between; }

    .tree-scroll { padding: 1rem .75rem; }
    .tree ul { margin-left: .8rem; padding-left: .8rem; }
    .tree li::before { left: -.8rem; width: .7rem; }
    .node { border-radius: var(--radius-sm); padding: .4rem .6rem; }
    .node .spouse { border-left: none; padding-left: 0; margin-left: 0; width: 100%; }

    .event-photos { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
    .event-photo img { height: 130px; }
    .event-card { padding: 1rem; }

    .gallery { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
    .gallery img { height: 110px; }

    .avatar-lg { width: 92px; height: 92px; font-size: 1.7rem; }

    .lightbox { padding: 3.5rem .75rem 2rem; }
    .lightbox-nav { width: 38px; height: 38px; font-size: 1.4rem; }
    .lightbox-nav.prev { left: .4rem; }
    .lightbox-nav.next { right: .4rem; }
    .lightbox-close { top: .6rem; right: .6rem; width: 34px; height: 34px; }

    .emoji-picker { max-height: 200px; }
    .composer-preview { width: 88px; height: 88px; }
}

@media (max-width: 900px) {
    .landing-nav { display: none; }
}

@media (max-width: 680px) {
    .feature-grid { grid-template-columns: 1fr; }
    .stats-inner { grid-template-columns: repeat(2, 1fr); }
    .section { padding: 3rem 1.15rem; }
    .hero { padding: 3rem 1.15rem 2.5rem; }
    .cta-band { padding: 2.5rem 1.25rem; }
    .landing-header .inner { padding: .7rem 1rem; gap: .75rem; }
    .brand { font-size: 1.05rem; }

    .auth-main { padding: 2rem 1rem; }
    .manage-nav { display: flex; overflow-x: auto; gap: .3rem; padding-bottom: .3rem; }
    .manage-nav a { white-space: nowrap; }
}

@media (max-width: 420px) {
    .landing-actions .btn { padding: .45rem .8rem; font-size: .85rem; }
    .stats-inner { grid-template-columns: 1fr 1fr; padding: 1.5rem 1rem; }
    .stat-value { font-size: 1.8rem; }
    .app-user .name { display: none; }
}

/* ---------- Семейный архив ---------- */

.notice {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: .85rem 1rem;
    margin-bottom: 1.25rem;
    font-size: .93rem;
    line-height: 1.55;
}

.notice-warn { background: #fdf6e8; border-color: var(--accent-light); color: #7a5716; }
.notice-info { background: #eef4f2; border-color: #cfe0d9; color: #1d3c33; }

/* Полоса расхода тарифа: тонкая, без цифр внутри — цифры стоят рядом. */
.quota { display: grid; gap: 1rem; }
.quota-row { display: grid; gap: .35rem; }

.quota-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    font-size: .9rem;
}

.quota-head .quota-value { color: var(--muted); white-space: nowrap; }

.quota-bar {
    height: 8px;
    border-radius: 999px;
    background: #ece5d9;
    overflow: hidden;
}

.quota-fill { height: 100%; background: var(--brand); border-radius: 999px; }
.quota-fill.warn { background: var(--accent); }
.quota-fill.over { background: var(--danger); }

/* Ссылка-приглашение: длинная, должна переноситься, а не рвать вёрстку. */
.invite-link {
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: .82rem;
    word-break: break-all;
    background: var(--surface-2, #f7f3ec);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: .6rem .75rem;
    margin-top: .5rem;
}

.archive-switch { display: grid; gap: .5rem; }

.archive-switch button {
    text-align: left;
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
}

/* Строка формы: поля рядом, на узком экране — друг под другом.
   Кнопку выравниваем по середине поля: поле с плавающей подписью выше кнопки,
   и при выравнивании по верху кнопка зрительно липнет к заголовку панели. */
.form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .85rem;
}

/* Когда строка переносится, кнопка уезжает на свою строку — добавляем воздуха. */
@media (max-width: 560px) {
    .form-row > .btn { margin-top: .25rem; }
}

/* Переключатель архивов в шапке. */
.archive-name {
    color: rgba(255, 255, 255, .72);
    font-size: .85rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.archive-picker { position: relative; }

.archive-picker > summary {
    list-style: none;
    cursor: pointer;
    color: rgba(255, 255, 255, .82);
    font-size: .85rem;
    padding: .25rem .5rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, .2);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.archive-picker > summary::-webkit-details-marker { display: none; }
.archive-picker[open] > summary { background: rgba(255, 255, 255, .12); }

.archive-picker > .archive-switch {
    position: absolute;
    right: 0;
    top: calc(100% + .4rem);
    z-index: 40;
    min-width: 240px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: .4rem;
}

@media (max-width: 720px) {
    .archive-name, .archive-picker > summary { max-width: 120px; }
    .archive-picker > .archive-switch { position: fixed; left: .75rem; right: .75rem; min-width: 0; }
}

/* ---------- Подвал ---------- */

/* Подвал того же цвета, что и шапка: страница получает внятную рамку сверху и снизу,
   а правовые ссылки перестают теряться на общем светлом фоне.

   margin-top: auto — чтобы на короткой странице подвал прижимался к низу окна,
   а не висел сразу под текстом. Фиксированный отступ добавлял высоту сверх 100vh
   и уводил подвал за пределы экрана даже там, где места было в избытке. */
.site-footer { background: var(--brand-dark); color: rgba(255, 255, 255, .72); margin-top: auto; }

/* Лендинг — обычный поток, а не колонка на всю высоту: здесь отступ задаём явно. */
.landing .site-footer { margin-top: 4rem; }

.site-footer .inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 1.75rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
    justify-content: space-between;
    align-items: center;
    font-size: .88rem;
}

.site-footer .text-muted-2 { color: rgba(255, 255, 255, .5); }

.site-footer-links { display: flex; flex-wrap: wrap; gap: 1.25rem; }

.site-footer-links a {
    color: rgba(255, 255, 255, .8);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.site-footer-links a:hover { color: #fff; border-bottom-color: var(--brand-light); }

/* ---------- Правовые документы ---------- */

.legal {
    max-width: 46rem;
    margin: 0 auto;
    padding: 1rem 0 3rem;
    line-height: 1.7;
}

.legal h1 { font-size: 1.9rem; margin: 0 0 .35rem; }
.legal h2 { font-size: 1.22rem; margin: 2.2rem 0 .7rem; }
.legal h3 { font-size: 1.02rem; margin: 1.4rem 0 .5rem; color: var(--brand-dark); }
.legal p { margin: 0 0 .9rem; }
.legal ul, .legal ol { margin: 0 0 1rem; padding-left: 1.4rem; }
.legal li { margin-bottom: .4rem; }
.legal code { font-size: .88em; background: var(--paper-2); padding: .1rem .35rem; border-radius: 4px; }

.legal-meta { color: var(--muted); font-size: .88rem; margin-bottom: 1.5rem; }

/* Реквизиты: подпись слева, значение справа, на узком экране — в столбик. */
.legal-facts {
    display: grid;
    grid-template-columns: minmax(9rem, auto) 1fr;
    gap: .45rem 1.5rem;
    margin: 0 0 1rem;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}

.legal-facts dt { color: var(--muted); font-size: .87rem; }
.legal-facts dd { margin: 0; }

.legal-steps > li { margin-bottom: .9rem; }

.legal-form { display: grid; gap: 1rem; max-width: 34rem; margin-top: 1.25rem; }

@media (max-width: 560px) {
    .legal-facts { grid-template-columns: 1fr; gap: .1rem; }
    .legal-facts dd { margin-bottom: .65rem; }
}

/* Согласия при регистрации: отметка слева, текст в одну колонку рядом. */
.consents { display: grid; gap: .75rem; margin: 1.25rem 0 1.5rem; }

.consent {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .6rem;
    align-items: start;
    font-size: .9rem;
    line-height: 1.5;
    cursor: pointer;
}

.consent input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    margin-top: .15rem;
    accent-color: var(--brand);
    cursor: pointer;
}

/* ---------- Скрытый по жалобе материал ---------- */

.blocked-note {
    background: #f7f3ec;
    border: 1px dashed #ddd3c2;
    border-radius: var(--radius-sm);
    padding: .8rem 1rem;
    color: var(--muted);
    font-size: .9rem;
    line-height: 1.55;
    margin: .5rem 0 1rem;
}

.blocked-note.blocked-inline { padding: .5rem .75rem; margin: .25rem 0; font-size: .87rem; }

.event-actions { display: flex; justify-content: flex-end; margin: .25rem 0 .5rem; }

.report-link {
    color: var(--muted);
    font-size: .8rem;
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.report-link:hover { color: var(--danger); border-bottom-color: currentColor; }

/* ---------- Разбор жалоб ---------- */

.reports { display: grid; gap: 1.25rem; }

.report-head {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    align-items: center;
    justify-content: space-between;
}

.report-head .chip + .chip { margin-left: .35rem; }

.report-details {
    white-space: pre-wrap;
    border-left: 3px solid var(--line);
    padding-left: .9rem;
    margin: 1rem 0;
    line-height: 1.6;
}

.report-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.check-inline { display: inline-flex; align-items: center; gap: .45rem; font-size: .9rem; color: var(--muted); }
.check-inline input { accent-color: var(--brand); width: 1rem; height: 1rem; }

.form-control-sm { padding: .4rem .6rem; font-size: .9rem; }

/* Жалоба в просмотрщике снимков — на тёмном фоне. */
.lightbox-figure .report-link { color: rgba(255, 255, 255, .55); }
.lightbox-figure .report-link:hover { color: #fff; }

/* На странице входа подвал не тянется во всю ширину — он идёт отдельной плашкой
   под карточкой, шириной с неё. */
.site-footer-compact {
    margin-top: 1.5rem;
    width: 100%;
    max-width: 27rem;
    border-radius: var(--radius);
}

.site-footer-compact .inner {
    padding: 1rem 1.25rem;
    justify-content: center;
    text-align: center;
    font-size: .82rem;
    gap: .5rem 1.25rem;
}

.site-footer-compact .site-footer-links { gap: 1rem; justify-content: center; }

/* Переименование архива отделяем от сведений ниже: иначе поле и первый факт
   зрительно слипаются в один блок. */
.archive-rename { margin-bottom: 1.75rem; }

/* Приписка под кнопками первого экрана: условие пробного периода. */
.hero-note { margin: 1rem 0 0; color: var(--muted); font-size: .88rem; }

/* Правовая приписка в нижнем призыве — светлая, на тёмном фоне полосы. */
.cta-note {
    margin: 1.25rem auto 0;
    max-width: 34rem;
    font-size: .82rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, .6);
}

.cta-note a { color: rgba(255, 255, 255, .85); border-bottom: 1px solid rgba(255, 255, 255, .35); }
.cta-note a:hover { color: #fff; text-decoration: none; }

@media (max-width: 900px) {
    .graph-bar { grid-template-columns: 1fr; }
    .graph-controls { justify-content: space-between; }
}

/* Заголовок подраздела внутри раздела архива: сам раздел уже озаглавлен макетом. */
.section-title { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.25rem; }
.section-title .panel-title { border: none; padding: 0; }

/* Пункт меню с названием архива: тот же вид, что у остальных, плюс значок и
   ограничение по ширине — названия семей бывают длинными. */
.app-nav .archive-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: rgba(255, 255, 255, .78);
    padding: .4rem .9rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: .93rem;
    white-space: nowrap;
}

.app-nav .archive-link span {
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-nav .archive-link:hover { color: #fff; background: rgba(255, 255, 255, .1); text-decoration: none; }
.app-nav .archive-link.active { color: var(--brand-dark); background: var(--accent-light); }

/* Сводка под боковым меню раздела архива. */
.archive-aside-usage {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .85rem;
    line-height: 1.6;
}

.archive-aside-name { font-family: var(--serif); color: var(--brand-dark); font-size: .95rem; margin-bottom: .3rem; }

/* Пояснение под полем формы. */
.field-hint {
    color: var(--muted);
    font-size: .86rem;
    line-height: 1.55;
    margin: -.5rem 0 1.1rem;
}

/* Девичья фамилия в узле графа: тише и мельче основной — это уточнение, а не имя. */
.graph-maiden { font-size: 11.5px; font-weight: 400; fill: #7a7264; }
