:root {
  --palette-midnight-ink: #020c16;
  --palette-deep-navy: #04162a;
  --palette-night-blue: #08234a;
  --palette-electric-blue: #1e73d8;
  --palette-bright-sky: #46b3f3;
  --palette-rescale-brand: #339abd;
  --palette-rescale-brand-light: #6bc4d8;
  --palette-rescale-brand-dark: #247e9c;
  --palette-rescale-brand-deep: #1b6b86;
  --palette-rescale-brand-sky: #4a9ab6;
  --palette-cyan-glow: #68eaf6;
  --palette-slate-teal: #16384a;
  --palette-steel-blue: #2b5872;
  --palette-mist-gray: #c7d4de;
  --palette-soft-white: #f5f7fa;

  --color-muted: #f5f7fa;
  --color-surface: #ffffff;
  --color-surface-glass: rgba(255, 255, 255, 0.74);
  --color-surface-glass-strong: rgba(245, 247, 250, 0.92);
  --color-text-primary: var(--palette-midnight-ink);
  --color-text-secondary: var(--palette-steel-blue);
  --color-text-tertiary: rgba(43, 88, 114, 0.62);
  --color-border-subtle: rgba(43, 88, 114, 0.16);
  --color-border-glass: rgba(70, 179, 243, 0.28);
  --color-row-hover: rgba(51, 154, 189, 0.08);
  --color-row-selected: rgba(51, 154, 189, 0.14);
  --color-rescale-blue-text: var(--palette-rescale-brand-dark);

  --color-success: #1f9269;
  --color-success-bg: #e3f5ed;
  --color-warn: #b86b00;
  --color-warn-bg: #fdf1d6;
  --color-error: #c0265a;
  --color-error-bg: #fde6ee;

  --shadow-card:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 14px 40px -28px rgba(4, 22, 42, 0.32);
  --shadow-rail: 0 22px 60px -28px rgba(4, 22, 42, 0.45);
  --glass-blur: blur(18px) saturate(145%);

  --gradient-brand-button: linear-gradient(
    135deg,
    var(--palette-rescale-brand-sky) 0%,
    var(--palette-rescale-brand-dark) 35%,
    var(--palette-rescale-brand-deep) 100%
  );
  --gradient-rail: linear-gradient(
    180deg,
    var(--palette-midnight-ink) 0%,
    var(--palette-deep-navy) 100%
  );

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-pill: 999px;

  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  color: var(--color-text-primary);
  background:
    radial-gradient(
      ellipse at 82% 8%,
      rgba(70, 179, 243, 0.1),
      transparent 42rem
    ),
    linear-gradient(180deg, rgba(8, 35, 74, 0.05), transparent 24rem),
    var(--color-muted);
  background-attachment: fixed;
  background-repeat: no-repeat;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

a {
  color: var(--color-rescale-blue-text);
}

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

h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
}

h2 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

/* ---- shell ---- */

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px 1fr;
}

/* ---- rail ---- */

.rail {
  color: rgba(245, 247, 250, 0.92);
  background: var(--gradient-rail);
  padding: 22px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  border-right: 1px solid rgba(70, 179, 243, 0.12);
  position: relative;
  box-shadow: var(--shadow-rail);
}

.rail::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    circle at 0% 0%,
    rgba(70, 179, 243, 0.18),
    transparent 38%
  );
}

.rail > * {
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
}

.brand-logo {
  height: 24px;
  width: 106px;
  object-fit: contain;
}

.brand-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--palette-cyan-glow);
  padding: 0 8px;
  margin-top: -2px;
  opacity: 0.85;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  color: rgba(245, 247, 250, 0.78);
  background: transparent;
  text-align: left;
  min-height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition:
    background 120ms ease,
    color 120ms ease;
}

.nav-item .icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: rgba(245, 247, 250, 0.62);
}

.nav-item:hover {
  background: rgba(70, 179, 243, 0.1);
  color: var(--palette-soft-white);
}

.nav-item.active {
  background: rgba(70, 179, 243, 0.18);
  color: var(--palette-soft-white);
  box-shadow: inset 0 0 0 1px rgba(104, 234, 246, 0.18);
}

.nav-item.active .icon {
  color: var(--palette-cyan-glow);
}

.rail-foot {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.env-label {
  font-size: 11px;
  letter-spacing: 0;
  text-transform: uppercase;
  color: rgba(199, 212, 222, 0.54);
  padding: 0 6px;
}

.env-label code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--palette-mist-gray);
  text-transform: none;
  letter-spacing: 0;
}

