:root {
  color-scheme: light;
  --navy: #10213f;
  --navy-2: #172a4d;
  --teal: #148b87;
  --teal-dark: #0e6f6c;
  --teal-pale: #e8f5f3;
  --ink: #182338;
  --muted: #687587;
  --line: #dce3ea;
  --canvas: #f4f6f8;
  --danger: #b33c3c;
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
button, input { font: inherit; }
[hidden] { display: none !important; }
.admin-brand { align-items: center; color: var(--navy); display: inline-flex; font-size: 21px; gap: 10px; letter-spacing: -.03em; text-decoration: none; }
.admin-brand img { border-radius: 8px; }
.admin-brand strong { color: var(--teal); }
.admin-brand.inverse { color: #fff; }

.login-layout { display: grid; grid-template-columns: 1fr 480px; min-height: 100vh; }
.login-copy { background: var(--navy); color: #fff; display: flex; flex-direction: column; justify-content: space-between; padding: 46px 8vw 90px; }
.login-copy > div { max-width: 650px; }
.login-copy > div p, .eyebrow, .admin-topbar p, .card-header p { color: #67c8c2; font-size: 10px; font-weight: 800; letter-spacing: .13em; margin: 0 0 10px; }
.login-copy h1 { font-size: clamp(42px, 5vw, 68px); letter-spacing: -.055em; line-height: 1.02; margin: 0 0 22px; }
.login-copy > div span { color: #b8c3d4; font-size: 16px; line-height: 1.7; }
.login-card { align-self: center; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 22px 60px #10213f14; margin: 40px; padding: 34px; }
.login-card .eyebrow { color: var(--teal-dark); }
.login-card h2 { color: var(--navy); font-size: 25px; margin: 0 0 8px; }
.login-card > p:not(.eyebrow, .error-message) { color: var(--muted); font-size: 13px; line-height: 1.55; }
.login-card form { display: grid; gap: 18px; margin-top: 26px; }
label { color: #354256; display: grid; font-size: 12px; font-weight: 700; gap: 7px; }
input { background: #fff; border: 1px solid #ced7e0; border-radius: 7px; color: var(--ink); min-height: 43px; outline: 0; padding: 0 12px; }
input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px #148b871b; }
.login-card button, .primary-action, .search-bar button, .create-card > button, .section-toolbar form button {
  background: var(--teal); border: 0; border-radius: 7px; color: #fff; cursor: pointer; font-weight: 750; min-height: 43px; padding: 0 16px;
}
.error-message { background: #fff0f0; border-radius: 7px; color: var(--danger); font-size: 12px; padding: 12px; }

.admin-app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.admin-sidebar { background: var(--navy); color: #fff; display: flex; flex-direction: column; min-height: 100vh; padding: 22px 14px; position: sticky; top: 0; }
.admin-sidebar .admin-brand { padding: 0 10px 22px; }
.nav-label { color: #7889a3; font-size: 9px; font-weight: 800; letter-spacing: .12em; margin: 18px 12px 8px; }
.admin-sidebar nav { display: grid; gap: 4px; }
.admin-sidebar nav button { align-items: center; background: transparent; border: 0; border-radius: 7px; color: #b9c4d6; cursor: pointer; display: flex; gap: 11px; padding: 11px 12px; text-align: left; }
.admin-sidebar nav button span { color: #8394ad; font-size: 16px; width: 18px; }
.admin-sidebar nav button:hover, .admin-sidebar nav button.active { background: #ffffff13; color: #fff; }
.admin-sidebar nav button.active { box-shadow: inset 3px 0 var(--teal); }
.sidebar-bottom { border-top: 1px solid #ffffff15; display: grid; gap: 6px; margin-top: auto; padding: 18px 8px 0; }
.sidebar-bottom a, .sidebar-bottom button { background: transparent; border: 0; color: #a9b6c9; cursor: pointer; font-size: 12px; padding: 7px 4px; text-align: left; text-decoration: none; }
.sidebar-bottom a:hover, .sidebar-bottom button:hover { color: #fff; }

.admin-main { min-width: 0; padding: 0 34px 60px; }
.admin-topbar { align-items: center; border-bottom: 1px solid var(--line); display: flex; height: 82px; justify-content: space-between; margin-bottom: 28px; }
.admin-topbar p { color: var(--teal-dark); margin-bottom: 3px; }
.admin-topbar h1 { color: var(--navy); font-size: 24px; margin: 0; }
.admin-identity { align-items: center; color: var(--muted); display: flex; font-size: 12px; gap: 10px; }
.admin-identity i { align-items: center; background: var(--navy); border-radius: 50%; color: #fff; display: flex; font-size: 10px; font-style: normal; font-weight: 800; height: 34px; justify-content: center; width: 34px; }
.metrics { display: grid; gap: 14px; grid-template-columns: repeat(4, 1fr); }
.metrics article { background: #fff; border: 1px solid var(--line); border-radius: 9px; display: grid; gap: 6px; padding: 19px; }
.metrics span { color: #7a8796; font-size: 9px; font-weight: 800; letter-spacing: .07em; }
.metrics strong { color: var(--navy); font-size: 29px; letter-spacing: -.03em; }
.metrics small { color: var(--muted); font-size: 10px; }
.overview-grid { display: grid; gap: 14px; grid-template-columns: 1.1fr .9fr; margin-top: 14px; }
.panel-card { background: #fff; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.card-header { align-items: center; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; padding: 17px 19px; }
.card-header p { color: var(--teal-dark); margin-bottom: 3px; }
.card-header h2 { color: var(--navy); font-size: 16px; margin: 0; }
.card-header button { background: transparent; border: 0; color: var(--teal-dark); cursor: pointer; font-size: 11px; font-weight: 700; }
.compact-list { display: grid; }
.compact-row { align-items: center; border-bottom: 1px solid #edf0f3; display: grid; font-size: 11px; gap: 10px; grid-template-columns: 1fr auto; padding: 13px 18px; }
.compact-row:last-child { border-bottom: 0; }
.compact-row strong { color: var(--navy); display: block; font-size: 12px; margin-bottom: 3px; }
.compact-row span { color: var(--muted); }
.compact-row time { color: #7b8795; }
.empty-state { color: var(--muted); font-size: 12px; padding: 28px; text-align: center; }

.section-toolbar { align-items: center; display: flex; gap: 24px; justify-content: space-between; margin-bottom: 20px; }
.section-toolbar h2 { color: var(--navy); font-size: 21px; margin: 0 0 5px; }
.section-toolbar p { color: var(--muted); font-size: 12px; margin: 0; }
.section-toolbar form, .search-bar { display: flex; gap: 8px; }
.section-toolbar form input, .search-bar input { min-width: 310px; }
.secondary-action { background: #fff; border: 1px solid var(--line); border-radius: 7px; color: var(--navy); cursor: pointer; min-height: 40px; padding: 0 14px; }
.table-card { overflow-x: auto; }
.admin-table { border-collapse: collapse; font-size: 11px; width: 100%; }
.admin-table th { background: #f7f8fa; color: #768291; font-size: 9px; letter-spacing: .06em; text-align: left; text-transform: uppercase; }
.admin-table th, .admin-table td { border-bottom: 1px solid #edf0f3; padding: 13px 15px; white-space: nowrap; }
.admin-table td { color: #4c596a; }
.admin-table td strong { color: var(--navy); }
.status { background: var(--teal-pale); border-radius: 999px; color: var(--teal-dark); display: inline-block; font-size: 9px; font-weight: 800; padding: 5px 8px; text-transform: uppercase; }
.status.revoked { background: #fff0f0; color: var(--danger); }

.create-card { align-items: end; background: #fff; border: 1px solid var(--line); border-radius: 9px; display: grid; gap: 12px; grid-template-columns: 1.2fr repeat(4, 1fr) auto; margin-bottom: 14px; padding: 18px; }
.create-card h3 { color: var(--navy); font-size: 14px; margin: 0 0 4px; }
.create-card p { color: var(--muted); font-size: 10px; margin: 0; }
.search-bar { margin-bottom: 14px; }
.search-bar input { flex: 1; }
.license-list { display: grid; gap: 10px; }
.license-card { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 17px; }
.license-summary { align-items: flex-start; display: grid; gap: 10px; grid-template-columns: 1fr auto; }
.license-summary h3 { color: var(--navy); font-size: 14px; margin: 0 0 5px; }
.license-summary p { color: var(--muted); font-size: 11px; margin: 0; }
.license-meta { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.license-meta code { background: var(--canvas); border-radius: 5px; color: var(--navy); font-size: 10px; padding: 6px 8px; }
.license-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.license-actions button, .device-list button { background: #fff; border: 1px solid var(--line); border-radius: 6px; color: var(--navy); cursor: pointer; font-size: 10px; font-weight: 700; padding: 7px 9px; }
.license-actions button.danger { color: var(--danger); }
.device-list { border-top: 1px solid #edf0f3; display: grid; margin-top: 14px; padding-top: 8px; }
.device-row { align-items: center; display: grid; font-size: 10px; gap: 8px; grid-template-columns: 1fr auto; padding: 7px 0; }
.device-row strong { color: var(--navy); }
.device-row span { color: var(--muted); }
.result-box { background: var(--navy); border-radius: 8px; color: #dfe7f1; font-size: 11px; margin-top: 14px; max-height: 260px; overflow: auto; padding: 15px; white-space: pre-wrap; }

@media (max-width: 1050px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .overview-grid { grid-template-columns: 1fr; }
  .create-card { grid-template-columns: 1fr 1fr; }
  .create-card > div { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-copy { min-height: 420px; padding: 30px 24px 60px; }
  .login-card { margin: -44px 14px 30px; position: relative; }
  .admin-app { display: block; }
  .admin-sidebar { min-height: auto; padding: 10px; position: static; }
  .admin-sidebar .admin-brand, .nav-label, .sidebar-bottom { display: none; }
  .admin-sidebar nav { display: flex; overflow-x: auto; }
  .admin-sidebar nav button { flex: 1; justify-content: center; white-space: nowrap; }
  .admin-sidebar nav button span { display: none; }
  .admin-main { padding-inline: 14px; }
  .admin-topbar { height: 70px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .section-toolbar { align-items: stretch; flex-direction: column; }
  .section-toolbar form, .search-bar { display: grid; }
  .section-toolbar form input, .search-bar input { min-width: 0; width: 100%; }
  .create-card { grid-template-columns: 1fr; }
}
