:root {
    --ink: #172026;
    --muted: #66717a;
    --line: #dde5df;
    --paper: #ffffff;
    --soft: #f5f8f6;
    --green: #247a4d;
    --green-soft: #dff3e9;
    --blue: #245a8d;
    --blue-soft: #e6f0f8;
    --amber: #9a6414;
    --amber-soft: #fff1d8;
    --red: #a33a3a;
    --red-soft: #fde7e7;
    --shadow: 0 12px 32px rgba(23, 32, 38, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--soft);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

code {
    background: #eef3ef;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: #2b4f3e;
    display: inline-block;
    max-width: 340px;
    overflow-wrap: anywhere;
    padding: 2px 6px;
}

.topbar {
    align-items: center;
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 24px;
    justify-content: space-between;
    min-height: 72px;
    padding: 0 6vw;
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    align-items: center;
    display: inline-flex;
    font-weight: 800;
    gap: 10px;
}

.brand-mark {
    align-items: center;
    background: var(--green);
    border-radius: 8px;
    color: #fff;
    display: inline-flex;
    height: 36px;
    justify-content: center;
    width: 36px;
}

.nav,
.hero-actions,
.panel-heading,
.admin-heading {
    align-items: center;
    display: flex;
    gap: 16px;
}

.nav {
    color: var(--muted);
    flex-wrap: wrap;
    font-size: 14px;
}

.nav a:hover,
.sidebar-nav a:hover,
.panel-heading a {
    color: var(--green);
}

.nav-action,
.primary-button,
.secondary-button,
.ghost-button {
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
}

.primary-button {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.secondary-button,
.nav-action,
.ghost-button {
    background: var(--paper);
    color: var(--ink);
}

.full {
    width: 100%;
}

.hero {
    align-items: center;
    display: grid;
    gap: 44px;
    grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr);
    min-height: calc(100vh - 72px);
    padding: 64px 6vw;
}

.hero h1,
.page-title h1 {
    font-size: clamp(36px, 6vw, 70px);
    line-height: 1.02;
    margin: 0;
    max-width: 850px;
}

.lead {
    color: var(--muted);
    font-size: 19px;
    max-width: 680px;
}

.eyebrow {
    color: var(--green);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    margin: 0 0 10px;
    text-transform: uppercase;
}

.hero-panel {
    align-items: center;
    display: flex;
    justify-content: center;
}

.phone-frame {
    background: #fbfffc;
    border: 10px solid #1e2a30;
    border-radius: 34px;
    box-shadow: var(--shadow);
    min-height: 520px;
    padding: 34px 26px;
    width: min(360px, 100%);
}

.phone-top {
    background: #1e2a30;
    border-radius: 999px;
    height: 10px;
    margin: 0 auto 48px;
    width: 94px;
}

.family-node {
    align-items: center;
    border-radius: 50%;
    color: #fff;
    display: flex;
    font-weight: 800;
    height: 112px;
    justify-content: center;
    margin: 0 auto;
    width: 112px;
}

.parent {
    background: var(--blue);
}

.child {
    background: var(--green);
    height: 88px;
    width: 88px;
}

.family-branch {
    background: var(--line);
    height: 70px;
    margin: 0 auto;
    width: 4px;
}

.family-row {
    display: flex;
    justify-content: space-around;
}

.safety-strip {
    background: var(--green-soft);
    border: 1px solid #b9dfcb;
    border-radius: 8px;
    color: var(--green);
    font-weight: 800;
    margin-top: 40px;
    padding: 12px;
    text-align: center;
}

.metrics-band {
    background: var(--ink);
    color: #fff;
    display: grid;
    gap: 1px;
    grid-template-columns: repeat(3, 1fr);
}

.metrics-band div {
    padding: 28px 6vw;
}

.metrics-band strong {
    display: block;
    font-size: 36px;
}

.metrics-band span {
    color: #cfd8d2;
}

.section,
.page-title,
.split-section {
    padding: 72px 6vw;
}

.section-heading {
    margin-bottom: 28px;
    max-width: 780px;
}

.section-heading h2,
.split-section h2 {
    font-size: clamp(28px, 4vw, 44px);
    line-height: 1.08;
    margin: 0;
}

.service-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.service-grid.wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.service-card,
.login-panel,
.table-panel,
.stat,
.contact-panel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.service-card {
    padding: 22px;
}

.service-card h2,
.service-card h3,
.table-panel h2 {
    margin: 0 0 10px;
}

.service-card p,
.split-section p {
    color: var(--muted);
}

.card-head {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.split-section {
    display: grid;
    gap: 32px;
    grid-template-columns: .9fr 1.1fr;
}

.info-list,
.contact-panel {
    display: grid;
    gap: 12px;
}

.info-list span {
    background: var(--paper);
    border-left: 4px solid var(--green);
    border-radius: 6px;
    padding: 14px 16px;
}

.contact-panel {
    padding: 24px;
}

.footer {
    background: #11191d;
    color: #d8e0db;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding: 24px 6vw;
}

.login-wrap {
    display: grid;
    min-height: calc(100vh - 144px);
    padding: 72px 6vw;
    place-items: center;
}

.login-panel {
    max-width: 440px;
    padding: 28px;
    width: 100%;
}

.portal-login hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 22px 0;
}

.login-panel label {
    display: block;
    font-weight: 700;
    margin: 18px 0 8px;
}

.login-panel input {
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 16px;
    min-height: 46px;
    padding: 10px 12px;
    width: 100%;
}

.form-error {
    color: var(--red);
    font-weight: 700;
}

.admin-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    background: #11191d;
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px;
}

