:root {
    --ink: #17202a;
    --muted: #637083;
    --paper: #f4f6f8;
    --card: #ffffff;
    --navy: #10283f;
    --navy-soft: #1b3b58;
    --accent: #17a673;
    --accent-dark: #087c54;
    --warning: #f3ad25;
    --danger: #d94b4b;
    --line: #dce2e8;
    --shadow: 0 10px 28px rgba(16, 40, 63, .09);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--paper);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }

.topbar {
    min-height: 72px;
    padding: 0 4vw;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    color: #fff;
    background: var(--navy);
    border-bottom: 4px solid var(--accent);
}
.brand { display: flex; align-items: center; gap: 2px; color: #fff; text-decoration: none; font-size: 28px; font-weight: 800; }
.brand-mark { display: inline-grid; place-items: center; width: 38px; height: 38px; margin-right: 3px; border-radius: 10px; background: var(--accent); }
.brand small { margin-left: 10px; padding: 5px 8px; border-radius: 6px; color: var(--navy); background: #d8fff1; font-size: 10px; letter-spacing: .13em; }
.topnav { display: flex; align-items: center; gap: 22px; }
.topnav a { color: #fff; text-decoration: none; }
.topnav a:hover { color: #bff5e2; }
.topnav-user { color: #b9c7d3; }

.page-shell { width: min(1440px, 92vw); margin: 0 auto; padding: 42px 0 70px; }
.eyebrow { margin: 0 0 7px; color: var(--accent-dark); font-size: 12px; font-weight: 800; letter-spacing: .17em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(34px, 5vw, 50px); letter-spacing: -.04em; }
h2 { margin: 34px 0 8px; font-size: 24px; }
h3 { margin: 0 0 8px; }
.lead { margin: 9px 0 28px; color: var(--muted); font-size: 17px; }

.context-bar {
    display: grid;
    grid-template-columns: repeat(3, minmax(170px, 1fr)) auto;
    gap: 14px;
    margin: 0 0 28px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow);
}
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 13px; font-weight: 700; }
.field input, .field select, .field textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #c8d0d9;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
}
.field textarea { min-height: 100px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid rgba(23,166,115,.18); border-color: var(--accent); }
.field-help { color: var(--muted); font-size: 12px; }

.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 16px; }
.metric-card {
    min-height: 132px;
    padding: 23px;
    border-radius: 14px;
    color: #fff;
    background: var(--navy);
    box-shadow: var(--shadow);
    text-decoration: none;
    transition: transform .15s ease, background .15s ease;
}
.metric-card:hover { transform: translateY(-2px); background: var(--navy-soft); }
.metric-number { display: block; margin-bottom: 9px; color: #5ee3b4; font-size: 38px; font-weight: 800; line-height: 1; }
.metric-label { font-size: 15px; }
.metric-card.warning .metric-number { color: #ffd16f; }
.metric-card.danger .metric-number { color: #ff9f9f; }

.tabs { display: flex; flex-wrap: wrap; gap: 9px; margin: 16px 0 25px; }
.tab {
    padding: 10px 15px;
    border: 1px solid #cfd6de;
    border-radius: 9px;
    color: var(--ink);
    background: #fff;
    cursor: pointer;
    font-weight: 700;
}
.tab:hover, .tab.active { border-color: var(--accent); color: #fff; background: var(--accent); }
.module-grid { display: grid; grid-template-columns: repeat(3, minmax(240px, 1fr)); gap: 18px; }
.update-summary-grid { grid-template-columns: repeat(2, minmax(300px, 1fr)); margin-bottom: 30px; }
.module-card { position: relative; min-height: 230px; padding: 22px; border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 12px; background: var(--card); box-shadow: var(--shadow); }
.module-card[hidden] { display: none; }
.module-kicker { margin-bottom: 11px; color: var(--accent-dark); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.module-card p { margin: 0 0 22px; color: var(--muted); line-height: 1.55; }
.module-card .button { position: absolute; left: 22px; bottom: 22px; }
.badge { display: inline-block; margin-left: 7px; padding: 3px 7px; border-radius: 999px; color: #6e4a00; background: #fff0bf; font-size: 11px; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 43px; padding: 10px 16px; border: 0; border-radius: 8px; color: #fff; background: var(--accent); text-decoration: none; font-weight: 800; cursor: pointer; }
.button:hover { background: var(--accent-dark); }
.button-secondary { color: var(--ink); background: #e7edf2; }
.button-secondary:hover { background: #d5dee6; }
.button-danger { background: var(--danger); }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }

.panel { padding: 25px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 17px; }
.form-grid .wide { grid-column: 1 / -1; }
.login-shell { width: min(470px, 92vw); margin: 8vh auto; }
.login-shell .panel { padding: 32px; }
.login-shell .brand-login { margin: 0 0 25px; color: var(--navy); font-size: 34px; font-weight: 900; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: #526170; background: #eef2f5; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: 0; }
.empty-state { padding: 42px; color: var(--muted); text-align: center; }
.toolbar { display: flex; justify-content: space-between; gap: 14px; align-items: end; margin: 20px 0; }
.toolbar .field { flex: 1; max-width: 420px; }

.alert { margin: 0 0 18px; padding: 14px 17px; border-radius: 9px; }
.alert-success { color: #075c3e; background: #d9f7ec; }
.alert-error { color: #7c2020; background: #ffe0e0; }
.errors { margin: 0 0 20px; padding: 15px 20px 15px 38px; border-radius: 9px; color: #7c2020; background: #ffe0e0; }
.footer { padding: 22px 4vw; color: #738091; text-align: center; border-top: 1px solid var(--line); background: #fff; }

@media (max-width: 1100px) {
    .metric-grid { grid-template-columns: repeat(3, 1fr); }
    .module-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
    .topbar { align-items: flex-start; padding-top: 16px; padding-bottom: 16px; }
    .topnav { justify-content: flex-end; flex-wrap: wrap; gap: 10px 16px; font-size: 14px; }
    .topnav-user { display: none; }
    .page-shell { width: min(94vw, 700px); padding-top: 28px; }
    .context-bar, .form-grid { grid-template-columns: 1fr; }
    .form-grid .wide { grid-column: auto; }
    .metric-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .metric-card { min-height: 112px; padding: 18px; }
    .metric-number { font-size: 31px; }
    .module-grid { grid-template-columns: 1fr; }
    .update-summary-grid { grid-template-columns: 1fr; }
    .tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 7px; }
    .tab { flex: 0 0 auto; }
    .toolbar { align-items: stretch; flex-direction: column; }
    .toolbar .field { max-width: none; }
}

