:root {
  color-scheme: dark;
  --bg: #050203;
  --bg-elevated: #0b0305;
  --panel: rgba(16, 5, 8, 0.94);
  --panel-solid: #100508;
  --panel-soft: #17070b;
  --border: #351017;
  --border-bright: #5b1b25;
  --text: #f8e9ed;
  --text-soft: #d8b8c0;
  --muted: #9f7882;
  --accent: #ff3047;
  --accent-deep: #420a14;
  --accent-ink: #fff5f7;
  --blue: #ff7687;
  --danger: #ff1f3a;
  --danger-soft: rgba(255, 31, 58, 0.14);
  --warning: #ff9e5c;
  --warning-soft: rgba(255, 158, 92, 0.12);
  --success: #ff6477;
  --success-soft: rgba(255, 100, 119, 0.12);
  --focus: 0 0 0 3px rgba(255, 48, 71, 0.28);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  --font: "Segoe UI", "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1000px 600px at 92% -10%, rgba(255, 31, 58, 0.16), transparent 60%),
    radial-gradient(800px 500px at 10% 110%, rgba(130, 0, 19, 0.2), transparent 60%),
    var(--bg);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 50% 30%, black, transparent 75%);
  z-index: -1;
}

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

a:hover {
  color: #ff98a4;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(1.8rem, 3vw, 2.55rem);
  line-height: 1.1;
  letter-spacing: -0.04em;
  margin-bottom: 0.4rem;
}

h2 {
  font-size: 1.02rem;
  letter-spacing: -0.015em;
  margin-bottom: 0.2rem;
}

h3 {
  font-size: 1.08rem;
  margin-bottom: 0.45rem;
}

code,
.mono {
  font-family: var(--mono);
  font-size: 0.88em;
}

code {
  color: #f3d7dc;
  overflow-wrap: anywhere;
}

small {
  font-size: 0.78rem;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  padding: 1.45rem 1.1rem 1.2rem;
  border-right: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(24, 8, 12, 0.9), rgba(6, 2, 3, 0.97)),
    var(--bg-elevated);
  backdrop-filter: blur(14px);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.4rem;
  color: var(--text);
}

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

.brand strong {
  display: block;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
}

.brand small {
  display: block;
  color: var(--muted);
  margin-top: 0.05rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid rgba(255, 48, 71, 0.45);
  border-radius: 12px;
  background: #0b0305;
  box-shadow: 0 0 18px rgba(255, 31, 58, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.brand-mark svg {
  width: 24px;
  height: 24px;
}

.brand-mark-large {
  width: 48px;
  height: 48px;
  border-radius: 15px;
}

.brand-mark-large svg {
  width: 30px;
  height: 30px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.72rem;
  padding: 0.68rem 0.78rem;
  border-radius: 10px;
  color: var(--text-soft);
  border: 1px solid transparent;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.nav-link:hover {
  background: rgba(255, 70, 90, 0.045);
  color: var(--text);
}

.nav-link.active {
  color: var(--accent);
  background: linear-gradient(90deg, rgba(255, 48, 71, 0.1), rgba(255, 48, 71, 0.02));
  border-color: rgba(255, 48, 71, 0.15);
}

.nav-icon {
  width: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 1.02rem;
}

.nav-link.active .nav-icon {
  color: var(--accent);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 0.8rem;
}

.operator {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.35rem;
}

.operator-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(255, 100, 119, 0.08);
}

.operator strong {
  display: block;
  font-size: 0.86rem;
}

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

.main {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 2.15rem clamp(1.2rem, 3.4vw, 3.3rem) 4rem;
  min-width: 0;
}

/* ── Header and typography ────────────────────────────────────────────── */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.2rem;
  margin-bottom: 1.55rem;
}

.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.68rem;
  font-weight: 700;
  margin-bottom: 0.55rem;
}

