:root {
    --bg: #f4f6f9;
    --card: #ffffff;
    --text: #1c2733;
    --muted: #667483;
    --border: #d9e0e7;
    --primary: #1769aa;
    --primary-dark: #0e4e82;
    --danger: #b42318;
    --success: #207a4a;
    --warning: #8a5a00;
    --info: #0b7285;
    --shadow: 0 8px 24px rgba(21, 43, 64, .08);
}
* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { width: min(1220px, calc(100% - 32px)); margin: 0 auto; }
.topbar { background: #0f2942; color: white; box-shadow: 0 2px 8px rgba(0,0,0,.16); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; }
.brand { color: white; font-size: 20px; font-weight: 750; letter-spacing: .2px; }
.brand:hover { text-decoration: none; }
.brand span { font-size: 12px; padding: 3px 6px; background: #2f80c2; border-radius: 999px; vertical-align: middle; }
.main-nav { display: flex; gap: 18px; }
.main-nav a { color: #dce9f4; }
.page { padding: 28px 0 56px; min-height: calc(100vh - 122px); }
.footer { border-top: 1px solid var(--border); color: var(--muted); padding: 18px 0; background: white; font-size: 13px; }
h1, h2, h3 { line-height: 1.2; }
h1 { margin: 0 0 18px; font-size: 30px; }
h2 { margin: 0 0 14px; font-size: 22px; }
h3 { margin: 0 0 12px; font-size: 17px; }
.subtitle { color: var(--muted); margin-top: -8px; }
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 22px;
    margin-bottom: 20px;
}
.card-header { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 8px 13px;
    background: #e8edf2;
    color: #1d2d3d;
    font-weight: 650;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: #fff1f0; border-color: #f7c7c3; color: var(--danger); }
.btn-success { background: #e9f7ef; border-color: #b9e2c9; color: var(--success); }
.btn-warning { background: #fff7df; border-color: #ead497; color: var(--warning); }
.btn-ghost { background: white; border-color: var(--border); }
.btn-sm { min-height: 32px; padding: 5px 9px; font-size: 13px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-group { margin-bottom: 15px; }
label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.help { display: block; color: var(--muted); font-size: 12px; margin-top: 5px; }
input, select, textarea {
    width: 100%;
    border: 1px solid #bcc8d3;
    border-radius: 8px;
    background: white;
    color: var(--text);
    padding: 10px 11px;
    font: inherit;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(23,105,170,.15); border-color: var(--primary); }
input[type="checkbox"] { width: auto; }
.checkbox-line { display: flex; gap: 9px; align-items: center; font-weight: 600; }
.checkbox-line label { margin: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { border-bottom: 1px solid var(--border); text-align: left; padding: 11px 10px; vertical-align: top; font-size: 14px; }
th { color: #405162; background: #f7f9fb; font-size: 13px; }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-block; border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 750; }
.badge-neutral { background: #e7ebef; color: #405162; }
.badge-warning { background: #fff0c2; color: #775000; }
.badge-success { background: #dcefe4; color: #17633a; }
.badge-info { background: #d9f0f4; color: #075a68; }
.badge-dark { background: #243b53; color: white; }
.progress { height: 8px; border-radius: 99px; background: #e7edf3; overflow: hidden; min-width: 120px; }
.progress > span { display: block; height: 100%; background: var(--primary); }
.alert { border-radius: 9px; padding: 12px 14px; margin-bottom: 16px; border: 1px solid; }
.alert-success { background: #eaf7ef; border-color: #b9e1c8; color: #185c38; }
.alert-error { background: #fff0ef; border-color: #efc1bd; color: #8b1d16; }
.alert-warning { background: #fff8e5; border-color: #ead79c; color: #6e4b00; }
.alert-info { background: #eaf5fb; border-color: #bfdbea; color: #174f70; }
.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.login-shell { max-width: 460px; margin: 70px auto; }
.login-shell .card { padding: 30px; }
.section-nav {
    position: sticky;
    top: 10px;
    z-index: 5;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    background: rgba(244,246,249,.96);
    padding: 10px 0 14px;
    margin-bottom: 12px;
}
.section-nav a { white-space: nowrap; background: white; border: 1px solid var(--border); border-radius: 999px; padding: 7px 11px; font-size: 13px; font-weight: 700; color: #30465a; }
.section-nav a:hover { text-decoration: none; border-color: var(--primary); color: var(--primary); }
.section-title { scroll-margin-top: 85px; border-left: 5px solid var(--primary); padding-left: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: white; border: 1px solid var(--border); border-radius: 10px; padding: 15px; }
.kpi strong { display: block; font-size: 24px; }
.kpi span { color: var(--muted); font-size: 13px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.inline-form { display: inline; }
.warning-list, .error-list { margin: 8px 0 0; padding-left: 22px; }
.locked-banner { background: #edf2f7; border: 1px solid #cbd5df; border-radius: 9px; padding: 12px 14px; margin-bottom: 16px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #eef2f5; border-radius: 5px; padding: 2px 5px; }
@media (max-width: 900px) {
    .grid-4, .grid-3, .grid-2, .kpi-row { grid-template-columns: 1fr; }
    .card-header { flex-direction: column; }
    .topbar-inner { align-items: flex-start; padding: 14px 0; }
}
.plain-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.repeat-row { border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin: 12px 0; background: #fbfcfd; }
.danger-check { color: var(--danger); }
button:disabled, input:disabled, select:disabled, textarea:disabled { opacity: .72; cursor: not-allowed; }
