@import url("https://fonts.googleapis.com/css2?family=Orbitron:wght@600;700;800&family=Space+Grotesk:wght@400;500;700&display=swap");

:root {
  --td-brand-color: #5e8bff;
  --td-brand-color-hover: #84a9ff;
  --td-brand-color-light: rgba(94, 139, 255, 0.16);
  --td-brand-color-light-hover: rgba(94, 139, 255, 0.24);
  --td-success-color: #2ba471;
  --td-warning-color: #ed7b2f;
  --td-error-color: #f47070;
  --td-text-color-primary: rgba(255, 255, 255, 0.92);
  --td-text-color-secondary: rgba(255, 255, 255, 0.62);
  --td-text-color-placeholder: rgba(255, 255, 255, 0.38);
  --td-bg-color-page: #0f172a;
  --td-bg-color-page-secondary: #111b31;
  --td-bg-color-container: #162033;
  --td-bg-color-container-hover: #1c2740;
  --td-bg-color-secondarycontainer: #10192b;
  --td-border-level-1-color: #28344d;
  --td-border-level-2-color: #33415f;
  --td-mask-active: rgba(6, 12, 24, 0.58);
  --td-shadow-1: 0 10px 24px rgba(0, 0, 0, 0.24);
  --td-shadow-2: 0 18px 40px rgba(0, 0, 0, 0.32);
  --td-shadow-3: 0 28px 64px rgba(0, 0, 0, 0.44);
  --td-radius-xl: 24px;
  --td-radius-lg: 18px;
  --td-radius-md: 14px;
  --td-radius-sm: 10px;
  --td-accent-cyan: #38bdf8;
  --td-stage-max: 1520px;
  --history-columns: minmax(240px, 1.9fr) 108px 160px 118px minmax(220px, 1.45fr) 164px;
  --history-desktop-drawer-width: min(calc(100vw - 32px), max(70vw, 1300px));
}

* {
  box-sizing: border-box;
}

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

body {
  font-family:
    "Space Grotesk", "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI",
    "Noto Sans SC", sans-serif;
  color: var(--td-text-color-primary);
  color-scheme: dark;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(94, 139, 255, 0.16), transparent 26%),
    linear-gradient(180deg, #0b1120 0%, var(--td-bg-color-page) 40%, var(--td-bg-color-page-secondary) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(94, 139, 255, 0.06), transparent 22%),
    radial-gradient(circle at 82% 18%, rgba(94, 139, 255, 0.14), transparent 20%);
}

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

.hidden {
  display: none !important;
}

.page-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  isolation: isolate;
}

.console-shell::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.015), transparent 24%, rgba(255, 255, 255, 0.02) 68%, transparent 100%),
    radial-gradient(circle at 18% 88%, rgba(56, 189, 248, 0.08), transparent 26%);
  opacity: 0.92;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--td-brand-color);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(40, 52, 77, 0.92);
  background: rgba(10, 16, 28, 0.82);
  backdrop-filter: blur(14px);
}

.topbar-shell {
  padding: 18px clamp(18px, 3vw, 30px);
}

.topbar-shell::before {
  content: "";
  position: absolute;
  right: clamp(18px, 3vw, 30px);
  bottom: -1px;
  left: clamp(18px, 3vw, 30px);
  height: 1px;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0), rgba(56, 189, 248, 0.42), rgba(94, 139, 255, 0));
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand-copy {
  min-width: 0;
}

.brand-copy-primary {
  display: grid;
  gap: 4px;
}

.brand-copy h1 {
  margin: 0;
  font-family: "Orbitron", "Space Grotesk", sans-serif;
  font-size: clamp(1.48rem, 1.24rem + 0.92vw, 2.24rem);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-shadow: 0 0 24px rgba(104, 240, 255, 0.14);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
  background:
    radial-gradient(circle at 18% 22%, rgba(104, 240, 255, 0.18), transparent 40%),
    linear-gradient(145deg, rgba(21, 34, 58, 0.96), rgba(12, 20, 38, 0.98));
  border: 1px solid rgba(155, 214, 255, 0.16);
  box-shadow:
    0 16px 34px rgba(0, 82, 217, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.brand-mark-logo {
  position: relative;
  overflow: hidden;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.brand-mark-logo::after {
  display: none;
}

.brand-logo {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(104, 240, 255, 0.14));
}

.brand-kicker {
  display: none;
}

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

.topbar-actions {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.topbar-action-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-action-cluster[data-open="true"] {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0) translateY(0);
}

.mobile-topbar-actions-button {
  display: none;
  align-items: center;
  justify-content: center;
}

.mobile-topbar-actions-icon {
  width: 18px;
  height: 18px;
}

.status-pill,
.status-host,
.result-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--td-border-level-1-color);
  border-radius: 999px;
  background: rgba(16, 25, 43, 0.92);
  color: var(--td-text-color-secondary);
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--td-warning-color);
  box-shadow: 0 0 0 4px rgba(227, 115, 24, 0.14);
}

.status-pill[data-auth="ready"] .status-dot {
  background: var(--td-success-color);
  box-shadow: 0 0 0 4px rgba(43, 164, 113, 0.14);
}

.auth-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  width: 100%;
  padding: clamp(32px, 5vw, 56px) clamp(18px, 4vw, 32px) 72px;
}

.auth-stage {
  position: relative;
}

.auth-shell {
  width: min(1320px, 100%);
}

.auth-template {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  justify-content: center;
  align-items: stretch;
}

.auth-stage-shell {
  position: relative;
}

.auth-stage-frame {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  align-items: stretch;
  min-height: 640px;
  padding: 28px;
  border: 1px solid rgba(94, 139, 255, 0.16);
  border-radius: 34px;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(140deg, rgba(13, 20, 36, 0.98), rgba(9, 15, 28, 0.98)),
    rgba(9, 15, 28, 0.98);
  box-shadow:
    0 30px 56px rgba(2, 8, 20, 0.46),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.auth-stage-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 88px 88px;
  opacity: 0.22;
  pointer-events: none;
}

.auth-stage-visual {
  position: absolute;
  inset: 0;
  min-height: 580px;
  border: 0;
  border-radius: inherit;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 24%, rgba(56, 189, 248, 0.24), transparent 16%),
    radial-gradient(circle at 76% 18%, rgba(125, 156, 255, 0.28), transparent 20%),
    linear-gradient(135deg, rgba(14, 22, 40, 0.96) 0%, rgba(9, 15, 28, 0.72) 100%);
  box-shadow: none;
}