.page-subtitle {
  color: var(--muted);
  margin-bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.page-code {
  font-size: clamp(1.25rem, 2.4vw, 1.9rem);
  color: var(--text);
  letter-spacing: -0.02em;
}

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

.text-danger {
  color: var(--danger) !important;
}

.hint {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0;
}

.text-link {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
}

.cell-sub {
  display: block;
  color: var(--muted);
  margin-top: 0.3rem;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.67rem 1rem;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 120ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease;
  text-decoration: none;
  white-space: nowrap;
}

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

.btn:active {
  transform: translateY(0);
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
}

.btn:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.btn-primary {
  background: linear-gradient(145deg, #ff4b60, #d4142b);
  color: var(--accent-ink);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 22px rgba(255, 48, 71, 0.22);
}

.btn-primary:hover {
  color: var(--accent-ink);
  background: linear-gradient(145deg, #ff697b, #e91b33);
}

.btn-secondary {
  background: rgba(255, 70, 90, 0.05);
  border-color: var(--border-bright);
  color: var(--text);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.075);
  color: var(--text);
}

.btn-ghost {
  border-color: var(--border);
  color: var(--text-soft);
  background: transparent;
}

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

.btn-danger {
  background: linear-gradient(145deg, #ff354d, #b80d22);
  color: #fff5f7;
  box-shadow: 0 8px 22px rgba(255, 31, 58, 0.2);
}

.btn-danger:hover {
  background: linear-gradient(145deg, #ffa1b0, #f0687f);
  color: #fff5f7;
}

.btn-small {
  padding: 0.42rem 0.68rem;
  font-size: 0.78rem;
  border-radius: 7px;
}

.btn-full {
  width: 100%;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* ── Panels, stats, grids ──────────────────────────────────────────────── */

.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.025) inset;
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.panel-head p {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0.16rem 0 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(150deg, rgba(26, 8, 12, 0.95), rgba(9, 3, 5, 0.96));
}

.stat-card::after {
  content: "";
  position: absolute;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  right: -55px;
  top: -55px;
  background: rgba(255, 118, 135, 0.06);
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.stat-card strong {
  display: block;
  font-size: 2rem;
  letter-spacing: -0.05em;
  line-height: 1;
  margin-bottom: 0.45rem;
}

.stat-card small {
  color: var(--muted);
}

.stat-accent strong {
  color: var(--accent);
}

.stat-warn strong {
  color: var(--warning);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
  gap: 1.25rem;
  align-items: start;
}

.content-grid-wide {
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
}

.content-grid > .panel,
.content-grid > aside > .panel:last-child {
  margin-bottom: 0;
}

.content-grid > aside {
  min-width: 0;
}

.stack {
  display: grid;
  gap: 0.8rem;
}

/* ── Lists inside panels ───────────────────────────────────────────────── */

.app-list,
.activity-list,
.timeline {
  display: grid;
  gap: 0.14rem;
}

.app-row,
.activity-row,
.timeline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.72rem 0;
  border-bottom: 1px solid rgba(66, 19, 27, 0.65);
}

.app-row:last-child,
.activity-row:last-child,
.timeline-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.app-identity {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.app-identity strong {
  display: block;
  font-size: 0.9rem;
}

.app-identity small {
  color: var(--muted);
}

.product-orb {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 33px;
  height: 33px;
  border-radius: 9px;
  color: var(--blue);
  background: rgba(255, 118, 135, 0.09);
  border: 1px solid rgba(255, 118, 135, 0.16);
  font-weight: 700;
  font-size: 0.86rem;
}

.product-orb-large {
  width: 48px;
  height: 48px;
  font-size: 1.18rem;
  border-radius: 13px;
}

.app-metrics {
  display: flex;
  gap: 1.1rem;
  text-align: right;
  flex: 0 0 auto;
}

.app-metrics span {
  display: grid;
}

.app-metrics strong {
  font-size: 1rem;
}

.app-metrics small {
  color: var(--muted);
  font-size: 0.7rem;
}

.activity-row {
  justify-content: flex-start;
}

.activity-row > div {
  min-width: 0;
}

.activity-row strong {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-row small {
  color: var(--muted);
}

.activity-dot,
.timeline-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 48, 71, 0.07);
}

.empty-inline {
  color: var(--muted);
  margin: 0;
  padding: 1rem 0;
}

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

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

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

.data-table td {
  padding: 0.8rem 0.7rem;
  border-bottom: 1px solid rgba(66, 19, 27, 0.62);
  color: var(--text-soft);
  vertical-align: middle;
  font-size: 0.84rem;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr {
  transition: background 120ms ease;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.018);
}

.data-table .empty-cell {
  color: var(--muted);
  text-align: center;
  padding: 2.2rem 1rem;
}

.cell-actions {
  text-align: right;
  white-space: nowrap;
}

.key-id {
  color: var(--text);
  font-size: 0.78rem;
  letter-spacing: -0.02em;
}

.key-link code {
  color: var(--accent);
  font-size: 0.8rem;
}

.key-link:hover code {
  text-decoration: underline;
}

.table-keys {
  min-width: 900px;
}

.product-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.48rem;
  border-radius: 99px;
  border: 1px solid rgba(255, 118, 135, 0.2);
  background: rgba(255, 118, 135, 0.07);
  color: #ffa0aa;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
  border-radius: 99px;
  font-size: 0.69rem;
  font-weight: 700;
  text-transform: capitalize;
  border: 1px solid transparent;
  white-space: nowrap;
}

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

.status-active {
  color: var(--success);
  background: var(--success-soft);
  border-color: rgba(255, 100, 119, 0.18);
}

.status-unused {
  color: var(--blue);
  background: rgba(255, 118, 135, 0.09);
  border-color: rgba(255, 118, 135, 0.18);
}

.status-banned,
.status-expired {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(255, 31, 58, 0.18);
}

.lock-state {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--muted);
  font-size: 0.7rem;
}

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

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  align-items: end;
}

.field {
  display: grid;
  gap: 0.37rem;
  min-width: 0;
}

.field > span {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--text-soft);
  font-size: 0.76rem;
  font-weight: 600;
}