.sidebar-brand {
    color: #fff;
}

.sidebar-nav {
    display: grid;
    gap: 4px;
}

.sidebar-nav a {
    border-radius: 8px;
    color: #d4ded8;
    padding: 10px 12px;
}

.ghost-button {
    background: transparent;
    color: #fff;
    width: 100%;
}

.admin-main {
    min-width: 0;
    padding: 28px;
}

.portal-main {
    padding: 28px 6vw 72px;
}

.portal-hero {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
}

.portal-hero h1 {
    font-size: clamp(34px, 5vw, 58px);
    line-height: 1.05;
    margin: 0;
}

.portal-stats {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.notice {
    background: var(--green-soft);
    border: 1px solid #b9dfcb;
    border-radius: 8px;
    color: var(--green);
    font-weight: 700;
    margin-bottom: 18px;
    padding: 12px 14px;
}

.notice.error {
    background: var(--red-soft);
    border-color: #efb8b8;
    color: var(--red);
}

.notice.inline {
    margin: 14px 0;
}

.invite-notice {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.invite-notice strong {
    background: #fff;
    border: 1px solid #b9dfcb;
    border-radius: 8px;
    color: var(--ink);
    font-size: 22px;
    letter-spacing: 0;
    padding: 4px 10px;
}

.admin-heading {
    justify-content: space-between;
    margin-bottom: 24px;
}

.admin-heading h1 {
    font-size: 34px;
    margin: 0;
}

.stat-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 18px;
}

.stat {
    padding: 18px;
}

.stat span {
    color: var(--muted);
}

.stat strong {
    display: block;
    font-size: 34px;
}

.admin-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 18px;
}

.lab-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 18px;
}

.lab-panel {
    overflow: visible;
}

.panel-copy,
.muted-text {
    color: var(--muted);
}

.panel-copy {
    margin: 0 0 14px;
}

.lab-panel hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 20px 0;
}

.form-grid {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
}

.form-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lab-panel label {
    color: var(--muted);
    display: grid;
    font-size: 13px;
    font-weight: 700;
    gap: 6px;
}

.lab-panel input,
.lab-panel select,
.lab-panel textarea {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    font: inherit;
    min-height: 42px;
    padding: 9px 10px;
    width: 100%;
}

.lab-panel textarea {
    min-height: 76px;
    resize: vertical;
}

.lab-panel button {
    margin: 4px 8px 4px 0;
}

.stack-form {
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 14px;
}

.invite-card-head {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.invite-card-head div {
    display: grid;
    gap: 4px;
}

.mini-pill {
    background: var(--blue-soft);
    border: 1px solid #c7dbec;
    border-radius: 999px;
    color: var(--blue);
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    margin: 0 6px 6px 0;
    padding: 4px 8px;
    text-transform: capitalize;
}

.live-preview {
    background: #10181c;
    border-radius: 8px;
    color: #d9f1e5;
    display: grid;
    gap: 6px;
    min-width: 220px;
    padding: 14px;
}

.live-preview span {
    color: #b9c9c0;
    font-size: 13px;
}

.inline-form {
    align-items: center;
    display: flex;
    gap: 8px;
}

.inline-form select {
    border: 1px solid var(--line);
    border-radius: 8px;
    min-height: 38px;
    padding: 8px;
}

.ghost-light-button,
.ghost-danger-button {
    background: #eef3ef;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
}

.ghost-danger-button {
    background: var(--red-soft);
    border-color: #efb8b8;
    color: var(--red);
}

.stack-actions {
    margin-bottom: 6px;
}

.console-output {
    background: #10181c;
    border-radius: 8px;
    color: #d9f1e5;
    margin: 0;
    max-height: 420px;
    overflow: auto;
    padding: 16px;
    white-space: pre-wrap;
}

.table-panel {
    overflow: auto;
    padding: 18px;
}

.panel-heading {
    justify-content: space-between;
    margin-bottom: 12px;
}

table {
    border-collapse: collapse;
    min-width: 760px;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 12px 10px;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.status {
    border-radius: 999px;
    display: inline-flex;
    font-size: 12px;
    font-weight: 800;
    padding: 4px 9px;
    text-transform: capitalize;
}

.status-active,
.status-granted,
.status-info,
.status-parent {
    background: var(--green-soft);
    color: var(--green);
}

.status-pending,
.status-ask-each-time,
.status-kid {
    background: var(--amber-soft);
    color: var(--amber);
}

.status-revoked,
.status-inactive,
.status-error {
    background: var(--red-soft);
    color: var(--red);
}

.pagination {
    display: flex;
    gap: 8px;
    list-style: none;
    padding-left: 0;
}

@media (max-width: 920px) {
    .hero,
    .split-section,
    .service-grid,
    .service-grid.wide,
    .admin-grid,
    .lab-grid,
    .stat-grid {
        grid-template-columns: 1fr;
    }

    .admin-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .metrics-band {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .topbar,
    .footer,
    .admin-heading,
    .portal-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .hero,
    .section,
    .page-title,
    .split-section,
    .login-wrap {
        padding: 44px 20px;
    }

    .admin-main {
        padding: 18px;
    }

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