.auth-stage-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 22% 52%, rgba(56, 189, 248, 0.14), transparent 18%),
    linear-gradient(90deg, transparent 0 10%, rgba(255, 255, 255, 0.03) 10% 10.2%, transparent 10.2% 100%),
    linear-gradient(180deg, transparent 0 18%, rgba(255, 255, 255, 0.02) 18% 18.18%, transparent 18.18% 100%);
  opacity: 0.9;
}

.auth-stage-visual::after {
  content: "";
  position: absolute;
  right: 72px;
  bottom: 58px;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(104, 240, 255, 0.1);
  border-radius: 38px;
  transform: rotate(10deg);
  opacity: 0.42;
}

.auth-stage-orbit,
.auth-stage-grid,
.auth-stage-pulse,
.auth-stage-wordmark {
  position: absolute;
  inset: auto;
  pointer-events: none;
}

.auth-stage-orbit {
  top: 98px;
  left: 86px;
  width: 290px;
  height: 290px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 50%;
  box-shadow:
    0 0 0 28px rgba(56, 189, 248, 0.05),
    0 0 0 72px rgba(94, 139, 255, 0.04);
}

.auth-stage-grid {
  right: 120px;
  bottom: 88px;
  width: 260px;
  height: 260px;
  border-radius: 34px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 34px 34px;
  opacity: 0.22;
  transform: rotate(6deg);
}

.auth-stage-pulse {
  top: 78px;
  right: 160px;
  width: 180px;
  height: 180px;
  border-radius: 40px;
  background:
    radial-gradient(circle at center, rgba(104, 240, 255, 0.18), transparent 60%);
  filter: blur(10px);
  opacity: 0.64;
}

.auth-stage-wordmark {
  top: 54px;
  left: 56px;
  display: grid;
  gap: 2px;
  font-family: "Orbitron", "Space Grotesk", sans-serif;
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.auth-stage-wordmark span:first-child {
  color: rgba(255, 255, 255, 0.28);
  font-size: clamp(2.4rem, 4.2vw, 4.6rem);
}

.auth-stage-wordmark span:last-child {
  color: rgba(104, 240, 255, 0.82);
  font-size: clamp(2.8rem, 5vw, 5.4rem);
}

.auth-stage-panel {
  position: relative;
  z-index: 1;
  grid-column: 2;
  width: min(100%, 430px);
  margin-left: auto;
  align-self: center;
}

.auth-console-card {
  min-height: 0;
  padding: 36px;
  border-color: rgba(104, 240, 255, 0.16);
  backdrop-filter: blur(26px);
  background:
    linear-gradient(180deg, rgba(17, 28, 48, 0.82), rgba(10, 18, 33, 0.9));
  box-shadow:
    0 22px 54px rgba(4, 9, 21, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.auth-console-card .auth-header h2 {
  font-family: "Orbitron", "Space Grotesk", sans-serif;
  font-size: clamp(1.7rem, 1.58rem + 0.58vw, 2.16rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.auth-console-card .auth-form {
  gap: 20px;
}

.auth-console-card .primary-button {
  width: 100%;
  min-height: 48px;
  border-radius: 16px;
}

.auth-panel,
.workspace-card,
.result-card,
.message-box,
.history-drawer,
.result-panel-shell,
.tool-sidebar {
  background: var(--td-bg-color-container);
  border: 1px solid var(--td-border-level-1-color);
  box-shadow: var(--td-shadow-1);
}

.auth-panel,
.workspace-card,
.result-card,
.message-box,
.tool-sidebar {
  border-radius: var(--td-radius-xl);
}

.auth-panel {
  display: grid;
  align-content: start;
  gap: 24px;
  padding: 32px;
}

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

.panel-header h2,
.workspace-card-head h3,
.result-card h3 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.3;
}

.auth-form,
.provision-form {
  display: grid;
  gap: 24px;
}

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

.field-full {
  grid-column: 1 / -1;
}

.field span {
  color: var(--td-text-color-primary);
  font-size: 14px;
  font-weight: 600;
}

.field-note {
  color: var(--td-text-color-secondary);
  font-size: 12px;
  line-height: 1.6;
}

.field input,
.field select {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--td-border-level-1-color);
  border-radius: 12px;
  color: var(--td-text-color-primary);
  background: var(--td-bg-color-secondarycontainer);
  outline: none;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.field select option {
  color: var(--td-text-color-primary);
  background: var(--td-bg-color-container);
}

.field input::placeholder {
  color: var(--td-text-color-placeholder);
}

.field input:focus,
.field select:focus {
  border-color: var(--td-brand-color);
  box-shadow: 0 0 0 3px rgba(0, 82, 217, 0.14);
}

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

.action-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.auth-actions {
  align-items: center;
}

.ghost-button,
.primary-button,
.copy-button {
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease,
    color 180ms ease;
}

.ghost-button {
  min-height: 40px;
  padding: 0 14px;
  border-color: var(--td-border-level-1-color);
  color: var(--td-text-color-primary);
  background: var(--td-bg-color-container);
}

.primary-button {
  min-height: 44px;
  padding: 0 18px;
  color: #ffffff;
  font-weight: 600;
  background: linear-gradient(135deg, var(--td-brand-color) 0%, var(--td-brand-color-hover) 100%);
  box-shadow: 0 10px 20px rgba(0, 82, 217, 0.2);
}

.copy-button {
  min-height: 34px;
  padding: 0 12px;
  border-color: rgba(0, 82, 217, 0.18);
  color: var(--td-brand-color);
  background: var(--td-brand-color-light);
}

.ghost-button:hover,
.primary-button:hover,
.copy-button:hover {
  transform: translateY(-1px);
}

.ghost-button:hover {
  border-color: var(--td-brand-color-light-hover);
  background: var(--td-bg-color-container-hover);
}

.primary-button:hover {
  box-shadow: 0 14px 24px rgba(0, 82, 217, 0.28);
}

.copy-button:hover {
  background: #dfeaff;
}

.danger-ghost {
  color: var(--td-error-color);
  border-color: rgba(213, 73, 65, 0.18);
  background: rgba(213, 73, 65, 0.06);
}

.danger-ghost:hover {
  box-shadow: 0 10px 18px rgba(213, 73, 65, 0.12);
}

.primary-button:disabled,
.ghost-button:disabled,
.copy-button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
  box-shadow: none;
}

.helper-text,
.history-meta,
.message-box,
.result-card p,
.result-item span,
.selection-preview p,
.workspace-stat small,
.history-value-block span,
.history-time-cell small,
.history-muted {
  color: var(--td-text-color-secondary);
}

.dashboard-shell {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  gap: 24px;
  flex: 1 1 auto;
  width: min(var(--td-stage-max), 100%);
  margin: 0 auto;
  padding: 28px clamp(16px, 2.4vw, 24px) 36px;
}

.dashboard-grid {
  min-width: 0;
}

.dashboard-template {
  align-self: stretch;
}

.tool-sidebar,
.operation-panel,
.dashboard-workspace {
  min-width: 0;
}

.tool-sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 92px;
  align-self: start;
  max-height: calc(100dvh - 116px);
  overflow: auto;
  padding: 20px;
}

.console-sidebar {
  border-radius: 28px;
  backdrop-filter: blur(18px);
  background:
    linear-gradient(180deg, rgba(23, 33, 52, 0.96), rgba(16, 25, 43, 0.98));
  box-shadow:
    0 24px 44px rgba(4, 8, 20, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.tool-sidebar-header {
  display: grid;
  gap: 12px;
}

.tool-sidebar-brandline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tool-sidebar-badge {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--td-brand-color) 0%, var(--td-brand-color-hover) 100%);
}

.tool-sidebar-brandtext {
  display: grid;
  gap: 2px;
}

.tool-sidebar-brandtext strong {
  font-size: 16px;
}

.tool-sidebar-brandtext span {
  color: var(--td-text-color-secondary);
  font-size: 13px;
}

.tool-nav {
  display: grid;
  gap: 10px;
}

.tool-button {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 12px 14px;
  border: 1px solid var(--td-border-level-1-color);
  border-radius: 16px;
  text-align: left;
  color: var(--td-text-color-primary);
  background: var(--td-bg-color-secondarycontainer);
  overflow: hidden;
  backdrop-filter: blur(6px);
}

.tool-button::after {
  content: "";
  position: absolute;
  right: 14px;
  bottom: 0;
  left: 14px;
  height: 2px;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 180ms ease;
  background: linear-gradient(90deg, var(--td-accent-cyan) 0%, var(--td-brand-color) 100%);
}

.tool-button:hover {
  border-color: rgba(94, 139, 255, 0.32);
  background: var(--td-bg-color-container-hover);
  box-shadow: var(--td-shadow-1);
}

.tool-button:hover::after,
.tool-button.active::after {
  transform: scaleX(1);
}

.tool-button.active {
  border-color: rgba(94, 139, 255, 0.34);
  background: linear-gradient(135deg, rgba(94, 139, 255, 0.18) 0%, rgba(18, 30, 54, 0.96) 100%);
  box-shadow: inset 3px 0 0 var(--td-brand-color), var(--td-shadow-1);
}

.tool-button-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  color: var(--td-brand-color);
  background: rgba(94, 139, 255, 0.16);
}

.tool-button-icon-svg {
  width: 18px;
  height: 18px;
  overflow: visible;
  filter: drop-shadow(0 4px 8px rgba(94, 139, 255, 0.14));
}

.tool-button-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.tool-button-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
}

