:root {
  --canvas: #EEF2F0;
  --surface: #FFFFFF;
  --ink: #14201D;
  --muted: #5F6F6A;
  --primary: #0F6B57;
  --info: #2463EB;
  --warning: #B8681D;
  --danger: #C54444;
  --divider: #D4DDD8;
  --primary-soft: #E4F1EC;
  --info-soft: #E8EFFC;
  --warning-soft: #F8EEE3;
  --danger-soft: #F9EAEA;
  --surface-elevated: #FBFCFA;
  --shadow-soft: 0 10px 28px rgba(20, 32, 29, 0.05);
  --shadow-control: 0 1px 0 rgba(20, 32, 29, 0.03);
  --radius: 8px;
  --sidebar-width: 248px;
  --control-height: 40px;
  color-scheme: light;
  font-family: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
  font-synthesis: none;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(15, 107, 87, 0.06), transparent 28%),
    linear-gradient(180deg, #F5F8F6 0%, var(--canvas) 220px);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--primary-soft);
  color: var(--ink);
}

:focus-visible {
  outline: 3px solid rgba(36, 99, 235, 0.34);
  outline-offset: 2px;
}

.auth-checking {
  min-height: 100svh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--muted);
}

.auth-checking p {
  margin: 0;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--divider);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 720ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.login-view {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(340px, 1.15fr) minmax(360px, 520px);
  align-items: stretch;
  background: var(--canvas);
}

.login-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  min-width: 0;
  min-height: 100svh;
  border-right: 1px solid var(--divider);
  background:
    radial-gradient(circle at 18% 22%, rgba(15, 107, 87, 0.18), transparent 28%),
    radial-gradient(circle at 78% 68%, rgba(36, 99, 235, 0.12), transparent 30%),
    linear-gradient(160deg, #F7FBFA 0%, #E8F2EE 48%, #E7EEF8 100%);
}

.login-fx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.login-brand-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 24%),
    linear-gradient(90deg, rgba(238, 242, 240, 0.12), transparent 40%);
  pointer-events: none;
}

.login-brand-content {
  position: relative;
  z-index: 1;
  display: flex;
  width: min(100%, 640px);
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
  padding: clamp(36px, 6vw, 72px);
}

.login-brand-mark {
  display: flex;
  align-items: center;
  gap: 16px;
}

.login-brand strong,
.sidebar-brand strong {
  display: block;
  font-family: Bahnschrift, "Arial Narrow", sans-serif;
  font-weight: 650;
  letter-spacing: 0;
}

.login-brand-mark strong {
  font-size: clamp(28px, 3.4vw, 42px);
  line-height: 1.05;
}

.login-brand-mark span:last-child {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-family: Bahnschrift, "Arial Narrow", sans-serif;
  font-size: 12px;
  text-transform: uppercase;
}

.login-brand-copy {
  max-width: 460px;
}

.login-brand-copy h2 {
  margin: 8px 0 14px;
  font-size: clamp(28px, 3.2vw, 40px);
  line-height: 1.15;
}

.login-brand-copy > p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.login-brand-points {
  display: grid;
  gap: 10px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.login-brand-points li {
  position: relative;
  padding: 12px 14px 12px 36px;
  border: 1px solid rgba(212, 221, 216, 0.9);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(8px);
  color: var(--ink);
  font-weight: 600;
}

.login-brand-points li::before {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  transform: translateY(-50%);
  content: "";
}

.brand-index {
  display: grid;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  color: var(--primary);
  background: rgba(255, 255, 255, 0.8);
  font-family: Bahnschrift, "Arial Narrow", sans-serif;
  font-size: 18px;
  font-weight: 700;
}

.login-panel {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: clamp(24px, 4vw, 48px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.2)),
    var(--canvas);
}

.login-panel-card {
  width: min(100%, 420px);
  padding: 34px 32px 30px;
  border: 1px solid var(--divider);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
}

.login-panel h1 {
  margin: 4px 0 8px;
  font-size: 28px;
  line-height: 1.2;
}

.login-panel-subtitle {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.login-panel form {
  display: grid;
  gap: 16px;
}

.captcha-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 148px;
  gap: 12px;
  align-items: end;
}

.captcha-frame {
  display: grid;
  place-items: center;
  min-height: var(--control-height);
  height: var(--control-height);
  padding: 0;
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  background: #F4F8F6;
  cursor: pointer;
  overflow: hidden;
  box-shadow: var(--shadow-control);
}

