:root {
    color-scheme: dark;
    --navy-950: #071426;
    --navy-900: #0b1b32;
    --navy-850: #102640;
    --navy-800: #17304d;
    --amber: #e6a62e;
    --amber-strong: #f2bd55;
    --surface: #0b1b32;
    --surface-raised: #102640;
    --surface-muted: #132c47;
    --border: rgba(255, 255, 255, 0.09);
    --text: #f3f5f9;
    --text-muted: #9aa7bb;
    --success: #40c887;
    --danger: #ef7373;
    --warning: #e9ad42;
    --blue: #5da9ee;
    font-family: "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--navy-950); color: var(--text); }
body { font-size: 14px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
h1, h2, p { margin-top: 0; }
h1, h2 { letter-spacing: 0; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--amber);
    outline-offset: 2px;
}

.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); background: var(--navy-950); }
.admin-sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; border-right: 1px solid var(--border); background: var(--navy-950); z-index: 30; }
.sidebar-brand { height: 86px; padding: 17px 19px; display: flex; align-items: center; gap: 11px; border-bottom: 1px solid var(--border); overflow: hidden; }
.sidebar-icon { width: 39px; height: 39px; object-fit: contain; flex: 0 0 auto; }
.sidebar-wordmark { width: 126px; max-height: 38px; object-fit: contain; object-position: left center; }
.mobile-close { display: none; margin-left: auto; }
.admin-nav { display: flex; flex-direction: column; gap: 5px; padding: 20px 13px; }
.nav-section { padding: 0 11px 7px; color: #6f7e94; font-size: 10px; text-transform: uppercase; font-weight: 800; letter-spacing: 0; }
.nav-entry { display: flex; align-items: center; gap: 11px; min-height: 44px; padding: 0 12px; border-left: 2px solid transparent; border-radius: 6px; color: #bcc7d8; font-weight: 600; }
.nav-entry i { width: 20px; text-align: center; color: #91a0b6; font-size: 17px; }
.nav-entry:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-entry.active { color: #fff; border-left-color: var(--amber); background: rgba(230,166,46,.13); }
.nav-entry.active i { color: var(--amber); }
.sidebar-account { margin-top: auto; min-height: 82px; padding: 14px 15px; display: grid; grid-template-columns: 37px minmax(0,1fr) 34px; align-items: center; gap: 10px; border-top: 1px solid var(--border); }
.account-avatar { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 50%; background: var(--amber); color: #162235; font-size: 11px; font-weight: 900; }
.sidebar-account strong, .sidebar-account span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-account strong { font-size: 12px; }.sidebar-account span { color: var(--text-muted); font-size: 10px; }
.sidebar-account a, .mobile-close, .mobile-menu { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); }
.sidebar-account a:hover { color: #fff; background: rgba(255,255,255,.05); }

.admin-workspace { min-width: 0; }
.admin-topbar { position: sticky; top: 0; z-index: 20; height: 68px; padding: 0 28px; display: flex; align-items: center; gap: 13px; justify-content: space-between; border-bottom: 1px solid var(--border); background: rgba(7,20,38,.95); backdrop-filter: blur(12px); }
.admin-topbar > div:first-of-type { margin-right: auto; }
.admin-topbar span, .admin-topbar strong { display: block; }
.admin-topbar > div > span { color: var(--text-muted); font-size: 10px; text-transform: uppercase; font-weight: 700; }
.admin-topbar > div > strong { font-size: 14px; }
.topbar-status { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 11px; }
.topbar-status span { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(64,200,135,.12); }
.mobile-menu { display: none; }
.admin-content { max-width: 1600px; margin: 0 auto; padding: 28px; }

.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 21px; }
.page-heading h1 { margin: 4px 0 5px; font-size: 28px; line-height: 1.1; }
.page-heading p { margin: 0; color: var(--text-muted); max-width: 720px; }
.section-kicker { color: var(--amber); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.content-section { padding: 19px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.section-title-row { display: flex; justify-content: space-between; align-items: end; gap: 14px; margin-bottom: 15px; }
.section-title-row h2 { margin: 3px 0 0; font-size: 16px; }
.count-label { color: var(--text-muted); font-size: 11px; }
.text-command { color: var(--amber); font-size: 11px; font-weight: 700; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 18px; }
.metric-grid.compact .metric-panel { min-height: 121px; }
.metric-panel { position: relative; min-height: 151px; padding: 18px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); overflow: hidden; }
.metric-panel > span, .metric-panel > strong, .metric-panel > small { display: block; }
.metric-panel > span { color: var(--text-muted); font-size: 11px; font-weight: 600; }
.metric-panel > strong { margin: 13px 0 4px; font-size: 24px; line-height: 1.15; overflow-wrap: anywhere; }
.metric-panel > small { color: #718097; font-size: 10px; }
.metric-icon { position: absolute; right: 15px; top: 15px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 7px; font-size: 16px; }
.metric-icon.amber { color: var(--amber); background: rgba(230,166,46,.13); }
.metric-icon.blue { color: var(--blue); background: rgba(93,169,238,.12); }
.metric-icon.green { color: var(--success); background: rgba(64,200,135,.12); }
.metric-icon.violet { color: #b294ee; background: rgba(178,148,238,.12); }
.split-grid { display: grid; grid-template-columns: .85fr 1.15fr; gap: 18px; }
.performance-list { display: grid; gap: 8px; }
.performance-list > div { display: grid; grid-template-columns: 1fr 1fr auto; align-items: center; gap: 10px; min-height: 58px; padding: 0 13px; border: 1px solid var(--border); background: var(--surface-raised); border-radius: 6px; }
.performance-list span { color: var(--text-muted); }.performance-list em { color: var(--amber); font-style: normal; font-weight: 700; }
.activity-list { display: grid; }
.activity-item { min-height: 58px; display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: 0; }
.activity-avatar { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 6px; background: var(--surface-raised); color: var(--amber); font-size: 10px; font-weight: 800; }
.activity-item strong, .activity-item span { display: block; }.activity-item div > span { color: var(--text-muted); font-size: 10px; }

.filter-bar { display: flex; align-items: center; gap: 9px; padding: 12px; margin-bottom: 15px; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; }
.search-field { min-width: 250px; flex: 1; position: relative; }
.search-field i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-field input { width: 100%; padding-left: 36px; }
.filter-bar input, .filter-bar select, .form-field input, .form-field textarea {
    height: 40px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-raised); color: var(--text); padding: 0 11px;
}
.date-input { width: 145px; }
.license-filter select { width: 170px; }
.segmented-control { display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-raised); }
.segmented-control button { min-height: 32px; padding: 0 11px; border: 0; border-radius: 5px; background: transparent; color: var(--text-muted); font-size: 11px; font-weight: 700; white-space: nowrap; }
.segmented-control button.active { color: #172335; background: var(--amber); }
.icon-command, .icon-text-command, .primary-command, .secondary-command { border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.icon-command { width: 36px; height: 36px; display: inline-grid; place-items: center; background: transparent; color: var(--text); }
.icon-command:hover { border-color: rgba(230,166,46,.45); color: var(--amber); }
.icon-text-command, .primary-command, .secondary-command { min-height: 40px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; }
.icon-text-command { background: var(--surface); color: var(--text); }
.primary-command { border-color: var(--amber); background: var(--amber); color: #172335; }
.secondary-command { background: transparent; color: var(--text); }
.secondary-command.danger { border-color: rgba(239,115,115,.35); color: var(--danger); }
button:disabled { opacity: .5; cursor: not-allowed; }

.table-section { padding: 0; overflow: hidden; }
.table-section > .section-title-row { padding: 17px 18px 0; }
.data-table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 820px; }
.data-table th { height: 40px; padding: 0 13px; color: #76869d; background: rgba(255,255,255,.02); border-block: 1px solid var(--border); text-align: left; font-size: 9px; text-transform: uppercase; white-space: nowrap; }
.data-table td { height: 58px; padding: 8px 13px; border-bottom: 1px solid var(--border); color: #cbd4e1; white-space: nowrap; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: rgba(255,255,255,.018); }
.data-table td strong, .data-table td small { display: block; }
.data-table td strong { color: var(--text); font-size: 12px; }.data-table td small { color: var(--text-muted); font-size: 10px; margin-top: 3px; }
.row-command-cell { width: 54px; text-align: right; }
.status-pill { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 5px; background: rgba(255,255,255,.06); color: #b6c1d0; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.status-pill.pending, .status-pill.pendingtrial, .status-pill.trialing { color: var(--warning); background: rgba(233,173,66,.12); }
.status-pill.approved, .status-pill.active, .status-pill.completed, .status-pill.legacy { color: var(--success); background: rgba(64,200,135,.12); }
.status-pill.rejected, .status-pill.cancelled, .status-pill.expired, .status-pill.failed { color: var(--danger); background: rgba(239,115,115,.12); }
.status-pill.inprogress, .status-pill.ready { color: var(--blue); background: rgba(93,169,238,.12); }
.flag-list { display: flex; gap: 5px; flex-wrap: wrap; }.flag-list span { padding: 3px 6px; border-radius: 4px; background: var(--surface-raised); color: var(--text-muted); font-size: 9px; }

.page-alert { padding: 11px 13px; margin-bottom: 14px; border: 1px solid; border-radius: 7px; font-size: 12px; }
.page-alert.error { color: #ffaaaa; border-color: rgba(239,115,115,.35); background: rgba(239,115,115,.08); }
.page-alert.success { color: #80e1b0; border-color: rgba(64,200,135,.35); background: rgba(64,200,135,.08); }
.page-alert.warning { color: #f3ca79; border-color: rgba(233,173,66,.35); background: rgba(233,173,66,.08); }
.loading-state, .compact-empty { padding: 35px 18px; color: var(--text-muted); text-align: center; }
.empty-page { text-align: center; margin-top: 60px; }.empty-page i { color: var(--amber); font-size: 34px; }

.drawer-backdrop, .mobile-overlay { position: fixed; inset: 0; border: 0; background: rgba(2,8,16,.68); z-index: 80; }
.detail-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 94vw); z-index: 90; padding: 22px; border-left: 1px solid var(--border); background: var(--navy-900); box-shadow: -22px 0 60px rgba(0,0,0,.35); overflow-y: auto; }
.detail-drawer.wide { width: min(880px, 96vw); }
.detail-drawer > header { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding-bottom: 17px; border-bottom: 1px solid var(--border); }
.detail-drawer h2 { margin: 4px 0 0; font-size: 21px; }
.detail-list { display: grid; margin: 20px 0; }
.detail-list > div { display: grid; grid-template-columns: 110px 1fr; padding: 11px 0; border-bottom: 1px solid var(--border); }
.detail-list dt { color: var(--text-muted); font-size: 10px; text-transform: uppercase; }.detail-list dd { margin: 0; overflow-wrap: anywhere; }
.form-field { display: grid; gap: 7px; color: var(--text-muted); font-size: 11px; font-weight: 700; }
.form-field textarea { min-height: 120px; height: auto; padding: 11px; resize: vertical; }
.drawer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 14px; }
.review-history { margin-top: 20px; }.review-history p { color: var(--text-muted); margin-top: 12px; }
.drawer-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin: 16px 0; }
.drawer-summary > div { padding: 11px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-raised); }
.drawer-summary span, .drawer-summary strong { display: block; }.drawer-summary span { color: var(--text-muted); font-size: 9px; text-transform: uppercase; }.drawer-summary strong { margin-top: 5px; font-size: 12px; overflow-wrap: anywhere; }
.drawer-table { border: 1px solid var(--border); border-radius: 7px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; padding: 18px; background: rgba(2,8,16,.78); }
.result-dialog { width: min(420px,100%); padding: 25px; border: 1px solid var(--border); border-radius: 8px; background: var(--navy-900); text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.result-icon { width: 46px; height: 46px; display: grid; place-items: center; margin: 0 auto 13px; border-radius: 50%; background: rgba(64,200,135,.13); color: var(--success); font-size: 24px; }
.result-dialog h2 { margin-bottom: 6px; }.result-dialog > p { color: var(--text-muted); }
.login-key-result { margin: 18px 0; padding: 14px; border: 1px solid rgba(230,166,46,.3); border-radius: 7px; background: rgba(230,166,46,.08); }
.login-key-result span, .login-key-result strong { display: block; }.login-key-result span { color: var(--text-muted); font-size: 10px; text-transform: uppercase; }.login-key-result strong { margin-top: 3px; color: var(--amber); font-size: 28px; letter-spacing: 2px; }
.result-dialog .primary-command { width: 100%; }

.admin-login-body { min-height: 100vh; background: var(--navy-950); }
.admin-login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0,1.2fr) minmax(400px,.8fr); }
.admin-login-brand { position: relative; padding: 48px 7vw; display: flex; flex-direction: column; justify-content: space-between; border-right: 1px solid var(--border); background: linear-gradient(145deg, #071426 0%, #0b1b32 65%, #102640 100%); }
.admin-login-brand::after { content: ""; position: absolute; inset: auto 7vw 27% 7vw; height: 1px; background: linear-gradient(90deg,var(--amber),transparent); opacity: .7; }
.admin-login-lockup { display: flex; align-items: center; gap: 13px; }.admin-login-lockup img:first-child { width: 46px; height: 46px; }.admin-login-lockup img:last-child { width: 156px; max-height: 48px; object-fit: contain; object-position: left; }
.admin-login-copy { max-width: 650px; position: relative; z-index: 1; margin-bottom: 9vh; }
.admin-login-copy > span { color: var(--amber); text-transform: uppercase; font-size: 11px; font-weight: 800; }
.admin-login-copy h1 { margin: 13px 0 18px; font-size: clamp(36px,5vw,66px); line-height: 1.04; font-weight: 700; max-width: 720px; }
.admin-login-copy p { color: #9eabc0; font-size: 16px; max-width: 590px; }
.admin-login-panel { display: grid; place-items: center; padding: 35px; background: #08172a; }
.admin-login-panel form { width: min(390px,100%); }
.login-heading { margin-bottom: 25px; }.login-heading h2 { margin: 6px 0; font-size: 25px; }.login-heading p { color: var(--text-muted); }
.input-with-icon { position: relative; }.input-with-icon i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }.input-with-icon input { width: 100%; padding-left: 39px; }
.admin-login-panel .primary-command { width: 100%; margin-top: 15px; }
.form-alert { display: flex; gap: 9px; margin-bottom: 16px; padding: 11px; border: 1px solid rgba(239,115,115,.35); border-radius: 7px; color: #ffaaaa; background: rgba(239,115,115,.08); }
.login-footnote { margin: 18px 0 0; color: #66768c; font-size: 10px; text-align: center; }

@media (max-width: 1100px) {
    .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .split-grid { grid-template-columns: 1fr; }
    .filter-bar { flex-wrap: wrap; }
    .search-field { flex-basis: 100%; }
}

@media (max-width: 760px) {
    .admin-shell { grid-template-columns: 1fr; }
    .admin-sidebar { position: fixed; left: 0; width: min(280px,88vw); transform: translateX(-105%); transition: transform .2s ease; box-shadow: 20px 0 50px rgba(0,0,0,.4); }
    .admin-shell.mobile-open .admin-sidebar { transform: translateX(0); }
    .mobile-close, .mobile-menu { display: grid; }
    .admin-topbar { padding: 0 16px; }.topbar-status { display: none; }
    .admin-content { padding: 18px 14px 35px; }
    .page-heading { align-items: start; flex-direction: column; }
    .metric-grid { grid-template-columns: 1fr; }
    .metric-panel { min-height: 125px; }
    .filter-bar { align-items: stretch; flex-direction: column; }
    .search-field, .license-filter select, .date-input { width: 100%; min-width: 0; }
    .segmented-control { overflow-x: auto; width: 100%; }.segmented-control button { flex: 1; }
    .performance-list > div { grid-template-columns: 1fr auto; }.performance-list em { grid-column: 1/-1; }
    .drawer-summary { grid-template-columns: 1fr; }
    .admin-login-shell { grid-template-columns: 1fr; }
    .admin-login-brand { min-height: 310px; padding: 28px; border-right: 0; border-bottom: 1px solid var(--border); }
    .admin-login-copy { margin: 60px 0 0; }.admin-login-copy h1 { font-size: 36px; }
    .admin-login-panel { padding: 38px 22px; }
}
