:root {
    --bg: #f7f8f6;
    --surface: #ffffff;
    --ink: #1f2933;
    --muted: #64748b;
    --line: #d7ded9;
    --teal: #0f766e;
    --teal-dark: #115e59;
    --amber: #b7791f;
    --red: #b42318;
    --green: #15803d;
    --shadow: 0 10px 28px rgba(15, 23, 42, .08);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100%;
    margin: 0;
    color: var(--ink);
    font: 16px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

a {
    color: var(--teal-dark);
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
.as-link {
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 9px 14px;
    cursor: pointer;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

button:disabled {
    cursor: default;
}

.primary {
    background: var(--teal);
    color: #fff;
}

.primary:hover {
    background: var(--teal-dark);
}

.secondary {
    background: #eef8f5;
    border-color: #add5cd;
    color: var(--teal-dark);
}

.danger {
    background: #fff1f0;
    border-color: #ffc9c4;
    color: var(--red);
}

.text-button {
    background: transparent;
    color: var(--ink);
    padding-inline: 6px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    padding: 9px 10px;
}

textarea {
    min-height: 84px;
    resize: vertical;
}

label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: .88rem;
    font-weight: 650;
}

.page {
    width: min(1180px, calc(100% - 24px));
    margin: 0 auto;
    padding: 18px 0 44px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px max(12px, calc((100vw - 1180px) / 2));
    background: rgba(255,255,255,.94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 800;
}

.brand img,
.app-mark {
    width: 34px;
    height: 34px;
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar nav a {
    border-radius: 8px;
    color: var(--muted);
    padding: 8px 10px;
    text-decoration: none;
    font-weight: 700;
}

.topbar nav a.active {
    background: #e7f3ef;
    color: var(--teal-dark);
}

.hero-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 12px 0 16px;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(2rem, 4vw, 3.1rem);
    line-height: 1;
}

h2 {
    margin-bottom: 14px;
    font-size: 1.24rem;
}

h3 {
    margin-bottom: 2px;
    font-size: 1.05rem;
}

.eyebrow,
.muted,
.empty {
    color: var(--muted);
}

.eyebrow {
    margin-bottom: 8px;
    font-weight: 750;
}

.section-band {
    margin: 18px 0;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255,255,255,.78);
    box-shadow: var(--shadow);
}

.section-title,
.work-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.work-block {
    padding: 16px 0;
    border-top: 1px solid var(--line);
}

.work-block:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.status {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: .78rem;
    font-weight: 800;
}

.status.due {
    background: #fff5d6;
    color: var(--amber);
}

.status.done {
    background: #e7f8ec;
    color: var(--green);
}

.status.idle {
    background: #eef2f7;
    color: var(--muted);
}

.task-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.task-row {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.task-row.is-done {
    background: #f4fbf7;
}

.check-button {
    width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    border-radius: 8px;
    border-color: #a8b7ad;
    background: #fff;
    color: var(--green);
    font-size: 1.1rem;
}

.task-row:not(.is-done) .check-button:hover {
    border-color: var(--teal);
    box-shadow: inset 0 0 0 2px #d5eee8;
}

.task-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.task-copy strong {
    overflow-wrap: anywhere;
}

.task-copy span,
.direct-tile span {
    color: var(--muted);
    font-size: .82rem;
}

.task-details {
    position: relative;
}

.task-details summary {
    list-style: none;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 999px;
    display: grid;
    place-items: center;
    cursor: pointer;
    color: var(--teal-dark);
    font-weight: 900;
}

.task-details summary::-webkit-details-marker {
    display: none;
}

.task-details[open] p {
    position: absolute;
    right: 0;
    top: 40px;
    z-index: 2;
    width: min(360px, calc(100vw - 40px));
    margin: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
    color: var(--ink);
    font-size: .9rem;
}

.file-chip {
    width: auto;
    color: var(--muted);
}

.file-chip span {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 10px;
    border: 1px dashed #b7c4bc;
    border-radius: 8px;
    background: #fbfdfc;
    color: var(--muted);
    font-size: .82rem;
}

.file-chip input {
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
}

.file-chip:focus-within span {
    outline: 2px solid #9ad5cb;
}

.subsection-label {
    margin: 14px 0 6px;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.inline-action {
    margin-top: 12px;
}

.extra-session {
    margin-top: 10px;
    padding: 10px;
    border-radius: 8px;
    background: #f6fbfa;
}

.area-group {
    margin-top: 16px;
}

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
}

.direct-tile {
    min-height: 150px;
    display: grid;
    gap: 10px;
    align-content: start;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.direct-tile .primary {
    width: 100%;
}

.stat-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.stat-strip span {
    min-width: 120px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: var(--surface);
    color: var(--muted);
}

.stat-strip strong {
    display: block;
    color: var(--ink);
    font-size: 1.4rem;
}

.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
}

.admin-tabs {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    padding: 0 0 0 6px;
    margin: 0 0 -1px;
    border-bottom: 1px solid var(--line);
    scrollbar-width: thin;
}

.admin-tabs a {
    flex: 0 0 auto;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    background: #eef3f0;
    color: var(--muted);
    padding: 9px 16px;
    text-decoration: none;
    font-weight: 800;
    box-shadow: inset 0 -1px 0 var(--line);
}

.admin-tabs a.active {
    position: relative;
    border-color: var(--line);
    background: rgba(255,255,255,.92);
    color: var(--teal-dark);
    box-shadow: none;
}

.admin-tabs a.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: #fff;
}

.admin-page > .section-band,
.admin-page > .split {
    margin-top: 0;
}

.admin-page > .split .section-band {
    margin-top: 0;
}

.area-picker {
    display: grid;
    gap: 8px;
    margin: 0 0 18px;
}

.area-picker > span {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.area-picker > div {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.area-picker a {
    flex: 0 0 auto;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    padding: 8px 12px;
    text-decoration: none;
    font-weight: 800;
}

.area-picker a.active {
    border-color: #93c9c0;
    background: #e7f3ef;
    color: var(--teal-dark);
}

.activity-list {
    display: grid;
    gap: 10px;
}

.activity-list div {
    display: grid;
    gap: 2px;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--line);
}

.activity-list span {
    color: var(--muted);
    font-size: .86rem;
}

.filter-bar,
.create-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    align-items: end;
    gap: 10px;
    margin-bottom: 14px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 10px;
    text-align: left;
    white-space: nowrap;
}

th {
    color: var(--muted);
    font-size: .82rem;
}

.admin-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, .45fr);
    gap: 10px;
}

