/* ==========================================================================
   ACE Web Design System V2 — Dimensional Precision (Linear × Stripe × Apple)
   Strict CSP safe (zero inline styles), self-hosted fonts, EN / 中文
   ========================================================================== */

@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/inter-regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/inter-medium.ttf') format('truetype');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/inter-semibold.ttf') format('truetype');
  font-weight: 600 700;
  font-display: swap;
}
@font-face {
  font-family: 'Inter Tight';
  src: url('/assets/fonts/inter-tight-semibold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/assets/fonts/geist-mono.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/assets/fonts/geist-mono-medium.ttf') format('truetype');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Noto Sans SC';
  src: url('/assets/fonts/noto-sans-sc.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --font-sans: 'Inter', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', system-ui, -apple-system, sans-serif;
  --font-display: 'Inter Tight', 'Inter', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --bg-canvas: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-rail: #F4F7FB;
  --bg-subtle: #EDF2F7;
  --bg-inset: #F9FBFD;
  --bg-hover: #F1F5F9;
  --bg-code-dark: #10141D;

  --ink-primary: #0F172A;
  --ink-secondary: #475569;
  --ink-tertiary: #768499;
  --ink-muted: #909EB2;

  --border-default: #E2E8F0;
  --border-subtle: #EDF2F7;
  --border-strong: #CBD5E1;

  /* Airy Sky-Frost Blue Accent & Frosted Light-Blue Primary Buttons */
  --accent: #2563EB;
  --accent-top: #3B82F6;
  --accent-bottom: #1D58D8;
  --accent-bg: #EFF6FF;
  --accent-border: #BFDBFE;
  --accent-ink: #1746A8;

  --btn-primary-top: #2E8BFF;
  --btn-primary-bottom: #0F6EF5;
  --btn-primary-hover-top: #4096FF;
  --btn-primary-hover-bottom: #1B79FF;
  --btn-primary-ink: #FFFFFF;
  --btn-primary-border: #0C62DE;
  --btn-primary-border-hover: #176EEB;

  --ok-fg: #0F6A3B;
  --ok-bg: #ECFDF4;
  --ok-border: #B7ECCD;
  --ok-dot: #16A34A;

  --warn-fg: #92400E;
  --warn-bg: #FFF8E7;
  --warn-border: #FCDD9C;
  --warn-dot: #D97706;

  --danger-fg: #991B1B;
  --danger-bg: #FEF2F2;
  --danger-border: #FECACA;
  --danger-dot: #DC2626;

  /* Layered Optical Elevation */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-card:
    0 0 0 1px rgba(15, 23, 42, 0.06),
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 12px 28px -8px rgba(15, 23, 42, 0.08),
    0 28px 60px -20px rgba(15, 23, 42, 0.12);
  --shadow-card-hover:
    0 0 0 1px rgba(37, 99, 235, 0.2),
    0 2px 6px rgba(15, 23, 42, 0.05),
    0 20px 44px -14px rgba(37, 99, 235, 0.14);
  --shadow-btn-primary:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -1px 0 rgba(8, 66, 152, 0.22),
    0 1px 2px rgba(15, 110, 245, 0.24),
    0 6px 16px -4px rgba(15, 110, 245, 0.36);
  --shadow-btn-primary-hover:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset 0 -1px 0 rgba(8, 66, 152, 0.18),
    0 2px 5px rgba(15, 110, 245, 0.28),
    0 10px 24px -6px rgba(15, 110, 245, 0.46);
  --shadow-btn-secondary:
    inset 0 1px 0 #FFFFFF,
    0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-toast:
    0 0 0 1px rgba(15, 23, 42, 0.08),
    0 14px 34px -10px rgba(15, 23, 42, 0.22);

  --radius-sm: 7px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-snappy: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.28, 0.64, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { margin: 0; min-height: 100%; background: var(--bg-canvas); }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-primary);
  background: var(--bg-canvas);
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
:lang(zh-CN) body { line-height: 1.62; }

a { color: var(--ink-secondary); text-decoration: none; transition: color 160ms var(--ease-snappy); }
a:hover { color: var(--ink-primary); }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, select, textarea { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code, pre, .mono { font-family: var(--font-mono); }
.tabular { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

.icon { width: 15px; height: 15px; flex: 0 0 auto; display: inline-block; vertical-align: -2px; }

/* Architectural Canvas: Soft Grid + Subtle Indigo Atmospheric Glow */
.page-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.032) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 74% 62% at 50% 0%, #000 18%, transparent 78%);
  mask-image: radial-gradient(ellipse 74% 62% at 50% 0%, #000 18%, transparent 78%);
}
.page-glow {
  position: fixed;
  left: 50%;
  top: -320px;
  width: 1180px;
  height: 640px;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(closest-side, rgba(56, 130, 246, 0.095), rgba(56, 130, 246, 0));
}

/* ==========================================================================
   Shell: Topbar, Main, Footer (Home / Focus / Workspace)
   ========================================================================== */

.topbar {
  position: relative;
  z-index: 10;
  flex: 0 0 auto;
  height: 64px;
}
.topbar-inner {
  height: 100%;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 clamp(18px, 4vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand { display: inline-flex; align-items: center; border-radius: 6px; padding: 4px 2px; }
.brand img { display: block; height: 17px; width: auto; }

.topnav {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 28px);
  font-size: 13px;
  font-weight: 500;
}
.topnav a { position: relative; padding: 4px 0; }
.topnav a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.5px;
  border-radius: 99px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 200ms var(--ease-out);
}
.topnav a:hover::after { transform: scaleX(1); }

/* Animated Sliding Segmented Language Switch */
.language {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid var(--border-default);
  border-radius: 9px;
  background: rgba(238, 240, 245, 0.85);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
}
.language::before {
  content: '';
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  border-radius: 6.5px;
  background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(15, 23, 42, 0.04);
  transition: transform 260ms var(--ease-spring);
  pointer-events: none;
}
:lang(zh-CN) .language::before { transform: translateX(100%); }
.language button {
  position: relative;
  z-index: 1;
  min-width: 42px;
  height: 24px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-tertiary);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: color 180ms var(--ease-snappy);
}
.language button:hover { color: var(--ink-primary); }
.language button[aria-pressed='true'] { color: var(--ink-primary); }

/* Workspace Topbar */
.layout-workspace .topbar {
  height: 58px;
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}
.layout-workspace .topbar-inner { max-width: 1140px; padding: 0 24px; }
.layout-workspace .brand img { height: 15px; }
.topbar-sep { width: 1px; height: 18px; background: var(--border-default); flex: 0 0 auto; }
.workspace-org {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
}
.workspace-org-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }

