:root {
  --navy: #17276f;
  --blue: #3247a8;
  --teal: #4da9a5;
  --ink: #172033;
  --muted: #687086;
  --line: #dfe4ee;
  --soft: #f0f4ff;
  --surface: #ffffff;
  --danger: #b42318;
  --warning: #a15c08;
  --success: #16794c;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #f7f9fc; font-family: Inter, "Segoe UI", Arial, sans-serif; letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
.hidden { display: none !important; }
.login-view { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 44%) minmax(440px, 56%); background: var(--surface); }
.login-brand { background: var(--soft); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 18px; border-right: 1px solid var(--line); }
.login-brand img { width: min(310px, 64%); }
.login-brand span { color: var(--navy); font-size: 18px; font-weight: 700; }
.login-form { width: min(440px, calc(100% - 64px)); margin: auto; display: grid; gap: 12px; }
.eyebrow { margin: 0 0 6px; color: var(--teal); font-size: 12px; font-weight: 800; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; color: var(--navy); font-size: 32px; line-height: 1.15; }
h2 { margin-bottom: 0; font-size: 17px; }
h3 { margin-bottom: 10px; font-size: 15px; }
.login-copy { margin-bottom: 22px; color: var(--muted); line-height: 1.55; }
label { margin-top: 4px; font-size: 13px; font-weight: 700; }
input, select, textarea { min-height: 44px; border: 1px solid #cfd6e3; border-radius: 6px; padding: 0 13px; color: var(--ink); background: #fff; outline: none; }
textarea { padding-top: 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(50, 71, 168, .1); }
.primary-button, .secondary-button, .danger-button { min-height: 42px; border-radius: 6px; padding: 0 18px; border: 1px solid transparent; font-weight: 700; }
.primary-button { background: var(--blue); color: #fff; }
.secondary-button { border-color: #cfd6e3; background: #fff; color: var(--navy); }
.danger-button { border-color: #f0b8b3; background: #fff5f4; color: var(--danger); }
.text-button, .back-button { border: 0; background: transparent; color: var(--blue); font-weight: 700; padding: 6px; }
.form-error { min-height: 20px; margin: 0; color: var(--danger); font-size: 13px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: 64px minmax(0, 1fr); }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar-brand, .topbar-user { display: flex; align-items: center; gap: 14px; }
.topbar-brand img { width: 124px; }
.topbar-brand span { padding-left: 14px; border-left: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 700; }
.topbar-user { font-size: 13px; }
.sidebar { min-height: calc(100vh - 64px); padding: 20px 12px; background: var(--soft); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.nav-item { width: 100%; min-height: 42px; border: 0; border-radius: 6px; background: transparent; color: #39415a; text-align: left; padding: 0 14px; font-weight: 700; }
.nav-item.active { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(23, 39, 111, .08); }
.nav-symbol { display: inline-block; width: 24px; font-size: 18px; }
.sidebar-foot { margin-top: auto; padding: 12px 14px; color: var(--navy); font-size: 12px; font-weight: 700; line-height: 1.5; }
.sidebar-foot span { color: var(--muted); font-weight: 500; }
.main-content { min-width: 0; padding: 28px 32px 48px; position: relative; }
.view-section { max-width: 1420px; margin: 0 auto; }
.page-heading { min-height: 64px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-heading h1 { font-size: 28px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.metric { min-height: 108px; padding: 18px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.metric-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-value { margin-top: 10px; color: var(--navy); font-size: 29px; font-weight: 800; }
.metric-note { margin-top: 5px; color: var(--muted); font-size: 11px; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .8fr); gap: 18px; }
.panel { padding: 20px; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.panel-heading span { color: var(--muted); font-size: 12px; text-align: right; }
.bar-chart { min-height: 220px; display: flex; align-items: flex-end; gap: 12px; border-bottom: 1px solid var(--line); padding: 15px 5px 0; }
.bar-column { flex: 1; min-width: 24px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; }
.bar { width: 100%; max-width: 48px; min-height: 4px; background: var(--blue); border-radius: 3px 3px 0 0; }
.distribution-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 13px 0; border-bottom: 1px solid #edf0f5; }
.distribution-row:last-child { border-bottom: 0; }
.distribution-row strong { color: var(--navy); }
.toolbar { display: grid; grid-template-columns: minmax(260px, 1fr) 180px auto; gap: 10px; margin-bottom: 16px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 13px 15px; border-bottom: 1px solid #edf0f5; text-align: left; font-size: 13px; }
th { color: var(--muted); background: #fafbfe; font-size: 11px; text-transform: uppercase; }
tbody tr:hover { background: #fafcff; }
.company-cell strong, .company-cell span { display: block; }
.company-cell span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.status { display: inline-flex; align-items: center; min-height: 24px; border-radius: 12px; padding: 0 9px; font-size: 11px; font-weight: 800; text-transform: capitalize; }
.status-active { color: var(--success); background: #eaf8f1; }
.status-approved { color: var(--success); background: #eaf8f1; }
.status-pending { color: var(--warning); background: #fff5df; }
.status-rejected { color: var(--danger); background: #fff0ef; }
.status-suspended { color: var(--warning); background: #fff5df; }
.status-archived, .status-cancelled { color: var(--muted); background: #eef1f6; }
.row-action { border: 0; background: transparent; color: var(--blue); font-weight: 700; }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding-top: 14px; color: var(--muted); font-size: 12px; }
.back-button { margin: -6px 0 18px; }
.detail-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.detail-header p { color: var(--muted); margin: 6px 0 0; }
.detail-controls { display: flex; align-items: center; gap: 8px; }
.detail-controls select { min-width: 145px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; margin-top: 20px; align-items: start; }
.stack { display: grid; gap: 18px; }
.usage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); gap: 10px; }
.usage-item { padding: 13px; background: var(--soft); border-left: 3px solid var(--teal); }
.usage-item span, .usage-item strong { display: block; }
.usage-item span { color: var(--muted); font-size: 11px; }
.usage-item strong { margin-top: 6px; color: var(--navy); font-size: 20px; }
.definition-list { display: grid; grid-template-columns: 130px 1fr; gap: 10px; margin: 0; font-size: 13px; }
.definition-list dt { color: var(--muted); }
.definition-list dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.feature-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid #edf0f5; font-size: 12px; }
.feature-row:last-child { border-bottom: 0; }
.override-form { display: grid; gap: 10px; padding-top: 14px; }
.override-form .inline { display: grid; grid-template-columns: 1fr 120px; gap: 8px; }
.plan-management-grid { display: grid; grid-template-columns: minmax(280px, .7fr) minmax(520px, 1.3fr); gap: 18px; align-items: start; }
.billing-layout { display: grid; grid-template-columns: minmax(520px, 1.35fr) minmax(260px, .65fr); gap: 18px; align-items: start; }
.billing-note-panel { background: var(--soft); }
.billing-note-panel ol { margin: 18px 0 0; padding-left: 20px; color: #39415a; line-height: 1.8; }
.upgrade-queue-panel { margin-top: 18px; padding: 0; overflow: hidden; }
.upgrade-queue-panel .panel-heading { padding: 18px 20px 0; }
.upgrade-queue-panel .panel-heading select { width: 150px; }
.payment-evidence { display: grid; gap: 4px; }
.payment-evidence a { color: var(--blue); font-weight: 700; }
.review-actions { display: flex; align-items: center; gap: 6px; }
.review-actions button { min-height: 32px; padding: 0 10px; }
.review-note { max-width: 190px; color: var(--muted); font-size: 11px; white-space: normal; }
.plan-list { display: grid; gap: 8px; }
.plan-list-heading > div { display: grid; gap: 3px; }
.plan-list-heading > div > span { text-align: left; }
.plan-list-heading .text-button { padding-right: 0; font-size: 12px; }
.plan-list-group { display: grid; gap: 7px; }
.plan-list-group + .plan-list-group { margin-top: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.plan-list-group > h3 { margin: 0 2px 3px; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.plan-list-item { width: 100%; border: 1px solid var(--line); border-radius: 6px; background: #fff; padding: 14px; text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; }
.plan-list-item:hover, .plan-list-item.active { border-color: var(--blue); background: var(--soft); }
.plan-list-item.inactive { opacity: .62; }
.plan-list-item strong { color: var(--navy); }
.plan-list-item span { color: var(--muted); font-size: 12px; }
.plan-form, .form-grid, .feature-editor { display: grid; gap: 14px; }
.plan-form > label, .form-grid label { display: grid; gap: 7px; }
.form-grid.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.feature-editor { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.feature-editor-row { min-height: 72px; display: grid; grid-template-columns: minmax(0, 1fr) 110px; align-items: center; gap: 10px; padding: 10px 12px; background: var(--soft); border-left: 3px solid var(--teal); }
.feature-editor-row.switch { grid-template-columns: 1fr auto; }
.feature-editor-row strong, .feature-editor-row span { display: block; }
.feature-editor-row span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.entitlement-help { margin: -8px 0 10px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.allowance-summary { border-top: 1px solid #edf0f5; }
.allowance-summary-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 10px; padding: 12px 0; border-bottom: 1px solid #edf0f5; }
.allowance-summary-row > span:first-child { min-width: 0; display: grid; gap: 3px; }
.allowance-summary-row small { color: var(--muted); font-size: 10px; font-weight: 500; overflow-wrap: anywhere; }
.allowance-current-value { display: grid; justify-items: end; color: var(--navy); font-size: 12px; font-weight: 800; }
.allowance-current-value small { margin-top: 2px; color: var(--teal); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.entitlement-reset { justify-self: end; font-size: 11px; }
.allowance-summary-row .entitlement-reset { grid-column: 1 / -1; padding: 2px 0; }
.allowance-editor-form { display: grid; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.allowance-editor-form h3 { margin-bottom: 3px; }
.lifecycle-divider { height: 1px; margin: 20px 0 4px; background: var(--line); }
.retention-note { margin: 16px 0 0; padding: 12px; color: var(--muted); background: var(--soft); font-size: 12px; line-height: 1.5; }
#allowanceValueControl { display: grid; gap: 8px; }
.small-button { min-height: 36px; border: 1px solid #cfd6e3; border-radius: 6px; background: #fff; color: var(--navy); font-weight: 700; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; min-height: auto; }
.loading-bar { position: fixed; top: 64px; left: 220px; right: 0; height: 3px; background: var(--teal); z-index: 6; animation: pulse 1s infinite alternate; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 380px; padding: 13px 16px; border-radius: 6px; background: var(--ink); color: #fff; font-size: 13px; box-shadow: 0 8px 24px rgba(23, 32, 51, .22); }
.empty { padding: 34px; text-align: center; color: var(--muted); }
@keyframes pulse { from { opacity: .45; } to { opacity: 1; } }
@media (max-width: 900px) {
  .login-view { grid-template-columns: 1fr; }
  .login-brand { min-height: 180px; border-right: 0; border-bottom: 1px solid var(--line); }
  .login-brand img { width: 220px; }
  .login-form { padding: 42px 0; }
  .app-shell { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar { padding: 14px 8px; }
  .nav-item { font-size: 0; text-align: center; padding: 0; }
  .nav-symbol { width: auto; font-size: 20px; }
  .sidebar-foot { display: none; }
  .main-content { padding: 22px 18px 40px; }
  .loading-bar { left: 76px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .overview-grid, .detail-grid { grid-template-columns: 1fr; }
  .plan-management-grid, .billing-layout { grid-template-columns: 1fr; }
  .usage-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 580px) {
  .topbar { padding: 0 14px; }
  .topbar-brand span, #platformUserName { display: none; }
  .toolbar { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr; }
  .detail-header { display: grid; }
  .detail-controls { flex-wrap: wrap; }
  .form-grid.two-columns, .feature-editor { grid-template-columns: 1fr; }
  .panel-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .panel-heading span { text-align: left; }
}
