:root {
    --navy: #0D1C3F;
    --navy-2: #122139;
    --yellow: #FAD41B;
    --yellow-hover: #e8c20a;
    --ink: #172033;
    --muted: #667085;
    --surface: #ffffff;
    --canvas: #f3f6fb;
    --border: #dce3ed;
    --green: #067647;
    --green-bg: #ecfdf3;
    --red: #b42318;
    --red-bg: #fef3f2;
    --orange: #b54708;
    --orange-bg: #fffaeb;
    --blue: #175cd3;
    --blue-bg: #eff8ff;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--canvas);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 100% 0, rgba(250, 212, 27, .10), transparent 25rem),
        var(--canvas);
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { color: var(--navy); font-size: clamp(1.75rem, 3vw, 2.45rem); letter-spacing: -.035em; }
h2 { color: var(--navy); letter-spacing: -.02em; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    min-height: 68px;
    padding: .65rem clamp(1rem, 3vw, 2.5rem);
    color: white;
    background: linear-gradient(110deg, var(--navy), var(--navy-2));
    border-bottom: 3px solid var(--yellow);
    box-shadow: 0 8px 24px rgba(13, 28, 63, .18);
}
.brand { display: inline-flex; align-items: center; gap: .7rem; color: white; font-weight: 800; white-space: nowrap; }
.brand:hover { color: white; }
.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    color: var(--navy);
    background: var(--yellow);
    font-size: .78rem;
    letter-spacing: .05em;
}
.nav-links { margin-left: auto; display: flex; align-items: center; gap: .25rem; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-link, .nav-button {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: .55rem .75rem;
    border: 0;
    border-radius: 9px;
    color: #d9e1ee;
    background: transparent;
    font: inherit;
    font-weight: 650;
    white-space: nowrap;
    cursor: pointer;
}
.nav-link:hover, .nav-link.active, .nav-button:hover { color: white; background: rgba(255,255,255,.1); }
.nav-link.active { box-shadow: inset 0 -2px var(--yellow); }
.logout-form { margin: 0; }

.container { width: min(1440px, 100%); margin: 0 auto; padding: clamp(1.25rem, 3vw, 2.5rem); }
.container.narrow { width: min(860px, 100%); }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.page-header h1 { margin-bottom: .35rem; }
.page-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; }
.eyebrow { margin-bottom: .35rem; color: #8a7200; font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.card {
    margin-bottom: 1.15rem;
    padding: clamp(1rem, 2vw, 1.5rem);
    background: rgba(255,255,255,.97);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 8px 28px rgba(13, 28, 63, .07);
}
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.card-header h2 { margin: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.metric-card { position: relative; overflow: hidden; min-height: 150px; border-top: 4px solid var(--yellow); }
.metric-card::after { content: ""; position: absolute; right: -30px; bottom: -55px; width: 130px; height: 130px; border-radius: 50%; background: rgba(250,212,27,.16); }
.metric { margin-top: .45rem; color: var(--navy); font-size: clamp(2rem, 5vw, 3rem); font-weight: 850; line-height: 1; }
.quick-link { display: block; color: inherit; transition: transform .18s ease, box-shadow .18s ease; }
.quick-link:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(13,28,63,.11); }