/* Mineral-Tinted Squircles (replaces harsh flat black blobs!) */
.squircle {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.65);
}
.squircle-xs { width: 22px; height: 22px; border-radius: 6px; font-size: 10.5px; }
.squircle-sm { width: 26px; height: 26px; border-radius: 7px; font-size: 11.5px; }
.squircle-md { width: 32px; height: 32px; border-radius: 9px; font-size: 13px; }
.squircle-round { border-radius: 50%; }

/* Airy Glacier-Mineral Squircles (cool blue-slate / cyan / seafoam pastels) */
.tone-0 { background: linear-gradient(180deg, #EFF6FF 0%, #DBEAFE 100%); color: #1D4ED8; }
.tone-1 { background: linear-gradient(180deg, #ECFEFF 0%, #CFFAFE 100%); color: #0E7490; }
.tone-2 { background: linear-gradient(180deg, #F1F5F9 0%, #E2E8F0 100%); color: #334155; }
.tone-3 { background: linear-gradient(180deg, #ECFDF5 0%, #D1FAE5 100%); color: #047857; }
.tone-4 { background: linear-gradient(180deg, #F0F5FA 0%, #DFEAFA 100%); color: #1E3A8A; }

.avatar-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 2px 10px 2px 3px;
  border: 1px solid var(--border-default);
  border-radius: 999px;
  background: var(--bg-surface);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-secondary);
  box-shadow: var(--shadow-xs);
}

/* Main & Footer */
.page-main {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  width: 100%;
}
.layout-focus .page-main {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: clamp(16px, 3vh, 36px) 18px clamp(24px, 4vh, 48px);
}
.layout-workspace .page-main {
  max-width: 1140px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.site-footer { position: relative; z-index: 1; flex: 0 0 auto; }
.footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 16px clamp(18px, 4vw, 48px);
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--ink-tertiary);
  font-size: 12px;
}

/* ==========================================================================
   Motion System
   ========================================================================== */

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes surface-in {
  from { opacity: 0; transform: translateY(10px) scale(0.988); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes panel-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pop-in {
  0% { transform: scale(0); opacity: 0; }
  70% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes circle-pop {
  0% { transform: scale(0.84); opacity: 0; }
  65% { transform: scale(1.04); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes check-draw {
  from { stroke-dashoffset: 32; }
  to { stroke-dashoffset: 0; }
}
@keyframes redirect-progress {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.rise { opacity: 0; animation: rise 580ms var(--ease-out) forwards; }
.d1 { animation-delay: 50ms; }
.d2 { animation-delay: 130ms; }
.d3 { animation-delay: 210ms; }

/* ==========================================================================
   Home Page
   ========================================================================== */

.layout-home { height: 100dvh; overflow: hidden; }
.layout-home .topbar { height: 72px; }
.layout-home .page-main {
  flex: 1 1 auto;
  min-height: 0;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 clamp(18px, 4vw, 48px) 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.hero h1 {
  margin: 0;
  max-width: 980px;
  font-family: var(--font-display);
  font-size: clamp(36px, min(5.3vw, 8.2vh), 76px);
  line-height: 1.06;
  font-weight: 600;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
:lang(zh-CN) .hero h1 { letter-spacing: -0.012em; line-height: 1.18; }
.hero-muted { color: var(--ink-muted); }
.hero-copy {
  margin: clamp(16px, 2.8vh, 26px) 0 0;
  max-width: 560px;
  font-size: clamp(15px, 1.4vw, 17px);
  line-height: 1.65;
  color: var(--ink-secondary);
}

.prompt-card {
  margin-top: clamp(28px, 5.2vh, 48px);
  width: min(100%, 640px);
  padding: 0;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  color: var(--ink-primary);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: box-shadow 260ms var(--ease-out), transform 260ms var(--ease-out);
}
.prompt-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }
.prompt-card:active { transform: translateY(0) scale(0.994); }
.prompt-card[data-copied='true'] {
  box-shadow: 0 0 0 1.5px var(--ok-dot), 0 20px 44px -18px rgba(22, 163, 74, 0.28);
}
.prompt-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px 11px 18px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-rail);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 500;
}
.copy-pill {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--btn-primary-border);
  border-radius: 7px;
  background: linear-gradient(180deg, var(--btn-primary-top) 0%, var(--btn-primary-bottom) 100%);
  color: var(--btn-primary-ink);
  font-size: 12px;
  font-weight: 500;
  flex: 0 0 auto;
  box-shadow: var(--shadow-btn-primary);
  transition: transform 160ms var(--ease-snappy), box-shadow 200ms var(--ease-out), background 200ms, border-color 180ms;
}
.prompt-card:hover .copy-pill {
  border-color: var(--btn-primary-border-hover);
  background: linear-gradient(180deg, var(--btn-primary-hover-top) 0%, var(--btn-primary-hover-bottom) 100%);
  box-shadow: var(--shadow-btn-primary-hover);
}
.prompt-card[data-copied='true'] .copy-pill {
  border-color: var(--ok-border);
  background: linear-gradient(180deg, #ECFDF4 0%, #D3F6E3 100%);
  color: var(--ok-fg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 4px 12px -4px rgba(22, 163, 74, 0.25);
}
.copy-pill .icon { width: 13px; height: 13px; }
.copy-pill .icon-check, .terminal-copy .icon-check { display: none; }
[data-copied='true'] .icon-copy { display: none; }
[data-copied='true'] .icon-check { display: inline-block; animation: pop-in 240ms var(--ease-spring) both; }

.prompt-text {
  display: block;
  width: 100%;
  padding: 18px 18px 20px;
  color: #1E293B;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

/* ==========================================================================
   Dimensional Tactile Buttons (Zero Flat Black Blocks!)
   ========================================================================== */

.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border-default);
  border-radius: 9px;
  background: linear-gradient(180deg, #FFFFFF 0%, #F7F8FB 100%);
  color: var(--ink-primary);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-btn-secondary);
  transition:
    transform 130ms var(--ease-snappy),
    box-shadow 200ms var(--ease-out),
    border-color 160ms var(--ease-snappy),
    background 180ms var(--ease-snappy),
    color 160ms var(--ease-snappy);
}
.btn:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: linear-gradient(180deg, #FFFFFF 0%, #F1F3F8 100%);
  box-shadow: inset 0 1px 0 #FFFFFF, 0 2px 6px rgba(15, 23, 42, 0.08);
  color: var(--ink-primary);
}
.btn:active:not(:disabled) {
  transform: translateY(0.5px) scale(0.984);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn .icon-arrow { transition: transform 180ms var(--ease-out); }
.btn:hover:not(:disabled) .icon-arrow { transform: translateX(2.5px); }

/* Cloudflare-Inspired Crisp Primary Button (#0051C3) */
.btn-primary {
  border: 1px solid var(--btn-primary-border);
  background: linear-gradient(180deg, var(--btn-primary-top) 0%, var(--btn-primary-bottom) 100%);
  color: var(--btn-primary-ink);
  font-weight: 500;
  text-shadow: 0 1px 1px rgba(0, 32, 86, 0.24);
  box-shadow: var(--shadow-btn-primary);
}
.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(108deg, transparent 20%, rgba(255, 255, 255, 0.16) 50%, transparent 80%);
  transform: translateX(-110%);
  transition: transform 520ms var(--ease-out);
  pointer-events: none;
}
.btn-primary:hover:not(:disabled) {
  border-color: var(--btn-primary-border-hover);
  background: linear-gradient(180deg, var(--btn-primary-hover-top) 0%, var(--btn-primary-hover-bottom) 100%);
  color: #FFFFFF;
  transform: translateY(-1px);
  box-shadow: var(--shadow-btn-primary-hover);
}
.btn-primary:hover:not(:disabled)::after { transform: translateX(110%); }
.btn-primary:active:not(:disabled) {
  transform: translateY(0.5px) scale(0.985);
  background: linear-gradient(180deg, #0D64E0 0%, #0957C9 100%);
  box-shadow: inset 0 1.5px 3px rgba(8, 56, 130, 0.28), 0 1px 4px rgba(15, 110, 245, 0.22);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ink-secondary);
  box-shadow: none;
}
.btn-ghost:hover:not(:disabled) {
  border-color: transparent;
  background: rgba(15, 23, 42, 0.05);
  box-shadow: none;
  color: var(--ink-primary);
}

.btn-danger {
  border-color: var(--border-default);
  background: linear-gradient(180deg, #FFFFFF 0%, #FAFAFC 100%);
  color: var(--ink-secondary);
}
.btn-danger:hover:not(:disabled) {
  border-color: var(--danger-border);
  background: linear-gradient(180deg, #FFF5F5 0%, #FEECEC 100%);
  color: var(--danger-fg);
  box-shadow: 0 2px 8px -2px rgba(220, 38, 38, 0.18);
}
.btn-danger[data-armed='true'] {
  border-color: #C81E1E;
  background: linear-gradient(180deg, #E53E3E 0%, #C52222 100%);
  color: #FFFFFF;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 6px 14px -4px rgba(220, 38, 38, 0.45);
}

.btn-sm { height: 31px; padding: 0 11px; font-size: 12px; border-radius: 7.5px; }
.btn-xs { height: 25px; padding: 0 8px; font-size: 11.5px; border-radius: 6px; gap: 5px; }
.btn-lg { height: 42px; padding: 0 18px; font-size: 13.5px; border-radius: 10px; }
.btn-block { width: 100%; }

.btn[data-loading='true'] { pointer-events: none; opacity: 0.88; }
.btn[data-loading='true']::before {
  content: '';
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 620ms linear infinite;
}

.link-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 150ms, color 150ms;
}
.link-action:hover { background: var(--accent-bg); color: var(--accent-bottom); }
.link-action .icon { width: 13px; height: 13px; }

/* ==========================================================================
   Cards & Split-Pane Precision Architecture (Above-the-Fold, Zero Scrolling!)
   ========================================================================== */

.card {
  width: 100%;
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.layout-focus .card { animation: surface-in 360ms var(--ease-out) both; }
.card-narrow { max-width: 440px; }
.card-medium { max-width: 520px; }
.card-wide { max-width: 720px; margin: 0 auto; }

/* Desktop Two-Column Architectural Split Card */
.split-card {
  width: 100%;
  max-width: 724px;
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  animation: surface-in 360ms var(--ease-out) both;
}
.split-card-wide { max-width: 760px; grid-template-columns: 332px minmax(0, 1fr); }

.split-rail {
  padding: 24px;
  background: linear-gradient(180deg, #F6F9FD 0%, #F1F5FA 100%);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
.split-stage {
  padding: 24px 26px;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.split-spacer { flex: 1 1 auto; }

.card-section { padding: 22px 24px; border-bottom: 1px solid var(--border-subtle); }
.card-section:last-child { border-bottom: 0; }
.card-section .pill + .card-title { margin-top: 10px; }

.card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.02em;
}
:lang(zh-CN) .card-title { letter-spacing: -0.008em; }
.card-lead {
  margin: 5px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-secondary);
}
.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.stage-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-primary);
}
.rail-eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-tertiary);
}

/* Compact Recessed Device Code Capsule (replaces huge 115px dashed box) */
.code-chip {
  padding: 11px 13px;
  border: 1px solid var(--border-default);
  border-radius: 11px;
  background: #FFFFFF;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 0 rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.code-chip-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-tertiary);
}
.code-chip-value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.07em;
  line-height: 1.25;
  color: var(--ink-primary);
}
.timer-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
}
.timer-pill .icon { width: 12px; height: 12px; color: var(--accent); }

/* Rail Client Header & Identity Anchor */
.client-head {
  display: flex;
  align-items: center;
  gap: 11px;
}
.client-icon-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(180deg, #FFFFFF 0%, #EEF1F8 100%);
  border: 1px solid var(--border-default);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
  color: var(--accent-ink);
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}
.client-head-text { min-width: 0; }
.client-sub {
  margin: 2px 0 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail-identity {
  padding-top: 14px;
  border-top: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  gap: 9px;
}
.rail-identity-meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.rail-identity-name { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-identity-sub { font-size: 11px; color: var(--ink-tertiary); }

/* Flush Selectable Radio List (Zero Nested Card-in-Card!) */
.choice-list {
  border: 1px solid var(--border-default);
  border-radius: 12px;
  background: var(--bg-surface);
  overflow: hidden;
}
.choice-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 150ms var(--ease-snappy);
}
.choice-row:last-child { border-bottom: 0; }
.choice-row:hover { background: #F7F8FC; }
.choice-row input[type='radio'] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.choice-row:has(input:checked) {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.06) 0%, rgba(37, 99, 235, 0.012) 100%);
}
.choice-row:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.radio-ring {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: #FFFFFF;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  transition: border-color 180ms var(--ease-snappy), box-shadow 180ms var(--ease-snappy);
}
.radio-ring::after {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #FFFFFF;
  transform: scale(0);
  transition: transform 220ms var(--ease-spring);
}
.choice-row:has(input:checked) .radio-ring {
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--accent-top) 0%, var(--accent-bottom) 100%);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.choice-row:has(input:checked) .radio-ring::after { transform: scale(1); }

.choice-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.choice-name { font-size: 13px; font-weight: 500; color: var(--ink-primary); overflow-wrap: anywhere; }
.choice-sub { font-size: 11.5px; color: var(--ink-tertiary); line-height: 1.4; }

/* Unavailable org disclosure (quietly folded!) */
.muted-disclosure {
  border-radius: 9px;
  background: var(--bg-rail);
  border: 1px solid var(--border-subtle);
  padding: 8px 12px;
}
.muted-disclosure summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-tertiary);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.muted-disclosure summary::-webkit-details-marker { display: none; }
.muted-disclosure summary:hover { color: var(--ink-secondary); }
.muted-disclosure summary .icon { width: 14px; height: 14px; transition: transform 180ms var(--ease-snappy); }
.muted-disclosure[open] summary .icon { transform: rotate(180deg); }
.unavailable-list {
  list-style: none;
  margin: 8px 0 2px;
  padding: 8px 0 0;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: panel-in 180ms var(--ease-out) both;
}
.unavailable-item { font-size: 12px; line-height: 1.45; color: var(--ink-secondary); }
.unavailable-item strong { color: var(--ink-primary); font-weight: 500; }
.unavailable-item p { margin: 2px 0 0; font-size: 11.5px; color: var(--ink-tertiary); }

.stage-footer {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stage-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
  color: var(--ink-tertiary);
}
.stage-subbar form { margin: 0; }
.deny-link {
  padding: 2px 6px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-tertiary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: color 150ms, background 150ms;
}
.deny-link:hover { color: var(--danger-fg); background: var(--danger-bg); }

.empty-stage {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding: 18px 8px;
}
.empty-stage p { margin: 0; max-width: 300px; font-size: 13px; color: var(--ink-secondary); line-height: 1.55; }

/* Permissions list (compact in left rail) */
.perm-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12px;
  color: var(--ink-secondary);
}
.perm-list li { display: flex; align-items: flex-start; gap: 8px; line-height: 1.4; }
.perm-list li .icon { width: 14px; height: 14px; margin-top: 2px; color: var(--accent); }
.perm-list li.perm-boundary .icon { color: var(--ink-tertiary); }

/* ==========================================================================
   Pills, Tags, Callouts, KV-List, Forms, Code, Segmented Tabs
   ========================================================================== */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 23px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}
.pill-dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; }
.pill-neutral { background: var(--bg-subtle); color: var(--ink-secondary); }
.pill-neutral .pill-dot { background: #94A3B8; }
.pill-ok { background: var(--ok-bg); color: var(--ok-fg); box-shadow: inset 0 0 0 1px var(--ok-border); }
.pill-ok .pill-dot { background: var(--ok-dot); }
.pill-warn { background: var(--warn-bg); color: var(--warn-fg); box-shadow: inset 0 0 0 1px var(--warn-border); }
.pill-warn .pill-dot { background: var(--warn-dot); }
.pill-danger { background: var(--danger-bg); color: var(--danger-fg); box-shadow: inset 0 0 0 1px var(--danger-border); }
.pill-danger .pill-dot { background: var(--danger-dot); }
.pill-accent { background: var(--accent-bg); color: var(--accent-ink); box-shadow: inset 0 0 0 1px var(--accent-border); }
.pill-accent .pill-dot { background: var(--accent); }

.tag {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 7px;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  background: var(--bg-inset);
  color: var(--ink-secondary);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.callout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-inset);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-secondary);
}
.callout .icon { margin-top: 2px; }
.callout-content { flex: 1 1 auto; min-width: 0; }
.callout-content strong { display: block; color: inherit; font-weight: 600; margin-bottom: 2px; }
.callout-content p { margin: 0; }
.callout-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-fg); }
.callout-danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-fg); }
.callout-ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-fg); }

