:root {
  --navy: #0b1f3a;
  --navy-2: #16365f;
  --orange: #f58220;
  --orange-soft: #fff2e7;
  --ink: #172033;
  --muted: #6b7280;
  --line: #e5e9f0;
  --surface: #ffffff;
  --canvas: #f5f7fa;
  --green: #138a5b;
  --green-soft: #eaf8f2;
  --red: #c83c3c;
  --red-soft: #fff0f0;
  --shadow: 0 18px 50px rgba(11, 31, 58, 0.12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow {
  margin: 0 0 6px;
  color: var(--orange);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 16% 20%, rgba(245, 130, 32, .18), transparent 28%),
    linear-gradient(145deg, #07162b, #0b1f3a 55%, #16365f);
}
.login-card {
  width: min(430px, 100%);
  padding: 42px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 24px;
  background: rgba(255,255,255,.98);
  box-shadow: 0 28px 80px rgba(0,0,0,.25);
}
.login-card h1 { margin: 0 0 8px; font-size: 31px; }
.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 22px;
  place-items: center;
  border-radius: 16px;
  background: var(--orange);
  color: #fff;
  font: 800 29px/1 Georgia, serif;
  box-shadow: 0 10px 24px rgba(245,130,32,.28);
}
.brand-mark.small { width: 42px; height: 42px; margin: 0; border-radius: 12px; font-size: 23px; }
.stack { display: grid; gap: 16px; margin-top: 26px; }
label { display: grid; gap: 7px; color: #344054; font-size: 13px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid #d6dce5;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  outline: none;
  padding: 11px 12px;
  transition: border .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(245,130,32,.12);
}
.button {
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 750;
}
.button.primary { background: var(--orange); color: #fff; box-shadow: 0 7px 18px rgba(245,130,32,.22); }
.button.primary:hover { background: #df6f12; }
.button.ghost { border-color: var(--line); background: #fff; color: var(--navy); }
.button.danger { border-color: #f3c5c5; background: var(--red-soft); color: var(--red); }
.button.small { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.form-error { min-height: 18px; margin: 0; color: var(--red); font-size: 13px; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 max(24px, calc((100vw - 1320px) / 2));
  border-bottom: 1px solid rgba(255,255,255,.1);
  background: var(--navy);
  color: #fff;
}
.brand-lockup, .admin-tools { display: flex; align-items: center; gap: 12px; }
.brand-lockup strong, .brand-lockup span { display: block; }
.brand-lockup span { margin-top: 2px; color: #abb9cc; font-size: 11px; letter-spacing: .12em; }
.admin-tools { font-size: 13px; }
.content { width: min(1320px, calc(100% - 48px)); margin: 38px auto 70px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.page-heading h1 { margin: 0 0 7px; font-size: 30px; }
.page-heading p { margin-top: 0; }
.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin: 26px 0;
}
.stats article {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(11,31,58,.035);
}
.stats span { display: block; color: var(--muted); font-size: 12px; }
.stats strong { display: block; margin-top: 9px; color: var(--navy); font-size: 28px; }
.stats .warning { border-color: #ffd7b5; background: var(--orange-soft); }
.stats .warning strong { color: #b45408; }
.panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(11,31,58,.055);
}
.panel-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px; border-bottom: 1px solid var(--line); }
.panel-toolbar h2 { margin: 0 0 5px; font-size: 18px; }
.panel-toolbar p { margin: 0; font-size: 12px; }
.search { width: min(340px, 100%); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 14px 16px; border-bottom: 1px solid #edf0f4; text-align: right; vertical-align: middle; white-space: nowrap; }
th { background: #fafbfc; color: #5c6678; font-size: 11px; letter-spacing: .02em; }
tbody tr:hover { background: #fcfcfd; }
.customer-cell strong, .customer-cell span { display: block; }
.customer-cell span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.key-mask { direction: ltr; color: #667085; font: 12px Consolas, monospace; }
.badge { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 750; }
.badge.active { background: var(--green-soft); color: var(--green); }
.badge.pending { background: #eef2ff; color: #4c5fc7; }
.badge.expired, .badge.revoked { background: var(--red-soft); color: var(--red); }
.badge.suspended { background: #fff6df; color: #9b6800; }
.actions { display: flex; gap: 7px; }
.empty { padding: 50px; text-align: center; color: var(--muted); }
dialog { width: min(650px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 20px; background: transparent; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(6,17,33,.65); backdrop-filter: blur(3px); }
.dialog-card { display: grid; gap: 18px; padding: 28px; border-radius: 20px; background: #fff; }
.dialog-card.compact { width: min(480px, 100%); margin: auto; text-align: center; }
.dialog-card.wide { width: min(720px, 100%); }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.dialog-heading h2, .dialog-card h2 { margin: 0; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: #667085; font-size: 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 10px; background: #f8fafc; }
.check-row input { width: auto; accent-color: var(--orange); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.success-icon { display: grid; width: 58px; height: 58px; margin: auto; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 28px; font-weight: 900; }
.license-key { padding: 16px; border: 1px dashed #f1a867; border-radius: 12px; background: var(--orange-soft); color: var(--navy); font: 700 16px Consolas, monospace; word-break: break-all; }
.devices-list { display: grid; gap: 10px; }
.device-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.device-row strong, .device-row span { display: block; }
.device-row span { margin-top: 5px; color: var(--muted); font-size: 11px; }
.toast { position: fixed; bottom: 24px; left: 24px; z-index: 20; transform: translateY(30px); opacity: 0; padding: 12px 18px; border-radius: 10px; background: var(--navy); color: #fff; box-shadow: var(--shadow); transition: .25s; pointer-events: none; }
.toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 980px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding-inline: 24px; }
}
@media (max-width: 650px) {
  .content { width: min(100% - 24px, 1320px); margin-top: 24px; }
  .page-heading, .panel-toolbar { align-items: stretch; flex-direction: column; }
  .stats { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .admin-tools span { display: none; }
  .login-card { padding: 30px 24px; }
}