.captcha-frame:hover {
  border-color: rgba(15, 107, 87, 0.45);
}

.captcha-image {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.captcha-image svg {
  width: 148px;
  height: 44px;
}

.captcha-loading {
  color: var(--muted);
  font-size: 12px;
}

.section-kicker {
  margin: 0;
  color: var(--primary);
  font-family: Bahnschrift, "Arial Narrow", sans-serif;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
}

.field {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.field > span,
.field-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: var(--control-height);
  border: 1px solid var(--divider);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  padding: 8px 11px;
  box-shadow: var(--shadow-control);
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

textarea {
  min-height: 104px;
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #B7C1BE;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--info);
  box-shadow: 0 0 0 3px rgba(36, 99, 235, 0.1);
  outline: none;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
  accent-color: var(--primary);
}

.button,
.icon-button {
  display: inline-flex;
  min-height: var(--control-height);
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.button {
  gap: 8px;
  padding: 8px 13px;
  font-weight: 650;
  white-space: nowrap;
}

.button.wide {
  width: 100%;
}

.button.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--surface);
  box-shadow: 0 8px 18px rgba(15, 107, 87, 0.18);
}

.button.primary:hover {
  border-color: #0B5948;
  background: #0B5948;
}

.button.secondary {
  border-color: var(--divider);
  background: var(--surface);
  color: var(--ink);
}

.button.secondary:hover,
.icon-button:hover {
  border-color: #B7C1BE;
  background: #F8FAF9;
}

.button.quiet {
  justify-content: flex-start;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  padding-inline: 0;
}

.button.quiet:hover {
  color: var(--ink);
}

.button.danger {
  border-color: var(--danger);
  background: var(--danger);
  color: var(--surface);
}

.button.danger:hover {
  border-color: #A83636;
  background: #A83636;
}

.button.text-danger {
  border-color: var(--divider);
  background: var(--surface);
  color: var(--danger);
}

.button.text-danger:hover {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.button:not(:disabled):active,
.icon-button:not(:disabled):active {
  transform: translateY(1px);
}

.icon-button {
  width: var(--control-height);
  flex: 0 0 var(--control-height);
  padding: 0;
  border-color: var(--divider);
  background: var(--surface);
}

.form-message {
  min-height: 21px;
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.admin-layout {
  min-height: 100svh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  transition: grid-template-columns 160ms ease;
}

.admin-layout.sidebar-collapsed {
  grid-template-columns: 84px minmax(0, 1fr);
}

.admin-sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  width: var(--sidebar-width);
  height: 100svh;
  flex-direction: column;
  border-right: 1px solid var(--divider);
  background: var(--surface);
  transition: width 160ms ease;
}

.admin-layout.sidebar-collapsed .admin-sidebar {
  width: 84px;
}

.sidebar-brand {
  display: flex;
  min-height: 88px;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--divider);
}

.sidebar-brand .brand-index {
  flex-basis: 38px;
  width: 38px;
  height: 38px;
  font-size: 15px;
}

.sidebar-brand strong {
  font-size: 16px;
}

.sidebar-brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-family: Bahnschrift, "Arial Narrow", sans-serif;
  font-size: 10px;
  text-transform: uppercase;
}

.primary-nav {
  display: grid;
  gap: 3px;
  padding: 20px 12px;
}

.primary-nav a {
  position: relative;
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 11px;
  border-radius: 4px;
  color: var(--muted);
  padding: 9px 12px;
  font-weight: 600;
  transition: background-color 160ms ease, color 160ms ease;
}

.primary-nav a:hover {
  background: var(--canvas);
  color: var(--ink);
}

.primary-nav a[aria-current="page"] {
  background: var(--primary-soft);
  color: var(--primary);
}

.primary-nav a[aria-current="page"]::before {
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: -12px;
  width: 3px;
  background: var(--primary);
  content: "";
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 12px 16px;
  border-top: 1px solid var(--divider);
}

.sidebar-collapse-button {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 9px 12px;
  font-weight: 600;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

.sidebar-collapse-button:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.admin-layout.sidebar-collapsed .sidebar-brand span:last-child,
.admin-layout.sidebar-collapsed .primary-nav a span,
.admin-layout.sidebar-collapsed .sidebar-collapse-button span {
  display: none;
}

.admin-layout.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  padding-inline: 12px;
}