.kv-list {
  margin: 0;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  row-gap: 7px;
  column-gap: 10px;
  font-size: 12.5px;
}
.kv-list dt { color: var(--ink-tertiary); }
.kv-list dd { margin: 0; color: var(--ink-primary); min-width: 0; overflow-wrap: anywhere; }

/* Animated Segmented Tab Control (Approve Page Passkey / SSH) */
.segmented-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid var(--border-default);
  border-radius: 10px;
  background: var(--bg-rail);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}
.segmented-tabs::before {
  content: '';
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  border-radius: 7.5px;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.09), 0 0 0 1px rgba(15, 23, 42, 0.04);
  transition: transform 260ms var(--ease-spring);
  pointer-events: none;
}
.segmented-tabs[data-active-index='1']::before { transform: translateX(100%); }
.segmented-tab {
  position: relative;
  z-index: 1;
  height: 32px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-tertiary);
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: color 160ms var(--ease-snappy);
}
.segmented-tab:hover { color: var(--ink-primary); }
.segmented-tab[aria-selected='true'] { color: var(--ink-primary); }
.tab-panel { display: flex; flex-direction: column; gap: 14px; flex: 1 1 auto; animation: panel-in 200ms var(--ease-out) both; }

.passkey-stage {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 16px 8px;
}
.passkey-medallion {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(180deg, #EFF6FF 0%, #DBEAFE 100%);
  color: var(--accent-ink);
  box-shadow: inset 0 1px 0 #FFFFFF, 0 0 0 1px rgba(37, 99, 235, 0.16), 0 8px 20px -8px rgba(37, 99, 235, 0.28);
  display: inline-grid;
  place-items: center;
}
.passkey-medallion .icon { width: 24px; height: 24px; }
.passkey-stage p { margin: 0; max-width: 260px; font-size: 12.5px; color: var(--ink-secondary); line-height: 1.5; }

.approval-meta-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.approval-action-code { margin: 3px 0 0; font-family: var(--font-mono); font-size: 11px; color: var(--ink-tertiary); }
.approval-progress { display: inline-flex; align-items: center; gap: 6px; }
.progress-dots { display: inline-flex; gap: 4px; }
.progress-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.progress-dot-done { background: var(--ok-dot); box-shadow: 0 0 0 2px var(--ok-bg); }

.payload-summary {
  border: 1px solid var(--border-default);
  border-radius: 9px;
  overflow: hidden;
  background: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.65;
}
.payload-line { padding: 3.5px 10px; overflow-wrap: anywhere; }
.payload-line + .payload-line { border-top: 1px solid var(--border-subtle); }
.payload-line-add { background: #ECFDF4; color: #125E35; }
.payload-line-neutral { background: #FFFFFF; color: var(--ink-secondary); }

.disclosure summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-tertiary);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary:hover { color: var(--ink-primary); }
.disclosure summary .icon { width: 13px; height: 13px; transition: transform 180ms var(--ease-snappy); }
.disclosure[open] summary .icon { transform: rotate(180deg); }
.code-pre {
  margin: 8px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--border-default);
  border-radius: 9px;
  background: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.55;
  color: var(--ink-primary);
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 160px;
}
.digest-line {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-tertiary);
}
.digest-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.reject-box { padding-top: 10px; border-top: 1px solid var(--border-subtle); }
.reject-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-tertiary);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.reject-toggle::-webkit-details-marker { display: none; }
.reject-toggle:hover { color: var(--danger-fg); }
.reject-toggle .icon { width: 13px; height: 13px; transition: transform 180ms; }
.reject-box[open] .reject-toggle .icon { transform: rotate(180deg); }
.reject-form { margin-top: 10px; display: flex; flex-direction: column; gap: 9px; animation: panel-in 180ms var(--ease-out) both; }