.field > span small {
  color: var(--muted);
  font-weight: 400;
}

.field input,
.field select {
  width: 100%;
  min-height: 42px;
  padding: 0.58rem 0.7rem;
  border: 1px solid var(--border-bright);
  border-radius: 9px;
  background: rgba(10, 3, 5, 0.72);
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.field select {
  appearance: none;
  padding-right: 2rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.field input:hover,
.field select:hover {
  border-color: #7a2934;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus);
}

.field input::placeholder {
  color: #865c64;
}

.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 30px #100508 inset;
  transition: background-color 9999s ease-out;
}

.field-compact input {
  max-width: 110px;
}

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

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 0.25rem;
}

.filter-bar {
  display: flex;
  align-items: end;
  gap: 0.65rem;
  flex-wrap: wrap;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(11, 3, 5, 0.48);
  margin-bottom: 0.9rem;
}

.filter-bar .field {
  flex: 0 0 auto;
}

.filter-bar .field-search {
  flex: 1 1 260px;
}

.filter-bar .field input,
.filter-bar .field select {
  min-height: 38px;
}

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

.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.8rem 0.95rem;
  border-radius: 10px;
  margin-bottom: 1.15rem;
  border: 1px solid;
  font-size: 0.84rem;
  line-height: 1.45;
}

.alert > span {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 800;
  margin-top: 0.03rem;
}

.alert-success {
  color: #ffc3cb;
  background: var(--success-soft);
  border-color: rgba(255, 100, 119, 0.25);
}

.alert-success > span {
  background: rgba(255, 100, 119, 0.2);
}

.alert-error {
  color: #ffb0ba;
  background: var(--danger-soft);
  border-color: rgba(255, 31, 58, 0.25);
}

.alert-error > span {
  background: rgba(255, 31, 58, 0.18);
}

.alert-warning {
  color: #ffc49c;
  background: var(--warning-soft);
  border-color: rgba(255, 158, 92, 0.25);
}

.alert-warning > span {
  background: rgba(255, 158, 92, 0.2);
}

/* ── Detail pages ──────────────────────────────────────────────────────── */

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem 1.5rem;
  margin: 0;
}

.detail-grid div {
  min-width: 0;
}

.detail-grid dt {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.18rem;
}

.detail-grid dd {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.detail-grid dd small {
  display: block;
}

.note-box {
  margin-top: 1.2rem;
  padding: 0.85rem;
  border-left: 2px solid var(--border-bright);
  background: rgba(255, 255, 255, 0.018);
  border-radius: 0 8px 8px 0;
}

.note-box span {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
}

.note-box p {
  margin: 0.2rem 0 0;
  color: var(--text-soft);
  font-size: 0.85rem;
}

.action-stack {
  display: grid;
  gap: 0.85rem;
}

.danger-panel {
  border-color: rgba(255, 31, 58, 0.2);
  background: linear-gradient(160deg, rgba(255, 31, 58, 0.045), rgba(16, 5, 8, 0.94) 40%);
}

.timeline-row {
  justify-content: flex-start;
  align-items: flex-start;
}

.timeline-row > div {
  min-width: 0;
}

.timeline-row strong,
.timeline-row small {
  display: block;
}

.timeline-row small {
  color: var(--muted);
}

.timeline-dot {
  margin-top: 0.48rem;
}

.metadata {
  margin-top: 0.3rem;
}

.metadata summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 0.75rem;
}