.alert { padding: .85rem 1rem; margin-bottom: 1rem; color: var(--green); background: var(--green-bg); border: 1px solid #abefc6; border-radius: 12px; }
.alert.warning { color: var(--orange); background: var(--orange-bg); border-color: #fedf89; }
.alert.error-alert { color: var(--red); background: var(--red-bg); border-color: #fecdca; }
.error { margin-top: .3rem; color: var(--red); font-size: .88rem; }

.button, button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 42px;
    padding: .65rem 1rem;
    color: var(--navy);
    background: var(--yellow);
    border: 1px solid var(--yellow);
    border-radius: 10px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.button:hover, button:hover { color: var(--navy); background: var(--yellow-hover); border-color: var(--yellow-hover); transform: translateY(-1px); }
.button.secondary, button.secondary { color: white; background: var(--navy); border-color: var(--navy); }
.button.outline, button.outline { color: var(--navy); background: white; border-color: #aab7ca; }
.button.danger, button.danger { color: white; background: var(--red); border-color: var(--red); }
.button.small-button { min-height: 34px; padding: .4rem .7rem; font-size: .86rem; }
.button.disabled { pointer-events: none; opacity: .4; }
.inline { display: inline; }
.button-row { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1rem; }

label { display: block; margin: .8rem 0 .35rem; color: var(--navy); font-weight: 750; }
input, select, textarea {
    width: 100%;
    min-height: 44px;
    padding: .7rem .8rem;
    color: var(--ink);
    background: white;
    border: 1px solid #b9c4d3;
    border-radius: 10px;
    font: inherit;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { min-height: 100px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--navy); box-shadow: 0 0 0 4px rgba(250,212,27,.28); }
input[type="checkbox"] { width: 18px; min-height: 18px; accent-color: var(--navy); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.filter-grid { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(180px, 1fr) auto; gap: 1rem; align-items: end; }
.filter-grid button { margin-bottom: 0; }
.check-grid { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .45rem; }
.check-option { display: inline-flex; align-items: center; gap: .45rem; margin: 0; padding: .65rem .8rem; background: #f7f9fc; border: 1px solid var(--border); border-radius: 10px; }
.toggle-row { display: flex; align-items: flex-start; gap: .65rem; padding: .9rem; margin-top: 1rem; background: #f7f9fc; border: 1px solid var(--border); border-radius: 12px; }
.toggle-row label { margin: 0; }

.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 13px; }
table { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0; background: white; }
th, td { padding: .82rem .9rem; text-align: left; vertical-align: middle; border-bottom: 1px solid #e8edf3; }
th { color: #44516a; background: #f7f9fc; font-size: .76rem; font-weight: 850; letter-spacing: .055em; text-transform: uppercase; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fffdf2; }
td { max-width: 280px; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.cell-title { display: block; color: var(--navy); font-weight: 750; }
.cell-subtitle { display: block; margin-top: .18rem; color: var(--muted); font-size: .78rem; }
.empty-state { padding: 2.5rem 1rem; text-align: center; color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .28rem .58rem; border-radius: 999px; font-size: .74rem; font-weight: 850; letter-spacing: .025em; white-space: nowrap; }
.status-paid, .status-success, .status-active, .severity-low { color: var(--green); background: var(--green-bg); }
.status-not-paid, .status-failed, .status-failure, .status-disabled, .severity-high, .severity-critical { color: var(--red); background: var(--red-bg); }
.status-pending, .severity-medium { color: var(--orange); background: var(--orange-bg); }
.status-neutral, .severity-info { color: var(--blue); background: var(--blue-bg); }
.provider-list { display: flex; flex-wrap: wrap; gap: .35rem; }
.provider { color: var(--navy); background: #edf1f7; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 1rem; }
.page-count { color: var(--muted); font-size: .9rem; text-align: center; }
.page-buttons { display: flex; gap: .5rem; }
.page-size { display: flex; align-items: center; gap: .45rem; color: var(--muted); font-size: .85rem; }
.page-size select { width: auto; min-height: 36px; padding: .35rem 1.8rem .35rem .55rem; }

.secret { padding: 1rem; overflow-x: auto; color: #e9eef7; background: var(--navy-2); border-radius: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-all; }
code { padding: .18rem .35rem; color: #344054; background: #eef2f7; border-radius: 5px; font-size: .82rem; }

.auth-page { display: grid; min-height: 100vh; place-items: center; padding: 1.2rem; background: linear-gradient(135deg, var(--navy) 0 55%, var(--navy-2) 55% 100%); }
.auth-shell { display: grid; grid-template-columns: minmax(280px, .9fr) minmax(340px, 1fr); width: min(940px, 100%); overflow: hidden; background: white; border-radius: 24px; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.auth-brand { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 520px; padding: clamp(2rem, 5vw, 3.3rem); color: white; background: linear-gradient(145deg, #122b60, var(--navy)); overflow: hidden; }
.auth-brand::after { content: ""; position: absolute; right: -100px; bottom: -120px; width: 320px; height: 320px; border: 55px solid rgba(250,212,27,.2); border-radius: 50%; }
.auth-brand h1 { position: relative; z-index: 1; color: white; font-size: clamp(2.1rem, 5vw, 3.4rem); }
.auth-brand p { position: relative; z-index: 1; color: #cbd5e5; line-height: 1.7; }
.auth-logo { position: relative; z-index: 1; display: flex; align-items: center; gap: .75rem; font-weight: 850; }
.auth-card { display: flex; flex-direction: column; justify-content: center; padding: clamp(2rem, 6vw, 4.2rem); }
.auth-card h2 { margin-bottom: .45rem; font-size: 2rem; }
.auth-card button { width: 100%; margin-top: 1.2rem; }
.otp-input { text-align: center; font-size: 1.8rem; font-weight: 800; letter-spacing: .45em; }

@media (max-width: 900px) {
    .topbar { align-items: flex-start; flex-direction: column; gap: .45rem; }
    .nav-links { width: 100%; margin-left: 0; padding-bottom: .15rem; }
    .filter-grid { grid-template-columns: 1fr 1fr; }
    .filter-grid .filter-action { grid-column: 1 / -1; }
    .auth-shell { grid-template-columns: 1fr; width: min(520px, 100%); }
    .auth-brand { min-height: 235px; }
}

@media (max-width: 640px) {
    .container { padding: 1rem; }
    .page-header, .card-header, .pagination { align-items: stretch; flex-direction: column; }
    .page-actions, .page-actions .button { width: 100%; }
    .form-grid, .filter-grid { grid-template-columns: 1fr; }
    .filter-grid .filter-action, .form-grid .full { grid-column: auto; }
    .page-buttons { display: grid; grid-template-columns: 1fr 1fr; }
    .auth-brand { min-height: 205px; padding: 1.6rem; }
    .auth-brand h1 { font-size: 2rem; }
    .auth-card { padding: 1.6rem; }
}
