:root {
    color-scheme: light;
    font: 100%/1.5 system-ui, sans-serif;
    color: #172321;
    background: #f2f5f4;
    --accent: #16594f;
    --border: #d2ddd9;
    --muted: #4b5b57;
}

* { box-sizing: border-box; }
body { margin: 0; }
h1, h2, p, dl { margin: 0; }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); line-height: 1.12; }
h2 { font-size: 1.125rem; margin-bottom: 1rem; }
a { color: var(--accent); text-underline-offset: .18em; }
button, input, select { font: inherit; }
small { font-size: .875rem; }

.wrap { width: min(72rem, 100% - 2.5rem); margin-inline: auto; }
.topbar { background: #fff; border-bottom: 1px solid var(--border); }
.topbar-inner { min-height: 4.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { text-decoration: none; font-weight: 800; font-size: 1.125rem; color: #1a3531; }
.topbar-links { display: flex; align-items: center; gap: .25rem; }
.topbar-menu { display: none; position: relative; }
.topbar-menu summary { white-space: nowrap; }
.menu-items { position: absolute; inset-inline-end: 0; z-index: 2; min-width: 12rem; margin-top: .4rem; padding: .35rem; border: 1px solid var(--border); border-radius: .5rem; background: #fff; box-shadow: 0 .4rem 1rem #17232119; }
.nav-items a, .nav-items button { display: block; padding: .55rem .7rem; border: 0; border-radius: .25rem; background: transparent; color: #172321; text-align: start; text-decoration: none; white-space: nowrap; cursor: pointer; }
.nav-items a:hover, .nav-items button:hover, .nav-items [aria-current] { background: #e8f3ef; }
.menu-items button { width: 100%; }
.main { padding-block: clamp(1.5rem, 4vw, 3rem); }
.stack { display: grid; gap: 1rem; }
.form-page { max-width: 42rem; }
.panel { background: #fff; border: 1px solid var(--border); border-radius: .75rem; padding: clamp(1rem, 3vw, 1.5rem); min-width: 0; }
.login { max-width: 28rem; margin: 2.5rem auto; }
.login h1 { margin-bottom: 1.5rem; }
.login .button { justify-self: start; }
label { display: grid; gap: .35rem; font-size: .9375rem; font-weight: 650; }
label small { color: var(--muted); font-weight: 400; }
input, select { min-width: 0; width: 100%; padding: .57rem .68rem; border: 1px solid #9cafa9; border-radius: .35rem; color: #172321; background: #fff; }
input[type="file"] { font-size: .9rem; padding: .45rem; }
input::file-selector-button { font: inherit; padding: .32rem .5rem; margin-right: .65rem; border: 1px solid var(--border); border-radius: .25rem; background: #f2f5f4; color: #172321; cursor: pointer; }
:focus-visible { outline: 2px solid #1c796b; outline-offset: 3px; }
.button { display: inline-block; border: 1px solid var(--accent); border-radius: .35rem; padding: .45rem .8rem; background: var(--accent); color: #fff; cursor: pointer; font-weight: 650; font-size: .9rem; text-decoration: none; }
.button-light { background: #fff; border-color: #9aada6; color: var(--accent); }
.button-danger { background: #fff; border-color: #c58d88; color: #932b26; }
.button:hover:not(:disabled) { filter: brightness(.93); }
.button:disabled { opacity: .55; cursor: default; }
.muted { color: var(--muted); }
.panel > .muted { margin-top: 1rem; }
.error { color: #932b26; font-size: .9rem; }
.notice { border: 1px solid #afc6be; background: #e8f3ef; border-radius: .4rem; padding: .6rem .8rem; }
.section-heading, .actions { display: flex; justify-content: space-between; align-items: center; gap: .65rem; flex-wrap: wrap; }
.section-heading h2 { margin: 0; }
.section-heading > div > p { margin-top: .3rem; }
.status { display: inline-block; border-radius: .3rem; padding: .15rem .45rem; background: #eff2f1; color: #354642; font-size: .875rem; font-weight: 650; }
.status-running, .status-archived, .status-completed { background: #dfefe9; color: #215247; }
.status-paused, .status-accepted, .status-uncertain, .status-attention, .status-archive_pending { background: #fbecd4; color: #684313; }
.status-failed, .status-missing_account { background: #f8e4e2; color: #932b26; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: .75rem .6rem; vertical-align: top; border-bottom: 1px solid var(--border); }
th { font-size: .875rem; color: #40534d; }
table small { display: block; color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
.metrics { display: grid; grid-template-columns: repeat(6, 1fr); gap: .6rem; }
.metric { padding: .8rem .85rem; border: 1px solid var(--border); border-radius: .45rem; background: #fff; }
.metric dt { color: var(--muted); font-size: .875rem; }
.metric dd { margin: 0; font-size: 1.5rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.row-actions { justify-content: start; margin-top: .4rem; }
.pagination { display: flex; gap: .75rem; align-items: center; justify-content: end; margin-top: 1rem; font-size: .9rem; }
.filter { display: flex; align-items: center; }
.back { font-size: .9rem; }
.mail-preview { display: block; width: 100%; height: clamp(22rem, 64vh, 42rem); border: 1px solid var(--border); background: #fff; }
.contact-form { margin-block: 1rem; padding: 1rem; background: #f5f8f7; border: 1px solid var(--border); border-radius: .4rem; }
.contact-fields { display: grid; gap: .65rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.contact-fields .error { color: #932b26; }

@media (max-width: 48rem) {
    .topbar-links { display: none; }
    .topbar-menu { display: block; }
    .metrics { grid-template-columns: repeat(3, 1fr); }
    .contact-fields { grid-template-columns: 1fr; }
}

@media (max-width: 30rem) {
    .wrap { width: calc(100% - 1.25rem); }
    .metrics { grid-template-columns: repeat(2, 1fr); }
}