.admin-card,
.password-card,
.admin-area {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 12px;
}

.admin-card,
.password-card {
    display: grid;
    gap: 10px;
}

.check-line {
    display: flex;
    align-items: center;
    gap: 8px;
}

.check-line input {
    width: auto;
}

.admin-area {
    margin-bottom: 14px;
}

.admin-area-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.area-form {
    display: grid;
    gap: 10px;
}

.tasks-admin {
    margin-top: 14px;
    display: grid;
    gap: 8px;
}

.task-admin-row {
    display: grid;
    grid-template-columns: repeat(6, minmax(110px, 1fr));
    gap: 8px;
    align-items: start;
    padding: 10px;
    border-radius: 8px;
    background: #f8faf8;
}

.task-admin-row textarea {
    grid-column: span 3;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.photo-grid.small {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

figure {
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    overflow: hidden;
}

figure img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    background: #eef2f7;
}

figcaption {
    padding: 8px;
    color: var(--muted);
    font-size: .82rem;
}

figure form {
    padding: 0 8px 8px;
}

.flash {
    width: min(1180px, calc(100% - 24px));
    margin: 10px auto;
    border-radius: 8px;
    padding: 10px 12px;
    font-weight: 700;
}

.flash.ok {
    background: #e7f8ec;
    color: var(--green);
}

.flash.bad {
    background: #fff1f0;
    color: var(--red);
}

.login-shell,
.setup {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-panel,
.setup {
    width: min(420px, 100%);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 24px;
}

.stack {
    display: grid;
    gap: 12px;
}

code {
    background: #eef2f7;
    border-radius: 6px;
    padding: 2px 5px;
}

@media (max-width: 780px) {
    .hero-row,
    .section-title,
    .work-header,
    .topbar {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar nav {
        justify-content: space-between;
        width: 100%;
    }

    .split,
    .admin-list {
        grid-template-columns: 1fr;
    }

    .task-row {
        grid-template-columns: 40px minmax(0, 1fr) auto;
    }

    .task-row .file-chip {
        grid-column: 2 / -1;
    }

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

    .task-admin-row textarea {
        grid-column: auto;
    }
}
