:root {
    --green: #1a7a3c;
    --green-dark: #146332;
    --green-deep: #1b8a3e;
    --green-bright: #1f8f44;
    --gold: #c4a35a;
    --gold-deep: #b08d3c;
    --lime: #c6a84b;
    --lime-ink: #1a7a3c;
    --cream: #f6f4ee;
    --ink: #1c1c1c;
    --muted: #3e4650;
    --card: #ffffff;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    background: #e6e8ec;
    color: var(--ink);
    font-family: "Source Sans 3", "Segoe UI", sans-serif;
    display: flex;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
}

.app {
    width: 100%;
    max-width: 440px;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--cream);
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 0 1px rgba(8, 40, 24, 0.04), 0 18px 50px rgba(8, 40, 24, 0.08);
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--green);
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.hero {
    position: relative;
    overflow: hidden;
    padding: calc(12px + env(safe-area-inset-top)) 14px 52px;
    background:
        radial-gradient(90% 80% at 100% 0%, rgba(255, 255, 255, 0.14), transparent 42%),
        linear-gradient(180deg, #0d7349 0%, #085c3c 100%);
    color: #fff;
}

.logo-row {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.logo {
    width: 72px;
    height: 68px;
    object-fit: contain;
    display: block;
    background: #eeeff1;
    border-radius: 12px;
    padding: 3px;
}

.hero-copy {
    position: relative;
    z-index: 1;
    margin-top: 12px;
    text-align: center;
}

.hero h1 {
    margin: 0;
    color: #fff;
    font-family: Montserrat, "Source Sans 3", sans-serif;
    font-size: 22px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.hero h1 .sub {
    display: block;
    margin-top: 4px;
    font-size: 17px;
    font-weight: 700;
}

.plan {
    margin: 8px 0 0;
    color: #fff;
    font-size: 14.5px;
    font-weight: 700;
}

.tag {
    margin: 4px 0 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13.5px;
    font-weight: 600;
}

.hero-wave {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    width: 100%;
    height: 52px;
    display: block;
}

.hub {
    display: flex;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.hub p {
    margin: 0;
    background: var(--gold);
    color: #fff;
    font-weight: 700;
    font-size: 14.5px;
    line-height: 1;
    padding: 9px 16px;
    border-radius: 999px;
    box-shadow: 0 6px 16px rgba(140, 110, 40, 0.18);
}

.list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px 16px 8px;
}

.card {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 36px;
    gap: 12px;
    align-items: center;
    background: var(--card);
    color: inherit;
    text-decoration: none;
    border-radius: 18px;
    padding: 14px 12px 14px 14px;
    box-shadow: 0 10px 24px rgba(24, 40, 28, 0.06);
    border: 1px solid rgba(24, 40, 28, 0.06);
    border-left: 4px solid var(--green);
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.card:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
}

.card:active {
    transform: scale(0.99);
}

.ico {
    width: 46px;
    height: 46px;
    color: var(--green);
}

.ico svg {
    width: 46px;
    height: 46px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.copy {
    min-width: 0;
}

.ct {
    display: block;
    color: #173024;
    font-size: 16.5px;
    line-height: 1.2;
    font-weight: 700;
}

.cd {
    display: block;
    margin-top: 3px;
    color: #4a5c54;
    font-size: 14px;
    line-height: 1.35;
    font-weight: 500;
}

.go {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--green);
    display: grid;
    place-items: center;
}

.card.programme { --accent: #0c9048; }
.card.resources { --accent: #7d3f94; }
.card.say { --accent: #ef9d34; }
.card.recommendations { --accent: #e24e30; }
.card.feedback { --accent: #3d8c4e; }

.card .ico { color: var(--accent, var(--green)); }
.card .go { background: var(--accent, var(--green)); }
.card { border-left-color: var(--accent, var(--green)); }

.go svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: #fff;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.card { cursor: pointer; }

.footer {
    margin-top: auto;
    text-align: center;
    background: var(--cream);
    padding-bottom: env(safe-area-inset-bottom);
}

.footer-waves {
    display: block;
    width: 100%;
    height: 86px;
}

.store-error {
    margin: 12px 16px 0;
    background: #fde8e4;
    color: #7a261c;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 14px;
}

@media (hover: hover) {
    .card:hover {
        transform: translateY(-1px);
        box-shadow: 0 14px 28px rgba(18, 50, 32, 0.11);
    }
}

@media (max-width: 480px) {
    body { background: var(--cream); }
    .app { box-shadow: none; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
    .card { transition: none; }
}

/* Admin */
body.admin {
    display: block;
    background: #eef3ef;
    color: #163028;
}

.wrap {
    width: min(920px, calc(100% - 24px));
    margin: 0 auto;
    padding: 22px 0 48px;
}

.top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-end;
    margin-bottom: 16px;
}

.top h1 {
    margin: 0;
    font-size: 30px;
    letter-spacing: -0.03em;
    color: #0e4d34;
}

.top .eyebrow { margin-bottom: 2px; color: #1f7a4c; }

.clock {
    margin: 4px 0 0;
    color: #4d6158;
    font-size: 14px;
}

.top-actions, .exports {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.btn, button {
    appearance: none;
    border: 0;
    background: var(--green);
    color: #fff;
    font: inherit;
    font-weight: 700;
    border-radius: 999px;
    padding: 10px 16px;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn.light, button.light {
    background: #fff;
    color: var(--green);
    box-shadow: inset 0 0 0 1.5px #b7d2c4;
}

button.danger {
    background: #8d2f2f;
}

.note {
    background: #fff;
    border-radius: 14px;
    padding: 12px 14px;
    margin: 0 0 12px;
    box-shadow: 0 8px 20px rgba(16, 40, 24, 0.05);
}

.note.ok { background: #e5f6ea; color: #145c34; }
.note.warn { background: #fff4d8; color: #6a4b10; }
.note.bad { background: #fde8e4; color: #7a261c; }

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.stat, .panel {
    background: #fff;
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 8px 22px rgba(16, 40, 24, 0.05);
}

.stat span {
    display: block;
    color: #5b6d64;
    font-size: 13px;
    font-weight: 700;
}

.stat strong {
    display: block;
    margin-top: 4px;
    font-size: 28px;
    letter-spacing: -0.03em;
    color: var(--green);
}

.stat em {
    display: block;
    margin-top: 2px;
    color: #6b7c74;
    font-style: normal;
    font-size: 12px;
}

.range {
    display: flex;
    gap: 8px;
    margin: 4px 0 12px;
}

.range a {
    text-decoration: none;
    color: var(--green);
    background: #fff;
    border-radius: 999px;
    padding: 8px 12px;
    font-weight: 700;
    font-size: 14px;
}

.range a.on {
    background: var(--green);
    color: #fff;
}

.panel { margin-bottom: 12px; }

.panel h2 {
    margin: 0 0 10px;
    font-size: 18px;
}

.help, .muted {
    color: #52655c;
    font-size: 14px;
    line-height: 1.45;
}

.bar-row {
    display: grid;
    grid-template-columns: minmax(120px, 190px) 1fr auto;
    gap: 8px;
    align-items: center;
    margin: 8px 0;
    font-size: 14px;
}

.bar {
    height: 8px;
    background: #e5eee8;
    border-radius: 99px;
    overflow: hidden;
}

.bar span {
    display: block;
    height: 100%;
    background: var(--green);
    border-radius: 99px;
}

.days {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.days th, .days td {
    text-align: left;
    padding: 7px 4px;
    border-bottom: 1px solid #edf2ee;
}

.days th:nth-child(n + 2), .days td:nth-child(n + 2) { text-align: right; }

.link-row {
    padding: 12px 0;
    border-top: 1px solid #edf2ee;
}

.link-row:first-of-type { border-top: 0; }

.link-row label {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
}

input[type="text"], input[type="password"] {
    width: 100%;
    border: 1.5px solid #d5e2da;
    background: #fbfcfb;
    border-radius: 12px;
    padding: 11px 12px;
    font: inherit;
    color: inherit;
}

input:focus {
    outline: 3px solid rgba(31, 138, 78, 0.25);
    border-color: #1f8a4e;
}

.check {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
    font-size: 14px;
    font-weight: 600;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.log {
    padding: 12px 0;
    border-top: 1px solid #edf2ee;
}

.log:first-of-type { border-top: 0; padding-top: 0; }

.log header {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: baseline;
}

.log h3 { margin: 0; font-size: 16px; }

.log p { margin: 4px 0 0; color: #3d5148; font-size: 14px; }

.pill {
    background: #e7f5ec;
    color: #14643c;
    border-radius: 99px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

details { margin-top: 6px; color: #5c6e66; font-size: 13px; }
details summary { cursor: pointer; }

.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
}

.login {
    width: min(420px, 100%);
    background: #fff;
    border-radius: 20px;
    padding: 22px 20px;
    box-shadow: 0 16px 40px rgba(16, 40, 24, 0.08);
}

.login h1 { margin: 6px 0 8px; color: #0e4d34; font-size: 28px; }
.login label { display: block; font-weight: 700; margin: 14px 0 6px; }

@media (max-width: 720px) {
    .stats { grid-template-columns: 1fr 1fr; }
    .top { flex-direction: column; align-items: stretch; }
    .bar-row { grid-template-columns: 1fr auto; }
    .bar { grid-column: 1 / -1; grid-row: 2; }
}
