:root {
  color-scheme: dark;
  --bg: #0d151c;
  --surface: #14212b;
  --surface-raised: #192934;
  --border: #2a3a45;
  --text: #f0f4f6;
  --muted: #a7b5bd;
  --green: #32b886;
  --green-dark: #197d5c;
  --red: #ef7777;
  --amber: #e8b454;
  --blue: #78afe7;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 7px; color: #76d7b2; font-size: 11px; font-weight: 800; letter-spacing: 1.45px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(25px, 3vw, 34px); letter-spacing: -.7px; }
h2 { margin-bottom: 5px; font-size: 21px; letter-spacing: -.3px; }
h3 { margin-bottom: 7px; font-size: 16px; }
.fine-print { color: #82929c; font-size: 12px; line-height: 1.55; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at 50% 0%, #17332f 0%, var(--bg) 54%); }
.login-card { width: min(100%, 420px); padding: 34px; border: 1px solid var(--border); border-radius: 22px; background: rgba(20, 33, 43, .96); box-shadow: 0 24px 80px #0007; }
.brand-logo { display: block; width: 74px; height: 74px; margin-bottom: 18px; object-fit: contain; }
.brand-logo.small { flex: 0 0 42px; width: 42px; height: 42px; margin: 0; }
.login-card h1 { margin-bottom: 7px; }
.login-card > .muted { margin-bottom: 24px; line-height: 1.5; }
.stack { display: grid; gap: 16px; }
label { display: grid; gap: 7px; color: #dce5e9; font-size: 13px; font-weight: 700; }
input, select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #344752; border-radius: 10px; outline: none; background: #101b23; color: var(--text); }
input::placeholder { color: #74858f; }
input:focus, select:focus { border-color: #55c698; box-shadow: 0 0 0 3px #32b88625; }
.fine-print { margin: 18px 0 0; }
.button { display: inline-flex; min-height: 41px; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 750; transition: .15s ease; }
.button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.button.primary { background: var(--green-dark); color: white; }
.button.secondary { border-color: var(--border); background: #172630; color: #e2eaed; }
.button.danger { border-color: #743b3d; background: #3a2326; color: #ffb5b4; }
.button.small-button { min-height: 32px; padding: 6px 10px; font-size: 12px; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 2; display: flex; width: 256px; flex-direction: column; padding: 25px 16px 17px; border-right: 1px solid var(--border); background: #101a22; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 25px; color: var(--text); text-decoration: none; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.nav { display: grid; gap: 6px; }
.nav-item { display: flex; width: 100%; min-height: 43px; align-items: center; gap: 11px; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; color: #b9c5cb; cursor: pointer; text-align: left; font-size: 13px; font-weight: 650; }
.nav-item span { width: 17px; color: #86a198; text-align: center; font-size: 16px; }
.nav-item:hover { background: #1a2a33; color: white; }
.nav-item.active { background: #19392f; color: #9eefd0; }
.nav-item.active span { color: #70dcaf; }
.sidebar-bottom { margin-top: auto; padding: 0 8px; }
.sidebar-bottom .fine-print { margin-bottom: 14px; }
.nav-item.logout { padding-left: 0; }
.main-content { min-height: 100vh; margin-left: 256px; padding: 0 clamp(20px, 4vw, 52px) 26px; }
.topbar { display: flex; min-height: 105px; align-items: center; justify-content: space-between; margin-bottom: 25px; border-bottom: 1px solid var(--border); }
.topbar .eyebrow { margin-bottom: 5px; }
.topbar-user { display: flex; align-items: center; gap: 9px; color: #c1ccd1; font-size: 13px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px #32b88620; }
.view { max-width: 1440px; margin: 0 auto; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 12px 0 20px; }
.section-heading .muted { margin: 0; font-size: 13px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; }
.metric-card { min-height: 132px; padding: 18px; border: 1px solid var(--border); border-radius: 15px; background: linear-gradient(145deg, #172630, #132029); }
.metric-label { display: block; color: var(--muted); font-size: 12px; font-weight: 650; }
.metric-value { display: block; margin: 17px 0 6px; font-size: 30px; font-weight: 800; letter-spacing: -.8px; }
.metric-note { color: #8e9da6; font-size: 11px; }
.billing-panel { display: flex; align-items: center; gap: 15px; margin-top: 18px; padding: 20px; }
.billing-panel > div:nth-child(2) { flex: 1; }
.billing-panel p { margin: 0; font-size: 13px; line-height: 1.5; }
.billing-panel h3 { margin-bottom: 5px; }
.panel { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.panel-icon { display: grid; width: 42px; height: 42px; flex: 0 0 42px; place-items: center; border-radius: 13px; background: #203a34; color: #79ddb5; font-size: 22px; }
.badge { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 99px; background: #20362f; color: #92e2bd; font-size: 11px; font-weight: 750; white-space: nowrap; }
.badge.warning { background: #3a3224; color: #f4d18a; }
.badge.danger { background: #402729; color: #ffaaa9; }
.badge.neutral { background: #263640; color: #c1cdd3; }
.toolbar { display: flex; align-items: center; gap: 14px; margin: 16px 0; }
.toolbar input { max-width: 390px; }
.toolbar span { font-size: 12px; }
.table-wrap { width: 100%; overflow-x: auto; margin: 14px 0 25px; border: 1px solid var(--border); border-radius: 13px; background: #111d25; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 13px 14px; border-bottom: 1px solid #283842; text-align: left; vertical-align: middle; white-space: nowrap; }
th { background: #172630; color: #aebcc3; font-size: 10px; letter-spacing: .65px; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #17263080; }
td .secondary-line { display: block; margin-top: 4px; color: #82939c; font-size: 11px; }
td.actions-cell { min-width: 118px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)); gap: 15px; margin: 18px 0 20px; padding: 20px; }
.form-title { grid-column: 1 / -1; margin: 0; }
.form-submit { display: flex; grid-column: 1 / -1; align-items: center; gap: 12px; }
.form-submit .muted { font-size: 12px; }
.subsection { margin-top: 30px; }
.notice { margin: 12px 0 18px; padding: 12px 14px; border: 1px solid #344752; border-radius: 10px; background: #172630; color: #d3e0e4; font-size: 13px; line-height: 1.5; }
.notice.warning { border-color: #655230; background: #332d21; color: #ecd39c; }
.notice.error { border-color: #743b3d; background: #3a2326; color: #ffb5b4; }
.notice.success { border-color: #276246; background: #18352c; color: #a1ebc8; }
.page-footer { margin: 38px 0 0; padding: 18px 0; border-top: 1px solid var(--border); color: #788891; font-size: 11px; }
.dialog { width: min(100% - 30px, 480px); max-height: min(90vh, 820px); padding: 0; overflow: auto; border: 1px solid #3b4e59; border-radius: 18px; background: #14212b; color: var(--text); box-shadow: 0 25px 90px #0009; }
.dialog::backdrop { background: #03090dc9; backdrop-filter: blur(3px); }
.dialog-card { display: grid; gap: 17px; padding: 23px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 2px; }
.dialog-head h2 { overflow-wrap: anywhere; }
.dialog-head p { margin-bottom: 5px; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 9px; background: #192a34; cursor: pointer; font-size: 23px; line-height: 1; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 5px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 5; max-width: min(420px, calc(100% - 44px)); padding: 13px 16px; border: 1px solid #3f5b51; border-radius: 12px; background: #19352d; color: #dcf8e9; box-shadow: 0 10px 40px #0006; font-size: 13px; }

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
}
@media (max-width: 700px) {
  .sidebar { position: sticky; top: 0; width: auto; height: auto; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand { padding: 0 4px 9px; }
  .brand-logo.small { width: 34px; height: 34px; flex-basis: 34px; }
  .nav { display: flex; overflow-x: auto; gap: 5px; }
  .nav-item { width: auto; min-height: 37px; flex: 0 0 auto; gap: 6px; padding: 8px 10px; font-size: 11px; }
  .nav-item span { width: auto; font-size: 14px; }
  .sidebar-bottom { display: none; }
  .main-content { margin-left: 0; padding: 0 14px 20px; }
  .topbar { min-height: 78px; margin-bottom: 20px; }
  .topbar-user { max-width: 42%; overflow: hidden; font-size: 11px; }
  .section-heading { align-items: flex-start; }
  .section-heading .button { flex: 0 0 auto; }
  .metric-grid { gap: 9px; }
  .metric-card { min-height: 112px; padding: 13px; }
  .metric-value { margin-top: 13px; font-size: 26px; }
  .billing-panel { align-items: flex-start; flex-wrap: wrap; padding: 15px; }
  .billing-panel > div:nth-child(2) { min-width: calc(100% - 60px); }
  .billing-panel .badge { margin-left: 56px; }
  .form-grid { grid-template-columns: 1fr; padding: 15px; }
  .toolbar { align-items: flex-start; flex-direction: column; }
  .toolbar input { max-width: none; }
  .login-card { padding: 25px; }
}
