:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: #f7f8fa;
  background: #0a0b0d;
  letter-spacing: 0;
  --surface: #111317;
  --surface-raised: #171a1f;
  --surface-soft: #1d2026;
  --line: #2a2e35;
  --line-strong: #3a4049;
  --text: #f7f8fa;
  --muted: #939ba6;
  --red: #e43b56;
  --red-soft: #32151c;
  --cyan: #36c0cc;
  --green: #55d694;
  --amber: #e9b949;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: #0a0b0d; }
body { margin: 0; min-height: 100vh; background: #0a0b0d; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted, .form-note { color: var(--muted); }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #0a0b0d;
}
.login-panel {
  width: min(408px, 100%);
  display: grid;
  gap: 17px;
  padding: 34px;
  background: #121418;
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--red);
  border-radius: 6px;
  box-shadow: 0 24px 70px #000a;
}
.brand-mark { color: var(--red); font-size: 29px; font-weight: 900; line-height: 1; }
.login-panel h1 { margin: 2px 0 0; font-size: 25px; font-weight: 720; }
.login-panel p { margin: -8px 0 5px; }

label { display: grid; gap: 7px; color: #c7cdd5; font-size: 12px; font-weight: 650; }
input, select, textarea {
  width: 100%;
  color: var(--text);
  background: #0d0f12;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  outline: none;
}
input, select { min-height: 40px; padding: 8px 11px; }
textarea { min-height: 96px; padding: 10px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px #36c0cc24;
}
button {
  min-height: 36px;
  padding: 7px 13px;
  color: #eef1f4;
  background: #22262d;
  border: 1px solid #393f49;
  border-radius: 4px;
}
button:hover { background: #2b3038; border-color: #4c535f; }
button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
button.primary { color: #fff; background: var(--red); border-color: #f05a71; font-weight: 750; }
button.primary:hover { background: #f04460; }
button.danger { color: #ff9aaa; background: #31151b; border-color: #72303b; }
button.danger:hover { background: #421a22; border-color: #93404e; }
button:disabled { cursor: wait; opacity: .58; }
.error { min-height: 18px; margin: -3px 0; color: #ff8fa1; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 230px minmax(0, 1fr); }
aside {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #0e1013;
  border-right: 1px solid var(--line);
}
.brand { display: grid; gap: 5px; padding: 25px 20px 23px; border-bottom: 1px solid var(--line); }
.brand strong { color: var(--red); font-size: 25px; font-weight: 900; line-height: 1; }
.brand span { color: #a4abb5; font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; }
nav { display: grid; gap: 3px; padding: 18px 10px; }
.nav-button {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  text-align: left;
  background: transparent;
  border-color: transparent;
  color: #b7bec8;
}
.nav-button > span { color: #626b77; font: 700 9px Consolas, monospace; }
.nav-button:hover { background: #171a1f; border-color: transparent; color: #fff; }
.nav-button.active {
  color: #fff;
  background: #1c2026;
  border-color: #303640;
  box-shadow: inset 3px 0 var(--red);
}
.nav-button.active > span { color: var(--red); }
.account { margin-top: auto; display: grid; gap: 12px; padding: 16px; border-top: 1px solid var(--line); }
.account-row { min-width: 0; display: flex; align-items: center; gap: 10px; }
.account-row #admin-name { overflow: hidden; color: #d5d9df; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--red-soft);
  border: 1px solid #75303d;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
}
.quiet { width: 100%; background: transparent; }

.workspace { min-width: 0; padding: 0 28px 34px; }
header {
  min-height: 88px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}
header h1 { margin: 0 0 5px; font-size: 23px; font-weight: 730; }
header p { margin: 0; color: var(--muted); font-size: 12px; }
.header-meta { display: flex; align-items: center; gap: 14px; }
#header-clock { color: #d3d7dd; font: 650 12px Consolas, monospace; }
.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  color: var(--green);
  background: #10241a;
  border: 1px solid #285b3e;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 750;
}
.status::before { width: 6px; height: 6px; content: ""; background: currentColor; border-radius: 50%; }
.view { padding-top: 24px; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(160px, 1fr)); gap: 12px; }
.metrics article {
  position: relative;
  min-height: 142px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  padding: 18px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
}
.metrics article::after {
  position: absolute;
  top: 0;
  right: 0;
  width: 34px;
  height: 3px;
  content: "";
  background: #707884;
}
.metrics article[data-tone="green"]::after { background: var(--green); }
.metrics article[data-tone="amber"]::after { background: var(--amber); }
.metrics article[data-tone="cyan"]::after { background: var(--cyan); }
.metrics article[data-tone="red"]::after { background: var(--red); }
.metrics span { color: #b8bec7; font-size: 12px; font-weight: 650; }
.metrics strong { align-self: center; font-size: 34px; font-weight: 760; }
.metrics small { color: #727b87; font-size: 10px; text-transform: uppercase; letter-spacing: .8px; }
.overview-operations { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 28px; margin-top: 28px; }
.overview-operations > section { min-width: 0; padding-top: 15px; border-top: 1px solid var(--line); }
.attention-list { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: 5px; }
.attention-list > div { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: var(--surface); }
.attention-list span { color: #aeb5bf; font-size: 11px; }
.attention-list strong { font-size: 18px; }
.attention-list [data-tone="amber"] strong { color: var(--amber); }
.attention-list [data-tone="red"] strong { color: #ff8fa1; }

.toolbar {
  min-height: 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  color: #d4d8de;
  font-size: 13px;
}
.toolbar strong { font-weight: 650; }
.toolbar-count { margin-left: 6px; color: var(--muted); font-size: 10px; font-weight: 600; }
.toolbar-actions { display: flex; align-items: center; gap: 9px; }
.filter-bar { min-height: 52px; display: grid; grid-template-columns: minmax(220px, 1fr) 150px 145px auto; align-items: center; gap: 8px; padding: 8px; margin-bottom: 10px; background: #0f1114; border: 1px solid var(--line); border-radius: 5px; }
.filter-bar input, .filter-bar select { min-height: 34px; }
.segmented { display: flex; padding: 2px; background: #0c0e11; border: 1px solid var(--line); border-radius: 4px; }
.segmented button { min-height: 28px; padding: 4px 9px; border: 0; background: transparent; font-size: 10px; }
.segmented button.active { color: #fff; background: #2a2f37; box-shadow: inset 0 -2px var(--red); }
.source-label { display: block; margin-top: 4px; color: #69727d; font-size: 9px; text-transform: uppercase; }
.button-link { display: inline-grid; min-height: 36px; place-items: center; padding: 7px 13px; color: #eef1f4; background: #22262d; border: 1px solid #393f49; border-radius: 4px; text-decoration: none; font-size: 12px; }
.commerce-status { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 17px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--cyan); border-radius: 5px; }
.commerce-status > div:first-child { display: grid; gap: 4px; }
.commerce-status span { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.commerce-status strong { font-size: 14px; }
.commerce-status .ready { color: var(--green); }
.commerce-status .warning { color: var(--amber); }
.sales-grid { display: grid; gap: 22px; margin-top: 22px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.section-title strong { font-size: 13px; }
.section-title span { color: var(--muted); font-size: 10px; }
.offer-grid { display: grid; grid-template-columns: repeat(3, minmax(190px, 1fr)); gap: 10px; }
.offer-grid article { display: grid; gap: 13px; padding: 15px; background: var(--surface); border: 1px solid var(--line); border-top: 2px solid var(--red); border-radius: 5px; }
.offer-grid article > div { display: grid; gap: 4px; }
.offer-grid article span, .offer-grid article small { color: var(--muted); font-size: 10px; }
.offer-grid article strong { font-size: 14px; }
.offer-grid article b { font-size: 21px; }
.offer-grid article footer { display: flex; align-items: center; justify-content: space-between; }
.offer-grid article code { color: #aeb5bf; font-size: 10px; }
.empty-panel { min-height: 110px; display: grid; place-items: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 5px; font-size: 12px; }
.channel-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 16px; }
.channel-summary article { min-width: 0; min-height: 70px; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--green); border-radius: 5px; }
.channel-summary article[data-channel="beta"] { border-left-color: var(--amber); }
.channel-summary article > div { min-width: 0; display: grid; gap: 5px; }
.channel-summary article > div span { color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; }
.channel-summary article > div strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.channel-summary article button { min-height: 29px; padding: 4px 8px; font-size: 10px; }
.channel-summary.compact { grid-template-columns: 1fr; margin: 0; }
.channel-summary.compact article { min-height: 58px; }

.store-body { min-height: 100vh; color: var(--text); background: #0a0b0d; }
.store-shell { width: min(1060px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 56px; }
.store-header { min-height: 68px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.store-brand { display: flex; align-items: baseline; gap: 10px; }
.store-brand strong { color: var(--red); font-size: 25px; font-weight: 900; }
.store-brand span { color: #abb2bc; font-size: 11px; text-transform: uppercase; }
.secure-note { color: var(--green); font-size: 11px; }
.store-intro { padding: 46px 0 28px; }
.store-intro h1 { max-width: 670px; margin: 0 0 12px; font-size: clamp(30px, 5vw, 54px); line-height: 1.04; }
.store-intro p { max-width: 580px; margin: 0; color: #aeb5bf; line-height: 1.55; }
.store-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.store-offer { display: grid; grid-template-rows: auto auto 1fr auto; gap: 17px; min-height: 310px; padding: 22px; background: #121418; border: 1px solid #30353d; border-top: 3px solid var(--red); border-radius: 6px; }
.store-offer h2 { margin: 0; font-size: 19px; }
.store-price { font-size: 31px; font-weight: 780; }
.store-offer p { margin: 0; color: #9ea6b0; font-size: 12px; line-height: 1.55; }
.checkout-form { display: grid; gap: 9px; }
.checkout-form input { min-height: 38px; }
.purchase-panel { width: min(620px, 100%); margin: 70px auto 0; display: grid; gap: 18px; padding: 28px; background: #121418; border: 1px solid #343a43; border-top: 3px solid var(--green); border-radius: 6px; }
.purchase-panel h1 { margin: 0; font-size: 26px; }
.license-output { display: block; overflow-wrap: anywhere; padding: 15px; color: #fff; background: #08090b; border: 1px solid #3c434d; border-radius: 4px; font: 700 16px Consolas, monospace; }

@media (max-width: 860px) {
  .offer-grid, .store-grid { grid-template-columns: 1fr; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-actions { flex-wrap: wrap; }
}
.toolbar-search { width: min(390px, 48vw); min-height: 34px; }
.table-wrap { overflow: auto; background: #0f1114; border: 1px solid var(--line); border-radius: 5px; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { height: 47px; padding: 8px 12px; text-align: left; border-bottom: 1px solid #25292f; font-size: 12px; }
th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #8f98a4;
  background: #171a1f;
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .6px;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #15181c; }
td code { color: #cbd2da; font: 11px Consolas, monospace; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  color: #bfc6cf;
  background: #242931;
  border: 1px solid #363c46;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .45px;
}
.badge.active, .badge.stable, .badge.published { color: #79e3ab; background: #10241a; border-color: #285b3e; }
.badge.beta, .badge.draft { color: #f3c85f; background: #29220f; border-color: #59491e; }
.badge.suspended, .badge.rental { color: #f0c56a; }
.badge.revoked, .badge.expired, .badge.withdrawn { color: #ff8fa1; background: #2b1318; border-color: #67303a; }
.empty { height: 150px; color: var(--muted); text-align: center; }

dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  color: var(--text);
  background: var(--surface-raised);
  border: 1px solid #454c57;
  border-top: 3px solid var(--red);
  border-radius: 6px;
  padding: 0;
  box-shadow: 0 24px 90px #000d;
}
.wide-dialog { width: min(960px, calc(100vw - 32px)); }
.dialog-subtitle { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.license-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: 5px; }
.license-facts > div { min-width: 0; min-height: 62px; display: grid; align-content: center; gap: 6px; padding: 11px 13px; background: #111419; }
.license-facts > div > span:first-child { color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.license-facts code { overflow: hidden; color: #d5dae1; font: 11px Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.license-facts strong { overflow: hidden; color: #eef1f4; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.detail-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 12px; }
.detail-section-title { margin-top: 22px; }
.compact-empty { height: 76px; }
dialog::backdrop { background: #050608d9; }
dialog form { display: grid; gap: 17px; padding: 20px; }
.dialog-head, dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-head h2 { margin: 0; font-size: 18px; }
.icon-button { width: 34px; padding: 0; font-size: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.checkbox-label { display: flex; align-items: center; gap: 9px; align-self: end; min-height: 40px; }
.checkbox-label input { width: 16px; min-height: 16px; }
.row-actions { display: flex; gap: 6px; }
.row-actions button { min-height: 29px; padding: 4px 8px; font-size: 10px; }
.id-list { display: grid; gap: 4px; }
.id-list code { display: block; }
.form-note { margin: -4px 0 0; font-size: 11px; line-height: 1.45; }
dialog footer { justify-content: flex-end; padding-top: 5px; }
#issued-key {
  display: block;
  padding: 14px;
  color: #fff;
  background: #0c0e11;
  border: 1px solid var(--cyan);
  border-radius: 4px;
  font: 700 15px Consolas, monospace;
  overflow-wrap: anywhere;
}
#toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: 360px;
  padding: 11px 14px;
  color: #f6f7f9;
  background: #242930;
  border: 1px solid #4a525e;
  border-left: 3px solid var(--cyan);
  border-radius: 4px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: 150ms ease;
}
#toast.visible { opacity: 1; transform: translateY(0); }

@media (min-width: 1500px) {
  .metrics { grid-template-columns: repeat(6, minmax(145px, 1fr)); }
}

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 76px minmax(0, 1fr); }
  .brand span, .account-row #admin-name { display: none; }
  .brand { padding: 21px 13px; }
  .brand strong { font-size: 20px; }
  nav { padding-inline: 8px; }
  .nav-button { grid-template-columns: 1fr; gap: 3px; padding-inline: 8px; overflow: hidden; font-size: 0; text-align: center; }
  .nav-button > span { font-size: 10px; }
  .account { padding: 10px; }
  .account-row { justify-content: center; }
  .quiet { padding-inline: 4px; overflow: hidden; font-size: 10px; }
  .workspace { padding-inline: 16px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .overview-operations { grid-template-columns: 1fr; }
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .filter-bar > input, .filter-bar > .segmented { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .workspace { padding-inline: 12px; }
  header { min-height: 105px; align-items: flex-start; padding-block: 18px; }
  .header-meta { align-items: flex-end; flex-direction: column; gap: 7px; }
  #header-clock { font-size: 10px; }
  .metrics, .form-grid { grid-template-columns: 1fr; }
  .metrics article { min-height: 118px; }
  .toolbar { align-items: stretch; flex-direction: column; padding-bottom: 10px; }
  .toolbar-search { width: 100%; }
  .filter-bar, .channel-summary, .license-facts { grid-template-columns: 1fr; }
  .filter-bar > input, .filter-bar > .segmented { grid-column: auto; }
  .channel-summary article { grid-template-columns: minmax(0, 1fr) auto; }
  .channel-summary article button { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