.admin-layout.sidebar-collapsed .primary-nav a,
.admin-layout.sidebar-collapsed .sidebar-collapse-button {
  justify-content: center;
  padding-inline: 0;
}

.admin-layout.sidebar-collapsed .primary-nav a[aria-current="page"]::before {
  left: 0;
}

.sidebar-backdrop {
  display: none;
}

.workspace {
  min-width: 0;
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  min-height: 88px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--divider);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  padding: 14px clamp(20px, 3vw, 44px);
}

.page-header-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.user-center {
  position: relative;
}

.user-menu-button {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--divider);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  padding: 4px 12px 4px 4px;
  cursor: pointer;
  box-shadow: var(--shadow-control);
  transition: border-color 160ms ease, background-color 160ms ease;
}

.user-menu-button:hover,
.user-center.open .user-menu-button {
  border-color: rgba(15, 107, 87, 0.35);
  background: #fff;
}

.user-menu-meta {
  display: grid;
  min-width: 0;
  text-align: left;
}

.user-menu-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.user-menu-meta strong {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.user-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-family: Bahnschrift, "Arial Narrow", sans-serif;
  font-size: 13px;
  font-weight: 700;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.user-avatar.xl {
  width: 88px;
  height: 88px;
  font-size: 28px;
}

.user-avatar.has-image {
  color: transparent;
  border: 1px solid var(--divider);
}

.user-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  display: grid;
  width: 220px;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--divider);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(20, 32, 29, 0.12);
}

.user-menu-item {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
}

.user-menu-item:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.user-menu-item.danger {
  color: var(--danger);
}

.user-menu-item.danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.user-center-dialog {
  width: min(720px, calc(100vw - 32px));
}

.user-center-content {
  display: grid;
  gap: 18px;
}

.user-center-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.user-center-tabs .chip {
  border: 1px solid var(--divider);
  background: #fff;
  cursor: pointer;
}

.user-center-tabs .chip.active {
  border-color: rgba(15, 107, 87, 0.35);
  background: var(--primary-soft);
  color: var(--primary);
}

.profile-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
}

.profile-avatar-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  align-content: start;
  padding: 18px 14px;
  border: 1px solid var(--divider);
  border-radius: 12px;
  background: var(--surface-elevated);
}

.profile-avatar-actions {
  display: grid;
  width: 100%;
  gap: 8px;
}

.profile-avatar-actions .button {
  width: 100%;
  justify-content: center;
}

.help-text {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  line-height: 1.45;
}

.form-surface.compact {
  padding: 16px;
}

.page-heading {
  min-width: 0;
}

.page-heading p {
  margin: 0 0 3px;
  color: var(--muted);
  font-family: Bahnschrift, "Arial Narrow", sans-serif;
  font-size: 10px;
  text-transform: uppercase;
}

.page-heading h1 {
  max-width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 23px;
  line-height: 1.25;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.mobile-nav-button {
  display: none;
}

.app-view {
  min-width: 0;
  padding: 28px clamp(20px, 3vw, 44px) 52px;
}

.app-view:focus {
  outline: none;
}

.app-view.is-entering > * {
  animation: view-enter 160ms ease-out both;
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-stack {
  display: grid;
  gap: 28px;
}

.issuance-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--divider);
  border-top: 3px solid var(--primary);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.rail-metric {
  min-width: 0;
  padding: 21px 22px 19px;
}

.rail-metric + .rail-metric {
  border-left: 1px solid var(--divider);
}

.rail-metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.rail-metric strong {
  display: block;
  margin-top: 5px;
  font-family: Bahnschrift, "Arial Narrow", sans-serif;
  font-size: 30px;
  font-weight: 650;
  line-height: 1.1;
}

.rail-metric.info strong { color: var(--info); }
.rail-metric.warning strong { color: var(--warning); }

.section-band {
  min-width: 0;
  border: 1px solid var(--divider);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.section-head {
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--divider);
}

.section-head h2,
.subsection-head h2 {
  margin: 2px 0 0;
  font-size: 17px;
  line-height: 1.3;
}

.section-head p:not(.section-kicker),
.subsection-head p:not(.section-kicker) {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.section-actions,
.row-actions,
.pagination-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 28px;
}

.product-status-list,
.quick-action-list {
  display: grid;
}

.product-status-row {
  display: grid;
  grid-template-columns: minmax(210px, 1.5fr) repeat(3, minmax(86px, 0.5fr)) 38px;
  align-items: center;
  gap: 16px;
  min-height: 76px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--divider);
}

