:root {
    --gs-primary: #1f7a4d;
    --gs-primary-dark: #145c38;
    --gs-ink: #1b2430;
    --gs-muted: #5b6b7a;
    --gs-border: #e2e8ec;
    --gs-bg: #f7f9fa;
    --gs-surface: #ffffff;
    --gs-danger: #c0392b;
    --gs-warning: #b8860b;
    --gs-radius: 10px;
    font-size: 16px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    background: var(--gs-bg);
    color: var(--gs-ink);
    line-height: 1.5;
}

a { color: var(--gs-primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.25; margin-top: 0; }

.container { max-width: 1160px; margin: 0 auto; padding: 0 20px; }

/* ---- Motion (respects reduced-motion preference) ---- */
@media (prefers-reduced-motion: no-preference) {
    [data-reveal] {
        opacity: 0;
        transform: translateY(18px);
        transition: opacity .6s ease, transform .6s ease;
    }
    [data-reveal].revealed { opacity: 1; transform: none; }
    .grid-3 .card:nth-child(1) { transition-delay: .02s; }
    .grid-3 .card:nth-child(2) { transition-delay: .08s; }
    .grid-3 .card:nth-child(3) { transition-delay: .14s; }
    .grid-3 .card:nth-child(4) { transition-delay: .2s; }
    .grid-3 .card:nth-child(5) { transition-delay: .26s; }
    .grid-3 .card:nth-child(6) { transition-delay: .32s; }
    .stat-strip-inner .stat-item:nth-child(1) { transition-delay: .05s; }
    .stat-strip-inner .stat-item:nth-child(2) { transition-delay: .15s; }
    .stat-strip-inner .stat-item:nth-child(3) { transition-delay: .25s; }
    .stat-strip-inner .stat-item:nth-child(4) { transition-delay: .35s; }
    .kpi-row .kpi-card:nth-child(1) { transition-delay: .02s; }
    .kpi-row .kpi-card:nth-child(2) { transition-delay: .06s; }
    .kpi-row .kpi-card:nth-child(3) { transition-delay: .1s; }
    .kpi-row .kpi-card:nth-child(4) { transition-delay: .14s; }
    .kpi-row .kpi-card:nth-child(5) { transition-delay: .18s; }
    .kpi-row .kpi-card:nth-child(6) { transition-delay: .22s; }
    .kpi-row .kpi-card:nth-child(7) { transition-delay: .26s; }
    .kpi-row .kpi-card:nth-child(8) { transition-delay: .3s; }
    .kpi-row .kpi-card:nth-child(9) { transition-delay: .34s; }
    .kpi-row .kpi-card:nth-child(10) { transition-delay: .38s; }

    @keyframes heroIn {
        from { opacity: 0; transform: translateY(26px); }
        to { opacity: 1; transform: none; }
    }
    .hero-animate > * { animation: heroIn .8s ease both; }
    .hero-animate h1 { animation-delay: .05s; }
    .hero-animate p { animation-delay: .15s; }
    .hero-animate .btn { animation-delay: .25s; }
}
@media (prefers-reduced-motion: reduce) {
    [data-reveal] { opacity: 1; transform: none; }
}

/* ---- Public site chrome ---- */
.public-nav {
    background: var(--gs-surface);
    border-bottom: 1px solid var(--gs-border);
    position: sticky; top: 0; z-index: 10;
    transition: box-shadow .25s ease;
}
.public-nav.scrolled { box-shadow: 0 4px 16px rgba(16, 24, 31, 0.08); }
.public-nav .bar { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.public-nav .brand { font-weight: 700; font-size: 1.25rem; color: var(--gs-primary-dark); }
.public-nav nav a { margin-left: 20px; color: var(--gs-ink); font-weight: 500; position: relative; }
.public-nav nav a:not(.cta)::after {
    content: ""; position: absolute; left: 0; right: 100%; bottom: -4px; height: 2px;
    background: var(--gs-primary); transition: right .25s ease;
}
.public-nav nav a:not(.cta):hover::after { right: 0; }
.public-nav .cta { background: var(--gs-primary); color: #fff; padding: 8px 16px; border-radius: 6px; transition: background-color .2s ease, transform .15s ease; }
.public-nav .cta:hover { background: var(--gs-primary-dark); text-decoration: none; transform: translateY(-1px); }

.hero { padding: 64px 0; text-align: center; overflow: hidden; }
.hero h1 { font-size: 2.4rem; max-width: 720px; margin: 0 auto 16px; }
.hero p { color: var(--gs-muted); max-width: 620px; margin: 0 auto 24px; font-size: 1.1rem; }
.btn { display: inline-block; padding: 10px 22px; border-radius: 6px; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: background-color .2s ease, transform .15s ease, box-shadow .2s ease; }
.btn-primary { background: var(--gs-primary); color: #fff; }
.btn-primary:hover { background: var(--gs-primary-dark); text-decoration: none; color: #fff; transform: translateY(-2px); box-shadow: 0 8px 18px rgba(31,122,77,0.28); }
.btn-outline { border-color: var(--gs-primary); color: var(--gs-primary-dark); background: #fff; }
.btn-outline:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(16,24,31,0.1); text-decoration: none; }
.btn:active { transform: translateY(0) scale(.97); }

.stat-strip { background: var(--gs-primary-dark); }
.stat-strip-inner { display: flex; flex-wrap: wrap; justify-content: center; gap: 40px; padding: 28px 0; text-align: center; }
.stat-item .stat-value { font-size: 2.1rem; font-weight: 800; color: #fff; line-height: 1.1; }
.stat-item .stat-label { color: #cfe4d6; font-size: 0.85rem; margin-top: 4px; max-width: 220px; }

.section { padding: 48px 0; }
.section.alt { background: var(--gs-surface); border-top: 1px solid var(--gs-border); border-bottom: 1px solid var(--gs-border); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.card { background: var(--gs-surface); border: 1px solid var(--gs-border); border-radius: var(--gs-radius); padding: 20px; transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
.card:hover { transform: translateY(-5px); box-shadow: 0 14px 28px rgba(16,24,31,0.09); border-color: transparent; }

.public-footer { background: #10181f; color: #cbd5da; padding: 32px 0; margin-top: 40px; }
.public-footer a { color: #fff; }
.public-footer .cols { display: flex; flex-wrap: wrap; gap: 32px; justify-content: space-between; }

/* ---- App (authenticated) chrome ---- */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
    width: 240px; background: #12202a; color: #dbe6ea; flex-shrink: 0;
    padding: 20px 0;
}
.app-sidebar .brand { padding: 0 20px 20px; font-weight: 700; font-size: 1.1rem; color: #fff; }
.app-sidebar a {
    display: block; padding: 10px 20px; color: #cfe0e6; font-weight: 500;
}
.app-sidebar a:hover, .app-sidebar a.active { background: #1c313e; color: #fff; text-decoration: none; }
.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.app-topbar {
    background: var(--gs-surface); border-bottom: 1px solid var(--gs-border);
    padding: 14px 24px; display: flex; justify-content: space-between; align-items: center;
}
.app-content { padding: 24px; flex: 1; }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 1.5rem; margin: 0; }

table.data-table { width: 100%; border-collapse: collapse; background: var(--gs-surface); border: 1px solid var(--gs-border); border-radius: var(--gs-radius); overflow: hidden; }
table.data-table th, table.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--gs-border); text-align: left; font-size: 0.92rem; }
table.data-table th { background: #f0f3f4; font-weight: 600; }
table.data-table tr:last-child td { border-bottom: none; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.badge-active, .badge-published, .badge-active-status { background: #e3f5ea; color: var(--gs-primary-dark); }
.badge-inactive, .badge-draft { background: #eef1f2; color: var(--gs-muted); }
.badge-warning { background: #fdf3d8; color: var(--gs-warning); }
.badge-danger { background: #fbe4e1; color: var(--gs-danger); }

.form-card { background: var(--gs-surface); border: 1px solid var(--gs-border); border-radius: var(--gs-radius); padding: 24px; max-width: 640px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.92rem; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--gs-border); border-radius: 6px; font-size: 0.95rem;
}
.field-validation-error { color: var(--gs-danger); font-size: 0.85rem; display: block; margin-top: 4px; }
.validation-summary-errors { color: var(--gs-danger); background: #fbe4e1; padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; }
.validation-summary-errors ul { margin: 0; padding-left: 18px; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; }
.alert-danger { background: #fbe4e1; color: var(--gs-danger); }
.alert-success { background: #e3f5ea; color: var(--gs-primary-dark); }

.empty-state { text-align: center; padding: 48px 20px; color: var(--gs-muted); }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--gs-bg); }
.login-card { background: var(--gs-surface); border: 1px solid var(--gs-border); border-radius: 14px; padding: 40px; width: 100%; max-width: 400px; }
.login-card h1 { text-align: center; font-size: 1.4rem; margin-bottom: 24px; }

.status-page { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 20px; }
.status-page .code { font-size: 4rem; font-weight: 800; color: var(--gs-primary); }

.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card { background: var(--gs-surface); border: 1px solid var(--gs-border); border-radius: var(--gs-radius); padding: 18px; position: relative; overflow: hidden; transition: transform .2s ease, box-shadow .2s ease; }
.kpi-card:hover { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(16,24,31,0.08); }
.kpi-card::before { content: ""; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: var(--gs-primary); opacity: .55; }
.kpi-card .value { font-size: 1.8rem; font-weight: 700; color: var(--gs-primary-dark); }
.kpi-card .label { color: var(--gs-muted); font-size: 0.85rem; }
.kpi-card.accent-warning::before { background: var(--gs-warning); }
.kpi-card.accent-danger::before { background: var(--gs-danger); }
.kpi-card.accent-muted::before { background: var(--gs-muted); }

/* ---- Dashboard charts ---- */
.section-title { font-size: 1.05rem; font-weight: 700; margin: 32px 0 14px; color: var(--gs-ink); }
.section-title:first-of-type { margin-top: 8px; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; margin-bottom: 8px; }
.chart-grid.wide { grid-template-columns: repeat(auto-fit, minmax(480px, 1fr)); }
.chart-card { background: var(--gs-surface); border: 1px solid var(--gs-border); border-radius: var(--gs-radius); padding: 20px; }
.chart-card h3 { font-size: 0.95rem; margin: 0 0 14px; color: var(--gs-ink); }
.chart-card .chart-wrap { position: relative; height: 260px; }
.chart-card .chart-wrap.short { height: 200px; }
.chart-empty { color: var(--gs-muted); font-size: 0.88rem; text-align: center; padding: 40px 0; }

.table-card { background: var(--gs-surface); border: 1px solid var(--gs-border); border-radius: var(--gs-radius); padding: 20px; margin-top: 8px; overflow-x: auto; }
.table-card h3 { font-size: 0.95rem; margin: 0 0 14px; }
.table-card table.data-table { border: none; }
.table-card table.data-table th { background: transparent; border-bottom: 2px solid var(--gs-border); }