.metadata pre {
  max-width: 100%;
  overflow: auto;
  margin: 0.4rem 0 0;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(8, 2, 3, 0.62);
  color: var(--text-soft);
  font-size: 0.72rem;
  line-height: 1.45;
}

.audit-action {
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 0.76rem;
}

/* ── Generated keys / recovery ─────────────────────────────────────────── */

.generated-panel {
  border-color: rgba(255, 48, 71, 0.18);
}

.generated-list {
  display: grid;
  gap: 0.55rem;
}

.generated-key {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(9, 3, 5, 0.65);
}

.generated-index {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
}

.generated-key > div {
  min-width: 0;
  flex: 1;
}

.generated-key code {
  display: block;
  color: var(--accent);
  font-size: clamp(0.75rem, 1.3vw, 0.9rem);
  word-break: break-all;
}

.generated-key small {
  color: var(--muted);
}

.panel-note {
  background: rgba(20, 7, 10, 0.7);
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.steps div {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}

.steps span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(255, 48, 71, 0.1);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
}

.steps p {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0;
}

.recovery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.recovery-code {
  padding: 0.7rem;
  text-align: center;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(9, 3, 5, 0.66);
}

/* ── Applications ──────────────────────────────────────────────────────── */

.app-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.app-card {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  margin-bottom: 0;
}

.app-card-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.app-card-head > div {
  min-width: 0;
  flex: 1;
}

.app-card-head h2 {
  margin: 0;
}

.app-card-head code {
  color: var(--muted);
  font-size: 0.76rem;
}

.app-desc {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0;
  min-height: 2.5em;
}

.stat-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.stat-pair div {
  display: grid;
}

.stat-pair strong {
  font-size: 1.2rem;
}

.stat-pair small {
  color: var(--muted);
}

/* ── Security ──────────────────────────────────────────────────────────── */

.security-state {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 0.35rem 0;
}

.security-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 50%;
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid rgba(255, 100, 119, 0.2);
  font-weight: 800;
  font-size: 1.1rem;
}

.security-icon-muted {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
}

.setup-grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 1.4rem;
  align-items: start;
}

.qr-frame {
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #fff;
  width: max-content;
}

.qr-frame img {
  display: block;
  border-radius: 6px;
}

.secret-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(9, 3, 5, 0.65);
}

.secret-row code {
  flex: 1;
  font-size: 0.76rem;
  word-break: break-all;
}

.check-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.55rem;
}

.check-list li {
  position: relative;
  padding-left: 1.25rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.check-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: 0.72rem;
}

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

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.8rem;
  padding-top: 1rem;
  color: var(--muted);
  font-size: 0.76rem;
}

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

.auth-page {
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.auth-shell {
  width: min(1020px, 100%);
  min-height: min(640px, calc(100vh - 4rem));
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(13, 4, 6, 0.82);
  box-shadow: var(--shadow);
}

.auth-shell-narrow {
  width: min(520px, 100%);
  min-height: 0;
  grid-template-columns: 1fr;
}

.auth-shell-error {
  width: min(560px, 100%);
  min-height: 0;
  grid-template-columns: 1fr;
}

.auth-intro {
  position: relative;
  overflow: hidden;
  padding: 2.4rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    radial-gradient(500px 300px at 20% 0%, rgba(255, 48, 71, 0.12), transparent 65%),
    radial-gradient(500px 400px at 100% 100%, rgba(255, 118, 135, 0.12), transparent 65%),
    linear-gradient(155deg, #17070b, #080203);
  border-right: 1px solid var(--border);
}

.auth-intro::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(140deg, transparent 35%, black);
  opacity: 0.5;
  pointer-events: none;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 3rem;
  position: relative;
  z-index: 1;
}

.auth-brand strong {
  display: block;
  font-size: 1.15rem;
}

.auth-brand small {
  color: var(--muted);
}

.auth-intro h1 {
  position: relative;
  z-index: 1;
  font-size: clamp(1.85rem, 3.3vw, 2.9rem);
  max-width: 13ch;
  margin-bottom: 1rem;
  letter-spacing: -0.055em;
}

.auth-intro > p {
  position: relative;
  z-index: 1;
  color: var(--text-soft);
  max-width: 44ch;
  font-size: 0.92rem;
}

.auth-points {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1.5rem;
  position: relative;
  z-index: 1;
}

.auth-points span {
  padding: 0.3rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 99px;
  color: var(--text-soft);
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.025);
}

