/* ─────────────────────────────────────────────────────────────────────
   Licenser admin UI
   ───────────────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #08090b;
  --bg-soft: #0a0c0f;
  --panel: #0d0f12;
  --panel-2: #101216;
  --border: rgba(255, 255, 255, 0.09);
  --border-soft: rgba(255, 255, 255, 0.06);
  --text: #f5f6f7;
  --muted: #9aa1ab;
  --accent: #ff4d2e;
  --accent-strong: #ff4d2e;
  --accent-soft: rgba(255, 77, 46, 0.12);
  --accent-bright: #ff8068;
  --green: #3ddc97;
  --green-soft: rgba(61, 220, 151, 0.12);
  --amber: #ffb020;
  --amber-soft: rgba(255, 176, 32, 0.12);
  --red: #ff5a5f;
  --red-soft: rgba(255, 90, 95, 0.12);
  --violet: #b39ddb;
  --slate-soft: rgba(154, 161, 171, 0.14);
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: 0 22px 50px -38px rgba(0, 0, 0, 0.95);
  --font-body: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", Inter, ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 16px;
}

p {
  margin: 0 0 10px;
}

code,
.mono {
  font-family: var(--mono);
  font-size: 13px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

/* ── Shell ──────────────────────────────────────────────────────────── */

.shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px 18px;
  border-right: 1px solid var(--border-soft);
  background: linear-gradient(180deg, rgba(13, 15, 18, 0.92), rgba(8, 9, 11, 0.92));
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 17px;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 8px 20px -12px rgba(255, 77, 46, 0.8);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.nav-link {
  display: block;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  text-decoration: none;
}

.nav-link.is-active {
  color: var(--accent-bright);
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}

.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.brand-lockup:hover {
  color: var(--text);
  text-decoration: none;
}

.brand-lockup img {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 6px;
}

@media (max-width: 900px) {
  .brand-lockup span {
    display: none;
  }
}

.account-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--text);
}

.account-link:hover {
  background: rgba(255, 255, 255, 0.04);
  text-decoration: none;
}

.account-link.is-active {
  background: var(--accent-soft);
}

.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 650;
  color: #fff;
  background: linear-gradient(140deg, #ff4d2e, #8c2a12);
  flex: none;
}

.account-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.account-email {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-role {
  font-size: 11px;
  color: var(--muted);
}

/* ── Main area ──────────────────────────────────────────────────────── */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 34px 18px;
  background: linear-gradient(180deg, rgba(8, 9, 11, 0.94), rgba(8, 9, 11, 0.62));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}

.topbar-title h1 {
  font-size: 23px;
}

.topbar-title .muted {
  margin: 3px 0 0;
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px 34px 70px;
  width: 100%;
  max-width: 1400px;
}

/* ── Cards ──────────────────────────────────────────────────────────── */

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
}

.cols-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
}

.cols-2 > * {
  min-width: 0;
}

/* Rows whose cards hold data tables need wider columns before splitting. */
.cols-loose {
  grid-template-columns: repeat(auto-fit, minmax(min(450px, 100%), 1fr));
}

.cols-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

/* ── Stats ──────────────────────────────────────────────────────────── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(172px, 1fr));
  gap: 16px;
}

.stat {
  position: relative;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(165deg, var(--panel-2), var(--bg-soft));
  overflow: hidden;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  font-weight: 600;
}

.stat-value {
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.stat-note {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.stat-note.is-warn {
  color: var(--amber);
}

/* ── Tables ─────────────────────────────────────────────────────────── */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  white-space: nowrap;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.022);
}

.table .wrap {
  white-space: normal;
}

.table .empty {
  padding: 26px 12px;
  text-align: center;
  color: var(--muted);
}

.table .num {
  font-variant-numeric: tabular-nums;
}

/* Dense variant for tables inside narrow cards, e.g. the dashboard. */
.table-compact th,
.table-compact td {
  padding-left: 9px;
  padding-right: 9px;
}

.table-compact td .key-sub {
  display: block;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 560px) {
  .table-compact th,
  .table-compact td {
    padding-left: 6px;
    padding-right: 6px;
  }

  /* Customer is the least critical column on a phone; drop it to keep the rest visible. */
  .table-compact th:nth-child(2),
  .table-compact td:nth-child(2) {
    display: none;
  }
}

@media (max-width: 400px) {
  .table-compact th,
  .table-compact td {
    padding-left: 4px;
    padding-right: 4px;
  }
}