.dashboard-workspace,
.operation-panel {
  display: grid;
  gap: 24px;
}

.tool-view {
  display: grid;
  gap: 20px;
  align-content: start;
}

.tool-view-shell {
  width: 100%;
}

.workspace-hero {
  display: grid;
  gap: 16px;
}

.provision-workbench {
  gap: 28px;
}

.provision-hero {
  position: relative;
  min-height: 180px;
  padding: 30px 32px;
  border: 1px solid rgba(94, 139, 255, 0.18);
  border-radius: 30px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 16% 18%, rgba(56, 189, 248, 0.18), transparent 26%),
    radial-gradient(circle at 86% 22%, rgba(94, 139, 255, 0.24), transparent 28%),
    linear-gradient(135deg, rgba(18, 28, 49, 0.98) 0%, rgba(13, 21, 38, 0.96) 58%, rgba(10, 18, 34, 0.92) 100%);
  box-shadow: 0 24px 44px rgba(2, 8, 20, 0.42);
}

.provision-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at left center, rgba(56, 189, 248, 0.1), transparent 22%),
    repeating-linear-gradient(90deg, transparent 0 56px, rgba(255, 255, 255, 0.03) 56px 57px);
  opacity: 0.72;
  pointer-events: none;
}

.provision-hero::after {
  content: "";
  position: absolute;
  top: 24px;
  right: 26px;
  width: 148px;
  height: 148px;
  border: 1px solid rgba(56, 189, 248, 0.14);
  border-radius: 32px;
  transform: rotate(10deg);
  opacity: 0.54;
}

.provision-hero-header,
.provision-overview-grid {
  position: relative;
  z-index: 1;
}

.provision-hero-header {
  align-items: center;
}

.provision-hero h2 {
  margin: 0;
  font-size: clamp(2rem, 3.1vw, 2.65rem);
  letter-spacing: -0.04em;
  line-height: 1.04;
}

.provision-hero .ghost-button {
  min-height: 48px;
  padding: 0 18px;
  border-color: rgba(56, 189, 248, 0.22);
  background: rgba(12, 20, 38, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.provision-hero .ghost-button:hover {
  border-color: rgba(56, 189, 248, 0.36);
  background: rgba(18, 30, 54, 0.94);
  box-shadow: 0 14px 28px rgba(5, 10, 23, 0.34);
}

.redeem-workbench {
  gap: 28px;
}

.redeem-hero {
  position: relative;
  min-height: 180px;
  padding: 30px 32px;
  border: 1px solid rgba(94, 139, 255, 0.18);
  border-radius: 30px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 88% 28%, rgba(94, 139, 255, 0.22), transparent 24%),
    linear-gradient(135deg, rgba(18, 28, 49, 0.98) 0%, rgba(13, 21, 38, 0.96) 58%, rgba(10, 18, 34, 0.92) 100%);
  box-shadow: 0 24px 44px rgba(2, 8, 20, 0.42);
}

.redeem-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at left center, rgba(94, 139, 255, 0.12), transparent 18%),
    repeating-linear-gradient(90deg, transparent 0 56px, rgba(255, 255, 255, 0.03) 56px 57px);
  opacity: 0.72;
  pointer-events: none;
}