.product-status-row:last-child,
.quick-action-row:last-child {
  border-bottom: 0;
}

.product-status-row:hover,
.quick-action-row:hover,
tbody tr:hover {
  background: #F8FAF9;
}

.product-identity {
  min-width: 0;
}

.product-identity strong {
  display: block;
  overflow-wrap: anywhere;
  font-weight: 650;
}

.product-identity span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.row-metric {
  min-width: 0;
}

.row-metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.row-metric strong {
  display: block;
  margin-top: 2px;
  font-family: Bahnschrift, "Arial Narrow", sans-serif;
  font-size: 18px;
}

.row-link {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  justify-self: end;
  border-radius: 4px;
  color: var(--muted);
}

.row-link:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.quick-action-row {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--divider);
}

.quick-action-row strong {
  display: block;
}

.quick-action-row span {
  color: var(--muted);
  font-size: 12px;
}

.table-scroll {
  position: relative;
  width: 100%;
  overflow: auto;
  overscroll-behavior-inline: contain;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--divider);
  text-align: left;
  vertical-align: middle;
}

th {
  background: #F8FAF9;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

tbody tr {
  transition: background-color 160ms ease;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.cell-number,
.cell-code,
.license-output,
.metric-number {
  font-family: Bahnschrift, "Cascadia Mono", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.cell-code {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-binding {
  max-width: 300px;
  overflow-wrap: anywhere;
}

.table-actions {
  display: flex;
  min-width: max-content;
  gap: 6px;
}

.table-actions .icon-button {
  width: 34px;
  min-height: 34px;
  flex-basis: 34px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: max-content;
  font-size: 12px;
  font-weight: 600;
}

.status::before {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--muted);
  content: "";
}

.status.available::before,
.status.perpetual::before { background: var(--primary); }
.status.redeemed::before,
.status.used::before { background: var(--info); }
.status.trial::before { background: var(--warning); }
.status.error::before { background: var(--danger); }

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr)) auto;
  align-items: end;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--divider);
  background: linear-gradient(180deg, var(--surface-elevated), var(--surface));
}

.filters.compact {
  grid-template-columns: repeat(3, minmax(140px, 1fr)) auto;
}

.filters.filters-equal {
  grid-template-columns: repeat(5, minmax(0, 1fr)) minmax(92px, 0.7fr);
  gap: 10px;
}

.filters.filters-equal .field,
.filters.filters-equal .filter-actions {
  min-width: 0;
}

.filters.filters-equal .filter-actions {
  align-self: end;
}

.filter-actions {
  display: flex;
  gap: 8px;
}

.pagination {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  border-top: 1px solid var(--divider);
}

.pagination p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.identity-band {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) repeat(3, minmax(150px, 0.7fr));
  border: 1px solid var(--divider);
  border-top: 3px solid var(--ink);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.identity-primary,
.identity-item {
  min-width: 0;
  padding: 20px;
}

.identity-item {
  border-left: 1px solid var(--divider);
}

.identity-primary h2 {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-size: 21px;
}

.identity-primary span,
.identity-item span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.identity-item strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.form-surface {
  padding: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.form-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--divider);
  border-left: 1px solid var(--divider);
}

.detail-pair {
  min-width: 0;
  padding: 12px 14px;
  border-right: 1px solid var(--divider);
  border-bottom: 1px solid var(--divider);
}

.detail-pair span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.detail-pair strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  font-weight: 600;
}

.license-block {
  margin-top: 18px;
}

.license-block > span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.license-output {
  max-height: 240px;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--divider);
  border-radius: 4px;
  background: var(--canvas);
  color: var(--ink);
  padding: 13px;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-all;
}

.query-result {
  border-top: 2px solid var(--primary);
}

.result-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--divider);
}

.result-summary h2 {
  margin: 0;
  font-size: 17px;
}

.result-summary p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.state-row {
  display: grid;
  min-height: 180px;
  place-items: center;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.state-row.compact {
  min-height: 96px;
}

.state-content {
  display: grid;
  max-width: 440px;
  justify-items: center;
  gap: 8px;
}

.state-content svg {
  width: 24px;
  height: 24px;
}

.state-content strong {
  color: var(--ink);
}

.state-content p {
  margin: 0;
}

.state-content.error svg,
.state-content.error strong {
  color: var(--danger);
}

.loading-line {
  width: min(260px, 80%);
  height: 5px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--divider);
}