/* Form fields */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 500; color: var(--ink-secondary); }
.input, .select, .textarea {
  width: 100%;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--border-default);
  border-radius: 8.5px;
  background: var(--bg-surface);
  color: var(--ink-primary);
  font-size: 13px;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: border-color 150ms, box-shadow 150ms;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}
.textarea { min-height: 108px; resize: vertical; font-family: var(--font-mono); font-size: 12px; line-height: 1.55; background: var(--bg-inset); }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.field-full { grid-column: 1 / -1; }
.form-stack { display: flex; flex-direction: column; gap: 13px; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.form-hint { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-tertiary); }
.form-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Terminal Code Box */
.terminal-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 11px;
  background: linear-gradient(180deg, #161922 0%, #101218 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 12px rgba(15, 23, 42, 0.12);
  color: #E5E7EB;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
}
.terminal-code { flex: 1 1 auto; min-width: 0; margin: 0; white-space: pre-wrap; word-break: break-all; }
.terminal-copy {
  flex: 0 0 auto;
  height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6.5px;
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: background 150ms, border-color 150ms;
}
.terminal-copy:hover { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.28); }
.terminal-copy .icon { width: 12px; height: 12px; }

.step-heading { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 500; color: var(--ink-primary); margin: 0 0 8px; }
.step-num { font-family: var(--font-mono); font-size: 11px; color: var(--accent); font-weight: 600; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--ink-secondary); margin-bottom: 10px; }
.back-link:hover { color: var(--ink-primary); }

