:root {
  --primary: #150f23;
  --ink-deep: #1f1633;
  --accent-lime: #c2ef4e;
  --accent-pink: #fa7faa;
  --accent-violet: #6a5fc1;
  --accent-violet-deep: #422082;
  --accent-violet-mid: #79628c;
  --canvas-dark: #1f1633;
  --night: #150f23;
  --canvas-light: #ffffff;
  --press-light: #f0f0f0;
  --press-stronger: #efefef;
  --hairline-violet: #362d59;
  --hairline-cool: #cfcfdb;
  --hairline-cloud: #e5e7eb;
  --on-primary: #ffffff;
  --on-dark-muted: rgba(255, 255, 255, 0.72);
  --on-dark-faint: rgba(255, 255, 255, 0.18);
  --focus-ring: rgba(59, 130, 246, 0.5);
  --shadow-level-2: rgba(0, 0, 0, 0.1) 0 10px 15px -3px, rgba(0, 0, 0, 0.1) 0 4px 6px -4px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink-deep);
  background: var(--canvas-light);
  font-family: "Rubik", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  min-height: 72px;
  padding: 16px 24px;
  background: var(--canvas-light);
  border-bottom: 1px solid var(--hairline-cloud);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-deep);
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--on-primary);
  background: var(--primary);
  border-radius: 9999px;
  font-family: "Space Grotesk", "Rubik", sans-serif;
  font-weight: 700;
}

.topnav {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.topnav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  color: var(--ink-deep);
  border-radius: 12px;
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
}

.topnav a.is-active {
  color: var(--on-primary);
  background: var(--accent-violet-mid);
  box-shadow: inset 0 0 0 1px var(--accent-violet-deep);
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.session-label {
  color: var(--accent-violet-mid);
  font-family: Monaco, Menlo, "Ubuntu Mono", monospace;
  font-size: 14px;
  line-height: 1.5;
}

.storage-label {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  color: var(--on-primary);
  background: var(--accent-violet-mid);
  border: 1px solid var(--accent-violet-deep);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.8;
  letter-spacing: 0.25px;
  text-transform: uppercase;
}

.storage-label:empty {
  display: none;
}

.button.nav-toggle {
  display: none;
}

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: 0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  white-space: nowrap;
}

.primary-button {
  color: var(--on-primary);
  background: var(--primary);
}

.primary-button:active {
  color: #1a1a1a;
  background: var(--press-stronger);
}

.inverted-button {
  color: var(--ink-deep);
  background: var(--on-primary);
  border: 1px solid var(--hairline-cloud);
  box-shadow: rgba(0, 0, 0, 0.08) 0 2px 8px 0;
}

.inverted-button:active {
  color: #1a1a1a;
  background: var(--press-light);
}

.ghost-button {
  color: var(--ink-deep);
  background: transparent;
  border: 1px solid var(--hairline-cloud);
}

.button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.is-hidden {
  display: none !important;
}

.admin-list {
  display: grid;
  gap: 2px;
}

.admin-row {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr 0.7fr 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--hairline-cloud);
  border-radius: 8px;
  background: var(--on-primary);
}

.admin-row.table-head {
  border: 0;
  background: transparent;
}

.admin-row.is-inactive {
  opacity: 0.55;
}

.admin-row .action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.pagination-status {
  font-size: 13px;
}

