
:root {
    --navy: #1d3860;
    --navy-light: #2d4a75;
    --accent: #8b9fbe;
    --accent-hover: #6a7fa0;
    --page-bg: #f8f9fa;
    --text: #333;
    --muted: #666;
    --border: #cfd4dc;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--page-bg);
    color: var(--text);
    line-height: 1.6;
}

a { color: var(--navy); }

/* ===== Header / nav ===== */
header.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .1);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.9rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    flex-direction: column;
    color: white;
    text-decoration: none;
    font-weight: 600;
    line-height: 1.25;
}
.logo .logo-line1 { font-size: 0.85rem; opacity: 0.85; }
.logo .logo-line2 { font-size: 1.2rem; }

nav.main-nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
}
nav.main-nav a, nav.main-nav button.nav-link {
    display: inline-block;
    color: white;
    text-decoration: none;
    padding: 0.55rem 1rem;
    border-radius: 5px;
    font: inherit;
    font-size: 0.95rem;
    background: none;
    border: none;
    cursor: pointer;
}
nav.main-nav a:hover, nav.main-nav button.nav-link:hover {
    color: var(--accent);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.6rem;
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
}

@media (max-width: 768px) {
    nav.main-nav ul { display: none; }
    .mobile-menu-btn { display: block; }

    nav.main-nav.open ul {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: 0;
        width: 80%;
        max-width: 300px;
        height: 100%;
        background: var(--navy);
        padding: 1rem;
        align-items: flex-start;
        gap: 0;
        box-shadow: -2px 0 10px rgba(0,0,0,.2);
    }
    nav.main-nav.open a, nav.main-nav.open button.nav-link {
        width: 100%;
        padding: 0.9rem 0.5rem;
        border-bottom: 1px solid rgba(255,255,255,.1);
        border-radius: 0;
    }
}

/* ===== Page layout ===== */
.container {
    max-width: 1100px;
    margin: 20px auto;
    padding: 0 18px 50px;
}

h1 { margin-bottom: 5px; color: var(--navy); }
h2 { margin-top: 0; font-size: 20px; color: var(--navy); }
h3 { margin: 0 0 10px; color: var(--navy); }
.intro { color: var(--muted); margin-top: 0; }

section {
    background: white;
    padding: 22px;
    margin: 18px 0;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, .1);
    text-align: left;
}

section > h2, section > p, section > label, .question, .signature-section {
    text-align: left;
}

/* ===== Forms ===== */
.grid {
    display: grid;
    gap: 14px;
    margin-bottom: 14px;
}
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: 1fr 1fr 1fr; }
[hidden] { display: none !important; }

label {
    display: block;
    font-size: 14px;
    font-weight: 600;
}
input, textarea, select {
    display: block;
    width: 100%;
    margin-top: 5px;
    padding: 10px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font: inherit;
    font-weight: 400;
}
textarea { min-height: 75px; resize: vertical; }

label.inline-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}
label.inline-check input { width: auto; margin: 0; }

.question {
    border-top: 1px solid #ddd;
    padding: 14px 0;
}
.question.two-col {
    display: grid;
    grid-template-columns: 46% 54%;
    gap: 14px;
    align-items: start;
    padding: 10px 0;
    border-top: 1px solid #ddd;
}
.question-left, .question-right { min-width: 0; text-align: left; }
.question-right .conditional { margin-top: 0; }
.question-right label { font-weight: 500; }
.question-right textarea { min-height: 42px; margin-top: 6px; }
.simple-question { padding: 10px 0; }
.question-note { margin-left: 18px; font-size: 14px; font-weight: 400; }

.radios { display: flex; gap: 20px; margin-top: 8px; }
.radios label { font-weight: 400; }
.radios input { display: inline-block; width: auto; margin-right: 5px; }
.conditional { display: none; margin-top: 10px; }
.conditional.show { display: block; }