/* Reference ID Footer */
.reference-id {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-rail);
  color: var(--ink-tertiary);
  font-size: 11.5px;
}
.reference-id code { font-size: 11px; color: var(--ink-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reference-id .btn { margin-left: auto; }

/* Status / Terminal / Interstitial Card (Dimensional Medallion, Zero Flat Black!) */
.status-card { max-width: 440px; }
.status-body {
  padding: 36px 28px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 11px;
}
.status-body h1 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.status-copy { margin: 0; max-width: 340px; font-size: 13.5px; line-height: 1.6; color: var(--ink-secondary); }
.status-icon { width: 48px; height: 48px; animation: circle-pop 380ms var(--ease-out) both; }
.status-icon-ok .status-ring { fill: #16A34A; }
.status-icon-ok { color: #FFFFFF; filter: drop-shadow(0 8px 18px rgba(22, 163, 74, 0.34)); }
.status-icon-ok .status-check { stroke-dasharray: 32; stroke-dashoffset: 32; animation: check-draw 380ms var(--ease-out) 160ms forwards; }
.status-neutral .status-icon .status-ring { fill: #EEF0F5; }
.status-neutral .status-icon { color: var(--ink-secondary); }
.status-badge {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  display: inline-grid;
  place-items: center;
  animation: circle-pop 340ms var(--ease-out) both;
}
.status-badge .icon { width: 22px; height: 22px; }
.status-badge-warning { background: linear-gradient(180deg, #FFF7E0 0%, #FDEBC0 100%); color: #C26B08; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 6px 16px -6px rgba(217, 119, 6, 0.3); }
.status-badge-danger { background: linear-gradient(180deg, #FEEBEB 0%, #FDD9D9 100%); color: var(--danger-dot); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 6px 16px -6px rgba(220, 38, 38, 0.3); }
.status-badge-danger .status-icon { width: 26px; height: 26px; }
.status-badge-danger .status-ring { fill: transparent; }

.redirect-track { width: 164px; height: 3px; margin-top: 6px; border-radius: 999px; background: var(--border-subtle); overflow: hidden; }
.redirect-bar { display: block; width: 100%; height: 100%; background: linear-gradient(90deg, var(--accent-top), var(--accent-bottom)); transform-origin: left center; animation: redirect-progress 1.95s linear forwards; }
.status-actions { margin-top: 8px; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* ==========================================================================
   Settings Workspace (/settings & /settings/approval-methods)
   ========================================================================== */

.workspace-grid {
  display: grid;
  grid-template-columns: 206px minmax(0, 1fr);
  align-items: start;
  gap: 36px;
}
.workspace-nav {
  position: sticky;
  top: 82px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.workspace-nav-title {
  margin: 0 0 8px 11px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-tertiary);
}
.workspace-nav-item {
  height: 35px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
  cursor: pointer;
  transition: background 150ms var(--ease-snappy), color 150ms, border-color 150ms, box-shadow 150ms;
}
.workspace-nav-item .icon { color: var(--ink-tertiary); transition: color 150ms; }
.workspace-nav-item:hover { background: rgba(15, 23, 42, 0.04); color: var(--ink-primary); }
.workspace-nav-item:hover .icon { color: var(--ink-primary); }
.workspace-nav-item[aria-current='page'] {
  background: #FFFFFF;
  border-color: var(--border-default);
  color: var(--ink-primary);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.workspace-nav-item[aria-current='page'] .icon { color: var(--accent); }

.workspace-content { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.settings-panel { display: flex; flex-direction: column; gap: 16px; animation: panel-in 210ms var(--ease-out) both; }
.panel-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.02em;
}
:lang(zh-CN) .panel-head h1 { letter-spacing: -0.008em; }
.panel-head p { margin: 5px 0 0; font-size: 13px; color: var(--ink-secondary); }

/* Clean Surfaces (No Card-inside-Card Double Shadows!) */
.list-card {
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.subcard {
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.subcard .list-card {
  box-shadow: none;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
}
.subcard-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.subcard-head h2 { margin: 0; font-size: 14px; font-weight: 600; }
.subcard-desc { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-secondary); }

.list-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 140ms var(--ease-snappy);
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--bg-inset); }
.list-row-revoked { opacity: 0.58; }
.list-row .select { width: auto; min-width: 190px; max-width: 240px; flex: 0 0 auto; }

.row-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 8.5px;
  background: linear-gradient(180deg, #F5F6FA 0%, #ECEEF5 100%);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
  color: var(--ink-secondary);
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}
.row-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-size: 13px; font-weight: 500; color: var(--ink-primary); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.row-sub { font-size: 12px; color: var(--ink-tertiary); overflow-wrap: anywhere; }
.row-meta { font-size: 12px; color: var(--ink-tertiary); white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.row-empty { padding: 28px 18px; text-align: center; color: var(--ink-tertiary); font-size: 13px; }

/* Toggle Switch (Indigo active) */
.switch {
  width: 42px;
  height: 24px;
  padding: 2px;
  border: 0;
  border-radius: 999px;
  background: #CBD1DF;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.14);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  transition: background 200ms var(--ease-snappy);
}
.switch[aria-checked='true'] { background: linear-gradient(180deg, var(--accent-top), var(--accent-bottom)); }
.switch-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.24);
  transition: transform 240ms var(--ease-spring);
}
.switch[aria-checked='true'] .switch-thumb { transform: translateX(18px); }

/* Quota Usage Meters */
.quota-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.quota-item {
  padding: 13px 15px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-inset);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.quota-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12px; }
.quota-name { color: var(--ink-secondary); font-weight: 500; }
.quota-nums { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-primary); font-variant-numeric: tabular-nums; }
.quota-meter { appearance: none; -webkit-appearance: none; width: 100%; height: 5px; border: 0; border-radius: 999px; overflow: hidden; background: #E3E6EE; }
.quota-meter::-webkit-progress-bar { background: #E3E6EE; border-radius: 999px; }
.quota-meter::-webkit-progress-value { background: linear-gradient(90deg, var(--accent-top), var(--accent-bottom)); border-radius: 999px; }
.quota-meter::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.quota-meter.meter-warn::-webkit-progress-value { background: var(--warn-dot); }
.quota-meter.meter-warn::-moz-progress-bar { background: var(--warn-dot); }
.quota-meter.meter-danger::-webkit-progress-value { background: var(--danger-dot); }
.quota-meter.meter-danger::-moz-progress-bar { background: var(--danger-dot); }

.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); flex: 0 0 auto; }
.timeline-dot-recent { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }

.approval-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 13px 16px;
  border: 1px solid var(--accent-border);
  border-radius: 11px;
  background: linear-gradient(180deg, #F0F7FF 0%, #E3F0FF 100%);
  color: var(--accent-ink);
  animation: panel-in 200ms var(--ease-out) both;
}
.approval-banner-text { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 500; }
.approval-banner-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.org-picker-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.org-picker-btn { width: 100%; height: 46px; padding: 0 14px; justify-content: space-between; }
.org-picker-left { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; }

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 11px;
  background: var(--bg-surface);
  color: var(--ink-primary);
  font-size: 13px;
  line-height: 1.45;
  box-shadow: var(--shadow-toast);
  animation: toast-in 240ms var(--ease-out) both;
}
.toast-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: 0 0 auto; background: var(--accent); }
.toast-ok .toast-dot { background: var(--ok-dot); }
.toast-warn .toast-dot { background: var(--warn-dot); }
.toast-danger .toast-dot { background: var(--danger-dot); }
.toast-body { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 820px) {
  .workspace-grid { grid-template-columns: 1fr; gap: 18px; }
  .workspace-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    padding: 4px;
    border: 1px solid var(--border-default);
    border-radius: 11px;
    background: var(--bg-rail);
    scrollbar-width: none;
  }
  .workspace-nav::-webkit-scrollbar { display: none; }
  .workspace-nav-title { display: none; }
  .workspace-nav-item { flex: 0 0 auto; height: 32px; padding: 0 11px; }
}

@media (max-width: 720px) {
  .layout-focus .page-main { align-items: flex-start; padding-top: 16px; }
  .split-card, .split-card-wide {
    max-width: 460px;
    grid-template-columns: 1fr;
  }
  .split-rail {
    border-right: 0;
    border-bottom: 1px solid var(--border-subtle);
    padding: 20px;
    gap: 14px;
  }
  .split-stage { padding: 20px; }
}

@media (max-width: 640px) {
  .topbar { height: 58px; }
  .layout-home .topbar { height: 60px; }
  .topnav { gap: 12px; font-size: 12px; }
  .avatar-login { display: none; }
  .avatar-chip { padding: 2px; border: 0; background: transparent; box-shadow: none; }

  .hero h1 { font-size: clamp(32px, 9.6vw, 48px); }
  .hero-copy { font-size: 15px; }
  .prompt-card { margin-top: 26px; }
  .prompt-text { font-size: 12.5px; padding: 14px 14px 16px; }

  .card-section { padding: 18px; }
  .reference-id { padding: 11px 18px; }
  .field-grid, .quota-grid { grid-template-columns: 1fr; }
  .list-row { flex-wrap: wrap; gap: 10px; padding: 12px 14px; }
  .list-row .select { width: 100%; max-width: none; }
  .row-meta { order: 3; }
  .toast-stack { left: 16px; right: 16px; bottom: 16px; max-width: none; }
}

@media (max-height: 680px) {
  .layout-home { height: auto; min-height: 100dvh; overflow: auto; }
  .layout-home .page-main { padding-top: 28px; padding-bottom: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .rise { opacity: 1 !important; }
}