.workspace {
  width: min(100%, 1240px);
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.hero-band {
  position: relative;
  min-height: 184px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 24px;
  padding: 32px;
  overflow: visible;
  color: var(--on-primary);
  background-color: var(--canvas-dark);
  background-image: url("./assets/starfield.svg");
  background-size: 360px 220px;
  border-radius: 18px;
}

.sticker {
  position: absolute;
  pointer-events: none;
  user-select: none;
}

.sticker-astronaut {
  right: 250px;
  top: -32px;
  width: 116px;
  transform: rotate(5deg);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--on-dark-muted);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

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

h1 {
  max-width: 720px;
  margin-bottom: 0;
  font-family: "Space Grotesk", "Rubik", sans-serif;
  font-size: 48px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: 0;
}

.lime-chip {
  display: inline-block;
  padding: 0 12px;
  color: var(--ink-deep);
  background: var(--accent-lime);
  border-radius: 4px;
}

.release-pill {
  min-width: 260px;
  padding: 16px;
  color: var(--on-primary);
  background: var(--night);
  border: 1px solid var(--hairline-violet);
  border-radius: 12px;
}

.release-pill strong {
  display: block;
  margin-bottom: 4px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.25;
}

.release-pill span {
  display: block;
  color: var(--on-dark-muted);
  font-size: 14px;
  line-height: 1.43;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card,
.primary-panel,
.detail-panel {
  background: var(--canvas-light);
  border: 1px solid var(--hairline-cloud);
  border-radius: 12px;
}

.metric-card {
  min-height: 112px;
  padding: 24px;
}

.metric-card span {
  display: block;
  margin-bottom: 12px;
  color: var(--accent-violet-deep);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.8;
  letter-spacing: 0.25px;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  font-size: 30px;
  font-weight: 500;
  line-height: 1.2;
}

.metric-card em {
  display: block;
  margin-top: 8px;
  color: var(--accent-violet-mid);
  font-size: 14px;
  font-style: normal;
  line-height: 1.43;
}

.panel-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: start;
}

.primary-panel,
.detail-panel {
  min-width: 0;
  padding: 24px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.panel-header h2,
.detail-panel h2 {
  margin-bottom: 4px;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.25;
}

.panel-header p,
.detail-panel .muted {
  margin-bottom: 0;
  color: var(--accent-violet-mid);
  font-size: 14px;
  line-height: 1.43;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 220px) auto;
  gap: 12px;
  margin-bottom: 16px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.43;
}

.text-input,
.select-input,
.textarea-input {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  color: var(--ink-deep);
  background: var(--canvas-light);
  border: 1px solid var(--hairline-cool);
  border-radius: 6px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
}

.textarea-input {
  min-height: 120px;
  resize: vertical;
}

.text-input:focus,
.select-input:focus,
.textarea-input:focus {
  box-shadow: rgba(0, 0, 0, 0.15) 0 2px 10px inset;
}

.license-table {
  display: grid;
  gap: 8px;
}

.table-head,
.license-row,
.device-row,
.audit-row {
  display: grid;
  grid-template-columns: 1.15fr 1fr 120px 128px 1fr;
  align-items: center;
  gap: 12px;
}

.table-head {
  padding: 0 12px 8px;
  color: var(--accent-violet-mid);
  border-bottom: 1px solid var(--hairline-cloud);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.8;
  letter-spacing: 0.25px;
  text-transform: uppercase;
}

.license-row,
.device-row,
.audit-row {
  width: 100%;
  min-height: 64px;
  padding: 12px;
  color: var(--ink-deep);
  text-align: left;
  background: var(--canvas-light);
  border: 1px solid var(--hairline-cloud);
  border-radius: 8px;
}

.license-row.is-selected {
  border-color: var(--accent-violet-mid);
  box-shadow: inset 4px 0 0 var(--accent-violet-mid);
}

.license-code,
.mono {
  font-family: Monaco, Menlo, "Ubuntu Mono", monospace;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

.license-owner,
.license-expiry,
.license-device,
.device-row span,
.audit-row span {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-deep);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 8px;
  color: var(--ink-deep);
  border: 1px solid var(--hairline-cloud);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.8;
  letter-spacing: 0.25px;
  text-transform: uppercase;
}

.status-active {
  color: var(--on-primary);
  background: var(--primary);
  border-color: var(--primary);
}

.status-beta {
  color: var(--on-primary);
  background: var(--accent-violet-mid);
  border-color: var(--accent-violet-deep);
}

.status-suspended {
  color: var(--primary);
  background: rgba(250, 127, 170, 0.16);
  border-color: rgba(250, 127, 170, 0.42);
}

.status-expired {
  color: var(--accent-violet-mid);
  background: var(--press-stronger);
}

.empty-state {
  padding: 32px;
  color: var(--accent-violet-mid);
  border: 1px dashed var(--hairline-cool);
  border-radius: 8px;
  text-align: center;
}

.detail-stack {
  display: grid;
  gap: 16px;
}

.detail-group {
  padding-top: 16px;
  border-top: 1px solid var(--hairline-cloud);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.key-value {
  display: grid;
  gap: 4px;
}

.key-value > span {
  color: var(--accent-violet-mid);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.8;
  letter-spacing: 0.25px;
  text-transform: uppercase;
}

.key-value .status-badge {
  align-self: start;
}

.key-value strong {
  min-width: 0;
  overflow: hidden;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-row,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.release-form .wide,
.create-grid .wide {
  grid-column: 1 / -1;
}

.audit-list,
.device-list {
  display: grid;
  gap: 8px;
}

.audit-row {
  grid-template-columns: 150px 1fr 132px;
}

.audit-row small {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--accent-violet-mid);
  font-family: Monaco, Menlo, "Ubuntu Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-row {
  grid-template-columns: 1fr 1fr 130px 120px;
}

.code-block {
  overflow-x: auto;
  padding: 16px;
  color: var(--on-primary);
  background: var(--night);
  border-radius: 8px;
  font-family: Monaco, Menlo, "Ubuntu Mono", monospace;
  font-size: 16px;
  line-height: 1.5;
}

.footer-mark {
  margin-top: 32px;
}

.footer-mark img {
  width: 100%;
  height: 28px;
  object-fit: cover;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 48px));
  padding: 16px;
  color: var(--on-primary);
  background: var(--primary);
  border: 1px solid var(--hairline-violet);
  border-radius: 8px;
  box-shadow: var(--shadow-level-2);
}