.loading-line::after {
  display: block;
  width: 35%;
  height: 100%;
  background: var(--primary);
  content: "";
  animation: loading-slide 900ms ease-in-out infinite alternate;
}

@keyframes loading-slide {
  to { transform: translateX(185%); }
}

.dialog {
  width: min(620px, calc(100vw - 32px));
  max-height: min(820px, calc(100svh - 32px));
  margin: auto;
  overflow: auto;
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 0;
  box-shadow: 0 22px 60px rgba(23, 33, 38, 0.2);
}

.dialog::backdrop {
  background: rgba(23, 33, 38, 0.5);
}

.detail-dialog {
  width: min(760px, calc(100vw - 32px));
}

.confirm-dialog {
  width: min(460px, calc(100vw - 32px));
}

.dialog-body {
  margin: 0;
}

.dialog-header {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--divider);
}

.dialog-header h2 {
  margin: 2px 0 0;
  font-size: 18px;
}

.dialog-content {
  padding: 20px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 20px;
  border-top: 1px solid var(--divider);
}

.dialog .form-message {
  margin: 0;
  padding: 0 20px 12px;
}

.confirm-message {
  margin: 0;
  padding: 24px 20px;
  color: var(--muted);
}

.toast-region {
  position: fixed;
  z-index: 80;
  right: 20px;
  bottom: 20px;
  display: grid;
  width: min(360px, calc(100vw - 40px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--divider);
  border-left: 4px solid var(--primary);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  padding: 12px 14px;
  box-shadow: 0 12px 28px rgba(23, 33, 38, 0.14);
  animation: toast-enter 160ms ease-out both;
}

.toast.error {
  border-left-color: var(--danger);
}

.toast p {
  margin: 0;
  overflow-wrap: anywhere;
}

@keyframes toast-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}


.duration-combobox {
  display: grid;
  gap: 8px;
}

.duration-preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid var(--divider);
  border-radius: 999px;
  background: #F7FAF8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.chip:hover {
  border-color: #B7C8C1;
  background: var(--primary-soft);
  color: var(--primary);
}