.redeem-hero-header {
  position: relative;
  z-index: 1;
  align-items: center;
}

.redeem-hero-copy {
  display: grid;
  gap: 0;
}

.redeem-hero-copy h2 {
  margin: 0;
  font-size: clamp(2rem, 3.2vw, 2.7rem);
  letter-spacing: -0.04em;
  line-height: 1.04;
}

.redeem-history-trigger {
  min-height: 48px;
  padding: 0 18px;
  border-color: rgba(94, 139, 255, 0.24);
  background: rgba(12, 20, 38, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.redeem-history-trigger:hover {
  border-color: rgba(94, 139, 255, 0.4);
  background: rgba(18, 30, 54, 0.94);
  box-shadow: 0 14px 28px rgba(5, 10, 23, 0.34);
}

.page-header {
  padding: 0;
}

.workspace-overview-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.6fr) repeat(4, minmax(150px, 1fr));
  gap: 16px;
}

.provision-overview-grid {
  grid-template-columns: minmax(260px, 1.55fr) repeat(4, minmax(140px, 1fr));
}

.selection-preview {
  display: grid;
  gap: 12px;
  min-height: 150px;
  padding: 22px;
  border: 1px solid rgba(94, 139, 255, 0.18);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(94, 139, 255, 0.14), rgba(22, 32, 51, 0.98));
  box-shadow: var(--td-shadow-1);
}

.provision-selection-card {
  min-height: 164px;
  border-color: rgba(56, 189, 248, 0.18);
  background:
    linear-gradient(180deg, rgba(56, 189, 248, 0.12), rgba(22, 32, 51, 0.98));
}

.selection-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.selection-main strong {
  font-size: 20px;
  line-height: 1.35;
}

.selection-main span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--td-brand-color);
  font-size: 12px;
  font-weight: 700;
  background: rgba(94, 139, 255, 0.16);
}

.provision-selection-card .selection-main span {
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.14);
}

.workspace-stat {
  display: grid;
  align-content: space-between;
  gap: 10px;
  min-height: 150px;
  padding: 18px;
  border: 1px solid var(--td-border-level-1-color);
  border-radius: 18px;
  background: var(--td-bg-color-container);
  box-shadow: var(--td-shadow-1);
}

.provision-stat {
  min-height: 164px;
  border-color: rgba(94, 139, 255, 0.12);
  background:
    linear-gradient(180deg, rgba(25, 37, 62, 0.98), rgba(18, 28, 46, 0.94));
}

.provision-stat strong {
  font-size: 19px;
}

.workspace-stat-subvalue {
  color: var(--td-text-color-secondary);
  font-size: 14px;
  font-weight: 600;
}

.workspace-stat span {
  color: var(--td-text-color-secondary);
  font-size: 13px;
  font-weight: 500;
}

.workspace-stat strong {
  font-size: 18px;
  line-height: 1.4;
  word-break: break-all;
}

.workspace-card {
  display: grid;
  gap: 20px;
  padding: 24px;
}

.provision-config-card {
  position: relative;
  gap: 24px;
  align-content: start;
  padding: 30px;
  border-color: rgba(56, 189, 248, 0.14);
  border-radius: 30px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(22, 32, 53, 0.98), rgba(17, 26, 45, 0.96));
  box-shadow:
    0 24px 46px rgba(4, 9, 21, 0.44),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.provision-config-card::before {
  content: "";
  position: absolute;
  top: 22px;
  bottom: 22px;
  left: 0;
  width: 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--td-accent-cyan) 0%, rgba(56, 189, 248, 0.08) 100%);
}

.provision-config-card::after {
  content: "";
  position: absolute;
  top: 22px;
  right: 24px;
  width: 130px;
  height: 130px;
  border: 1px dashed rgba(56, 189, 248, 0.14);
  border-radius: 28px;
  opacity: 0.62;
  transform: rotate(12deg);
  pointer-events: none;
}

.redeem-config-card {
  position: relative;
  gap: 24px;
  align-content: start;
  padding: 30px;
  border-color: rgba(94, 139, 255, 0.16);
  border-radius: 30px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(22, 32, 53, 0.98), rgba(17, 26, 45, 0.96));
  box-shadow:
    0 24px 46px rgba(4, 9, 21, 0.44),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.redeem-config-card::before {
  content: "";
  position: absolute;
  top: 22px;
  bottom: 22px;
  left: 0;
  width: 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--td-brand-color) 0%, rgba(94, 139, 255, 0.08) 100%);
}

.redeem-config-card::after {
  content: "";
  position: absolute;
  top: 22px;
  right: 24px;
  width: 130px;
  height: 130px;
  border: 1px dashed rgba(94, 139, 255, 0.14);
  border-radius: 28px;
  opacity: 0.62;
  transform: rotate(12deg);
  pointer-events: none;
}

.workspace-card-form,
.workspace-card-table,
.workspace-card-toolbar {
  display: grid;
  gap: 20px;
}

.workspace-card-table {
  min-height: 0;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}

.workspace-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--td-border-level-1-color);
}

.provision-card-head {
  position: relative;
  padding-bottom: 20px;
}

.provision-card-head::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 140px;
  height: 1px;
  background: linear-gradient(90deg, var(--td-accent-cyan) 0%, transparent 100%);
}

.provision-card-head h3 {
  font-size: clamp(1.55rem, 2vw, 2rem);
  letter-spacing: -0.03em;
}

.provision-form-shell {
  gap: 30px;
}

.provision-form-grid {
  gap: 20px;
}