/* ===== Signatures ===== */
.signature-row {
    display: grid;
    grid-template-columns: minmax(0, 700px) 150px;
    gap: 24px;
    align-items: start;
    margin: 18px 0;
}
.signature-left { width: 100%; text-align: left; }
.signature-left canvas {
    display: block;
    width: 100%;
    max-width: 700px;
    height: 120px;
    margin: 6px 0 0;
    background: #fff;
    border: 1px solid #777;
    border-radius: 5px;
    touch-action: none;
}
.signature-date { padding-top: 0; text-align: left; }
.signature-date input { width: 100%; }
.signature-actions { margin-top: 5px; }

/* ===== Buttons ===== */
button, .btn {
    border: 0;
    border-radius: 5px;
    padding: 0.65rem 1.3rem;
    cursor: pointer;
    font: inherit;
    font-size: 0.95rem;
    text-decoration: none;
    display: inline-block;
    background: var(--accent);
    color: white;
    transition: background 0.2s;
}
button:hover, .btn:hover { background: var(--accent-hover); }

.btn-primary {
    background: var(--navy);
}
.btn-primary:hover { background: var(--navy-light); }

.btn-danger { background: #b3413c; }
.btn-danger:hover { background: #932e2a; }

.btn-secondary {
    background: white;
    color: var(--navy);
    border: 1.5px solid var(--navy);
}
.btn-secondary:hover { background: var(--page-bg); }

.submit {
    width: 100%;
    padding: 14px;
    font-size: 17px;
    font-weight: bold;
    background: var(--navy);
    color: white;
}
.submit:hover { background: var(--navy-light); }

.actions-row {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

/* ===== Cards / lists ===== */
.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, .1);
    padding: 1.5rem;
}

.auth-card {
    max-width: 420px;
    margin: 60px auto;
}
.auth-card h1 { text-align: center; }

.children-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    margin: 1.25rem 0;
}
.child-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, .1);
    padding: 1.25rem;
    transition: transform 0.2s, box-shadow 0.2s;
}
.child-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, .15);
}
.child-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}
.child-card h3 { margin: 0; }
.child-card .age-badge {
    background: var(--page-bg);
    color: var(--navy);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    white-space: nowrap;
}
.child-card .dob { color: var(--muted); font-size: 0.9rem; margin: 0.3rem 0 1rem; }
.child-card .child-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.child-card .child-actions form { display: inline; }
.child-card .child-actions .btn, .child-card .child-actions button {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}
.child-card label.select-child {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.child-card label.select-child input { width: auto; margin: 0; }

.empty-state {
    text-align: center;
    color: var(--muted);
    padding: 3rem 1rem;
}

/* ===== Tables (admin) ===== */
table.data-table {
    width: 100%;
    border-collapse: collapse;
}
table.data-table th, table.data-table td {
    text-align: left;
    padding: 0.7rem 0.6rem;
    border-bottom: 1px solid #eee;
}
table.data-table th {
    color: var(--navy);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.badge {
    display: inline-block;
    background: var(--navy);
    color: white;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
}
.inline-form { display: inline; }
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.25rem;
    margin: 1.25rem 0;
}
.stat-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, .1);
    padding: 1.5rem;
    text-align: center;
}
.stat-card .stat-value { font-size: 2.2rem; font-weight: 700; color: var(--navy); }
.stat-card .stat-label { color: var(--muted); font-size: 0.9rem; }

/* ===== Flash messages ===== */
.flash {
    padding: 0.8rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}
.flash.error { background: #fdecea; color: #932e2a; border: 1px solid #f3c6c2; }
.flash.success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c3e6c5; }

.warning-banner {
    background: #fff8e1;
    color: #7a5b00;
    border: 1px solid #f0dfa0;
    padding: 0.9rem 1.1rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-size: 0.92rem;
    line-height: 1.5;
}
.warning-banner strong { display: block; margin-bottom: 0.2rem; }

.selected-children-list {
    color: var(--muted);
    margin-top: -8px;
}

@media (max-width: 760px) {
    .grid.two, .grid.three { grid-template-columns: 1fr; }
    .question.two-col, .signature-row { grid-template-columns: 1fr; }
}
