* { box-sizing: border-box; }

:root {
  color-scheme: dark;
  font-family: Arial, "Noto Sans Arabic", system-ui, sans-serif;
  background: #08080a;
  color: #f1eff2;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --silver: #a3a1a7;
  --gold: #c8aa70;
  --line: rgba(164, 162, 169, .25);
}

html, body { min-width: 320px; min-height: 100%; margin: 0; }
body { min-height: 100vh; min-height: 100svh; overflow-x: hidden; }
button, input, select { font: inherit; }

.admin-stage {
  isolation: isolate;
  position: relative;
  display: flex;
  min-height: 100vh;
  min-height: 100svh;
  justify-content: center;
  overflow: hidden;
  padding: max(25px, env(safe-area-inset-top)) 22px max(32px, env(safe-area-inset-bottom));
  background:
    radial-gradient(ellipse at 50% 39%, rgba(142, 140, 145, .09), transparent 37%),
    radial-gradient(ellipse at 50% 100%, rgba(110, 87, 50, .07), transparent 44%),
    #08080a;
}

.scanlines {
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(190, 188, 192, .035) 3px 4px),
    linear-gradient(180deg, rgba(120, 46, 54, .045), transparent 37%, rgba(190, 190, 195, .02));
  opacity: .88;
}

.scanlines::after {
  position: absolute;
  inset: 0;
  content: "";
  background-image: radial-gradient(circle, rgba(190, 186, 180, .12) .7px, transparent .95px);
  background-size: 34px 34px;
  opacity: .22;
  mask-image: linear-gradient(to bottom, transparent, #000 12%, #000 91%, transparent);
}

.language-control {
  position: absolute;
  z-index: 1;
  top: max(25px, env(safe-area-inset-top));
  left: max(22px, env(safe-area-inset-left));
  display: flex;
  width: 62px;
  height: 42px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  direction: ltr;
  border: 1px solid rgba(141, 140, 147, .16);
  border-radius: 2px 2px 9px 2px;
  color: #d5d3d8;
  background: rgba(28, 27, 31, .78);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
}
.language-control svg { width: 18px; height: 18px; color: #9c9ba1; }

.admin-card {
  width: min(100%, 365px);
  margin-top: clamp(99px, 13vh, 122px);
  text-align: center;
  animation: card-in 650ms cubic-bezier(.2, .8, .2, 1) both;
}

.admin-brand-frame {
  display: grid;
  width: clamp(138px, 38vw, 158px);
  height: clamp(138px, 38vw, 158px);
  place-items: center;
  margin: 0 auto;
  padding: 4px;
  overflow: hidden;
  border: 1px solid rgba(202, 173, 112, .57);
  border-radius: 13px;
  background: linear-gradient(145deg, #201c15, #0b0c0e 64%);
  box-shadow: 0 0 30px rgba(184, 147, 72, .18), 0 14px 30px rgba(0, 0, 0, .58);
}
.admin-brand { display: block; width: 100%; height: 100%; border-radius: 9px; object-fit: contain; }

.admin-card h1 {
  margin: 29px 0 0;
  color: #929097;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: .03em;
  line-height: 1.5;
  text-shadow: 0 0 18px rgba(211, 208, 198, .08);
}

.login-form { margin-top: 29px; text-align: right; }
.field-group + .field-group { margin-top: 27px; }
.field-group label {
  display: block;
  margin: 0 0 9px;
  color: #85838d;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .035em;
}
.field-group input {
  display: block;
  width: 100%;
  height: 58px;
  padding: 0 17px;
  border: 1px solid rgba(151, 149, 157, .34);
  border-radius: 0;
  outline: 0;
  color: #eee8d9;
  background: rgba(12, 12, 15, .63);
  clip-path: polygon(0 0, 94% 0, 100% 18%, 100% 82%, 97% 100%, 0 100%);
  direction: ltr;
  font-size: 16px;
  letter-spacing: .08em;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.field-group input:focus {
  border-color: rgba(207, 174, 105, .72);
  box-shadow: inset 0 0 18px rgba(183, 144, 66, .07), 0 0 20px rgba(183, 144, 66, .09);
}

.login-status {
  min-height: 19px;
  margin: 12px 2px 0;
  color: #c7b78f;
  font-size: 12px;
  line-height: 1.6;
}
.login-status[data-state="error"] { color: #e49393; }
.login-status[data-state="success"] { color: #d9c696; }

.login-button {
  display: grid;
  width: 100%;
  min-height: 62px;
  place-items: center;
  margin-top: 14px;
  border: 0;
  border-radius: 0;
  color: #77747d;
  background: #1b1a1f;
  clip-path: polygon(0 0, 95% 0, 100% 18%, 100% 100%, 4% 100%, 0 82%);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: .04em;
  cursor: not-allowed;
  transition: color 170ms ease, background 170ms ease, box-shadow 170ms ease, transform 170ms ease;
}
.login-button:not(:disabled) {
  color: #17150f;
  background: linear-gradient(105deg, #ad8950, #d7c291 57%, #a98249);
  box-shadow: 0 0 24px rgba(183, 147, 78, .17);
  cursor: pointer;
}
.login-button:not(:disabled):hover {
  color: #100e0a;
  background: linear-gradient(105deg, #c19b5c, #e6d2a3 57%, #b89050);
  box-shadow: 0 0 30px rgba(183, 147, 78, .28);
}
.login-button:not(:disabled):active { transform: scale(.99); }

button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #d6b879; outline-offset: 3px; }

@keyframes card-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-height: 700px) {
  .admin-stage { padding-top: max(19px, env(safe-area-inset-top)); }
  .admin-card { margin-top: clamp(67px, 11vh, 82px); }
  .admin-brand-frame { width: 124px; height: 124px; }
  .admin-card h1 { margin-top: 20px; }
  .login-form { margin-top: 18px; }
  .field-group + .field-group { margin-top: 17px; }
  .field-group input { height: 50px; }
  .login-button { min-height: 54px; margin-top: 8px; }
}

.admin-stage.is-dashboard {
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
  padding: max(25px, env(safe-area-inset-top)) 22px max(34px, env(safe-area-inset-bottom));
}
.admin-card.is-dashboard {
  width: min(100%, 1120px);
  margin: 42px auto 0;
  text-align: right;
}
.admin-card.is-dashboard .admin-brand-frame { width: 76px; height: 76px; margin: 0 auto; }
.admin-card.is-dashboard h1 { margin: 13px 0 0; text-align: center; }
.dashboard { margin: 28px 0 50px; animation: card-in 350ms ease both; }
.dashboard[hidden], .login-panel[hidden] { display: none; }
.dashboard-heading, .section-heading, .record-heading, .issued-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.section-heading { flex-wrap: wrap; }
.dashboard-heading { margin: 0 0 17px; }
.dashboard-heading h2 { margin: 5px 0 0; color: #ece9e2; font-size: clamp(21px, 4vw, 28px); }
.eyebrow { color: var(--silver); font-size: 10px; font-weight: 700; letter-spacing: .18em; direction: ltr; }
.logout-button, .small-button, .load-more-button {
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid rgba(200, 170, 112, .32);
  color: #e3d2aa;
  background: rgba(35, 31, 24, .72);
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}
.logout-button:hover, .small-button:hover, .load-more-button:hover { border-color: var(--gold); background: rgba(117, 88, 43, .25); }
.dashboard-status { min-height: 20px; margin: 0 0 12px; color: #c7b78f; font-size: 12px; }
.dashboard-status[data-state="error"] { color: #e49393; }
.dashboard-status[data-state="success"] { color: #d9c696; }
.retry-dashboard { display: block; margin: -2px 0 13px auto; }
.retry-dashboard[hidden] { display: none; }
.maintenance-panel, .admin-section, .stat-card {
  border: 1px solid rgba(164, 162, 169, .2);
  background: rgba(13, 13, 16, .88);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .18);
}
.maintenance-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-color: rgba(200, 170, 112, .33);
  background: linear-gradient(110deg, rgba(28, 26, 22, .92), rgba(13, 13, 16, .92));
}
.maintenance-copy { display: flex; align-items: flex-start; gap: 12px; }
.maintenance-copy h3 { margin: 0; color: #eee9dc; font-size: 16px; }
.maintenance-copy p { margin: 6px 0 0; color: #aaa7ad; font-size: 12px; line-height: 1.6; }
.status-light { width: 10px; height: 10px; flex: 0 0 auto; margin-top: 5px; border-radius: 50%; background: #87a989; box-shadow: 0 0 12px rgba(135, 169, 137, .5); }
.status-light.is-on { background: #dc7777; box-shadow: 0 0 12px rgba(220, 119, 119, .55); }
.maintenance-toggle {
  min-width: 150px;
  min-height: 46px;
  padding: 10px 15px;
  border: 1px solid rgba(200, 170, 112, .55);
  color: #1a1711;
  background: linear-gradient(105deg, #ad8950, #d7c291 57%, #a98249);
  font-weight: 800;
  cursor: pointer;
}
.maintenance-toggle.is-on { border-color: rgba(220, 119, 119, .6); color: #f1dede; background: rgba(103, 42, 48, .72); }
.maintenance-toggle:disabled { opacity: .55; cursor: wait; }
.admin-section { margin-top: 18px; padding: 20px; }
.section-heading { margin-bottom: 9px; }
.section-heading h3 { margin: 4px 0 0; color: #efedf0; font-size: 18px; }
.section-note { margin: 9px 0 16px; color: #9d9aa2; font-size: 12px; line-height: 1.8; }
.key-create-form { display: grid; grid-template-columns: minmax(130px, .7fr) minmax(150px, 1fr) minmax(150px, .8fr); align-items: end; gap: 14px; }
.key-create-form .field-group { margin: 0; }
.key-create-form .field-group label { font-size: 13px; }
.key-create-form input { height: 48px; text-align: right; }
.key-create-form input[dir="ltr"] { text-align: left; }
.key-create-form .create-button { min-height: 48px; margin: 0; font-size: 16px; }
.key-control-form { display: grid; grid-template-columns: minmax(170px, 1.25fr) minmax(160px, 1fr) minmax(155px, .9fr) minmax(155px, .8fr); align-items: end; gap: 14px; }
.key-time-form { display: grid; grid-template-columns: minmax(130px, .85fr) minmax(170px, 1.25fr) minmax(180px, 1.1fr) minmax(155px, .9fr) minmax(145px, .8fr); align-items: end; gap: 12px; }
.key-time-form .field-group { min-width: 0; margin: 0; }
.key-time-form .field-group label { font-size: 13px; }
.key-time-form input, .key-time-form select {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 12px;
  border: 1px solid rgba(151, 149, 157, .34);
  border-radius: 0;
  outline: 0;
  color: #eee8d9;
  background: rgba(12, 12, 15, .8);
}
.key-time-form input { text-align: left; font-family: "Roboto Mono", Consolas, monospace; letter-spacing: .08em; }
.key-time-form select { text-align: right; }
.key-time-form input:focus, .key-time-form select:focus { border-color: rgba(227, 38, 49, .78); box-shadow: 0 0 18px rgba(227, 38, 49, .11); }
.key-time-form .key-time-button { min-height: 48px; margin: 0; font-size: 14px; }
.key-time-form #key-time-target:disabled { opacity: .48; cursor: not-allowed; }
.key-time-form #key-time-duration-group[hidden] { display: none; }
 .site-links-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 14px; }
.site-links-form .field-group { min-width: 0; margin: 0; }
.site-links-form .field-group label { font-size: 13px; }
.site-links-form input { display: block; width: 100%; height: 48px; padding: 0 12px; border: 1px solid rgba(151, 149, 157, .34); color: #eee8d9; background: rgba(12, 12, 15, .8); font-size: 12px; text-align: left; }
.site-links-form input:focus { border-color: rgba(207, 174, 105, .72); outline: 0; }
.site-links-form .site-links-save { grid-column: 1 / -1; min-height: 46px; margin: 0; font-size: 15px; }
.subscription-form { display: grid; gap: 14px; }
.subscription-form .field-group { margin: 0; }
.subscription-form textarea { display: block; width: 100%; min-height: 240px; padding: 12px; border: 1px solid rgba(151, 149, 157, .34); border-radius: 0; color: #eee8d9; background: rgba(12, 12, 15, .8); font: 12px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; resize: vertical; }
.subscription-form textarea:focus { border-color: rgba(207, 174, 105, .72); outline: 0; }
.subscription-form .subscription-save { min-height: 46px; margin: 0; font-size: 15px; }
.key-control-form .field-group { margin: 0; }
.key-control-form .field-group label { font-size: 13px; }
.key-control-form input, .key-control-form select {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 12px;
  border: 1px solid rgba(151, 149, 157, .34);
  border-radius: 0;
  outline: 0;
  color: #eee8d9;
  background: rgba(12, 12, 15, .8);
}
.key-control-form input { text-align: left; font-family: "Roboto Mono", Consolas, monospace; letter-spacing: .08em; }
.key-control-form select { text-align: right; }
.key-control-form input:focus, .key-control-form select:focus { border-color: rgba(207, 174, 105, .72); box-shadow: 0 0 18px rgba(183, 144, 66, .09); }
.key-control-form .key-control-button { min-height: 48px; margin: 0; font-size: 15px; }
#restriction-duration-group[hidden] { display: none; }
.login-status[data-state="error"] { color: #e49393; }
.login-status[data-state="success"] { color: #d9c696; }
.issued-panel { margin-top: 16px; padding: 15px; border: 1px solid rgba(200, 170, 112, .3); background: rgba(21, 20, 18, .75); }
.issued-panel[hidden] { display: none; }
.issued-heading { align-items: flex-start; }
.issued-heading h4 { margin: 0; color: #e8ddc2; font-size: 14px; }
.issued-heading p { margin: 5px 0 0; color: #a7a3a8; font-size: 11px; }
.issued-actions { display: flex; gap: 8px; }
.issued-codes { max-height: 210px; overflow: auto; margin: 14px 0 0; padding: 12px; border: 1px solid rgba(164, 162, 169, .16); color: #ead9ad; background: #08080a; font: 600 14px/1.9 "Roboto Mono", Consolas, monospace; letter-spacing: .08em; text-align: left; user-select: all; }
.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 11px; margin-top: 17px; }
.stat-card { display: flex; min-height: 84px; flex-direction: column; justify-content: center; gap: 9px; padding: 14px 16px; }
.stat-card span { color: #99969f; font-size: 12px; }
.stat-card strong { color: #dfcc9f; font: 700 24px/1 Arial, sans-serif; }
.records-section { padding-bottom: 15px; }
.record-list { display: flex; flex-direction: column; gap: 8px; }
.record-card { display: grid; grid-template-columns: minmax(160px, .9fr) minmax(0, 2fr) auto; align-items: center; gap: 12px; min-width: 0; padding: 10px 13px; border: 1px solid rgba(164, 162, 169, .17); border-radius: 6px; background: rgba(9, 9, 11, .8); }
.record-heading { min-width: 0; align-items: center; }
.record-heading h4 { margin: 0; color: #e4e1e4; font-size: 13px; line-height: 1.5; }
.state-badge { flex: 0 0 auto; padding: 4px 8px; border: 1px solid rgba(164, 162, 169, .23); color: #bab6bd; font-size: 10px; }
.state-badge.state-unused, .state-badge.state-active { border-color: rgba(139, 171, 139, .35); color: #a7c5a8; background: rgba(54, 79, 55, .18); }
.state-badge.state-expired { color: #aaa6ad; }
.state-badge.state-banned, .state-badge.state-revoked { border-color: rgba(202, 104, 104, .38); color: #e29d9d; background: rgba(90, 36, 42, .2); }
.state-badge.state-deleted { border-color: rgba(164, 162, 169, .3); color: #aaa7ae; background: rgba(90, 90, 96, .16); }
.record-card.state-frozen { border-color: rgba(227, 38, 49, .44); }
.state-badge.state-frozen { border-color: rgba(227, 38, 49, .52); color: #ffb0b5; background: rgba(93, 20, 28, .34); }
.record-card.state-restricted { border-color: rgba(200, 170, 112, .42); }
.state-badge.state-restricted { border-color: rgba(200, 170, 112, .54); color: #e3c87c; background: rgba(117, 88, 43, .19); }
.record-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 11px; min-width: 0; margin: 0; color: #aaa7ae; font-size: 10px; line-height: 1.5; }
.record-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin: 0; }
.small-button { min-height: 30px; padding: 5px 9px; font-size: 10px; }
.small-button.danger-soft { border-color: rgba(200, 120, 120, .35); color: #e4b0b0; background: rgba(78, 35, 39, .34); }
.small-button.danger { border-color: rgba(210, 90, 90, .5); color: #f0b3b3; background: rgba(98, 37, 42, .55); }
.bulk-delete-button { white-space: nowrap; }
.bulk-delete-button:disabled { opacity: .5; cursor: wait; }
.bulk-delete-overlay {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, .76);
  backdrop-filter: blur(4px);
}
.bulk-delete-overlay[hidden] { display: none; }
.bulk-delete-dialog {
  width: min(100%, 520px);
  padding: 22px;
  border: 1px solid rgba(200, 120, 120, .5);
  background: #111013;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .65);
}
.bulk-delete-dialog h3 { margin: 8px 0 12px; color: #eee8e5; font-size: 19px; }
.bulk-delete-dialog > p { color: #c7bfc0; font-size: 13px; line-height: 1.8; }
.bulk-delete-dialog .field-group { margin-top: 18px; }
.bulk-delete-dialog .field-group input { direction: rtl; }
.bulk-delete-actions { display: flex; gap: 10px; margin-top: 15px; }
.bulk-delete-actions button { flex: 1; min-height: 44px; }
.bulk-delete-actions button:disabled { opacity: .5; cursor: wait; }
.empty-state { width: 100%; margin: 0; padding: 16px; border: 1px dashed rgba(164, 162, 169, .22); border-radius: 6px; color: #98959c; font-size: 12px; text-align: center; }
.load-more-button { display: block; min-height: 38px; margin: 13px auto 0; }
.load-more-button[hidden] { display: none; }
.load-more-button:disabled { opacity: .5; cursor: wait; }

@media (max-width: 720px) {
  .admin-stage.is-dashboard { padding-right: 15px; padding-left: 15px; }
  .admin-card.is-dashboard { margin-top: 67px; }
  .dashboard { margin-top: 21px; }
  .dashboard-heading { align-items: flex-start; }
  .maintenance-panel { align-items: stretch; flex-direction: column; }
  .maintenance-toggle { width: 100%; }
  .section-heading .bulk-delete-button { width: 100%; }
  .key-create-form { grid-template-columns: 1fr 1fr; }
  .key-create-form .create-button { grid-column: 1 / -1; }
  .key-control-form { grid-template-columns: 1fr 1fr; }
  .key-time-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-links-form { grid-template-columns: 1fr 1fr; }
  .key-control-form .key-control-button { grid-column: 1 / -1; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .record-card { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; }
  .record-heading, .record-details, .record-actions { grid-column: 1 / -1; }
  .record-actions { justify-content: flex-start; }
}
@media (max-width: 430px) {
  .dashboard-heading { flex-direction: column; }
  .logout-button { width: 100%; }
  .admin-section { padding: 15px; }
  .key-create-form { grid-template-columns: 1fr; }
  .key-create-form .create-button { grid-column: auto; }
  .key-control-form { grid-template-columns: 1fr; }
  .key-time-form { grid-template-columns: 1fr; }
  .site-links-form { grid-template-columns: 1fr; }
  .site-links-form .site-links-save { grid-column: auto; }
  .key-control-form .key-control-button { grid-column: auto; }
  .issued-heading { flex-direction: column; }
  .record-details { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}


/* لوحة الإدارة: هوية LEGEND HACK الحمراء والفحمية */
:root {
  --red: #e32631;
  --gold: #e32631;
}

.admin-stage.is-dashboard {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(227, 38, 49, .11), transparent 36%),
    radial-gradient(ellipse at 50% 100%, rgba(227, 38, 49, .045), transparent 44%),
    #08080a;
}

.admin-card.is-dashboard .admin-brand-frame {
  border-color: rgba(227, 38, 49, .58);
  background: linear-gradient(145deg, #211013, #0b0c0e 64%);
  box-shadow: 0 0 24px rgba(227, 38, 49, .15), 0 14px 30px rgba(0, 0, 0, .58);
}

.admin-card.is-dashboard h1 { color: #e5e2e5; }
.dashboard-heading h2 { color: #f3eff1; }
.dashboard-status { color: #d9a5a8; }
.dashboard-status[data-state="success"] { color: #e7afb2; }
.login-status { color: #d9a5a8; }
.login-status[data-state="success"] { color: #e7afb2; }

.login-button:not(:disabled) {
  color: #fff;
  background: linear-gradient(105deg, #a90f1a, #e32631 57%, #b5121e);
  box-shadow: 0 0 24px rgba(227, 38, 49, .18);
}
.login-button:not(:disabled):hover {
  color: #fff;
  background: linear-gradient(105deg, #c91421, #f23a45 57%, #cc1724);
  box-shadow: 0 0 30px rgba(227, 38, 49, .28);
}
.field-group input:focus,
.site-links-form input:focus,
.subscription-form textarea:focus,
.key-control-form input:focus,
.key-control-form select:focus {
  border-color: rgba(227, 38, 49, .78);
  box-shadow: 0 0 18px rgba(227, 38, 49, .11);
}
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
.dashboard-tab:focus-visible, .help-details summary:focus-visible {
  outline: 2px solid #f04b55;
  outline-offset: 3px;
}

.logout-button, .small-button, .load-more-button {
  border-color: rgba(227, 38, 49, .36);
  color: #f0b7bb;
  background: rgba(45, 15, 19, .72);
}
.logout-button:hover, .small-button:hover, .load-more-button:hover {
  border-color: #e32631;
  color: #fff;
  background: rgba(121, 24, 33, .28);
}
.small-button.danger-soft {
  border-color: rgba(164, 38, 47, .55);
  color: #f2a6ab;
  background: rgba(76, 18, 24, .48);
}
.small-button.danger {
  border-color: rgba(227, 38, 49, .72);
  color: #fff;
  background: #6f0f18;
}
.small-button.danger:hover { background: #8f111c; }

.maintenance-panel {
  border-color: rgba(227, 38, 49, .34);
  background: linear-gradient(110deg, rgba(34, 15, 19, .92), rgba(13, 13, 16, .96));
}
.maintenance-toggle {
  border-color: rgba(227, 38, 49, .65);
  color: #fff;
  background: linear-gradient(105deg, #a90f1a, #e32631 57%, #b5121e);
}
.maintenance-toggle:hover:not(:disabled) { background: linear-gradient(105deg, #c91421, #f23a45 57%, #cc1724); }
.maintenance-toggle.is-on {
  border-color: rgba(227, 38, 49, .75);
  color: #ffe8e9;
  background: rgba(103, 20, 29, .78);
}
.status-light.is-on { background: #e32631; box-shadow: 0 0 12px rgba(227, 38, 49, .55); }

.dashboard-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0 16px;
  padding: 6px;
  border: 1px solid rgba(164, 162, 169, .18);
  background: linear-gradient(115deg, rgba(24, 23, 27, .96), rgba(12, 12, 15, .96));
}
.dashboard-tab {
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid transparent;
  color: #a7a3ab;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}
.dashboard-tab:hover { color: #f4e7e8; background: rgba(100, 22, 30, .2); }
.dashboard-tab.is-active {
  border-color: rgba(227, 38, 49, .42);
  color: #fff;
  background: linear-gradient(110deg, rgba(100, 18, 27, .68), rgba(48, 15, 20, .82));
  box-shadow: inset 0 -2px 0 #e32631;
}
.dashboard-tab-panel[hidden] { display: none; }
.dashboard-tab-panel { animation: card-in 220ms ease both; }

.section-heading { align-items: center; }
.section-heading > div:first-child { min-width: 0; }
.help-details {
  position: relative;
  flex: 0 0 auto;
  align-self: center;
}
.help-details summary {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid rgba(227, 38, 49, .58);
  border-radius: 50%;
  color: #ff9299;
  background: rgba(75, 14, 21, .42);
  font: 700 14px/1 Arial, sans-serif;
  cursor: pointer;
  list-style: none;
}
.help-details summary::-webkit-details-marker { display: none; }
.help-details summary:hover { color: #fff; background: rgba(150, 22, 33, .48); }
.help-content {
  position: absolute;
  z-index: 20;
  top: calc(100% + 9px);
  inset-inline-end: 0;
  width: min(430px, calc(100vw - 56px));
  max-height: min(60vh, 420px);
  overflow: auto;
  padding: 13px 15px;
  border: 1px solid rgba(227, 38, 49, .38);
  color: #ddd9de;
  background: #171417;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .55);
  text-align: right;
}
.help-content p { margin: 0; font-size: 12px; line-height: 1.85; }

.stats-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 11px;
  margin-top: 0;
}
.stat-card {
  grid-column: span 2;
  min-height: 90px;
  gap: 10px;
  border-color: rgba(164, 162, 169, .17);
  background: linear-gradient(145deg, rgba(22, 21, 25, .96), rgba(11, 11, 14, .98));
}
.stat-label { display: flex; align-items: center; gap: 8px; }
.stat-card span { color: #aaa6af; }
.stat-icon { width: 15px; height: 15px; flex: 0 0 15px; color: #c7c3ca; }
.stat-value { font: 700 25px/1 Arial, sans-serif; }
.stat-total-value { color: #f1eef1 !important; }
.stat-active-value { color: #80d69a !important; }
.stat-danger-value { color: #f06b74 !important; }
.stat-restricted-value { color: #e6a0a5 !important; }
.stat-revoked-value { color: #b7b2ba !important; }
.stat-card:has(.stat-active-value) .stat-icon { color: #80d69a; }
.stat-card:has(.stat-danger-value) .stat-icon { color: #f06b74; }
.stat-card:has(.stat-restricted-value) .stat-icon { color: #e6a0a5; }
.stat-card:has(.stat-revoked-value) .stat-icon { color: #b7b2ba; }

.issued-panel { border-color: rgba(227, 38, 49, .32); background: rgba(20, 14, 17, .8); }
.issued-heading h4, .issued-codes { color: #f0c3c6; }
.record-card.state-restricted { border-color: rgba(227, 38, 49, .38); }
.state-badge.state-restricted {
  border-color: rgba(227, 38, 49, .45);
  color: #f0a0a6;
  background: rgba(93, 20, 28, .24);
}

@media (max-width: 720px) {
  .dashboard-tabs { display: flex; gap: 5px; overflow-x: auto; padding: 4px; }
  .dashboard-tab { flex: 0 0 140px; min-height: 48px; padding: 7px 5px; font-size: 11px; }
  .stats-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .stat-card { grid-column: span 2; padding: 12px; }
}
@media (max-width: 430px) {
  .dashboard-tabs { gap: 4px; margin-top: 14px; }
  .dashboard-tab { min-height: 54px; padding: 6px 3px; font-size: 10px; }
  .help-content { width: min(340px, calc(100vw - 44px)); }
  .stat-card { min-height: 82px; padding: 10px; }
  .stat-card span { font-size: 10px; }
  .stat-value { font-size: 22px; }
}


.admin-stage:not(.is-dashboard) {
  background:
    radial-gradient(ellipse at 50% 39%, rgba(142, 140, 145, .08), transparent 37%),
    radial-gradient(ellipse at 50% 100%, rgba(227, 38, 49, .07), transparent 44%),
    #08080a;
}
.admin-brand-frame {
  border-color: rgba(227, 38, 49, .57);
  background: linear-gradient(145deg, #201014, #0b0c0e 64%);
  box-shadow: 0 0 26px rgba(227, 38, 49, .15), 0 14px 30px rgba(0, 0, 0, .58);
}
.stat-card:nth-child(4) { grid-column: 2 / span 2; }
.stat-card:nth-child(5) { grid-column: 4 / span 2; }

.hwid-help-note {
  padding: 11px 14px;
  border-inline-start: 2px solid #e32631;
  background: rgba(31, 13, 17, .78);
}


/* Reseller management */
.reseller-language-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; color: #bcb7bf; font-size: 12px; }
.reseller-language-toggle { min-width: 76px; border-color: rgba(227, 38, 49, .35); }
#panel-resellers[dir="ltr"] { text-align: left; }
#panel-resellers[dir="ltr"] .section-heading { text-align: left; }
#panel-resellers[dir="ltr"] .reseller-card-heading,
#panel-resellers[dir="ltr"] .reseller-card-summary,
#panel-resellers[dir="ltr"] .reseller-history-row { direction: ltr; }
.reseller-create-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 14px;
}
.reseller-create-form .field-group,
.reseller-price-form .field-group,
.reseller-balance-form .field-group { min-width: 0; margin: 0; }
.reseller-create-form .field-group label,
.reseller-price-form .field-group label,
.reseller-balance-form .field-group label { font-size: 12px; }
.reseller-create-form input,
.reseller-price-form input,
.reseller-balance-form input {
  display: block;
  width: 100%;
  height: 46px;
  padding: 0 11px;
  border: 1px solid rgba(151, 149, 157, .34);
  color: #eee8d9;
  background: rgba(12, 12, 15, .8);
  direction: ltr;
  text-align: left;
}
.reseller-create-form .reseller-create-button { grid-column: 1 / -1; min-height: 48px; margin: 0; font-size: 15px; }
.reseller-list { display: flex; flex-direction: column; gap: 12px; }
.reseller-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(227, 38, 49, .25);
  background: linear-gradient(145deg, rgba(23, 17, 20, .96), rgba(10, 10, 13, .98));
}
.reseller-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.reseller-card-heading h4 { margin: 0; color: #f2edef; font-size: 16px; }
.reseller-card [hidden] { display: none !important; }
.reseller-card-summary { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 10px 0 14px; color: #b5b0b8; font-size: 12px; }
.reseller-card-summary strong { color: #fff; }
.reseller-card .reseller-price-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; gap: 10px; padding-top: 13px; border-top: 1px solid rgba(164, 162, 169, .15); }
.reseller-price-form button { min-height: 44px; }
.reseller-balance-controls { display: grid; grid-template-columns: minmax(140px, .7fr) minmax(170px, 1.3fr) auto auto; align-items: end; gap: 9px; margin-top: 12px; }
.reseller-balance-controls .field-group { margin: 0; }
.reseller-balance-controls .small-button { min-height: 44px; }
.reseller-account-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.reseller-history-toggle[aria-expanded="true"] { color: #fff; background: rgba(121, 24, 33, .36); }
.reseller-history { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.reseller-history[hidden] { display: none; }
.reseller-history-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 9px 11px; border: 1px solid rgba(164, 162, 169, .14); color: #aaa7ae; background: rgba(8, 8, 10, .8); font-size: 11px; }
.reseller-history-row strong { color: #f0e8ea; }
.state-badge.state-suspended { border-color: rgba(227, 38, 49, .46); color: #f0a0a6; background: rgba(93, 20, 28, .24); }
.reseller-ledger-credit { color: #91d8a2 !important; }
.reseller-ledger-debit { color: #f0a0a6 !important; }
.reseller-load-more { align-self: center; }
@media (max-width: 720px) {
  .reseller-create-form { grid-template-columns: 1fr 1fr; }
  .reseller-card .reseller-price-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .reseller-price-form button { grid-column: 1 / -1; }
  .reseller-balance-controls { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 430px) {
  .reseller-create-form { grid-template-columns: 1fr; }
  .reseller-create-form .reseller-create-button { grid-column: auto; }
  .reseller-card { padding: 12px; }
  .reseller-card .reseller-price-form { grid-template-columns: 1fr; }
  .reseller-price-form button { grid-column: auto; }
  .reseller-balance-controls { grid-template-columns: 1fr 1fr; }
  .reseller-balance-controls .field-group { grid-column: 1 / -1; }
}