.rail-action {
  border: 1px solid rgba(104, 234, 246, 0.28);
  color: rgba(245, 247, 250, 0.95);
  background: rgba(8, 35, 74, 0.4);
  text-align: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition:
    background 120ms ease,
    border-color 120ms ease;
}

.rail-action:hover {
  background: rgba(70, 179, 243, 0.16);
  border-color: rgba(104, 234, 246, 0.5);
}

/* ---- main ---- */

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

.topbar {
  height: 64px;
  background: var(--color-surface-glass-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--color-border-subtle);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar h1 {
  line-height: 1.1;
}

.topbar-meta {
  font-size: 12px;
  color: var(--color-text-tertiary);
  margin-top: 2px;
}

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

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gradient-brand-button);
  color: white;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.userbox .who {
  display: grid;
  line-height: 1.25;
  text-align: center;
}

.userbox .who strong {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-primary);
}

/* ---- workspace ---- */

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px;
  gap: 18px;
  padding: 18px 22px 6px;
}

.workspace.single {
  grid-template-columns: minmax(0, 1fr);
}

.audit-pane {
  margin: 0 22px 22px;
}

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border-subtle);
}

.panel-head .title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-body {
  padding: 14px 16px 16px;
}

.count {
  min-width: 24px;
  height: 22px;
  padding: 0 8px;
  display: inline-grid;
  place-items: center;
  background: var(--color-row-selected);
  color: var(--color-rescale-blue-text);
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0;
}

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

.search {
  position: relative;
  width: 240px;
}

.search input {
  width: 100%;
  padding-left: 32px;
}

.search .icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--color-text-tertiary);
  pointer-events: none;
}

input,
textarea {
  display: block;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-primary);
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease;
}

input:hover,
textarea:hover {
  border-color: rgba(43, 88, 114, 0.32);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--palette-rescale-brand);
  box-shadow: 0 0 0 3px rgba(51, 154, 189, 0.16);
}

input {
  height: 34px;
  padding: 0 11px;
  font-size: 13px;
}

textarea {
  resize: vertical;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
}

label {
  display: grid;
  gap: 6px;
  color: var(--color-text-secondary);
  font-weight: 500;
  font-size: 12px;
}

/* ---- buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-subtle);
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    color 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
}

.btn:hover {
  border-color: rgba(43, 88, 114, 0.36);
  background: var(--palette-soft-white);
}

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

.btn .icon {
  width: 14px;
  height: 14px;
}

.btn.primary {
  border: 0;
  color: white;
  background: var(--gradient-brand-button);
  font-weight: 700;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 14px 28px -22px rgba(51, 154, 189, 0.86);
}

.btn.primary:hover {
  filter: saturate(1.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 18px 36px -22px rgba(51, 154, 189, 0.96);
}

.btn.primary:active {
  transform: scale(0.985);
  filter: brightness(0.98);
}

.btn.primary:disabled {
  background: var(--palette-mist-gray);
  color: rgba(43, 88, 114, 0.7);
  cursor: not-allowed;
  box-shadow: none;
  filter: none;
}

.btn:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.btn.subtle {
  border-color: transparent;
  background: transparent;
  color: var(--color-text-secondary);
}

.btn.subtle:hover {
  background: var(--color-row-selected);
  color: var(--color-rescale-blue-text);
  border-color: transparent;
}

.btn.danger {
  color: var(--color-error);
  border-color: rgba(192, 38, 90, 0.28);
  background: var(--color-error-bg);
}

.btn.danger:hover {
  border-color: rgba(192, 38, 90, 0.44);
  background: #fbd1df;
}

.btn.tiny {
  min-height: 26px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

/* ---- contract form ---- */

.contract-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr)) 142px;
  align-items: end;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--color-border-subtle);
  border-bottom: 1px solid var(--color-border-subtle);
  background: rgba(245, 247, 250, 0.6);
}

.contract-form input {
  height: 32px;
}

.contract-seats-form,
.contract-metadata-form {
  display: grid;
  gap: 10px;
  padding: 14px 16px 16px;
  border-bottom: 1px solid var(--color-border-subtle);
  background: rgba(245, 247, 250, 0.42);
}

.contract-seats-form {
  grid-template-columns: minmax(140px, 220px) minmax(220px, 1fr);
  align-items: end;
}