/* ── Badges ─────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: capitalize;
  border: 1px solid transparent;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-active {
  color: var(--green);
  background: var(--green-soft);
  border-color: rgba(52, 211, 153, 0.28);
}

.badge-suspended {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: rgba(251, 191, 36, 0.28);
}

.badge-revoked {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(251, 113, 133, 0.28);
}

.badge-expired {
  color: var(--violet);
  background: rgba(179, 157, 219, 0.12);
  border-color: rgba(179, 157, 219, 0.26);
}

.badge-warn {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: rgba(251, 191, 36, 0.26);
}

.badge-neutral {
  color: var(--muted);
  background: var(--slate-soft);
  border-color: rgba(139, 155, 184, 0.22);
}

.badge-warn::before,
.badge-neutral::before {
  display: none;
}

/* ── Buttons ────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.1;
  cursor: pointer;
  transition: transform 0.06s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  color: var(--text);
  background: transparent;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 12px 26px -16px rgba(255, 77, 46, 0.9);
}

.btn-primary:hover {
  background: var(--accent-bright);
}

.btn-ghost {
  border-color: var(--border);
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
}

.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
}

.btn-danger {
  border-color: rgba(251, 113, 133, 0.35);
  color: var(--red);
  background: rgba(251, 113, 133, 0.08);
}

.btn-danger:hover {
  background: rgba(251, 113, 133, 0.16);
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12.5px;
}

.btn-block {
  width: 100%;
}

.btn-link {
  border: none;
  background: none;
  color: var(--accent);
  padding: 0;
  cursor: pointer;
  font: inherit;
}

/* ── Forms ──────────────────────────────────────────────────────────── */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.filters .push {
  margin-left: auto;
}

input,
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.3;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(255, 77, 46, 0.2);
}

input::placeholder,
textarea::placeholder {
  color: #626a75;
}

input[type="color"] {
  height: 40px;
  padding: 4px;
  cursor: pointer;
}