.provision-form-grid .field {
  gap: 10px;
  padding: 16px 16px 18px;
  border: 1px solid rgba(94, 139, 255, 0.1);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(14, 21, 36, 0.76), rgba(11, 18, 31, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.provision-form-grid .field-full {
  padding: 18px;
}

.provision-form-grid .field span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.provision-form-grid .field input,
.provision-form-grid .field select {
  min-height: 52px;
  padding: 12px 16px;
  border-radius: 16px;
  border-color: rgba(94, 139, 255, 0.12);
  background: rgba(7, 13, 24, 0.74);
}

.provision-form-grid .field input:focus,
.provision-form-grid .field select:focus {
  box-shadow:
    0 0 0 3px rgba(94, 139, 255, 0.18),
    0 14px 24px rgba(0, 0, 0, 0.18);
  background: rgba(10, 16, 28, 0.94);
}

.provision-submit-row {
  justify-content: flex-start;
  padding-top: 2px;
}

.provision-submit-button {
  min-width: 208px;
  min-height: 54px;
  padding: 0 28px;
  border-radius: 18px;
  box-shadow:
    0 18px 32px rgba(56, 189, 248, 0.14),
    0 12px 28px rgba(94, 139, 255, 0.2);
}

.provision-submit-button:hover {
  box-shadow:
    0 22px 38px rgba(56, 189, 248, 0.18),
    0 14px 30px rgba(94, 139, 255, 0.24);
}

.redeem-card-head {
  position: relative;
  padding-bottom: 20px;
}

.redeem-card-head::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 120px;
  height: 1px;
  background: linear-gradient(90deg, var(--td-brand-color) 0%, transparent 100%);
}

.redeem-card-head h3 {
  font-size: clamp(1.55rem, 2vw, 2rem);
  letter-spacing: -0.03em;
}

.redeem-form-shell {
  gap: 30px;
}

.redeem-form-grid {
  gap: 20px;
}

.redeem-form-grid .field {
  gap: 10px;
  padding: 16px 16px 18px;
  border: 1px solid rgba(94, 139, 255, 0.1);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(14, 21, 36, 0.76), rgba(11, 18, 31, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.redeem-form-grid .field-full {
  padding: 18px;
}

.redeem-form-grid .field span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.redeem-form-grid .field input,
.redeem-form-grid .field select {
  min-height: 52px;
  padding: 12px 16px;
  border-radius: 16px;
  border-color: rgba(94, 139, 255, 0.12);
  background: rgba(7, 13, 24, 0.74);
}

.redeem-form-grid .field input:focus,
.redeem-form-grid .field select:focus {
  box-shadow:
    0 0 0 3px rgba(94, 139, 255, 0.18),
    0 14px 24px rgba(0, 0, 0, 0.18);
  background: rgba(10, 16, 28, 0.94);
}

.redeem-submit-row {
  justify-content: flex-start;
  padding-top: 2px;
}

.redeem-submit-button {
  min-width: 176px;
  min-height: 54px;
  padding: 0 26px;
  border-radius: 18px;
  box-shadow: 0 18px 30px rgba(94, 139, 255, 0.24);
}

.redeem-submit-button:hover {
  box-shadow: 0 22px 36px rgba(94, 139, 255, 0.28);
}

.helper-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--td-brand-color);
  font-size: 12px;
  font-weight: 600;
  background: var(--td-brand-color-light);
}

.history-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.history-filter select {
  min-height: 44px;
}

.history-meta:empty {
  display: none;
}

.history-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.redeem-code-list,
.redeem-history-list,
.history-table-body {
  display: grid;
  gap: 10px;
}

.redeem-history-list {
  min-height: 0;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.history-table-shell {
  display: grid;
  align-content: start;
  min-height: 100%;
  overflow-x: auto;
  overflow-y: visible;
  overscroll-behavior-x: contain;
  padding: 10px;
  border: 1px solid var(--td-border-level-1-color);
  border-radius: 16px;
  background: rgba(13, 22, 37, 0.94);
}

.history-mobile-list {
  display: none;
  gap: 12px;
}

.history-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  padding: 14px 18px;
  border: 1px solid rgba(94, 139, 255, 0.12);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(28, 39, 61, 0.96), rgba(23, 33, 52, 0.94)),
    rgba(23, 33, 52, 0.94);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 18px 32px rgba(4, 8, 20, 0.16);
}

.history-pagination-meta {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--td-text-color-secondary);
  font-size: 13px;
  text-align: left;
}

.history-pagination-range {
  color: rgba(227, 233, 242, 0.9);
  font-size: 13px;
  line-height: 1.5;
}

.history-page-size-shell {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  color: rgba(227, 233, 242, 0.84);
  white-space: nowrap;
}

.history-page-size-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.history-page-size-wrap::after {
  content: "";
  position: absolute;
  right: 14px;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid rgba(227, 233, 242, 0.76);
  border-bottom: 1.5px solid rgba(227, 233, 242, 0.76);
  transform: translateY(-2px) rotate(45deg);
  pointer-events: none;
}

.history-page-size-select {
  min-width: 102px;
  min-height: 40px;
  padding: 0 40px 0 16px;
  border: 1px solid rgba(116, 132, 167, 0.34);
  border-radius: 16px;
  color: rgba(240, 244, 251, 0.96);
  font-size: 14px;
  background: rgba(34, 46, 70, 0.92);
  outline: none;
  cursor: pointer;
  appearance: none;
}

.history-page-size-select:focus {
  border-color: rgba(26, 255, 223, 0.68);
  box-shadow: 0 0 0 3px rgba(26, 255, 223, 0.12);
}

.history-page-size-select option {
  color: var(--td-text-color-primary);
  background: var(--td-bg-color-container);
}

.history-pagination-controls {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
  border: 1px solid rgba(116, 132, 167, 0.26);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(57, 72, 98, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.history-pagination-pages {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  flex: 0 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
}

.history-page-nav,
.history-page-chip {
  min-width: 48px;
  min-height: 46px;
  padding: 0 14px;
  border: 0;
  border-radius: 0;
  color: rgba(227, 233, 242, 0.92);
  background: transparent;
  box-shadow: none;
  transform: none;
}

.history-page-nav,
.history-page-chip,
.history-page-ellipsis {
  border-right: 1px solid rgba(116, 132, 167, 0.22);
}

.history-page-chip {
  min-width: 50px;
  font-size: 14px;
  font-weight: 500;
}

.history-page-nav:last-child {
  border-right: 0;
}

.history-page-nav:hover,
.history-page-chip:hover {
  background: rgba(75, 92, 120, 0.48);
}

.history-page-nav:disabled {
  color: rgba(227, 233, 242, 0.34);
  background: transparent;
}

.history-page-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-size: 22px;
  line-height: 1;
}

.history-page-chip.active,
.history-page-chip[aria-current="page"] {
  color: #18f7de;
  background:
    linear-gradient(180deg, rgba(16, 90, 101, 0.42), rgba(10, 61, 73, 0.58)),
    rgba(10, 61, 73, 0.58);
  box-shadow: inset 0 0 0 1px rgba(24, 247, 222, 0.5);
}

.history-page-chip.active:hover,
.history-page-chip[aria-current="page"]:hover {
  background:
    linear-gradient(180deg, rgba(16, 104, 116, 0.48), rgba(10, 70, 84, 0.64)),
    rgba(10, 70, 84, 0.64);
}

.history-page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 46px;
  color: rgba(227, 233, 242, 0.66);
  font-size: 14px;
  background: transparent;
}