.contract-seats-form label {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.contract-seats-form label input {
  grid-column: 1;
}

.contract-seats-form .inline-helper {
  grid-column: 2;
  align-self: center;
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.contract-seats-form input {
  height: 32px;
}

.contract-metadata-form textarea {
  min-height: 86px;
}

.contract-seats-form .submit-row,
.contract-metadata-form .submit-row {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

.contract-seats-form .helper,
.contract-metadata-form .helper {
  color: var(--color-text-tertiary);
  font-size: 11.5px;
}

/* ---- table ---- */

.table-frame {
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--color-surface);
}

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

th {
  background: rgba(245, 247, 250, 0.7);
  color: var(--color-text-secondary);
  text-align: left;
  padding: 9px 12px;
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0;
  text-transform: uppercase;
  border-bottom: 1px solid var(--color-border-subtle);
}

td {
  border-top: 1px solid rgba(43, 88, 114, 0.08);
  padding: 11px 12px;
  vertical-align: middle;
  color: var(--color-text-primary);
}

tbody tr {
  cursor: pointer;
  transition: background 100ms ease;
}

tbody tr:hover {
  background: var(--color-row-hover);
}

tbody tr.selected {
  background: var(--color-row-selected);
  box-shadow: inset 3px 0 0 var(--palette-rescale-brand);
}

td .customer {
  font-weight: 500;
  color: var(--color-text-primary);
}

td .cust-id {
  display: block;
  font-size: 11.5px;
  color: var(--color-text-tertiary);
  margin-top: 1px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---- seat meter ---- */

.seat-meter {
  display: grid;
  grid-template-columns: 64px 1fr 38px;
  align-items: center;
  gap: 10px;
}

.meter-track {
  height: 6px;
  background: rgba(43, 88, 114, 0.12);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.meter-bar {
  height: 100%;
  background: var(--gradient-brand-button);
  border-radius: var(--radius-pill);
  transition: width 200ms ease;
}

.meter-bar.warn {
  background: linear-gradient(135deg, #f5b945, #d77f1e);
}

.meter-bar.full {
  background: linear-gradient(135deg, #d44a72, #a31e4a);
}

.seat-meter .pct {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--color-text-secondary);
  font-size: 12.5px;
  text-align: right;
}

.seat-meter .ratio {
  font-variant-numeric: tabular-nums;
  color: var(--color-text-primary);
  font-size: 12.5px;
}

/* ---- status pills ---- */

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: 0;
  text-transform: capitalize;
  white-space: nowrap;
}

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

.status.active {
  color: var(--color-success);
  background: var(--color-success-bg);
}

.status.capacity {
  color: var(--color-warn);
  background: var(--color-warn-bg);
}

.status.inactive,
.status.revoked {
  color: var(--color-error);
  background: var(--color-error-bg);
}

.status.superseded {
  color: var(--color-text-secondary);
  background: rgba(43, 88, 114, 0.1);
}

/* ---- detail views ---- */

.detail-hero {
  padding: 16px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--color-border-subtle);
  background:
    linear-gradient(
      135deg,
      rgba(51, 154, 189, 0.12),
      rgba(104, 234, 246, 0.04)
    ),
    var(--color-surface);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.detail-hero h2 {
  margin-bottom: 5px;
}

.detail-hero h3 {
  font-size: 20px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--color-text-primary);
  margin: 0 0 3px;
}

.detail-hero p {
  font-size: 12.5px;
  color: var(--color-text-secondary);
}

.detail-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.detail-stats span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  color: var(--color-text-secondary);
}

.detail-stats strong {
  color: var(--color-text-primary);
  font-weight: 700;
}

.detail-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

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

.license-detail-pane {
  overflow: hidden;
}

.license-hero .btn.primary {
  min-width: 116px;
}

.detail-section {
  padding: 16px;
  border-top: 1px solid rgba(43, 88, 114, 0.08);
}

.detail-section h2 {
  margin-bottom: 12px;
}

.technical-details {
  margin-top: 12px;
}

.technical-details summary {
  cursor: pointer;
  color: var(--color-text-secondary);
  font-size: 12.5px;
  font-weight: 700;
  padding: 8px 0;
}

.metadata-grid {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(0, 1fr);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.metadata-grid dt,
.metadata-grid dd {
  margin: 0;
  padding: 9px 12px;
  border-top: 1px solid rgba(43, 88, 114, 0.08);
  font-size: 12.5px;
}

.metadata-grid dt:nth-of-type(1),
.metadata-grid dd:nth-of-type(1) {
  border-top: 0;
}

.metadata-grid dt {
  color: var(--color-text-tertiary);
  background: rgba(245, 247, 250, 0.7);
  font-weight: 700;
}

.metadata-grid dd {
  word-break: break-word;
  color: var(--color-text-primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.json-block {
  max-height: 520px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  background: var(--palette-midnight-ink);
  color: var(--palette-soft-white);
  font-size: 12px;
  line-height: 1.55;
}

.inline-error {
  border: 1px solid var(--color-error);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  background: var(--color-error-bg);
  color: var(--color-error);
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 500;
}

.state.compact {
  padding: 22px 18px;
}

/* ---- issue pane ---- */

.issue-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-self: start;
  position: sticky;
  top: 84px;
}

.context-strip {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border-subtle);
  display: grid;
  gap: 8px;
  background: linear-gradient(
    135deg,
    rgba(70, 179, 243, 0.08),
    rgba(104, 234, 246, 0.04)
  );
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.context-strip .label {
  font-size: 10.5px;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  font-weight: 700;
}

.context-strip .name {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1.25;
}

.context-strip .meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--color-text-secondary);
  align-items: center;
  flex-wrap: wrap;
}

.context-strip .meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.context-strip .meta .sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--color-text-tertiary);
}

