:root { color-scheme: dark; font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: #090914; color: #f8fafc; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at top left, rgba(124,58,237,.32), transparent 36%), linear-gradient(135deg, #090914, #1b1232 58%, #090914); }
.shell { width: min(1220px, calc(100vw - 32px)); margin: 28px auto; display: grid; gap: 18px; }
.hero, .panel { border: 1px solid rgba(255,255,255,.12); background: rgba(18,18,30,.9); border-radius: 24px; box-shadow: 0 24px 80px rgba(0,0,0,.28); }
.hero { padding: 26px; background: linear-gradient(135deg, rgba(70,38,120,.9), rgba(35,27,44,.92)); display: flex; justify-content: space-between; gap: 16px; align-items: start; flex-wrap: wrap; overflow: hidden; }
.hero-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.eyebrow { margin: 0 0 8px; color: #ffd15c; text-transform: uppercase; letter-spacing: .16em; font-weight: 1000; font-size: 13px; }
h1 { margin: 0; font-size: clamp(30px, 5vw, 52px); line-height: 1; }
h2, h3 { margin: 0 0 12px; }
p { color: #c9c5e8; line-height: 1.5; }
.panel { padding: 20px; }
.admin-status { display: flex; gap: 16px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
label { display: grid; gap: 7px; font-weight: 900; color: #f8fafc; min-width: 0; align-content: start; }
.compact-field { align-self: start; }
input, select, textarea { width: 100%; min-width: 0; border: 1px solid #3b3953; border-radius: 14px; background: #0c0c17; color: #f8fafc; padding: 12px 13px; font: inherit; outline: none; }
input:focus, select:focus, textarea:focus { border-color: rgba(255,209,92,.7); box-shadow: 0 0 0 3px rgba(255,209,92,.12); }
textarea { min-height: 96px; resize: vertical; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.full { grid-column: 1 / -1; }
.row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.row.split { justify-content: space-between; }
button { position: relative; border: 0; border-radius: 14px; padding: 12px 16px; font-weight: 1000; color: #17110d; background: #ffd15c; cursor: pointer; transition: transform .12s ease, filter .18s ease, box-shadow .18s ease, opacity .18s ease, background .18s ease; box-shadow: 0 10px 24px rgba(0,0,0,.18); }
button:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.04); box-shadow: 0 14px 28px rgba(0,0,0,.24); }
button:active:not(:disabled), button.is-busy { transform: translateY(1px) scale(.99); filter: brightness(.96); box-shadow: 0 6px 12px rgba(0,0,0,.18); }
button:focus-visible { outline: 2px solid rgba(255,209,92,.95); outline-offset: 2px; }
button.secondary { color: #f8fafc; background: #3a3853; }
button.danger { color: #ffe7e7; background: #6b1f2a; border: 1px solid rgba(248,113,113,.45); }
button.success { color: #08140c; background: #7df7a3; }
button:disabled { opacity: .68; cursor: not-allowed; }
.action-btn { min-width: 124px; }
.toast-wrap { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 10px; z-index: 9999; width: min(360px, calc(100vw - 24px)); pointer-events: none; }
.toast { position: relative; pointer-events: auto; padding: 13px 40px 13px 15px; border-radius: 16px; border: 1px solid rgba(74,222,128,.45); background: rgba(20,24,36,.96); color: #f8fafc; box-shadow: 0 24px 60px rgba(0,0,0,.35); transform: translateY(10px); opacity: 0; animation: toastIn .16s ease forwards; }
.toast.success { border-color: rgba(74,222,128,.45); }
.toast.error { border-color: rgba(248,113,113,.5); }
.toast.warn { border-color: rgba(255,209,92,.45); }
.toast-title { font-weight: 1000; margin-bottom: 4px; }
.toast-message { color: #ddd9f9; line-height: 1.4; overflow-wrap: anywhere; }
.toast-close { position: absolute; top: 8px; right: 10px; background: transparent; color: #cfcde5; box-shadow: none; padding: 4px 7px; border-radius: 10px; }
.toast-close:hover:not(:disabled) { background: rgba(255,255,255,.08); transform: none; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.table-wrap { overflow: auto; border-radius: 18px; border: 1px solid rgba(255,255,255,.1); }
table { width: 100%; border-collapse: collapse; min-width: 980px; }
th, td { padding: 11px; border-bottom: 1px solid rgba(255,255,255,.08); text-align: left; vertical-align: top; font-size: 14px; }
tr:hover td { background: rgba(255,255,255,.025); }
th { color: #ffd15c; background: rgba(255,255,255,.04); }
code, pre { color: #ffd15c; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
pre { white-space: pre-wrap; background: #05050d; border: 1px solid #35344d; border-radius: 14px; padding: 12px; line-height: 1.45; margin: 0; }
.pill { display: inline-flex; border-radius: 999px; padding: 5px 9px; background: #1f2937; border: 1px solid rgba(255,255,255,.1); font-weight: 900; font-size: 12px; text-transform: capitalize; }
.pill.active { background: rgba(20,83,45,.35); color: #bbf7d0; border-color: rgba(74,222,128,.35); }
.pill.revoked, .pill.expired, .pill.transferred { background: rgba(127,29,29,.35); color: #fecaca; border-color: rgba(248,113,113,.35); }
.muted { color: #aaa6c8; }
.small { font-size: 12px; }
.stack { display: grid; gap: 8px; }
.mini-row, .date-time-row { display: flex; gap: 8px; align-items: stretch; }
.mini-row input, .date-time-row input { min-width: 0; }
.mini-row button { flex: 0 0 auto; padding-inline: 12px; white-space: nowrap; }
.output-box { display: none; gap: 12px; }
.output-box.is-visible { display: grid; }
.license-key-output { min-height: 130px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; color: #ffd15c; }
.callout { border: 1px solid rgba(125,247,163,.26); background: rgba(20,83,45,.14); border-radius: 18px; padding: 14px; overflow: hidden; }
.license-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; margin: 10px 0 12px; }
.iso-preview { color: #ffd15c; overflow-wrap: anywhere; }
.hidden { display: none !important; }
@media (max-width: 820px) {
  .shell { width: min(100vw - 18px, 1220px); margin: 10px auto; gap: 12px; }
  .hero, .panel { border-radius: 18px; padding: 16px; }
  .grid { grid-template-columns: 1fr; }
  .full { grid-column: auto; }
  .row, .row.split, .hero-actions, .admin-status { justify-content: stretch; }
  .row button, .hero-actions button, .admin-status button { flex: 1 1 auto; }
  .date-time-row, .mini-row { flex-direction: column; }
  .license-toolbar { grid-template-columns: 1fr; }
  table { min-width: 860px; }
  th, td { padding: 9px; font-size: 13px; }
  .toast-wrap { left: 10px; right: 10px; bottom: 10px; width: auto; }
}


/* v124c hosted portal responsive polish */
html, body { max-width: 100%; overflow-x: hidden; }
button, input, select, textarea { max-width: 100%; }
.hero > div:first-child { min-width: 0; }
.hero p, .callout, .muted { overflow-wrap: anywhere; }
.form-actions { min-width: 0; }
#saveAndGenerateBtn { white-space: normal; }
.table-wrap { max-width: 100%; }
td code { display: inline-block; max-width: 100%; word-break: break-word; }

@media (max-width: 980px) {
  .grid { grid-template-columns: 1fr; }
  .full { grid-column: auto; }
  .row, .row.split { justify-content: stretch; align-items: stretch; }
  .row > button, .row > span, .row span.row, .hero-actions > * { flex: 1 1 auto; }
  .row span.row { display: grid; grid-template-columns: 1fr; width: 100%; }
  .date-time-row { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .shell { width: 100%; margin: 0; padding: 8px; gap: 10px; }
  .hero, .panel { border-radius: 18px; padding: 16px; }
  .hero { display: grid; gap: 14px; }
  .hero-actions { justify-content: stretch; display: grid; grid-template-columns: 1fr; }
  h1 { font-size: clamp(32px, 12vw, 46px); }
  h2 { font-size: 22px; }
  .admin-status { display: grid; grid-template-columns: 1fr; align-items: stretch; }
  .mini-row, .date-time-row { display: grid; grid-template-columns: 1fr; }
  .row, .row.split { display: grid; grid-template-columns: 1fr; }
  .license-toolbar { grid-template-columns: 1fr; }
  .toast-wrap { left: 8px; right: 8px; bottom: 8px; width: auto; }
  .license-key-output { min-height: 170px; }

  .table-wrap { overflow: visible; border: 0; border-radius: 0; }
  table { min-width: 0; width: 100%; display: block; }
  thead { display: none; }
  tbody { display: grid; gap: 12px; }
  tr { display: grid; gap: 0; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.035); border-radius: 18px; padding: 10px; }
  tr:hover td { background: transparent; }
  td { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 10px; align-items: start; border-bottom: 1px solid rgba(255,255,255,.07); padding: 9px 4px; font-size: 13px; }
  td:last-child { border-bottom: 0; }
  td::before { content: attr(data-label); color: #ffd15c; font-weight: 1000; }
  td.stack, td.action-stack { display: grid; grid-template-columns: 104px minmax(0, 1fr); }
  td.action-stack::before { align-self: start; padding-top: 10px; }
  td.action-stack > button { width: 100%; min-width: 0; }
  .action-stack { gap: 8px; }
}

@media (max-width: 420px) {
  .shell { padding: 6px; }
  .hero, .panel { padding: 14px; border-radius: 16px; }
  td { grid-template-columns: 1fr; gap: 4px; }
  td.action-stack { grid-template-columns: 1fr; }
  td.action-stack::before { padding-top: 0; }
}


/* v124d fully fluid viewport containment polish */
html { width: 100%; overflow-x: hidden; }
body { width: 100%; overflow-x: hidden; }
.shell {
  width: 100%;
  max-width: 1220px;
  margin-inline: auto;
  padding-inline: clamp(8px, 2vw, 18px);
  min-width: 0;
}
.hero, .panel, #adminPanel, form, .grid, label, .row, .hero-actions, .admin-status, .table-wrap {
  min-width: 0;
  max-width: 100%;
}
.hero, .panel { overflow: hidden; }
.grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 390px), 1fr));
  align-items: start;
}
.full { grid-column: 1 / -1; }
input, select, textarea, button { min-width: 0; }
button { white-space: normal; line-height: 1.2; }
.row { min-width: 0; }
.row > * { min-width: 0; }
.row > .row { flex: 1 1 520px; }
.row > .row > button { flex: 1 1 190px; }
#clearBtn { flex: 0 1 160px; }
#saveAndGenerateBtn { flex-grow: 1.4; }
.mini-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
}
.date-time-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, .45fr);
  min-width: 0;
}
.date-time-row input[type="date"], .date-time-row input[type="time"] { min-width: 0; }
.license-toolbar { grid-template-columns: minmax(0, 1fr) auto; }
.table-wrap { overflow-x: auto; }

@media (max-width: 760px) {
  .shell { margin: 0; padding: 8px; }
  .hero, .panel { padding: 16px; border-radius: 18px; }
  .hero { display: grid; grid-template-columns: 1fr; }
  .hero-actions, .admin-status, .row, .row.split, .row > .row {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    width: 100%;
  }
  .row > button, .row > .row > button, .hero-actions > *, .admin-status button, #clearBtn {
    width: 100%;
    flex-basis: auto;
  }
  .grid { grid-template-columns: 1fr; }
  .mini-row, .date-time-row, .license-toolbar { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .shell { padding: 6px; }
  .hero, .panel { padding: 14px; border-radius: 16px; }
  .callout { padding: 12px; }
  h1 { font-size: clamp(30px, 11vw, 42px); }
  h2 { font-size: 21px; }
  input, select, textarea, button { padding-inline: 12px; }
  .toast-wrap { left: 8px; right: 8px; bottom: 8px; width: auto; }
}

@media (max-width: 360px) {
  .shell { padding: 4px; }
  .hero, .panel { padding: 12px; }
  .eyebrow { letter-spacing: .12em; }
  h1 { font-size: 30px; }
  button { padding-inline: 10px; }
}

/* v124e stronger fluid containment + license cards at tablet widths */
.shell, .hero, .panel, #adminPanel, form, .grid, label, .row, .table-wrap, table, tbody, tr, td { min-width: 0; }
.shell { overflow-x: clip; }
.panel { overflow-x: clip; }
.row.full.split { display: grid; grid-template-columns: minmax(120px, 0.7fr) minmax(0, 3fr); align-items: stretch; }
.row.full.split > .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); width: 100%; }
.row.full.split button { width: 100%; }
#saveAndGenerateBtn { min-width: 0; }

/* Switch the license list from a wide table to contained cards before it can clip action buttons. */
@media (max-width: 1120px) {
  .table-wrap { overflow: visible; border: 0; border-radius: 0; }
  table { min-width: 0; width: 100%; display: block; }
  thead { display: none; }
  tbody { display: grid; gap: 12px; width: 100%; }
  tr { display: grid; gap: 0; width: 100%; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.035); border-radius: 18px; padding: 10px; }
  tr:hover td { background: transparent; }
  td { display: grid; grid-template-columns: minmax(92px, 128px) minmax(0, 1fr); gap: 10px; align-items: start; width: 100%; border-bottom: 1px solid rgba(255,255,255,.07); padding: 9px 4px; font-size: 13px; }
  td:last-child { border-bottom: 0; }
  td::before { content: attr(data-label); color: #ffd15c; font-weight: 1000; }
  td code, td strong, td span { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
  td.action-stack { display: grid; grid-template-columns: minmax(92px, 128px) minmax(0, 1fr); }
  td.action-stack::before { align-self: start; padding-top: 10px; }
  td.action-stack > button { width: 100%; min-width: 0; max-width: 100%; }
  .action-stack { gap: 8px; }
}

@media (max-width: 760px) {
  .row.full.split { grid-template-columns: 1fr; }
}

@media (max-width: 460px) {
  td, td.action-stack { grid-template-columns: 1fr; gap: 4px; }
  td.action-stack::before { padding-top: 0; }
}

/* v124f cleaner license cards + upgrade duplicate visibility */
.dup-warning {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,209,92,.4);
  background: rgba(255,209,92,.12);
  color: #ffedb0;
  font-weight: 900;
  font-size: 11px;
}
.license-row.is-duplicate {
  box-shadow: inset 0 0 0 1px rgba(255,209,92,.22);
}
@media (max-width: 1120px) {
  .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
  }
  table, thead, tbody, tr, td {
    min-width: 0;
  }
  table {
    display: block;
    width: 100%;
  }
  thead { display: none; }
  tbody {
    display: grid;
    gap: 12px;
    width: 100%;
  }
  tr.license-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
    width: 100%;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.035);
    border-radius: 18px;
    padding: 14px;
  }
  tr:hover td { background: transparent; }
  td {
    display: block;
    width: 100%;
    border-bottom: 0;
    padding: 0;
    font-size: 13px;
    overflow-wrap: anywhere;
  }
  td::before {
    content: attr(data-label);
    display: block;
    margin: 0 0 5px;
    color: #ffd15c;
    font-weight: 1000;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
  }
  td[data-label="License"], td[data-label="Status"], td[data-label="Actions"] {
    grid-column: 1 / -1;
  }
  td[data-label="License"] code,
  td[data-label="Device ID"] code {
    display: block;
    line-height: 1.45;
  }
  td[data-label="Status"] .pill {
    width: auto;
    min-width: 96px;
    justify-content: center;
  }
  td.action-stack {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }
  td.action-stack::before {
    grid-column: 1 / -1;
    padding: 0;
  }
  td.action-stack > button {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 44px;
  }
}
@media (max-width: 700px) {
  tr.license-row {
    grid-template-columns: 1fr;
    padding: 12px;
  }
  td.action-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 420px) {
  td.action-stack {
    grid-template-columns: 1fr;
  }
}


/* v127 final hosted admin portal polish */
body { padding-bottom: env(safe-area-inset-bottom); }
.panel-title-row {
  display: flex;
  gap: 14px;
  align-items: start;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.panel-title-row h2 { margin-bottom: 4px; }
.panel-title-row p { margin: 0; }
.workflow-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 14px;
}
.workflow-card {
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04);
  border-radius: 16px;
  padding: 12px;
  display: grid;
  gap: 5px;
  min-width: 0;
}
.workflow-card strong { color: #ffd15c; }
.workflow-card span { color: #c9c5e8; font-size: 12px; line-height: 1.45; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.stat-card {
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(18,18,30,.78);
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 14px 40px rgba(0,0,0,.18);
}
.stat-card span {
  display: block;
  color: #aaa6c8;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.stat-card strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(22px, 4vw, 32px);
  color: #f8fafc;
}
.stat-card.warn { border-color: rgba(255,209,92,.35); background: rgba(255,209,92,.08); }
#licenseForm { border-top: 1px solid rgba(255,255,255,.08); padding-top: 14px; }
.license-toolbar input { min-height: 46px; }
.table-wrap { background: rgba(4,4,10,.18); }
.action-stack .danger:last-child { background: #45121a; }
#outputBox { border-color: rgba(125,247,163,.22); }
#licenseKeyOutput { min-height: 160px; }

@media (max-width: 980px) {
  .workflow-cards { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-title-row { display: grid; grid-template-columns: 1fr; }
  .panel-title-row > button { width: 100%; }
}

@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px; border-radius: 16px; }
  .workflow-card { padding: 11px; }
  .hero p { margin-bottom: 0; }
  .action-btn { min-width: 0; }
  td.action-stack { grid-template-columns: 1fr; }
}

/* v127a summary card spacing polish */
.stats-grid {
  gap: 14px !important;
  margin: 14px 0 18px;
}
.stat-card {
  min-width: 0;
}
@media (max-width: 720px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px !important;
    margin: 12px 0 16px;
  }
}
@media (max-width: 420px) {
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 10px !important;
  }
}


/* v127b admin panel section spacing polish */
#adminPanel:not(.hidden) {
  display: grid;
  gap: 18px;
}
#adminPanel > section {
  min-width: 0;
}
#outputBox.is-visible {
  margin: 0;
}
#outputBox h2,
#outputBox h3 {
  margin-bottom: 10px;
}
#outputBox .row {
  margin-top: 2px;
}
#payloadOutput {
  margin-top: 2px;
}
@media (max-width: 760px) {
  #adminPanel:not(.hidden) {
    gap: 12px;
  }
}


/* v128 admin portal workflow safety polish */
.handoff-box {
  display: none;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255,209,92,.28);
  background: rgba(255,209,92,.08);
}
.handoff-box.is-visible { display: grid; }
.handoff-box h3 { margin: 0 0 2px; }
.handoff-box p { margin: 0; }
.handoff-box pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #f8fafc;
  background: rgba(4,4,10,.38);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px;
  padding: 12px;
  margin: 0;
}
@media (min-width: 1121px) {
  td.action-stack {
    min-width: 230px;
  }
  td.action-stack .action-btn {
    width: 100%;
    min-width: 0;
  }
}
@media (max-width: 1120px) {
  td.action-stack {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  td.action-stack::before {
    grid-column: 1 / -1;
  }
}
@media (max-width: 760px) {
  td.action-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 420px) {
  td.action-stack {
    grid-template-columns: 1fr;
  }
}
