:root {
    --app-bg: #f3f6fb;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --surface-border: #d9e2ec;
    --text-main: #122033;
    --text-soft: #5b6b7f;
    --primary: #295d95;
    --primary-hover: #214c79;
    --primary-soft: #eaf2fb;
    --success-soft: #e8f6ee;
    --success-text: #1f6b43;
    --warning-soft: #fff0e5;
    --warning-text: #a55b1a;
    --danger-text: #b42318;
    --shadow-soft: 0 14px 40px rgba(15, 23, 42, 0.08);
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

html {
    background: var(--app-bg);
}

body {
    background:
        radial-gradient(circle at top left, rgba(41, 93, 149, 0.08), transparent 30%),
        linear-gradient(180deg, #f6f9fc 0%, #eef3f8 100%);
    color: var(--text-main);
    min-height: 100vh;
}

body,
input,
select,
textarea,
button {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: var(--primary);
    text-decoration: none;
}

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

h1,
h2,
h3 {
    color: #102034;
    letter-spacing: -0.02em;
}

h1 {
    margin-bottom: 0.45rem;
    font-size: 2rem;
}

h2 {
    margin-bottom: 0.65rem;
    font-size: 1.25rem;
}

p,
li,
td,
th,
label,
small {
    color: var(--text-soft);
}

.app-shell {
    padding: 2rem 0 3rem;
}

.auth-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}

.container {
    max-width: 1240px;
}

.topbar {
    position: sticky;
    top: 1rem;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem 1.25rem;
    border: 1px solid rgba(217, 226, 236, 0.95);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(14px);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.brand-block {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.brand-title {
    color: var(--text-main);
    font-weight: 700;
    font-size: 1rem;
}

.brand-subtitle {
    color: var(--text-soft);
    font-size: 0.85rem;
}

.topnav-links,
.topnav-links ul,
.topnav-links li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-link,
.link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0.65rem 0.95rem;
    border-radius: 999px;
    color: var(--text-soft);
    font-weight: 600;
    transition: 0.2s ease;
}

.nav-link:hover,
.link-button:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.page-shell {
    display: grid;
    gap: 1.5rem;
}

.page-header,
.section-actions,
.card-head,
.button-row,
.actions {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.page-intro {
    padding: 1.75rem;
    border: 1px solid rgba(217, 226, 236, 0.95);
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.96));
    box-shadow: var(--shadow-soft);
}

.page-intro p:last-child,
.content-card p:last-child {
    margin-bottom: 0;
}

.content-card,
.filters,
.login-card,
.stats-card,
.info-list,
.table-card,
.form-card,
.empty-card {
    border: 1px solid rgba(217, 226, 236, 0.95);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.content-card,
.table-card,
.form-card,
.empty-card,
.filters,
.login-card {
    padding: 1.5rem;
}

.content-card-muted {
    background: linear-gradient(180deg, #fff, var(--surface-muted));
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
}

.stats-card {
    padding: 1.25rem;
}

.stats-card h2 {
    margin: 0 0 0.4rem;
    color: var(--primary);
    font-size: 2rem;
}

.stats-card p {
    margin: 0;
    line-height: 1.4;
}

.grid-two {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.5rem;
}

.detail-item strong,
.detail-key {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 700;
}

.detail-item p {
    margin-bottom: 0;
}

.notes-block {
    margin-top: 1rem;
}

.section-title {
    margin-bottom: 0;
}

.filters .grid {
    margin-bottom: 1rem;
}

label {
    color: var(--text-main);
    font-size: 0.92rem;
    font-weight: 600;
}

input,
select,
textarea {
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-sm);
    background: #fbfdff;
    box-shadow: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(41, 93, 149, 0.5);
    box-shadow: 0 0 0 0.2rem rgba(41, 93, 149, 0.12);
    background: #fff;
}

form p {
    margin-bottom: 1rem;
}

form p label {
    display: block;
    margin-bottom: 0.35rem;
}

form p input,
form p select,
form p textarea {
    width: 100%;
}

button,
[role="button"],
button.secondary,
a.secondary[role="button"] {
    border-radius: 12px;
    font-weight: 700;
}

button,
[role="button"]:not(.secondary):not(.contrast),
button[type="submit"] {
    background: linear-gradient(180deg, #326ca9, #295d95);
    border: none;
    color: #fff;
}

button:hover,
[role="button"]:not(.secondary):not(.contrast):hover,
button[type="submit"]:hover {
    background: linear-gradient(180deg, #295d95, #214c79);
}

.secondary,
a.secondary[role="button"],
button.secondary {
    background: #eef3f8;
    border: 1px solid var(--surface-border);
    color: var(--text-main);
}

.secondary:hover,
a.secondary[role="button"]:hover,
button.secondary:hover {
    background: #e4ebf3;
}

.contrast {
    background: #fff1ef;
    border: 1px solid #f5c5bf;
    color: var(--danger-text);
}

table {
    width: 100%;
    margin-bottom: 0;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #fff;
}

thead th {
    padding: 0.95rem 1rem;
    background: #f6f9fc;
    color: var(--text-main);
    font-size: 0.84rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--surface-border);
}

tbody td {
    padding: 1rem;
    vertical-align: top;
    border-bottom: 1px solid #e7edf4;
    color: var(--text-main);
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover td {
    background: #f9fbfd;
}

.row-alert td {
    background: #fff8f3;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    margin-right: 0.35rem;
    margin-bottom: 0.35rem;
    border: 1px solid #d8e4f0;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 700;
}

.tag-alert {
    background: var(--warning-soft);
    border-color: #f3d3b7;
    color: var(--warning-text);
}

.adult-card {
    border: 1px solid #efc98a;
    background: linear-gradient(180deg, #fff, #fff9f0);
}

.warning-text {
    color: var(--warning-text);
    font-weight: 700;
}

.ok-text {
    color: var(--success-text);
    font-weight: 700;
}

.muted-text {
    color: var(--text-soft);
}

.message {
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid #dbe8f4;
    border-radius: var(--radius-md);
    background: #f4f9ff;
    color: var(--text-main);
}

.child-photo {
    width: 100%;
    max-width: 220px;
    display: block;
    margin: 0.9rem 0;
    border: 1px solid var(--surface-border);
    border-radius: 16px;
}

.login-card {
    width: min(480px, 100%);
    padding: 2rem;
}

.login-card h1 {
    margin-bottom: 0.35rem;
}

.login-card .muted-text {
    margin-bottom: 1.5rem;
}

.link-button {
    background: none;
    border: none;
    margin: 0;
    padding: 0.65rem 0.95rem;
}

.danger-link {
    color: var(--danger-text);
    font-weight: 700;
}

.list-clean {
    list-style: none;
    margin: 0;
    padding: 0;
}

.list-clean li {
    padding: 0.85rem 0;
    border-bottom: 1px solid #e7edf4;
}

.list-clean li:last-child {
    border-bottom: none;
}

.inline-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
}

.line-form-card {
    padding: 1rem;
    border: 1px solid #e3eaf2;
    border-radius: var(--radius-md);
    background: #f9fbfe;
}

.login-wrap {
    width: min(540px, 100%);
}

@media (max-width: 900px) {
    .topbar {
        border-radius: 24px;
    }

    .grid-two,
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .app-shell {
        padding-top: 1rem;
    }

    .topbar {
        position: static;
        align-items: flex-start;
        border-radius: 22px;
    }

    .topnav-links {
        width: 100%;
    }

    .topnav-links ul {
        flex-wrap: wrap;
    }

    h1 {
        font-size: 1.6rem;
    }

    .page-intro,
    .content-card,
    .table-card,
    .form-card,
    .empty-card,
    .filters,
    .login-card {
        padding: 1.15rem;
    }

    table,
    thead,
    tbody,
    tr,
    td,
    th {
        display: block;
    }

    thead {
        display: none;
    }

    tbody tr {
        border-bottom: 1px solid #e7edf4;
    }

    tbody td {
        padding: 0.7rem 0;
        border: none;
    }
}