.history-table {
  display: grid;
  grid-template-columns: var(--history-columns);
  align-items: stretch;
  gap: 10px;
  width: max-content;
  min-width: 100%;
}

.history-table-head {
  color: var(--td-text-color-secondary);
  font-size: 13px;
  font-weight: 600;
}

.history-table-head > div {
  padding: 14px 16px;
}

.history-row {
  display: grid;
  grid-template-columns: var(--history-columns);
  border: 1px solid var(--td-border-level-1-color);
  border-radius: 14px;
  background: var(--td-bg-color-container);
}

.history-cell {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 16px 18px;
  color: var(--td-text-color-primary);
  font-size: 14px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.history-record-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(94, 139, 255, 0.14);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(20, 30, 48, 0.98), rgba(13, 22, 37, 0.98)),
    rgba(13, 22, 37, 0.98);
  box-shadow:
    0 16px 32px rgba(4, 8, 20, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.history-record-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.history-record-codeblock {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.history-record-label,
.history-record-caption {
  color: var(--td-text-color-secondary);
  font-size: 12px;
  line-height: 1.4;
}

.history-record-codeblock code {
  font-size: 14px;
  line-height: 1.6;
  word-break: break-all;
}

.history-record-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.history-record-value {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--td-accent-cyan);
  font-size: 12px;
  font-weight: 600;
  background: rgba(56, 189, 248, 0.14);
}

.history-record-main {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.history-record-cell {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(94, 139, 255, 0.12);
  border-radius: 14px;
  background: rgba(9, 16, 29, 0.72);
}

.history-record-detail {
  min-width: 0;
  color: var(--td-text-color-primary);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.history-record-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.history-record-actions .ghost-button,
.history-record-actions .copy-button {
  width: 100%;
  justify-content: center;
}

.history-code-cell {
  gap: 10px;
}

.history-code-cell code,
.redeem-code-item code,
.history-code-row code,
.result-item strong,
.delivery-template,
.status-host {
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Monaco, monospace;
}

.history-code-cell code,
.redeem-code-item code,
.history-code-row code,
.result-item strong {
  word-break: break-all;
}

.history-pill,
.history-tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(94, 139, 255, 0.12);
  border-radius: 999px;
  color: var(--td-text-color-primary);
  font-size: 12px;
  background: rgba(17, 29, 49, 0.92);
}

.history-pill.status-unused {
  color: var(--td-success-color);
  border-color: rgba(43, 164, 113, 0.18);
  background: rgba(43, 164, 113, 0.1);
}

.history-pill.status-used {
  color: var(--td-text-color-secondary);
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.06);
}

.history-pill.status-expired {
  color: var(--td-error-color);
  border-color: rgba(213, 73, 65, 0.18);
  background: rgba(213, 73, 65, 0.1);
}

.history-value-block,
.history-time-cell,
.history-table-body,
.history-item-main,
.history-info-grid {
  display: grid;
  gap: 4px;
}

.history-table-body {
  min-width: max-content;
  align-content: start;
}

.history-actions-cell {
  justify-content: flex-start;
}

.redeem-code-item,
.history-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--td-border-level-1-color);
  border-radius: 14px;
  background: var(--td-bg-color-secondarycontainer);
}

.history-code-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.history-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.message-box {
  padding: 16px 18px;
  line-height: 1.7;
  border-radius: 16px;
}

.message-box[data-tone="neutral"] {
  color: var(--td-text-color-secondary);
  background: rgba(16, 25, 43, 0.9);
}

.message-box[data-tone="success"] {
  color: var(--td-success-color);
  border-color: rgba(43, 164, 113, 0.18);
  background: rgba(43, 164, 113, 0.06);
}

.message-box[data-tone="error"] {
  color: var(--td-error-color);
  border-color: rgba(213, 73, 65, 0.18);
  background: rgba(213, 73, 65, 0.06);
}

.copy-toast {
  position: fixed;
  top: 92px;
  right: 16px;
  z-index: 96;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: auto;
  max-width: min(360px, calc(50vw - 32px));
  padding: 14px 16px;
  border: 1px solid rgba(43, 164, 113, 0.24);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(14, 22, 38, 0.96), rgba(10, 17, 31, 0.98));
  box-shadow:
    0 24px 44px rgba(4, 9, 21, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(18px);
  opacity: 0;
  transform: translateX(24px);
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.copy-toast[data-open="true"] {
  opacity: 1;
  transform: translateX(0);
}

.copy-toast[data-tone="success"] {
  border-color: rgba(43, 164, 113, 0.24);
}

.copy-toast[data-tone="error"] {
  border-color: rgba(213, 73, 65, 0.28);
}

.copy-toast-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: rgba(43, 164, 113, 0.12);
  color: var(--td-success-color);
}

.copy-toast[data-tone="error"] .copy-toast-icon {
  background: rgba(213, 73, 65, 0.12);
  color: var(--td-error-color);
}

.copy-toast-icon::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.04);
}

.copy-toast-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.copy-toast-copy strong {
  font-size: 14px;
  font-weight: 700;
}

.copy-toast-copy span {
  color: var(--td-text-color-secondary);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.result-state[data-state="success"] {
  color: var(--td-success-color);
}

.result-state[data-state="failed"] {
  color: var(--td-error-color);
}

.result-state[data-state="running"] {
  color: var(--td-warning-color);
}

.result-drawer-overlay,
.history-drawer-overlay {
  position: fixed;
  inset: 0;
  background: var(--td-mask-active);
  backdrop-filter: blur(3px);
}

.result-drawer-overlay {
  z-index: 60;
}

.history-drawer-overlay {
  z-index: 70;
}

.result-drawer {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 65;
  width: calc(50vw - 16px);
}

.result-panel-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 18px;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 24px;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--td-shadow-3);
}

.result-panel {
  background: var(--td-bg-color-container);
}

.result-drawer.hidden,
.result-drawer-overlay.hidden,
.history-drawer.hidden,
.history-drawer-overlay.hidden {
  display: none !important;
}

