@font-face {
  font-family: Manrope;
  src: url('./assets/manrope-regular.otf') format('opentype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: Manrope;
  src: url('./assets/manrope-semibold.otf') format('opentype');
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0b0c0d;
  --surface: #111314;
  --surface-raised: #17191a;
  --surface-hover: #202324;
  --line: #2b2e30;
  --line-strong: #3a3e40;
  --text: #f3f4f4;
  --muted: #a2a7a8;
  --subtle: #73797a;
  --accent: #8caeff;
  --accent-strong: #aec5ff;
  --success: #73d7ac;
  --danger: #ff8787;
  --warning: #f0c77b;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --motion: cubic-bezier(.22, 1, .36, 1);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 Manrope, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  z-index: 50;
  top: 10px;
  left: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  transform: translateY(-150%);
  background: var(--accent);
  color: #111315;
}
.skip-link:focus { transform: translateY(0); }

.shell { width: min(100% - 64px, 1376px); margin: 0 auto; }
.topbar {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo { display: block; width: 34px; height: 34px; flex: 0 0 auto; object-fit: contain; }
.brand-copy strong { display: block; font-size: 15px; font-weight: 700; letter-spacing: -.025em; }
.brand-copy small { display: block; margin-top: 1px; color: var(--muted); font-size: 11px; }
.top-actions { display: flex; align-items: center; gap: 20px; }
.connection { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.connection::before { width: 6px; height: 6px; border-radius: 50%; background: var(--subtle); content: ''; }
.connection[data-state='online'] { color: var(--success); }
.connection[data-state='online']::before { background: var(--success); }

.workspace { padding: 48px 0 72px; }
.page-intro { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.intro-copy { max-width: 720px; }
.eyebrow { margin: 0 0 9px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .055em; }
.intro-copy h1 { margin: 0; font-size: clamp(28px, 3.3vw, 38px); font-weight: 700; line-height: 1.18; letter-spacing: -.045em; }
.intro-copy > p:last-child { margin: 10px 0 0; color: var(--muted); font-size: 14px; }

.button, .action, .product-delete, .close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 8px 13px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  transition: border-color 180ms var(--motion), background-color 180ms var(--motion), color 180ms var(--motion), transform 180ms var(--motion);
}
.button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.button:hover, .action:hover, .product-delete:hover { border-color: #595f61; background: var(--surface-hover); }
.button:active, .action:active { transform: translateY(1px); }
.button.primary { min-height: 42px; padding: 10px 16px; border-color: var(--accent); background: var(--accent); color: #111315; }
.button.primary:hover { border-color: var(--accent-strong); background: var(--accent-strong); }
.button.secondary { background: var(--surface-raised); }
.button.ghost { border-color: transparent; color: var(--muted); }
.button.ghost:hover { border-color: var(--line); color: var(--text); }
.button.wide { width: 100%; }
.button.danger-fill { border-color: var(--danger); background: var(--danger); color: #210d0d; }
.button.danger-fill:hover { border-color: #ffaaaa; background: #ffaaaa; }

.overview { margin-bottom: 44px; }
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.stat { min-height: 84px; padding: 17px 20px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat b { display: block; font-size: 24px; font-weight: 700; line-height: 1.15; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.stat span { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }

.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.03em; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.catalog-section { margin-bottom: 44px; }
.products { display: flex; flex-wrap: wrap; gap: 9px; }
.product {
  display: flex;
  min-width: min(250px, 100%);
  min-height: 60px;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 11px 10px 14px;
  background: var(--surface);
  transition: border-color 180ms var(--motion), background-color 180ms var(--motion);
}
.product:hover { border-color: var(--line-strong); background: var(--surface-raised); }
.product .dot { width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: var(--success); }
.product > div { min-width: 0; flex: 1 1 auto; }
.product strong { display: block; overflow: hidden; font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.product small { display: block; overflow: hidden; margin-top: 2px; color: var(--muted); font: 11px/1.4 ui-monospace, 'Cascadia Code', Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.product-delete { min-height: 30px; flex: 0 0 auto; border-color: transparent; padding: 5px 7px; color: var(--muted); font-size: 11px; }
.product-delete:hover { border-color: #613b3b; background: #281819; color: var(--danger); }

.license-section { min-width: 0; }
.records-heading { margin-bottom: 17px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 9px 11px; margin-bottom: 13px; }
.filters label { color: var(--muted); font-size: 11px; font-weight: 600; }
input, select, textarea {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: var(--surface);
  color: var(--text);
}
input::placeholder, textarea::placeholder { color: var(--subtle); }
select { min-width: 170px; }
.filters input { width: min(330px, 100%); }
input:hover, select:hover, textarea:hover { border-color: #505557; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
table { width: 100%; min-width: 940px; border-collapse: collapse; text-align: left; }
th { height: 42px; background: #151718; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: none; letter-spacing: .015em; }
td, th { border-bottom: 1px solid var(--line); padding: 11px 13px; vertical-align: middle; }
td { color: #e4e6e6; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color 150ms ease; }
tbody tr:hover { background: #191b1c; }
.mono { color: #d4d7d7; font: 11px/1.45 ui-monospace, 'Cascadia Code', Consolas, monospace; }
.muted { color: var(--muted); }
.pill { display: inline-flex; align-items: center; min-height: 23px; border: 1px solid #28503f; border-radius: 6px; padding: 3px 7px; background: #142219; color: var(--success); font-size: 10px; font-weight: 700; white-space: nowrap; }
.pill.pending { border-color: #343e53; background: #191e28; color: #b6c8f2; }
.pill.revoked { border-color: #573333; background: #261818; color: var(--danger); }
.pill.expired { border-color: #55482f; background: #231f16; color: var(--warning); }
.actions { display: flex; flex-wrap: wrap; gap: 5px; }
.action { min-height: 29px; border-color: var(--line); border-radius: 6px; padding: 5px 8px; color: #d8dada; font-size: 10px; }
.action.danger { color: var(--danger); }
.action.danger:hover { border-color: #613b3b; background: #281819; }
td.revealed-key { max-width: 280px; overflow-wrap: anywhere; color: var(--text); }
.empty { padding: 34px 18px; color: var(--muted); text-align: center; font-size: 12px; }
.footnote { margin: 10px 0 0; color: var(--subtle); font-size: 11px; }

.overlay { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; overflow-y: auto; padding: 20px; background: rgb(0 0 0 / 76%); animation: fade-in 160ms ease-out; }
.dialog { position: relative; width: min(100%, 460px); max-height: calc(100dvh - 40px); overflow-y: auto; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); padding: 26px; background: #141617; animation: rise-in 220ms var(--motion); }
.dialog h2 { margin: 0; font-size: 22px; font-weight: 700; line-height: 1.25; letter-spacing: -.035em; }
.dialog-description, .login-copy > p:last-child { margin: 8px 0 22px; color: var(--muted); font-size: 12px; }
.dialog label, .login-dialog form > label { display: block; margin: 14px 0 6px; color: #dadddd; font-size: 11px; font-weight: 700; }
.dialog input, .dialog select, .dialog textarea { width: 100%; }
.dialog .wide { margin-top: 18px; }
.close { position: absolute; top: 15px; right: 15px; width: 32px; min-height: 32px; border-color: transparent; padding: 0; color: var(--muted); font-size: 21px; font-weight: 400; }
.close:hover { border-color: var(--line); background: var(--surface-hover); color: var(--text); }
.login-dialog { width: min(100%, 420px); padding: 26px; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 27px; }
.dialog-logo { width: 34px; height: 34px; object-fit: contain; }
.login-brand strong, .login-brand small { display: block; }
.login-brand strong { font-size: 12px; font-weight: 700; }
.login-brand small { margin-top: 1px; color: var(--muted); font-size: 10px; }
.login-copy .eyebrow { margin-bottom: 7px; color: var(--accent); }
.login-copy h2 { font-size: 25px; }
.login-copy > p:last-child { margin-bottom: 20px; }
.login-dialog form > label { margin-top: 0; }
.login-dialog input { min-height: 42px; }
.login-dialog .button { margin-top: 16px; }
.login-note { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 17px 0 0; color: var(--subtle); font-size: 10px; }
.lock-mark { position: relative; width: 10px; height: 8px; border: 1px solid currentColor; border-radius: 2px; }
.lock-mark::before { position: absolute; bottom: 5px; left: 1px; width: 6px; height: 5px; border: 1px solid currentColor; border-bottom: 0; border-radius: 5px 5px 0 0; content: ''; }
.error { margin: 8px 0 0; color: var(--danger); font-size: 11px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row > div { min-width: 0; }
.created-keys { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 14px; }
.created-keys h3 { margin: 0 0 8px; font-size: 13px; }
.created-keys textarea { min-height: 112px; font: 11px/1.5 ui-monospace, 'Cascadia Code', Consolas, monospace; resize: vertical; }
.created-keys button { margin-top: 9px; }
.confirm-dialog { width: min(100%, 400px); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.toast { position: fixed; z-index: 20; right: 22px; bottom: 20px; display: none; max-width: min(420px, calc(100vw - 32px)); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 11px 14px; background: #191b1c; color: var(--text); font-size: 12px; }
.toast.show { display: block; animation: rise-in 180ms var(--motion); }
.toast.bad { border-color: #714141; color: #ffb2b2; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 760px) {
  .shell { width: min(100% - 36px, 1376px); }
  .workspace { padding-top: 34px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .stat:nth-child(4) { border-top: 1px solid var(--line); }
  .catalog-section { margin-bottom: 36px; }
}
@media (max-width: 520px) {
  .shell { width: min(100% - 28px, 1376px); }
  .topbar { min-height: 66px; }
  .top-actions { gap: 9px; }
  .connection { font-size: 10px; }
  .brand { gap: 8px; }
  .brand-logo { width: 29px; height: 29px; }
  .brand-copy strong { font-size: 13px; }
  .brand-copy small { font-size: 10px; }
  .page-intro { align-items: stretch; flex-direction: column; gap: 16px; margin-bottom: 27px; }
  .page-intro > .button { align-self: flex-start; }
  .intro-copy h1 { font-size: 29px; }
  .intro-copy > p:last-child { font-size: 12px; }
  .overview { margin-bottom: 36px; }
  .stat { min-height: 75px; padding: 14px; }
  .stat b { font-size: 21px; }
  .section-heading { align-items: flex-start; }
  .section-heading p { max-width: 270px; }
  .section-heading > .button { padding: 7px 9px; font-size: 10px; }
  .product { min-width: 100%; }
  .filters { display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .filters select, .filters input { width: 100%; min-width: 0; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .dialog { padding: 22px; }
  .login-dialog { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