.context-strip.empty {
  background: rgba(43, 88, 114, 0.04);
}

.context-strip.empty .name {
  color: var(--color-text-tertiary);
  font-weight: 500;
  font-size: 13px;
}

.upload-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-subtle);
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.file-button:hover {
  border-color: rgba(43, 88, 114, 0.36);
  background: var(--palette-soft-white);
}

.file-button input {
  display: none;
}

.file-button .icon,
.btn .icon {
  width: 14px;
  height: 14px;
}

#requestJson {
  min-height: 130px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.55;
}

.preview {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}

.preview.empty {
  padding: 14px;
  color: var(--color-text-tertiary);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview.empty .icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  opacity: 0.7;
}

.preview dl {
  display: grid;
  grid-template-columns: 110px 1fr;
  margin: 0;
}

.preview dt,
.preview dd {
  margin: 0;
  padding: 8px 12px;
  border-top: 1px solid rgba(43, 88, 114, 0.08);
  font-size: 12.5px;
}

.preview dt:nth-of-type(1),
.preview dd:nth-of-type(1) {
  border-top: 0;
}

.preview dt {
  color: var(--color-text-tertiary);
  background: rgba(245, 247, 250, 0.55);
  font-weight: 500;
  letter-spacing: 0;
}

.preview dd {
  color: var(--color-text-primary);
}

.preview dd.hash {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
  font-size: 11.5px;
  color: var(--color-text-secondary);
}

.issue-form {
  display: grid;
  gap: 12px;
}

.issue-form textarea {
  min-height: 70px;
}

.issue-form .submit-row {
  display: grid;
  gap: 6px;
}

.issue-form .helper {
  font-size: 11.5px;
  color: var(--color-text-tertiary);
  text-align: center;
}

.issue-form .btn.primary {
  height: 42px;
  font-size: 14px;
  color: #ffffff;
}

/* ---- audit ---- */

.audit-pane .scoped {
  font-size: 12px;
  color: var(--color-text-tertiary);
  margin-left: 8px;
}

.audit-pane .scoped strong {
  color: var(--color-text-secondary);
  font-weight: 500;
}

.audit-row .action {
  font-weight: 500;
  color: var(--color-rescale-blue-text);
  letter-spacing: 0;
}

.audit-row .when {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.audit-row .actor {
  font-size: 12.5px;
  color: var(--color-text-secondary);
}

/* ---- empty / loading states ---- */

.state {
  padding: 36px 24px;
  text-align: center;
  color: var(--color-text-tertiary);
  font-size: 13px;
  display: grid;
  gap: 6px;
  justify-items: center;
}

.state .icon {
  width: 28px;
  height: 28px;
  color: var(--color-text-tertiary);
  margin-bottom: 4px;
  opacity: 0.55;
}

.state strong {
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 500;
}

.skeleton-row td {
  padding: 14px 12px;
}

.skeleton-bar {
  height: 10px;
  border-radius: var(--radius-pill);
  background: linear-gradient(
    90deg,
    rgba(43, 88, 114, 0.07),
    rgba(43, 88, 114, 0.14),
    rgba(43, 88, 114, 0.07)
  );
  background-size: 200% 100%;
  animation: skel 1.4s ease-in-out infinite;
}

@keyframes skel {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: -200% 50%;
  }
}

/* ---- notice ---- */

.notice {
  margin: 14px 22px 0;
  border: 1px solid var(--color-warn);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  background: var(--color-warn-bg);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #6b3b00;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 22px -16px rgba(184, 107, 0, 0.4);
}

.notice .icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.notice.error {
  border-color: var(--color-error);
  background: var(--color-error-bg);
  color: var(--color-error);
  box-shadow: 0 8px 22px -16px rgba(192, 38, 90, 0.4);
}