.auth-card {
  align-self: center;
  width: 100%;
  padding: clamp(1.7rem, 4vw, 3rem);
}

.auth-card-wide {
  max-width: 560px;
  margin: 0 auto;
}

.auth-card-head {
  margin-bottom: 1.5rem;
}

.auth-card-head h2,
.auth-card-head h1 {
  font-size: 1.9rem;
  margin-bottom: 0.4rem;
}

.auth-card-head p:not(.eyebrow) {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 0;
}

.auth-footnote {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.5;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin: 1.3rem 0 0;
}

.auth-shell-narrow .auth-card {
  align-self: stretch;
}

.error-code {
  font-family: var(--mono);
  color: var(--danger);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  margin-bottom: 0.55rem;
}

.error-message {
  color: var(--text-soft);
}

/* ── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 1150px) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .field-compact input {
    max-width: none;
  }
}

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

  .sidebar {
    position: relative;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.7rem;
    padding: 0.8rem 1rem;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .sidebar .brand small {
    display: none;
  }

  .nav {
    flex-direction: row;
    flex-wrap: wrap;
    order: 3;
    width: 100%;
    gap: 0.2rem;
    overflow-x: auto;
  }

  .nav-link {
    padding: 0.45rem 0.6rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .sidebar-footer {
    margin-left: auto;
    margin-top: 0;
    padding: 0;
    border: 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
  }

  .operator {
    display: none;
  }

  .sidebar-footer form {
    margin: 0;
  }

  .main {
    padding-top: 1.4rem;
  }

  .content-grid,
  .content-grid-wide {
    grid-template-columns: 1fr;
  }

  .content-grid > aside {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
  }

  .content-grid > aside > .panel {
    margin-bottom: 0;
  }

  .auth-shell {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .auth-intro {
    padding: 1.7rem;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .auth-brand {
    margin-bottom: 1.5rem;
  }

  .auth-intro h1 {
    max-width: none;
    font-size: 1.85rem;
  }

  .auth-intro > p,
  .auth-points {
    display: none;
  }

  .auth-card {
    padding: 1.6rem;
  }
}

@media (max-width: 680px) {
  .main {
    padding: 1.1rem 0.85rem 3rem;
  }

  .stat-grid,
  .form-grid,
  .setup-grid,
  .recovery-grid,
  .steps {
    grid-template-columns: 1fr;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.8rem;
  }

  .page-head .btn {
    align-self: stretch;
  }

  .panel {
    padding: 1rem;
    border-radius: 13px;
  }

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

  .filter-bar {
    align-items: stretch;
  }

  .filter-bar .field,
  .filter-bar .field-search {
    flex: 1 1 100%;
  }

  .generated-key {
    flex-wrap: wrap;
  }

  .generated-key > div {
    flex-basis: calc(100% - 45px);
  }

  .generated-key .btn {
    margin-left: auto;
  }

  .auth-page {
    padding: 0;
    place-items: stretch;
  }

  .auth-shell {
    min-height: 100vh;
    border-radius: 0;
    border: 0;
  }

  .auth-intro {
    display: none;
  }

  .auth-card {
    align-self: center;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
  }
}

@media print {
  body {
    background: #fff;
    color: #111;
  }

  body::before,
  .sidebar,
  .page-head .btn,
  .button-row,
  .alert,
  .hint,
  .panel-note {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .main {
    padding: 0;
    max-width: none;
  }

  .panel {
    box-shadow: none;
    background: #fff;
    border-color: #ddd;
    break-inside: avoid;
  }

  .generated-key code,
  .recovery-code,
  code {
    color: #111;
  }

  .generated-key,
  .recovery-code {
    border-color: #ccc;
    background: #fff;
  }
}

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

.manual-setup {
  width: 100%;
  padding: 1.15rem;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--panel-soft);
}

.mt-sm {
  margin-top: 0.8rem;
}


.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
