:root {
    --ink: #1e2528;
    --muted: #627075;
    --line: #d8dedc;
    --paper: #f7f8f5;
    --panel: #ffffff;
    --accent: #1f7a64;
    --accent-dark: #145846;
    --warn: #9c3d2e;
    --soft: #e8f2ee;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--paper);
}

a {
    color: inherit;
}

.app-shell {
    width: min(100%, 980px);
    margin: 0 auto;
    padding: 16px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 3;
    background: rgba(247, 248, 245, 0.96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(8px);
}

.topbar-inner {
    width: min(100%, 980px);
    margin: 0 auto;
    padding: 12px 16px;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.brand h1 {
    margin: 0;
    font-size: 1.15rem;
    letter-spacing: 0;
}

.brand span {
    display: block;
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 2px;
}

.nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.nav a,
.button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 11px;
    background: var(--panel);
    color: var(--ink);
    text-decoration: none;
    font-weight: 650;
    font-size: 0.92rem;
}

.nav a.active,
.button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.button.danger {
    border-color: #f0c2bb;
    color: var(--warn);
}

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

.two-col {
    grid-template-columns: 1fr;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}

.panel h2,
.panel h3 {
    margin: 0 0 10px;
    font-size: 1rem;
}

.muted {
    color: var(--muted);
}

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

.item {
    display: grid;
    gap: 8px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 5px solid var(--accent);
    border-radius: 8px;
    padding: 12px;
    text-decoration: none;
}

.item.overdue {
    border-left-color: var(--warn);
}

.item-title {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-weight: 750;
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 3px 9px;
    background: var(--soft);
    color: var(--accent-dark);
    font-size: 0.78rem;
    font-weight: 750;
    white-space: nowrap;
}

.pill.warn {
    background: #f8e5e0;
    color: var(--warn);
}

.form-grid {
    display: grid;
    gap: 12px;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
    font-size: 0.88rem;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid #c9d1cf;
    border-radius: 8px;
    padding: 10px 11px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

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

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.inline-actions {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.inline-actions a {
    font-weight: 750;
}

.inline-actions a:last-child {
    color: var(--warn);
}

.notice {
    border: 1px solid #b9d9cd;
    background: #eef8f4;
    color: #134f3f;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    font-weight: 650;
}

.note-block {
    display: grid;
    gap: 8px;
    border-top: 1px solid var(--line);
    padding-top: 12px;
    margin-top: 12px;
}

.report-list {
    display: grid;
    gap: 8px;
}

.report-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.report-row span {
    color: var(--muted);
    overflow-wrap: anywhere;
}

@media (min-width: 760px) {
    .two-col {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .wide {
        grid-column: 1 / -1;
    }

    .report-row {
        grid-template-columns: 1.2fr 0.8fr 0.8fr 1.4fr;
        align-items: center;
    }
}

@media (max-width: 520px) {
    .app-shell {
        padding: 12px;
    }

    .nav {
        grid-template-columns: repeat(2, 1fr);
    }

    .brand {
        align-items: flex-start;
        flex-direction: column;
    }
}