.notice.info {
  border-color: var(--color-success);
  background: var(--color-success-bg);
  color: var(--color-success);
  box-shadow: 0 8px 22px -16px rgba(31, 146, 105, 0.4);
}

.notice .close {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  opacity: 0.7;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
}

.notice .close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.06);
}

.loading-indicator {
  position: fixed;
  top: 14px;
  left: 50%;
  z-index: 30;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(51, 154, 189, 0.36);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.96);
  color: var(--color-rescale-blue-text);
  box-shadow: var(--shadow-card);
  font-size: 12.5px;
  font-weight: 700;
}

.loading-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(51, 154, 189, 0.22);
  border-top-color: var(--palette-rescale-brand);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- confirmation dialog ---- */

.confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 12, 22, 0.42);
  backdrop-filter: blur(12px) saturate(130%);
}

.confirm-panel {
  width: min(460px, 100%);
  border-radius: var(--radius-md);
  padding: 22px;
  background: var(--color-surface);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.72) inset,
    0 24px 70px -34px rgba(2, 12, 22, 0.72);
}

.confirm-panel h2 {
  font-size: 17px;
  margin-bottom: 8px;
}

.confirm-panel p {
  color: var(--color-text-secondary);
  font-size: 13.5px;
  line-height: 1.45;
}

.confirm-warning {
  margin-top: 12px;
  border: 1px solid rgba(192, 38, 90, 0.26);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  background: var(--color-error-bg);
  padding: 10px;
  color: var(--color-error);
  font-weight: 600;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* ---- login gate ---- */

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(2, 12, 22, 0.34), rgba(2, 12, 22, 0.48)),
    rgba(245, 247, 250, 0.38);
  backdrop-filter: blur(18px) saturate(138%);
}

.login-gate-panel {
  position: relative;
  width: min(440px, 100%);
  border-radius: var(--radius-md);
  padding: 26px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--color-text-primary);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.7) inset,
    0 24px 70px -34px rgba(2, 12, 22, 0.72),
    0 10px 24px -18px rgba(2, 12, 22, 0.42);
  animation: loginGateIn 240ms cubic-bezier(0.2, 0, 0, 1);
}

.login-gate-actions .btn:active {
  transform: scale(0.96);
}

.login-gate-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: var(--radius-md);
  background: var(--gradient-brand-button);
  color: white;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 16px 28px -22px rgba(51, 154, 189, 0.9);
}

.login-gate-mark .icon {
  width: 18px;
  height: 18px;
}

.login-gate-copy {
  display: grid;
  gap: 8px;
}

.login-gate-copy .eyebrow {
  color: var(--color-rescale-blue-text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.login-gate-copy h2 {
  font-size: 24px;
  line-height: 1.08;
  color: var(--color-text-primary);
  text-wrap: balance;
}

.login-gate-copy p:not(.eyebrow) {
  color: var(--color-text-secondary);
  font-size: 14px;
  line-height: 1.5;
  text-wrap: pretty;
}

.login-gate-actions {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.login-gate-actions .btn {
  min-height: 44px;
}

@keyframes loginGateIn {
  from {
    opacity: 0;
    transform: translateY(10px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

.hidden {
  display: none !important;
}

/* ---- responsive ---- */

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .issue-pane {
    position: static;
  }
}

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

  .rail {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    padding: 10px 14px;
    gap: 12px;
  }

  .rail::before {
    background: none;
  }

  .brand-tag {
    display: none;
  }

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

  .nav-item {
    justify-content: center;
    text-align: center;
  }

  .rail-foot {
    margin-top: 0;
    grid-template-columns: 1fr;
  }

  .env-label {
    display: none;
  }

  .topbar {
    height: auto;
    padding: 12px 18px;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .userbox {
    align-self: flex-end;
  }

  .workspace {
    padding: 14px;
    gap: 14px;
  }

  .audit-pane {
    margin: 0 14px 18px;
  }

  .detail-hero {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .detail-stats {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .login-gate {
    padding: 16px;
  }

  .login-gate-panel {
    padding: 22px;
  }

  .login-gate-copy h2 {
    font-size: 21px;
  }

  .panel-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .toolbar {
    width: 100%;
    flex-wrap: wrap;
  }

  .search {
    width: 100%;
  }

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

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

  .contract-seats-form .submit-row,
  .contract-metadata-form .submit-row {
    align-items: stretch;
    flex-direction: column;
  }

  .upload-row {
    grid-template-columns: 1fr;
  }

  .table-frame {
    overflow-x: auto;
  }

  table {
    min-width: 640px;
  }

  .preview dl {
    grid-template-columns: 96px 1fr;
  }

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

  .metadata-grid dd {
    border-top: 0;
  }
}
