:root {
    --navy: #0f2742;
    --navy-2: #14375f;
    --blue: #2563eb;
    --green: #16a34a;
    --orange: #f97316;
    --red: #dc2626;
    --teal: #0891b2;
    --ink: #172033;
    --muted: #667085;
    --line: #d9e2ef;
    --soft: #eef5fb;
    --bg: #f7fafc;
    --card: #ffffff;
    --shadow: 0 14px 34px rgba(15, 39, 66, .10);
    --radius: 8px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
    margin: 0;
    min-height: 100%;
    color: var(--ink);
    background: var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
svg { width: 1.15rem; height: 1.15rem; flex: 0 0 auto; }

.public-body {
    background: linear-gradient(180deg, #eef7fb 0%, #ffffff 42%, #f7fafc 100%);
}

.landing-hero {
    min-height: 92vh;
    display: grid;
    align-items: center;
    padding: 20px;
    color: #ffffff;
    background:
        linear-gradient(120deg, rgba(15, 39, 66, .92), rgba(20, 55, 95, .82)),
        url("https://images.unsplash.com/photo-1502904550040-7534597429ae?auto=format&fit=crop&w=1800&q=80") center/cover;
}

.landing-nav, .landing-section, .landing-hero-inner, .landing-footer {
    width: min(1120px, 100%);
    margin: 0 auto;
}

.landing-nav {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    color: #fff;
}

.landing-hero-inner {
    padding-top: 64px;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    letter-spacing: 0;
}
.brand-icon {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius);
    color: #ffffff;
    background: linear-gradient(135deg, var(--blue), var(--green));
    box-shadow: 0 10px 22px rgba(37, 99, 235, .28);
}

.hero-copy {
    max-width: 760px;
    display: grid;
    gap: 18px;
}
.hero-copy h1 {
    margin: 0;
    font-size: clamp(2.7rem, 8vw, 6.4rem);
    line-height: .95;
    letter-spacing: 0;
}
.hero-copy p {
    margin: 0;
    max-width: 680px;
    color: rgba(255, 255, 255, .9);
    font-size: 1.15rem;
    line-height: 1.55;
}
.hero-actions, .row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 640px;
    margin-top: 24px;
}
.hero-stat {
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .12);
    backdrop-filter: blur(8px);
}
.hero-stat strong { display: block; font-size: 1.35rem; }
.hero-stat span { color: rgba(255, 255, 255, .78); font-size: .88rem; }

.landing-section {
    padding: 52px 20px;
}
.legal-links {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 14px;
    color: var(--navy);
    font-weight: 800;
}
.legal-page {
    min-height: 100vh;
    background: var(--bg);
}
.legal-hero {
    padding: 28px 20px 22px;
    color: #fff;
    background: var(--navy);
}
.legal-hero > * {
    width: min(880px, 100%);
    margin-left: auto;
    margin-right: auto;
}
.legal-hero h1 {
    margin-top: 34px;
    margin-bottom: 8px;
    font-size: clamp(2rem, 6vw, 4rem);
    line-height: 1;
}
.legal-hero p {
    color: rgba(255, 255, 255, .78);
}
.legal-content {
    width: min(880px, calc(100% - 28px));
    margin: 18px auto 54px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 6px 20px rgba(15, 39, 66, .05);
}
.legal-content h2 {
    margin: 22px 0 8px;
    font-size: 1.12rem;
}
.legal-content p {
    color: var(--muted);
    line-height: 1.62;
}
.section-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: end;
    margin-bottom: 18px;
}
.section-head h2, .card h2, .panel h2 {
    margin: 0;
    font-size: 1.45rem;
}
.section-head p, .muted { color: var(--muted); margin: 6px 0 0; line-height: 1.5; }

.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.card, .panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 6px 20px rgba(15, 39, 66, .05);
}
.card { padding: 16px; }
.panel { padding: 18px; }
.feature-card {
    display: grid;
    gap: 10px;
    min-height: 128px;
}
.feature-card i, .metric-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    color: var(--blue);
    background: #eaf1ff;
}
.feature-card h3, .session-title, .metric-value {
    margin: 0;
    font-size: 1rem;
}
.feature-card p, .card p { margin: 0; color: var(--muted); line-height: 1.48; }
.steps {
    counter-reset: steps;
}
.step-card {
    position: relative;
    padding-left: 54px;
}
.step-card:before {
    counter-increment: steps;
    content: counter(steps);
    position: absolute;
    left: 16px;
    top: 16px;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: var(--orange);
    font-weight: 800;
}

