:root {
    --bg: #f3f1ec;
    --surface: #ffffff;
    --surface-soft: #f8f6f1;
    --border: #d8d2c6;
    --text: #1d2421;
    --muted: #66736d;
    --accent: #17624b;
    --accent-soft: #e5f1ec;
    --danger: #ab3d2f;
    --warning: #aa7a00;
    --shadow: 0 12px 32px rgba(27, 36, 33, 0.08);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", "Helvetica Neue", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(23, 98, 75, 0.08), transparent 26%),
        linear-gradient(180deg, #f5f3ee 0%, #efe9df 100%);
}
a { color: inherit; text-decoration: none; }
code { background: #f0ece4; padding: 0.15rem 0.35rem; border-radius: 6px; }

.app-shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.sidebar {
    background: #172432;
    color: #f7f5ef;
    padding: 2rem 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.brand { display: inline-block; font-size: 1.3rem; font-weight: 700; margin-bottom: 2rem; }
.nav { display: grid; gap: 0.65rem; }
.nav-link {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
}
.nav-link:hover { background: rgba(255, 255, 255, 0.11); }
.sidebar-footer { display: grid; gap: 1rem; }
.user-chip {
    display: grid;
    gap: 0.2rem;
    padding: 0.9rem 1rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 14px;
}
.main-content { padding: 2rem; }
.section-form { max-width: 1060px; margin: 0 auto; }
.page-header, .panel-heading, .summary-progress, .progress-row, .header-actions, .section-header-meta, .sticky-actions, .actions, .breadcrumb {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.page-header { margin-bottom: 1.5rem; }
.breadcrumb { margin-bottom: 1rem; color: var(--muted); flex-wrap: wrap; }
.breadcrumb-project-link {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text);
    font-weight: 600;
}
.eyebrow {
    display: inline-block;
    margin-bottom: 0.35rem;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.dashboard-grid, .grid {
    display: grid;
    gap: 1.5rem;
}
.dashboard-grid { grid-template-columns: 1.25fr 1fr; }
.admin-grid { grid-template-columns: 0.9fr 1.1fr; }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack { display: grid; gap: 1rem; }
.field, .checkbox-row {
    display: grid;
    gap: 0.45rem;
}
.is-hidden { display: none; }
.field span, .label, legend {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 600;
}
input, select, textarea, button {
    font: inherit;
}
input, select, textarea {
    width: 100%;
    padding: 0.85rem 0.95rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    color: var(--text);
}
textarea { resize: vertical; min-height: 88px; }
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.9rem 1.15rem;
    border: 0;
    border-radius: 14px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font-weight: 700;
}
.button-secondary {
    background: var(--surface-soft);
    color: var(--text);
    border: 1px solid var(--border);
}
.button-full { width: 100%; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    padding: 1rem 0.75rem;
    border-bottom: 1px solid #ebe4d8;
    text-align: left;
    vertical-align: top;
}
.muted { color: var(--muted); }
.alert {
    margin-bottom: 1rem;
    padding: 1rem 1.15rem;
    border-radius: 16px;
}
.alert-error {
    background: #f9e8e5;
    color: var(--danger);
    border: 1px solid #efc2bb;
}
.progress-bar {
    width: 180px;
    height: 10px;
    border-radius: 999px;
    background: #e7e1d7;
    overflow: hidden;
}
.progress-bar.large { width: 100%; max-width: 440px; height: 14px; }
.progress-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #17624b 0%, #2e8f6f 100%);
}
.status-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
}
.status-chip.neutral {
    background: #efe8db;
    color: #5a5145;
}
.section-list, .activity-list, .meta-grid, .summary-stats, .checklist-list {
    display: grid;
    gap: 1rem;
}
.meta-grid, .summary-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.section-card {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
}
.activity-item {
    display: grid;
    gap: 0.25rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid #ede5d8;
}
.checklist-item {
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 0.95rem 1rem;
    background: #fff;
}
.item-main {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.65rem;
}
.item-fields {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: minmax(0, 1.2fr) minmax(220px, 0.8fr);
}
.item-muted {
    opacity: 0.65;
    background: #f2efe8;
}
.compact select { min-width: 220px; }
.compact-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    white-space: nowrap;
    align-self: start;
    margin-top: 0.2rem;
}
.compact-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    min-width: 16px;
    padding: 0;
    border-radius: 4px;
}
.compact-checkbox span {
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 600;
}
.multi-options {
    display: grid;
    gap: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.85rem;
}
.note-field textarea {
    min-height: 68px;
}
.section-notes {
    margin-top: 1.75rem;
    padding-top: 1rem;
    border-top: 1px solid #ebe4d8;
}
.sticky-actions {
    position: sticky;
    bottom: 0;
    margin-top: 1.5rem;
    padding-top: 1rem;
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.96) 28%);
}
.autosave-status {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 600;
}
.autosave-status.is-success { color: var(--accent); }
.autosave-status.is-error { color: var(--danger); }
.standalone-page {
    min-height: calc(100vh - 4rem);
    display: grid;
    place-items: center;
    padding: 2rem;
}
.auth-card {
    width: 100%;
    max-width: 460px;
    padding: 2rem;
    background: rgba(255,255,255,0.96);
    border-radius: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.auth-card-wide { max-width: 760px; }
.print-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem;
}
.print-header, .print-section { margin-bottom: 2rem; }

@media (max-width: 1100px) {
    .dashboard-grid, .admin-grid, .two-col, .item-fields { grid-template-columns: 1fr; }
}

@media (max-width: 840px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { padding: 1.25rem; }
    .main-content { padding: 1.25rem; }
    .page-header, .panel-heading, .sticky-actions, .item-main, .summary-progress { flex-direction: column; align-items: stretch; }
    .progress-bar, .progress-bar.large { width: 100%; max-width: none; }
}

@media print {
    .print-mode { background: #fff; }
    .print-mode .status-chip { border: 1px solid #bbb; }
}