textarea {
  resize: vertical;
  min-height: 90px;
  font-family: var(--mono);
  font-size: 12.5px;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span,
.field-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.field > span.hint {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.field > span.hint,
.field .hint {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}

.field-error {
  margin: 0;
  font-size: 12px;
  color: var(--red);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid .span-2 {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.form-actions .spacer {
  flex: 1;
}

.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.inline-form input[type="number"] {
  width: 96px;
}

/* ── Alerts ─────────────────────────────────────────────────────────── */

.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13.5px;
}

.alert-success {
  color: #aef3d2;
  border-color: rgba(61, 220, 151, 0.3);
  background: rgba(61, 220, 151, 0.09);
}

.alert-error {
  color: #ffd2d4;
  border-color: rgba(255, 90, 95, 0.32);
  background: rgba(255, 90, 95, 0.1);
}

/* ── One-time secret ────────────────────────────────────────────────── */

.secret-card {
  border-color: rgba(255, 176, 32, 0.32);
  background: linear-gradient(160deg, rgba(255, 176, 32, 0.08), var(--panel));
}

/* Hash targets stop below the sticky topbar. app.js replaces this with the
   measured header height; the fallback covers the first paint. */
html {
  scroll-padding-top: 140px;
}

.secret-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

.secret-row code {
  flex: 1;
  min-width: 260px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(255, 176, 32, 0.4);
  background: rgba(0, 0, 0, 0.35);
  font-size: 15px;
  letter-spacing: 0.06em;
  overflow-wrap: anywhere;
}

/* ── Key/value detail grid ──────────────────────────────────────────── */

.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}

.kv {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.kv-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.kv-value {
  font-size: 14px;
  overflow-wrap: anywhere;
}

/* ── Chart ──────────────────────────────────────────────────────────── */

.chart {
  display: flex;
  align-items: stretch;
  gap: 7px;
  height: 170px;
  margin-top: 6px;
}

.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.chart-plot {
  flex: 1;
  display: flex;
  align-items: flex-end;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
}

.chart-bar {
  width: 100%;
  min-height: 3px;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, var(--accent-bright), color-mix(in srgb, var(--accent) 25%, transparent));
  transition: filter 0.15s ease;
}

.chart-col:hover .chart-bar {
  filter: brightness(1.25);
}

.chart-bar.is-empty {
  background: rgba(255, 255, 255, 0.08);
}

.chart-label {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
}

.chart-total {
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.code-block {
  margin: 0;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: rgba(0, 0, 0, 0.28);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: #d6d9de;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Code tabs (integration page) ───────────────────────────────────── */

.code-tabs {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.code-tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-soft);
}

.code-tab {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.code-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.code-tab[aria-selected='true'] {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(255, 77, 46, 0.28);
}

.code-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.code-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.code-panel[hidden] {
  display: none;
}

.code-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.steps {
  margin: 0 0 14px;
  padding-left: 20px;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13.5px;
}

.steps li::marker {
  color: var(--accent);
  font-weight: 700;
}

.steps strong {
  color: var(--text);
}

/* ── Activity timeline ──────────────────────────────────────────────── */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.timeline-item {
  display: flex;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border-soft);
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-dot {
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 77, 46, 0.16);
}

.timeline-body {
  min-width: 0;
}

.timeline-title {
  font-size: 13.5px;
}

.timeline-meta {
  font-size: 12px;
  color: var(--muted);
}

.event-type {
  font-weight: 600;
  color: var(--text);
}

/* ── Pagination ─────────────────────────────────────────────────────── */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
  font-size: 13px;
}

/* ── Empty / error states ───────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 44px 24px;
}

.status-code {
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--accent);
  margin-bottom: 6px;
}

.empty-state h2 {
  margin-bottom: 8px;
}

.empty-state .btn {
  margin-top: 14px;
}

/* ── Auth ───────────────────────────────────────────────────────────── */

.auth {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 32px 20px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 30px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 0 40px 90px -50px rgba(0, 0, 0, 0.95);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth-card .field {
  margin-top: 2px;
}

.auth-foot {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.auth-lockup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.auth-lockup img {
  width: 16px;
  height: 16px;
  border-radius: 5px;
}

/* ── Details ────────────────────────────────────────────────────────── */

details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
}

details + details {
  margin-top: 8px;
}

summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

summary:hover {
  color: var(--text);
}

details[open] summary {
  margin-bottom: 10px;
}

details form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Utility ────────────────────────────────────────────────────────── */

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.spread {
  justify-content: space-between;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.divider {
  height: 1px;
  background: var(--border-soft);
  margin: 6px 0;
}

.nowrap {
  white-space: nowrap;
}

.danger-zone {
  border-color: rgba(251, 113, 133, 0.28);
  background: linear-gradient(160deg, rgba(251, 113, 133, 0.06), var(--panel));
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
  }

  .nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar-foot {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .topbar,
  .content {
    padding-left: 18px;
    padding-right: 18px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Theme studio preview ───────────────────────────────────────────── */

.preview {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.preview-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border-soft);
}

.preview-bar .brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 10px;
}

.preview-bar-title {
  font-family: var(--font-display);
  font-weight: 700;
}

.preview-bar .badge {
  margin-left: auto;
}

.preview-body {
  padding: 16px;
  background: var(--bg);
}

.preview-heading {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
}

.preview-card {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
}

.preview-key {
  margin-top: 4px;
  font-family: var(--font-display);
}

/* ── License lookup source ──────────────────────────────────────────── */

.lookup-source {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.lookup-source strong {
  color: var(--text);
  font-weight: 600;
}

.lookup-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

/* ── Sign-in (LetsStreamIt card) ────────────────────────────────────── */

.login-card {
  width: 100%;
  max-width: 440px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 40px 90px -55px rgba(0, 0, 0, 0.95);
  overflow: hidden;
}

.login-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 38px 30px 22px;
  text-align: center;
}

.login-logo {
  display: block;
  width: 78px;
  height: 78px;
  margin-bottom: 18px;
  border-radius: 20px;
  box-shadow: 0 18px 36px -24px rgba(255, 77, 46, 0.9);
}

.login-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.login-subtitle {
  max-width: 330px;
  margin: 8px 0 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
}

.login-email {
  color: var(--text);
  font-weight: 600;
  word-break: break-all;
}

.login-error {
  width: 100%;
  margin: 16px 0 0;
  text-align: left;
}

.sso-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 50px;
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.sso-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.sso-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.sso-button img {
  width: 18px;
  height: 18px;
  border-radius: 5px;
}

.login-or {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 18px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.login-or::before,
.login-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-soft);
}

.login-or + .login-row {
  margin-top: 16px;
}

.login-row {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 22px;
}

.login-field {
  position: relative;
  flex: 1;
  min-width: 0;
}

.login-field svg {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.login-field input {
  width: 100%;
  height: 52px;
  padding: 0 14px 0 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-field input::placeholder {
  color: #626a75;
}

.login-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.login-arrow {
  flex: none;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.login-arrow svg {
  width: 20px;
  height: 20px;
}

.login-arrow:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.login-arrow:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.login-alt {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--muted);
}

.login-alt:hover {
  color: var(--accent-bright);
}

.login-foot {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 13px 18px;
  border-top: 1px solid var(--border-soft);
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}

.login-foot a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.login-foot a:hover {
  color: var(--accent-bright);
}

.login-meta {
  font-size: 11.5px;
}

@media (max-width: 560px) {
  .login-main {
    padding: 30px 20px 18px;
  }

  .login-logo {
    width: 68px;
    height: 68px;
    border-radius: 18px;
  }

  .login-title {
    font-size: 24px;
  }
}

/* ── Checkboxes ─────────────────────────────────────────────────────── */

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  cursor: pointer;
}

.check-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