.btn {
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 10px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 750;
    line-height: 1;
}
.btn-primary { color: #fff; background: var(--blue); }
.btn-green { color: #fff; background: var(--green); }
.btn-orange { color: #fff; background: var(--orange); }
.btn-danger { color: #fff; background: var(--red); }
.btn-light { color: var(--navy); background: #fff; border-color: var(--line); }
.btn-ghost { color: inherit; background: transparent; border-color: rgba(255, 255, 255, .55); }
.btn.is-disabled { opacity: .48; pointer-events: none; }
.btn-small { min-height: 34px; padding: 8px 10px; font-size: .86rem; }
.icon-btn {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
    background: #fff;
}

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 18px;
    background:
        linear-gradient(140deg, rgba(15, 39, 66, .95), rgba(8, 145, 178, .78)),
        url("https://images.unsplash.com/photo-1552674605-db6ffd4facb5?auto=format&fit=crop&w=1600&q=80") center/cover;
}
.auth-shell {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: .9fr 1fr;
    overflow: hidden;
    border-radius: 12px;
    background: rgba(255, 255, 255, .96);
    box-shadow: var(--shadow);
}
.auth-brand {
    min-height: 560px;
    padding: 32px;
    color: #fff;
    background: linear-gradient(160deg, var(--navy), var(--navy-2));
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.auth-brand h1 {
    margin: auto 0 10px;
    font-size: 2.4rem;
    line-height: 1.02;
}
.auth-brand p { color: rgba(255,255,255,.78); line-height: 1.55; margin: 0; }
.auth-panel {
    padding: 30px;
    display: grid;
    align-content: center;
}
.auth-panel h2 { margin: 0 0 8px; font-size: 1.65rem; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label, .check-label {
    font-size: .9rem;
    color: #344054;
    font-weight: 700;
}
.field input, .field select, .field textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid #cfd9e7;
    border-radius: var(--radius);
    padding: 10px 12px;
    background: #fff;
    color: var(--ink);
    outline: none;
}
.field textarea { min-height: 94px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.field-full { grid-column: 1 / -1; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 46px; }
.password-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    display: grid;
    place-items: center;
}
.strength {
    height: 7px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}
.strength span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--red);
    transition: width .2s ease, background .2s ease;
}
.check-label {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    line-height: 1.45;
}

.app-body {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 18px;
    color: #fff;
    background: var(--navy);
}
.side-nav {
    display: grid;
    gap: 6px;
    margin-top: 26px;
}
.side-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: rgba(255, 255, 255, .78);
}
.side-nav a.is-active, .side-nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, .12);
}
.nav-label {
    margin: 18px 12px 4px;
    color: rgba(255, 255, 255, .52);
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
}
.app-shell { min-width: 0; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 22px;
    background: rgba(247, 250, 252, .9);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
}
.topbar h1 { margin: 2px 0 0; font-size: 1.45rem; }
.eyebrow {
    color: var(--teal);
    font-size: .78rem;
    font-weight: 850;
    text-transform: uppercase;
}
.topbar-actions {
    display: flex;
    gap: 8px;
}
.page-content {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 20px 22px 92px;
}
.bottom-nav { display: none; }