.section-head {
  background: linear-gradient(180deg, #FBFCFB, var(--surface));
}

.table-scroll {
  background:
    linear-gradient(var(--surface) 30%, rgba(255,255,255,0)),
    linear-gradient(rgba(255,255,255,0), var(--surface) 70%) 0 100%,
    linear-gradient(90deg, rgba(20,32,29,0.05), rgba(20,32,29,0)),
    linear-gradient(90deg, rgba(20,32,29,0), rgba(20,32,29,0.05)) 100% 0;
  background-repeat: no-repeat;
  background-size: 100% 28px, 100% 28px, 18px 100%, 18px 100%;
  background-attachment: local, local, scroll, scroll;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.workspace {
  background: transparent;
}

.app-view {
  position: relative;
}

.login-panel,
.admin-sidebar {
  box-shadow: var(--shadow-soft);
}

.admin-sidebar {
  border-right-color: #D5DED9;
  background:
    linear-gradient(180deg, rgba(15, 107, 87, 0.04), transparent 180px),
    var(--surface);
}

.sidebar-brand {
  border-bottom-color: #D5DED9;
}

.primary-nav a {
  border-radius: 8px;
}

.primary-nav a:hover,
.primary-nav a[aria-current="page"] {
  background: var(--primary-soft);
}

.primary-nav a[aria-current="page"] {
  color: var(--primary);
  font-weight: 700;
}

.status {
  padding: 4px 9px 4px 8px;
  border-radius: 999px;
  background: #F4F7F5;
}

.status.available,
.status.perpetual {
  background: var(--primary-soft);
  color: #0C5A49;
}

.status.redeemed,
.status.used {
  background: var(--info-soft);
  color: #1D4FBE;
}

.status.trial {
  background: var(--warning-soft);
  color: #945214;
}

@media (max-width: 1100px) {
  .split-layout {
    grid-template-columns: 1fr;
  }

  .filters,
  .filters.compact {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .filters.filters-equal {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filter-actions {
    grid-column: 1 / -1;
  }

  .identity-band {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .identity-primary {
    grid-column: 1 / -1;
    border-bottom: 1px solid var(--divider);
  }

  .identity-item:first-of-type {
    border-left: 0;
  }
}

@media (max-width: 819px) {
  :root {
    --control-height: 44px;
  }

  .login-view {
    grid-template-columns: 1fr;
    align-content: stretch;
  }

  .login-brand {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--divider);
  }

  .login-brand-content {
    gap: 24px;
    padding: 28px 24px 24px;
  }

  .login-brand-copy h2 {
    font-size: 26px;
  }

  .login-brand-points {
    grid-template-columns: 1fr;
    margin-top: 18px;
  }

  .login-panel {
    padding: 20px 16px 28px;
  }

  .login-panel-card {
    padding: 26px 20px 22px;
  }

  .captcha-row {
    grid-template-columns: 1fr;
  }

  .captcha-frame {
    width: 100%;
  }

  .admin-layout.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .admin-layout.sidebar-collapsed .admin-sidebar {
    width: var(--sidebar-width);
  }

  .admin-layout.sidebar-collapsed .sidebar-brand span:last-child,
  .admin-layout.sidebar-collapsed .primary-nav a span,
  .admin-layout.sidebar-collapsed .sidebar-collapse-button span {
    display: initial;
  }

  .admin-layout.sidebar-collapsed .sidebar-brand,
  .admin-layout.sidebar-collapsed .primary-nav a,
  .admin-layout.sidebar-collapsed .sidebar-collapse-button {
    justify-content: flex-start;
  }

  .admin-layout.sidebar-collapsed .sidebar-brand {
    padding: 18px 20px;
  }

  .admin-layout.sidebar-collapsed .primary-nav a,
  .admin-layout.sidebar-collapsed .sidebar-collapse-button {
    padding: 9px 12px;
  }

  .sidebar-collapse-button {
    display: none;
  }

  .page-header-end {
    grid-column: 1 / -1;
    justify-content: space-between;
  }

  .user-menu-meta {
    display: none;
  }

  .profile-layout {
    grid-template-columns: 1fr;
  }

  .admin-layout {
    display: block;
  }

  .admin-sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-100%);
    transition: transform 160ms ease;
  }

  .admin-layout.drawer-open .admin-sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 25;
    display: block;
    visibility: hidden;
    border: 0;
    background: rgba(23, 33, 38, 0.42);
    opacity: 0;
    transition: opacity 160ms ease, visibility 160ms ease;
  }

  .admin-layout.drawer-open .sidebar-backdrop {
    visibility: visible;
    opacity: 1;
  }

  .page-header {
    min-height: 76px;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    padding: 10px 16px;
  }

  .mobile-nav-button {
    display: inline-flex;
  }

  .page-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .page-actions:empty {
    display: none;
  }

  .page-actions .button {
    flex: 1 1 auto;
  }

  .app-view {
    padding: 20px 16px 40px;
  }

  .issuance-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rail-metric:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--divider);
  }

  .rail-metric:nth-child(4) {
    border-top: 1px solid var(--divider);
  }

  .product-status-row {
    grid-template-columns: minmax(0, 1fr) repeat(2, minmax(64px, 0.45fr)) 34px;
  }

  .product-status-row .row-metric:nth-of-type(3) {
    display: none;
  }

  .filters,
  .filters.compact,
  .filters.filters-equal,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .filter-actions,
  .form-grid .full {
    grid-column: auto;
  }

  .filter-actions .button {
    flex: 1;
  }

  .pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-actions .button {
    flex: 1;
  }

  .identity-band {
    grid-template-columns: 1fr;
  }

  .identity-primary {
    grid-column: auto;
  }

  .identity-item {
    border-left: 0;
    border-top: 1px solid var(--divider);
  }

  .detail-list {
    grid-template-columns: 1fr;
  }

  .section-head,
  .result-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-actions,
  .result-actions {
    width: 100%;
  }

  .section-actions .button,
  .result-actions .button {
    flex: 1 1 auto;
  }

  .dialog-actions .button {
    flex: 1;
  }
}

@media (max-width: 520px) {
  .issuance-rail {
    grid-template-columns: 1fr;
  }

  .rail-metric + .rail-metric {
    border-top: 1px solid var(--divider);
    border-left: 0;
  }

  .product-status-row {
    grid-template-columns: minmax(0, 1fr) 70px 34px;
  }

  .product-status-row .row-metric:nth-of-type(2),
  .product-status-row .row-metric:nth-of-type(3) {
    display: none;
  }

  .quick-action-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .dialog {
    width: calc(100vw - 16px);
    max-height: calc(100svh - 16px);
  }

  .dialog-actions {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-fx-canvas {
    display: none;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