.login-mode .topnav,
.login-mode .topbar-actions,
.login-mode .button.nav-toggle,
.loading-mode .topnav,
.loading-mode .topbar-actions,
.loading-mode .button.nav-toggle {
  display: none;
}

.login-card {
  max-width: 520px;
}

.login-card h2 {
  margin-bottom: 24px;
  font-size: 30px;
  font-weight: 500;
  line-height: 1.2;
}

.login-hint {
  margin-top: 16px;
  margin-bottom: 0;
}

.form-error {
  padding: 12px;
  color: var(--primary);
  background: rgba(250, 127, 170, 0.16);
  border: 1px solid rgba(250, 127, 170, 0.42);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.43;
}

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

  .panel-layout {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 767px) {
  .topbar {
    position: static;
    grid-template-columns: 1fr auto;
    gap: 12px;
  }

  .topnav {
    display: none;
    grid-column: 1 / -1;
    flex-direction: column;
    justify-content: flex-start;
  }

  .topbar-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .button.nav-toggle {
    display: inline-flex;
  }

  .topbar.nav-open .topnav {
    display: flex;
  }

  .workspace {
    padding: 24px 16px 32px;
  }

  .hero-band {
    min-height: auto;
    display: grid;
    padding: 32px 24px;
  }

  .sticker-astronaut {
    display: none;
  }

  h1 {
    font-size: 40px;
  }

  .release-pill {
    min-width: 0;
  }

  .toolbar,
  .create-grid,
  .release-form,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .table-head {
    display: none;
  }

  .license-row,
  .device-row,
  .audit-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (max-width: 575px) {
  .topbar {
    padding: 12px 16px;
  }

  .brand {
    min-width: 0;
  }

  .brand > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-actions {
    align-items: stretch;
  }

  .session-label {
    width: 100%;
  }

  .topbar-actions .button {
    flex: 1 1 96px;
    padding-right: 10px;
    padding-left: 10px;
  }

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

  h1 {
    font-size: 34px;
  }

  .primary-panel,
  .detail-panel,
  .metric-card {
    padding: 16px;
  }
}