.flash {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 14px;
    border-radius: var(--radius);
    border: 1px solid;
    font-weight: 650;
}
.flash-success { color: #14532d; background: #dcfce7; border-color: #86efac; }
.flash-error { color: #7f1d1d; background: #fee2e2; border-color: #fecaca; }
.flash-info { color: #164e63; background: #cffafe; border-color: #67e8f9; }

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.metric-card {
    display: flex;
    gap: 12px;
    align-items: center;
}
.metric-value {
    font-size: 1.45rem;
    font-weight: 850;
    color: var(--navy);
}
.metric-label {
    color: var(--muted);
    font-size: .86rem;
}
.progress-bar {
    height: 10px;
    border-radius: 999px;
    background: #e8eef6;
    overflow: hidden;
}
.progress-bar span {
    display: block;
    height: 100%;
    width: var(--value, 0%);
    background: linear-gradient(90deg, var(--green), var(--blue));
}
.status-pill, .level-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 800;
}
.status-planned, .status-active { background: #eaf1ff; color: #1d4ed8; }
.status-completed { background: #dcfce7; color: #166534; }
.status-partial, .status-postponed { background: #ffedd5; color: #9a3412; }
.status-missed, .status-cancelled, .status-deleted { background: #fee2e2; color: #991b1b; }
.status-paused, .status-archived { background: #f1f5f9; color: #475569; }

.session-list {
    display: grid;
    gap: 10px;
}
.session-card {
    display: grid;
    grid-template-columns: 76px 1fr auto;
    gap: 12px;
    align-items: center;
}
.date-chip {
    display: grid;
    place-items: center;
    min-height: 64px;
    border-radius: var(--radius);
    background: var(--soft);
    color: var(--navy);
    font-weight: 850;
}
.date-chip small { color: var(--muted); font-weight: 800; }
.session-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-size: .86rem;
}
.session-meta span {
    display: inline-flex;
    gap: 5px;
    align-items: center;
}
.filters {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    align-items: end;
}
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}
th, td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}
th {
    color: var(--muted);
    font-size: .78rem;
    text-transform: uppercase;
}

.tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 12px;
}
.tab-btn {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 12px;
    background: #fff;
    color: var(--muted);
    font-weight: 800;
    white-space: nowrap;
}
.tab-btn.is-active { color: #fff; background: var(--navy); border-color: var(--navy); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

.onboarding-progress {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}
.onboarding-progress span {
    height: 8px;
    border-radius: 999px;
    background: #dbe6f3;
}
.onboarding-progress span.is-active { background: var(--blue); }
.alert-box {
    display: flex;
    gap: 10px;
    padding: 12px;
    border-radius: var(--radius);
    border: 1px solid #fed7aa;
    background: #fff7ed;
    color: #7c2d12;
    line-height: 1.45;
}

.chart-box {
    min-height: 310px;
    position: relative;
}
.chart-box canvas {
    max-height: 260px;
}
.chart-note {
    margin: 10px 0 0;
    color: var(--muted);
    line-height: 1.45;
    font-size: .9rem;
}

.empty-state {
    min-height: 360px;
    display: grid;
    place-items: center;
    text-align: center;
    align-content: center;
    gap: 10px;
    padding: 28px;
}
.empty-state > svg, .empty-state > i {
    width: 54px;
    height: 54px;
    color: var(--blue);
}
.debug-box {
    max-width: 100%;
    overflow: auto;
    padding: 12px;
    border-radius: var(--radius);
    background: #111827;
    color: #f8fafc;
    text-align: left;
}

.disclaimer {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e3a8a;
    border-radius: var(--radius);
    padding: 12px;
    line-height: 1.48;
    font-size: .92rem;
}
.danger-zone {
    border-color: #fecaca;
    background: #fffafa;
}

@media (max-width: 960px) {
    .app-body { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .topbar { padding: 14px 16px; }
    .page-content { padding: 16px 14px 92px; }
    .bottom-nav {
        position: fixed;
        z-index: 8;
        bottom: 0;
        left: 0;
        right: 0;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, .96);
        border-top: 1px solid var(--line);
        box-shadow: 0 -8px 20px rgba(15, 39, 66, .08);
    }
    .bottom-nav a {
        min-height: 48px;
        display: grid;
        justify-items: center;
        align-content: center;
        gap: 3px;
        color: var(--muted);
        border-radius: var(--radius);
        font-size: .72rem;
        font-weight: 800;
    }
    .bottom-nav a.is-active { color: var(--blue); background: #eaf1ff; }
    .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-5, .grid-4, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
    .landing-nav { padding: 0 14px; }
    .landing-hero { min-height: 88vh; padding: 16px; }
    .hero-copy h1 { font-size: 3rem; }
    .hero-stats { grid-template-columns: 1fr; }
    .section-head { display: grid; align-items: start; }
    .landing-section { padding: 38px 14px; }
    .grid-2, .grid-3, .grid-4, .grid-5, .form-grid, .metrics-grid { grid-template-columns: 1fr; }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand { min-height: auto; padding: 22px; gap: 36px; }
    .auth-brand h1 { font-size: 1.9rem; margin-top: 32px; }
    .auth-panel { padding: 20px; }
    .session-card {
        grid-template-columns: 58px 1fr;
    }
    .session-card .row-actions {
        grid-column: 1 / -1;
        justify-content: stretch;
    }
    .session-card .row-actions .btn { flex: 1; }
    .topbar h1 { font-size: 1.2rem; }
    .topbar .eyebrow { display: none; }
}
