:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  --bg: #0c1322; --surface: #151f31; --surface-raised: #1b2940;
  --line: #2b3a52; --text: #edf2fc; --muted: #a9b8ce;
  --accent: #b29aff; --accent-deep: #7b5ce1; --success: #6ce0aa;
  --danger: #ff8d9d; --radius: 18px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 80% -10%, #222448 0, transparent 34%), var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
a { color: #c3b3ff; text-underline-offset: 3px; overflow-wrap: anywhere; }
a:hover { color: #eee7ff; }
button, input, select { font: inherit; }
button, .button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 9px 15px; border: 1px solid transparent; border-radius: 11px; background: var(--accent-deep); color: #fff; font-weight: 650; text-decoration: none; cursor: pointer; transition: background .15s ease, transform .15s ease; }
button:hover, .button:hover { background: #9274f5; color: #fff; }
button:active, .button:active { transform: translateY(1px); }
button.danger { background: #a83953; }
button.danger:hover { background: #c54a65; }
:focus-visible { outline: 3px solid #d9ccff; outline-offset: 3px; }
input, select { min-height: 42px; max-width: 100%; padding: 9px 12px; border: 1px solid #40506a; border-radius: 10px; background: #10192a; color: var(--text); }
input::placeholder { color: #91a0b5; }
input:focus, select:focus { border-color: var(--accent); outline: 2px solid #a78bfa55; }
input[type="checkbox"] { width: 18px; min-height: 18px; accent-color: var(--accent-deep); vertical-align: middle; }
label { color: var(--muted); font-size: 13px; font-weight: 650; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(27px, 3vw, 36px); letter-spacing: -.035em; line-height: 1.15; margin-bottom: 10px; }
h2 { font-size: 19px; letter-spacing: -.02em; margin-bottom: 15px; }
h3 { font-size: 16px; margin-bottom: 14px; }
small, .muted { color: var(--muted); }
.topbar { position: sticky; top: 0; z-index: 10; border-bottom: 1px solid var(--line); background: #101827ed; backdrop-filter: blur(16px); }
.topbar-inner { max-width: 1460px; margin: auto; padding: 13px 28px; display: flex; align-items: center; gap: 28px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; flex: none; }
.brand:hover { color: var(--text); }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: linear-gradient(135deg, #7257d7, #ca70b6); color: #fff; font-weight: 800; font-size: 14px; letter-spacing: -.04em; }
.brand-name { display: block; font-weight: 800; font-size: 15px; line-height: 1.1; }
.brand-caption { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.nav-links { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; }
.nav-links a, .mobile-nav a { color: var(--muted); text-decoration: none; font-weight: 650; border-radius: 10px; }
.nav-links a { padding: 9px 11px; font-size: 13px; white-space: nowrap; }
.nav-links a:hover, .mobile-nav a:hover { background: #28344a; color: var(--text); }
.nav-links a.active, .mobile-nav a.active { background: #3b315f; color: #f4edff; }
.mobile-nav { display: none; margin-left: auto; position: relative; }
.mobile-nav summary { list-style: none; min-height: 42px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; font-weight: 700; }
.mobile-nav summary::-webkit-details-marker { display: none; }
.mobile-nav[open] summary { background: var(--surface-raised); }
.mobile-nav-list { position: absolute; right: 0; top: calc(100% + 8px); width: min(280px, calc(100vw - 30px)); padding: 8px; border: 1px solid var(--line); border-radius: 15px; background: #1b2940; box-shadow: 0 18px 40px #050a16aa; }
.mobile-nav-list a { display: block; padding: 12px; }
.logout-form { margin-left: auto; }
.logout-form button { min-height: 38px; padding: 7px 12px; border-color: var(--line); background: transparent; color: var(--muted); }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-shell { width: min(430px, 100%); }
.login-card { padding: 30px; border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(150deg, #1a263b, var(--surface)); box-shadow: 0 24px 70px #05091488; }
.login-brand { margin-bottom: 28px; }
.login-form { display: grid; gap: 9px; margin-top: 22px; }
.login-form input { width: 100%; margin-bottom: 8px; }
.login-form button { margin-top: 8px; }
.login-error { padding: 10px 12px; border: 1px solid #7a3046; border-radius: 10px; background: #462334; color: var(--danger); }
.wrap { max-width: 1460px; margin: auto; padding: 32px 28px 72px; }
.page-header { margin-bottom: 24px; }
.page-header .muted { margin: 0; max-width: 70ch; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 20px 0 28px; }
.card, .panel, .form-panel { background: linear-gradient(150deg, #1a263b, var(--surface)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 28px #070b171f; }
.card { min-width: 0; padding: 19px; color: var(--muted); font-size: 13px; font-weight: 650; }
.card .metric { margin-top: 9px; color: var(--text); font-size: clamp(25px, 2.8vw, 34px); font-weight: 780; line-height: 1.08; letter-spacing: -.04em; overflow-wrap: anywhere; }
.card:first-child { border-color: #62548c; background: linear-gradient(145deg, #2b2850, #1b263d); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid > * { min-width: 0; }
.panel, .form-panel { padding: 20px; margin-bottom: 20px; }
.panel h2, .form-panel h2 { margin-top: 0; }
.provider-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.provider-heading h2 { margin-bottom: 5px; }
.provider-heading p { margin-bottom: 0; }
.provider-cards { margin: 18px 0 14px; }
.provider-note { margin: 0; color: var(--muted); font-size: 13px; }
.provider-note strong { color: var(--text); }
.provider-error { margin: 14px 0 0; border: 1px dashed var(--line); border-radius: 12px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 24px; }
.toolbar a, .pagination a { display: inline-flex; align-items: center; min-height: 40px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 700; text-decoration: none; }
.toolbar a:hover, .pagination a:hover { color: var(--text); background: var(--surface-raised); }
.toolbar a.active { color: #fff; background: #59469d; border-color: #7963c1; }
.table-scroll { overflow-x: auto; scrollbar-color: #53617a transparent; }
table { width: 100%; border-collapse: collapse; table-layout: auto; }
th, td { padding: 13px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .065em; white-space: nowrap; }
td { font-size: 13px; overflow-wrap: anywhere; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #ffffff06; }
.status { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 750; background: #26334a; color: #b9c8e0; }
.status.ok, .ok { color: var(--success); }
.status.ok { background: #17382f; }
.status.bad, .bad { color: var(--danger); }
.status.bad { background: #462334; }
.status.pending { color: #f4c985; background: #473826; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.inline-form input { min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-field.wide { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.form-actions button { min-width: 150px; }
.pagination { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 16px; }
.bar { height: 8px; min-width: 90px; border-radius: 999px; overflow: hidden; background: #334155; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.empty { padding: 24px 12px; color: var(--muted); text-align: center; }
@media (max-width: 980px) { .nav-links { display: none; } .mobile-nav { display: block; } }
@media (max-width: 760px) {
  .topbar-inner { padding: 10px 16px; }
  .wrap { padding: 24px 16px 64px; }
  .grid { grid-template-columns: 1fr; gap: 0; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card { padding: 16px; }
  .panel, .form-panel { padding: 16px; }
  .data-table thead { display: none; }
  .data-table tbody, .data-table tr { display: block; }
  .data-table tr { margin: 10px 0; border: 1px solid var(--line); border-radius: 13px; background: #121c2d; overflow: hidden; }
  .data-table td { display: grid; grid-template-columns: minmax(96px, 38%) minmax(0, 1fr); gap: 8px; padding: 10px 12px; align-items: start; border-bottom: 1px solid #29364b; }
  .data-table td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .035em; }
  .data-table tr td:last-child { border-bottom: 0; }
  .data-table .empty { display: block; }
  .data-table .empty::before { content: none; }
  .data-table td form { min-width: 0; }
  .data-table td form input:not([type="checkbox"]) { width: 100%; }
}
@media (max-width: 440px) {
  .card .metric { font-size: 25px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-field.wide { grid-column: auto; }
  .inline-form { align-items: stretch; flex-direction: column; }
  .inline-form input, .inline-form button { width: 100%; }
  .toolbar a { flex: 1 1 auto; justify-content: center; }
  .provider-heading { align-items: stretch; flex-direction: column; }
  .provider-heading .status { align-self: flex-start; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
