* { box-sizing: border-box; }

body {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: #f3f5f7;
    margin: 0;
    color: #1f2933;
}

a { color: #1d4ed8; }

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

h1 { font-size: 1.45rem; margin-bottom: 0.25rem; }
h2 { font-size: 1.05rem; margin-bottom: 0; }
p { color: #64748b; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.25rem;
    padding: 0.45rem 0.85rem;
    border: 1px solid #1d4ed8;
    border-radius: 4px;
    background: #1d4ed8;
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}

.btn:hover { background: #1e40af; }

.btn-secondary {
    border-color: #cbd5e1;
    background: #fff;
    color: #334155;
}

.btn-secondary:hover { background: #f8fafc; }

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 1.25rem;
    color: #1e293b;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #1e293b;
    text-decoration: none;
    white-space: nowrap;
}

.brand-mark {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 2px;
    background: #16a34a;
}

.brand-name { font-weight: 650; font-size: 1.02rem; }

.nav-block { min-width: 0; }

.site-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    justify-content: flex-end;
}

.nav-link {
    color: #475569;
    text-decoration: none;
    padding: 0.4rem 0.65rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.nav-link:hover { background: #f1f5f9; }
.nav-link.active { color: #fff; background: #1d4ed8; }

.page-content {
    max-width: 1180px;
    margin: 0 auto;
    padding: 1.4rem 1.25rem 3rem;
}

body.wide-page .page-content { max-width: none; }

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel,
.form-panel,
.table-wrap,
.metric-card,
.alert {
    background: #fff;
    border: 1px solid #dbe3ea;
    border-radius: 8px;
}

.panel,
.form-panel { padding: 1rem; }

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.8rem;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.metric-card {
    display: block;
    padding: 1rem;
    text-decoration: none;
    color: #1f2933;
}

.metric-card strong {
    display: block;
    margin-top: 0.35rem;
    font-size: 1.65rem;
}

.metric-label {
    color: #64748b;
    font-size: 0.9rem;
}

.report-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.5rem;
}

.report-list a {
    display: block;
    padding: 0.75rem;
    border: 1px solid #dbe3ea;
    border-radius: 6px;
    background: #fff;
    text-decoration: none;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 0.48rem 0.55rem;
    color: #111827;
    background: #fff;
    font: inherit;
}

textarea {
    min-height: 6rem;
    resize: vertical;
}

.toolbar input,
.toolbar select { max-width: 24rem; }

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

.compact-form {
    display: grid;
    grid-template-columns: minmax(180px, 280px) minmax(220px, 1fr) auto;
    align-items: end;
    gap: 0.75rem;
    margin-bottom: 0.8rem;
}

.field {
    display: grid;
    gap: 0.3rem;
    color: #334155;
    font-size: 0.9rem;
}

.field-check {
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.5rem;
}

.field-check span { order: 2; }
.field-check input { order: 1; width: auto; }

.field-set {
    margin: 1rem 0 0;
    padding: 0.75rem;
    border: 1px solid #dbe3ea;
    border-radius: 6px;
}

.check-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.check-grid label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.check-grid input { width: auto; }

.actions { margin-top: 1rem; }

.alert {
    padding: 0.75rem;
    margin-bottom: 0.8rem;
    color: #991b1b;
    background: #fef2f2;
    border-color: #fecaca;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
    background: #fff;
}

th,
td {
    padding: 0.55rem 0.65rem;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: top;
    font-size: 0.9rem;
}

th {
    color: #475569;
    font-weight: 650;
    background: #f8fafc;
    text-transform: capitalize;
}

.pagination {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding-top: 0.8rem;
}

.site-footer {
    border-top: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 0.85rem;
    padding: 1rem 1.25rem;
    text-align: center;
}

@media (max-width: 720px) {
    .site-header,
    .page-head,
    .toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .site-nav { justify-content: flex-start; }

    .compact-form { grid-template-columns: 1fr; }
}