.result-drawer[data-open="true"],
.history-drawer[data-open="true"] {
  animation: drawer-in 180ms ease-out;
}

.result-drawer-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.result-stack {
  display: grid;
  flex: 1 1 auto;
  gap: 16px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
}

.result-card {
  padding: 18px;
}

.result-card.placeholder,
.error-card {
  min-height: 180px;
}

.compact-placeholder {
  min-height: 0;
}

.result-grid {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.result-item {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--td-border-level-1-color);
  border-radius: 14px;
  background: var(--td-bg-color-secondarycontainer);
}

.delivery-card {
  background: linear-gradient(180deg, rgba(94, 139, 255, 0.12), rgba(22, 32, 51, 0.98));
}

.delivery-header {
  display: grid;
  gap: 10px;
}

.delivery-header-copy {
  min-width: 0;
}

.delivery-header p {
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}

.delivery-actions {
  display: grid;
  margin-top: 14px;
}

.copy-button-strong {
  justify-self: end;
  color: var(--td-brand-color);
  background: var(--td-bg-color-container);
}

.delivery-actions .copy-button-strong {
  width: 100%;
  min-height: 44px;
  justify-content: center;
  color: #ffffff;
  font-weight: 700;
  background: linear-gradient(135deg, var(--td-brand-color) 0%, var(--td-brand-color-hover) 100%);
  border-color: rgba(132, 169, 255, 0.36);
  box-shadow: 0 14px 26px rgba(38, 91, 214, 0.26);
}

.delivery-actions .copy-button-strong:hover {
  background: linear-gradient(135deg, var(--td-brand-color-hover) 0%, #9ab8ff 100%);
}

.delivery-template {
  margin: 14px 0 0;
  padding: 16px 18px;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--td-border-level-1-color);
  border-radius: 14px;
  color: var(--td-text-color-primary);
  font-size: 0.92rem;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  background: rgba(16, 25, 43, 0.94);
}

.history-drawer {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  width: var(--history-desktop-drawer-width);
  max-width: calc(100vw - 32px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 18px;
  padding: 24px;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--td-shadow-3);
}

.history-drawer-shell {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  width: var(--history-desktop-drawer-width);
  max-width: calc(100vw - 32px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 18px;
  padding: 24px;
  border-radius: 22px;
  overflow: hidden;
  overscroll-behavior: contain;
  box-shadow: var(--td-shadow-3);
}

@keyframes drawer-in {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

  .auth-stage-frame {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 24px;
  }

  .auth-stage-visual {
    min-height: 260px;
  }

  .auth-stage-panel {
    grid-column: 1;
    width: min(100%, 460px);
    margin: 0 0 0 auto;
  }

  .auth-stage-wordmark {
    top: 36px;
    left: 32px;
  }

  .auth-stage-orbit {
    top: 112px;
    left: 54px;
    width: 220px;
    height: 220px;
  }

  .auth-stage-grid {
    right: 72px;
    bottom: 68px;
    width: 190px;
    height: 190px;
  }

  .dashboard-shell {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
  }

  .provision-hero,
  .redeem-hero,
  .provision-config-card,
  .redeem-config-card {
    min-height: 0;
  }

  .tool-sidebar {
    position: static;
    top: auto;
    max-height: none;
    overflow: visible;
  }

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

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

  .workspace-overview-primary {
    grid-column: 1 / -1;
  }

  .history-drawer,
  .history-drawer-shell {
    width: var(--history-desktop-drawer-width);
    max-width: calc(100vw - 32px);
  }

  .result-drawer {
    top: 16px;
    right: 16px;
    bottom: 16px;
    width: calc(50vw - 16px);
  }

  .result-panel-shell {
    border-radius: 24px;
  }

}

@media (max-width: 960px) {
  .topbar {
    gap: 16px;
    padding: 14px 18px;
  }

  .auth-stage-visual {
    min-height: 220px;
  }

  .auth-stage-frame {
    padding: 22px;
  }

  .auth-stage-panel {
    width: min(100%, 430px);
  }

  .auth-stage-wordmark span:first-child {
    font-size: clamp(2rem, 3.4vw, 3rem);
  }

  .auth-stage-wordmark span:last-child {
    font-size: clamp(2.4rem, 4vw, 3.8rem);
  }

  .tool-sidebar {
    padding: 18px;
  }

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

  .workspace-card,
  .auth-panel,
  .result-panel-shell,
  .history-drawer,
  .history-drawer-shell {
    padding: 20px;
  }

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

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

  .workspace-overview-primary {
    grid-column: 1 / -1;
  }

  .history-toolbar {
    grid-template-columns: 1fr;
  }

  .result-drawer {
    top: 16px;
    right: 16px;
    bottom: 16px;
    width: calc(50vw - 16px);
  }

  .result-panel-shell {
    border-radius: 24px;
  }

  .redeem-hero,
  .provision-hero,
  .provision-config-card,
  .redeem-config-card {
    padding: 24px;
    border-radius: 26px;
  }

  .provision-config-card::after,
  .redeem-config-card::after {
    width: 112px;
    height: 112px;
  }
}

@media (max-width: 720px) {
  .topbar,
  .topbar-status,
  .panel-header,
  .page-header,
  .action-row,
  .selection-main,
  .delivery-header,
  .history-header-actions,
  .history-item,
  .history-code-row,
  .workspace-card-head {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: start;
    padding-top: max(12px, env(safe-area-inset-top));
  }

  .brand-block {
    inline-size: auto;
    min-width: 0;
    gap: 12px;
  }

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

  .brand-logo {
    width: 32px;
    height: 32px;
  }

  .brand-copy h1 {
    font-size: clamp(1.02rem, 5vw, 1.34rem);
    letter-spacing: 0.1em;
  }

  .topbar-status {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: flex-start;
    inline-size: auto;
    width: auto;
    gap: 10px;
  }

  .topbar-status > * {
    inline-size: auto;
    width: auto;
    min-width: 0;
    justify-content: flex-end;
    text-align: right;
  }

  .topbar-actions {
    justify-content: flex-end;
  }

  .mobile-topbar-actions-button {
    display: inline-flex;
    justify-content: center;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 14px;
  }

  .topbar-action-cluster {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 58;
    display: grid;
    align-content: start;
    justify-items: stretch;
    gap: 10px;
    width: 0;
    min-height: 100dvh;
    padding: 0;
    border: 0 solid rgba(94, 139, 255, 0.12);
    border-radius: 24px 0 0 24px;
    background:
      linear-gradient(180deg, rgba(18, 28, 49, 0.98), rgba(11, 18, 31, 0.98)),
      rgba(16, 25, 43, 0.98);
    box-shadow: none;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    visibility: hidden;
    transform: translateX(0);
    transition:
      opacity 180ms ease,
      width 180ms ease,
      padding 180ms ease,
      border-width 180ms ease,
      box-shadow 180ms ease;
  }

  .topbar-action-cluster[data-open="true"] {
    width: 50vw;
    padding: calc(82px + env(safe-area-inset-top)) 14px calc(18px + env(safe-area-inset-bottom))
      14px;
    border-width: 1px;
    box-shadow:
      -24px 0 42px rgba(4, 8, 20, 0.34),
      inset 1px 0 0 rgba(255, 255, 255, 0.03);
    overflow: auto;
    visibility: visible;
  }

  .topbar-action-cluster .ghost-button {
    inline-size: 100%;
    justify-content: flex-start;
    min-height: 44px;
  }

  #auth-status,
  #instance-host {
    display: none !important;
  }

  .auth-layout,
  .dashboard-shell {
    padding: 16px;
  }

  .dashboard-shell {
    padding-bottom: calc(132px + env(safe-area-inset-bottom));
  }

  .auth-stage-visual {
    min-height: 180px;
    border-radius: 24px;
  }

  .auth-stage-frame {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 18px;
    border-radius: 26px;
  }

  .auth-stage-wordmark {
    top: 24px;
    left: 22px;
    gap: 4px;
  }

  .auth-stage-wordmark span:first-child {
    font-size: 1.6rem;
  }

  .auth-stage-wordmark span:last-child {
    font-size: 2rem;
  }

  .auth-stage-orbit {
    top: 78px;
    left: 30px;
    width: 160px;
    height: 160px;
    box-shadow:
      0 0 0 18px rgba(56, 189, 248, 0.05),
      0 0 0 42px rgba(94, 139, 255, 0.035);
  }

  .auth-stage-grid {
    right: 24px;
    bottom: 24px;
    width: 132px;
    height: 132px;
    background-size: 22px 22px;
  }

  .auth-stage-pulse {
    top: 28px;
    right: 24px;
    width: 100px;
    height: 100px;
  }

  .auth-stage-panel {
    grid-column: 1;
    width: 100%;
    margin: 0;
  }

  .auth-panel,
  .tool-sidebar,
  .workspace-card,
  .result-panel-shell {
    padding: 18px;
  }

  .tool-sidebar {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 64;
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
    max-height: none;
    overflow: hidden;
    border-radius: 24px 24px 0 0;
    background:
      linear-gradient(180deg, rgba(23, 33, 52, 0.94), rgba(16, 25, 43, 0.98));
    box-shadow:
      0 -18px 42px rgba(4, 8, 20, 0.36),
      0 0 0 1px rgba(94, 139, 255, 0.1);
    backdrop-filter: blur(18px);
  }

  .tool-sidebar-header {
    display: none;
  }

  .redeem-hero,
  .provision-hero,
  .provision-config-card,
  .redeem-config-card {
    padding: 20px;
    border-radius: 24px;
  }

  .provision-workbench,
  .redeem-workbench {
    gap: 16px;
  }

  .provision-hero,
  .redeem-hero {
    position: static;
    top: auto;
    z-index: auto;
  }

  .provision-config-card::after,
  .redeem-config-card::after {
    display: none;
  }

  .provision-form-grid .field,
  .provision-form-grid .field-full,
  .redeem-form-grid .field,
  .redeem-form-grid .field-full {
    padding: 14px;
    border-radius: 18px;
  }

  .form-grid,
  .workspace-overview-grid {
    grid-template-columns: 1fr;
  }

  .tool-nav {
    inline-size: 100%;
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .tool-button {
    min-width: 0;
    grid-template-columns: 1fr;
    justify-items: center;
    min-height: 72px;
    padding: 14px 12px;
    border-radius: 18px;
    gap: 8px;
    text-align: center;
  }

  .tool-button::after {
    right: 16px;
    left: 16px;
  }

  .tool-button-copy {
    justify-items: center;
  }

  .tool-button-icon {
    width: 32px;
    height: 32px;
    border-radius: 12px;
  }

  .tool-button-title {
    font-size: 14px;
    line-height: 1.35;
  }

  .provision-overview-grid {
    grid-template-columns: 1fr;
  }

  .selection-main strong {
    font-size: 18px;
  }

  .provision-submit-button,
  .redeem-submit-button {
    inline-size: 100%;
  }

  .action-row > .ghost-button,
  .history-header-actions .ghost-button,
  .result-drawer-actions .ghost-button {
    inline-size: 100%;
    justify-content: center;
  }

  .history-drawer,
  .history-drawer-shell {
    top: 0;
    right: 0;
    bottom: 0;
    width: min(calc(100vw - 18px), 420px);
    padding: 12px 0 12px 12px;
    border-radius: 24px 0 0 24px;
  }

  .history-table-shell {
    display: none;
  }

  .history-mobile-list {
    display: grid;
  }

  .history-pagination {
    display: none;
  }

  .history-header-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .history-header-actions .ghost-button {
    min-height: 40px;
    padding: 0 10px;
    font-size: 13px;
    line-height: 1.2;
    border-radius: 12px;
  }

  .history-record-topline {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
  }

  .history-record-card {
    gap: 12px;
    padding: 16px;
    border-radius: 16px;
  }

  .history-record-main {
    grid-template-columns: 1fr;
  }

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

  .history-record-actions > :only-child {
    grid-column: 1 / -1;
  }

  .result-drawer {
    top: 0;
    right: 0;
    bottom: 0;
    width: min(calc(100vw - 18px), 420px);
  }

  .copy-toast {
    top: 12px;
    right: 12px;
    width: auto;
    max-width: min(calc(100vw - 24px), 340px);
    grid-template-columns: 36px minmax(0, 1fr);
    padding: 13px 14px;
    border-radius: 16px;
  }

  .copy-toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }

  .result-panel-shell {
    padding: 18px;
    border-radius: 24px 0 0 24px;
  }

  .history-record-cell {
    padding: 12px;
  }
}
