/* AHAN Canonical Design System Tokens (Daylight Blueprint <-> Obsidian Dark)
   Shared across all public surfaces (/, /app/hub, /library, /board, /exchange, /beta,
   /contact, /login, /signup) and owner consoles (/app/me, /app/team). */

:root {
  color-scheme: light;

  /* Base Palette (preserved for full backward compatibility across all surfaces) */
  --ahan-bg: #F4F6FA;
  --ahan-surface: #FFFFFF;
  --ahan-surface-soft: #F8FAFD;
  --ahan-ink: #0D1526;
  --ahan-ink-2: #3A465C;
  --ahan-ink-muted: #52617A;
  --ahan-border: #E2E8F0;
  --ahan-border-strong: #CBD5E1;

  /* Brand & Semantic Accents (preserved) */
  --ahan-primary: #2F6BFF;
  --ahan-primary-hover: #1E56E6;
  --ahan-primary-soft: #EEF4FF;
  --ahan-primary-line: #C7DAFF;

  --ahan-emerald: #0F7A52;
  --ahan-emerald-soft: #ECFDF5;
  --ahan-emerald-line: #B7E4D0;

  --ahan-gold: #D97706;
  --ahan-gold-dark: #A15C00;
  --ahan-gold-soft: #FFFBEB;
  --ahan-gold-line: #F5D49B;

  --ahan-danger: #DC2626;
  --ahan-danger-soft: #FEF2F2;
  --ahan-danger-line: #FECACA;

  /* Geometry & Elevation */
  --ahan-radius-sm: 10px;
  --ahan-radius-md: 14px;
  --ahan-radius-lg: 18px;
  --ahan-radius-pill: 999px;
  --ahan-shadow-sm: 0 1px 2px rgba(13, 21, 38, 0.04), 0 6px 20px rgba(13, 21, 38, 0.04);
  --ahan-shadow-md: 0 10px 30px rgba(13, 21, 38, 0.07);

  /* Header & Blueprint Canvas */
  --ahan-header-h: 54px;
  --ahan-header-bg: rgba(244, 246, 250, 0.88);
  --ahan-grid-line: rgba(13, 21, 38, 0.035);
  --ahan-grid-size: 28px;

  /* Typography */
  --ahan-font-display: "Bricolage", "Geist", "PingFang SC", "Microsoft YaHei UI", Georgia, serif;
  --ahan-font-sans: "Geist", "Inter", "PingFang SC", "Microsoft YaHei UI", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --ahan-font-mono: "GeistMono", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Semantic Design Tokens — Daylight Blueprint (Light Default) */
  --ahan-canvas: #F4F7FC;
  --ahan-surface-elevated: #FFFFFF;
  --ahan-surface-subtle: #EDF2FA;
  --ahan-text-primary: #0D1526;
  --ahan-text-secondary: #3A465C;
  --ahan-text-muted: #52617A;
  --ahan-accent: #1D4ED8;
  --ahan-accent-hover: #1E40AF;
  --ahan-accent-soft: #EFF6FF;
  --ahan-accent-line: #BFDBFE;
  --ahan-accent-ink: #FFFFFF;
  --ahan-ok: #0F7A52;
  --ahan-ok-soft: #ECFDF5;
  --ahan-ok-line: #B7E4D0;
  --ahan-warn: #B45309;
  --ahan-warn-soft: #FFFBEB;
  --ahan-warn-line: #F5D49B;
  --ahan-err: #DC2626;
  --ahan-err-soft: #FEF2F2;
  --ahan-err-line: #FECACA;

  /* Unified App Shell Header Tokens (Light) */
  --ahan-shell-h: 54px;
  --ahan-shell-bg: rgba(255, 255, 255, 0.92);
  --ahan-shell-border: #DCE4F0;
  --ahan-shell-ink: #0D1526;
  --ahan-shell-muted: #475569;
  --ahan-shell-hover-bg: rgba(29, 78, 216, 0.07);
  --ahan-shell-active-bg: #EFF6FF;
  --ahan-shell-active-ink: #1D4ED8;
  --ahan-shell-active-line: #BFDBFE;
  --ahan-shell-shadow: 0 1px 2px rgba(13, 21, 38, 0.04);
}

:root[data-theme="dark"],
[data-theme="dark"] {
  color-scheme: dark;

  /* Base Palette — Obsidian Dark */
  --ahan-bg: #070B14;
  --ahan-surface: #0F172A;
  --ahan-surface-soft: #162033;
  --ahan-ink: #F1F5F9;
  --ahan-ink-2: #CBD5E1;
  --ahan-ink-muted: #94A3B8;
  --ahan-border: #1E293B;
  --ahan-border-strong: #334155;

  --ahan-primary: #60A5FA;
  --ahan-primary-hover: #93C5FD;
  --ahan-primary-soft: rgba(59, 130, 246, 0.16);
  --ahan-primary-line: rgba(96, 165, 250, 0.36);

  --ahan-emerald: #34D399;
  --ahan-emerald-soft: rgba(16, 185, 129, 0.15);
  --ahan-emerald-line: rgba(52, 211, 153, 0.36);

  --ahan-gold: #FBBF24;
  --ahan-gold-dark: #FCD34D;
  --ahan-gold-soft: rgba(245, 158, 11, 0.16);
  --ahan-gold-line: rgba(251, 191, 36, 0.36);

  --ahan-danger: #F87171;
  --ahan-danger-soft: rgba(239, 68, 68, 0.16);
  --ahan-danger-line: rgba(248, 113, 113, 0.36);

  --ahan-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.36), 0 8px 24px rgba(0, 0, 0, 0.32);
  --ahan-shadow-md: 0 14px 36px rgba(0, 0, 0, 0.48);
  --ahan-header-bg: rgba(7, 11, 20, 0.88);
  --ahan-grid-line: rgba(148, 163, 184, 0.08);

  /* Semantic Design Tokens — Obsidian Dark */
  --ahan-canvas: #070B14;
  --ahan-surface-elevated: #0F172A;
  --ahan-surface-subtle: #162033;
  --ahan-text-primary: #F1F5F9;
  --ahan-text-secondary: #CBD5E1;
  --ahan-text-muted: #94A3B8;
  --ahan-accent: #60A5FA;
  --ahan-accent-hover: #93C5FD;
  --ahan-accent-soft: rgba(96, 165, 250, 0.16);
  --ahan-accent-line: rgba(96, 165, 250, 0.38);
  --ahan-accent-ink: #070B14;
  --ahan-ok: #34D399;
  --ahan-ok-soft: rgba(16, 185, 129, 0.16);
  --ahan-ok-line: rgba(52, 211, 153, 0.38);
  --ahan-warn: #FCD34D;
  --ahan-warn-soft: rgba(245, 158, 11, 0.16);
  --ahan-warn-line: rgba(251, 191, 36, 0.38);
  --ahan-err: #F87171;
  --ahan-err-soft: rgba(239, 68, 68, 0.16);
  --ahan-err-line: rgba(248, 113, 113, 0.38);

  /* Unified App Shell Header Tokens (Dark) */
  --ahan-shell-bg: rgba(15, 23, 42, 0.90);
  --ahan-shell-border: #1E293B;
  --ahan-shell-ink: #F1F5F9;
  --ahan-shell-muted: #94A3B8;
  --ahan-shell-hover-bg: rgba(96, 165, 250, 0.12);
  --ahan-shell-active-bg: rgba(96, 165, 250, 0.18);
  --ahan-shell-active-ink: #93C5FD;
  --ahan-shell-active-line: rgba(96, 165, 250, 0.38);
  --ahan-shell-shadow: 0 2px 10px rgba(0, 0, 0, 0.42);
}

/* ---------------- Unified App Shell Bar (54px sticky top, z-index 900) ---------------- */
#ahan-shell-mount {
  position: sticky;
  top: 0;
  z-index: 900;
  width: 100%;
  max-width: 100%;
  flex: none;
}

.ahan-shell-bar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 900;
  height: var(--ahan-shell-h, 54px);
  min-height: var(--ahan-shell-h, 54px);
  width: 100%;
  max-width: 100%;
  flex: none;
  box-sizing: border-box;
  overflow: hidden;
  background: var(--ahan-shell-bg);
  border-bottom: 1px solid var(--ahan-shell-border);
  box-shadow: var(--ahan-shell-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--ahan-shell-ink);
  font: 500 13px/1.25 var(--ahan-font-sans);
  -webkit-font-smoothing: antialiased;
}

body.has-ahan-shell[data-ahan-shell-page="home"] > .ahan-shell-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
}

.ahan-shell-bar *,
.ahan-shell-bar *::before,
.ahan-shell-bar *::after {
  box-sizing: border-box;
}

.ahan-shell-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  max-width: 1440px;
  height: 100%;
  margin: 0 auto;
  padding: 0 16px;
}

.ahan-shell-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 4px 6px 4px 2px;
  border-radius: 9px;
  color: var(--ahan-shell-ink);
  text-decoration: none;
  font: 700 13.5px/1 var(--ahan-font-display);
  letter-spacing: -0.02em;
  white-space: nowrap;
  transition: opacity 0.14s ease, background-color 0.14s ease;
}

.ahan-shell-brand:hover {
  text-decoration: none;
  background: var(--ahan-shell-hover-bg);
}

.ahan-shell-brand:focus-visible,
.ahan-shell-tab:focus-visible,
.ahan-shell-credits:focus-visible,
.ahan-shell-cta:focus-visible,
.ahan-shell-action-link:focus-visible,
.ahan-shell-theme-btn:focus-visible {
  outline: 2px solid var(--ahan-accent);
  outline-offset: 2px;
}

.ahan-shell-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: linear-gradient(145deg, #1E3A8A, #0D1526);
  color: #F8FAFC;
  font: 700 11px/1 var(--ahan-font-mono);
  letter-spacing: -0.03em;
  flex: none;
}

[data-theme="dark"] .ahan-shell-mark {
  background: linear-gradient(145deg, #2563EB, #1E3A8A);
  color: #F8FAFC;
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.35);
}

.ahan-shell-brand-sep,
.ahan-shell-brand-name {
  color: var(--ahan-shell-ink);
}

.ahan-shell-brand-sep {
  opacity: 0.45;
  margin: 0 2px;
}

.ahan-shell-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.ahan-shell-nav::-webkit-scrollbar {
  display: none;
}

.ahan-shell-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--ahan-shell-muted);
  text-decoration: none;
  font: 600 13px/1 var(--ahan-font-sans);
  white-space: nowrap;
  flex: none;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.ahan-shell-tab:hover {
  background: var(--ahan-shell-hover-bg);
  color: var(--ahan-shell-ink);
  text-decoration: none;
}

.ahan-shell-tab.is-active {
  background: var(--ahan-shell-active-bg);
  border-color: var(--ahan-shell-active-line);
  color: var(--ahan-shell-active-ink);
  font-weight: 700;
}

.ahan-shell-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex: 0 0 auto;
  min-width: 0;
}

.ahan-shell-credits {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 28px;
  padding: 0 9px;
  border-radius: var(--ahan-radius-pill, 999px);
  border: 1px solid var(--ahan-gold-line);
  background: var(--ahan-gold-soft);
  color: var(--ahan-gold-dark);
  text-decoration: none;
  font: 700 11.5px/1 var(--ahan-font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: pointer;
  flex: none;
  transition: background-color 0.14s ease, border-color 0.14s ease, transform 0.12s ease;
}

.ahan-shell-credits:hover {
  border-color: var(--ahan-gold);
  background: var(--ahan-warn-soft);
  color: var(--ahan-gold-dark);
  text-decoration: none;
}

.ahan-shell-credits[hidden] {
  display: none !important;
}

.ahan-shell-credits-ico {
  font-size: 11px;
  line-height: 1;
}

.ahan-shell-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 9px;
  border-radius: var(--ahan-radius-pill, 999px);
  border: 1px solid var(--ahan-border);
  background: var(--ahan-surface-soft);
  color: var(--ahan-text-secondary);
  font: 600 11.5px/1 var(--ahan-font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ahan-shell-status[hidden] {
  display: none !important;
}

.ahan-shell-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ahan-text-muted);
  flex: none;
}

.ahan-shell-status.is-ok {
  border-color: var(--ahan-ok-line);
  background: var(--ahan-ok-soft);
  color: var(--ahan-ok);
}

.ahan-shell-status.is-ok .ahan-shell-status-dot {
  background: var(--ahan-ok);
}

.ahan-shell-status.is-warn {
  border-color: var(--ahan-warn-line);
  background: var(--ahan-warn-soft);
  color: var(--ahan-warn);
}

.ahan-shell-status.is-warn .ahan-shell-status-dot {
  background: var(--ahan-warn);
}

.ahan-shell-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--ahan-accent);
  background: var(--ahan-accent);
  color: var(--ahan-accent-ink);
  text-decoration: none;
  font: 600 12.5px/1 var(--ahan-font-sans);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.14s ease, border-color 0.14s ease, transform 0.12s ease;
}

.ahan-shell-cta:hover {
  background: var(--ahan-accent-hover);
  border-color: var(--ahan-accent-hover);
  color: var(--ahan-accent-ink);
  text-decoration: none;
}

.ahan-shell-auth-slot {
  display: inline-flex;
  align-items: center;
  flex: none;
}

.ahan-shell-action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--ahan-border);
  background: var(--ahan-surface);
  color: var(--ahan-shell-ink);
  text-decoration: none;
  font: 600 12.5px/1 var(--ahan-font-sans);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.ahan-shell-account-btn {
  display: inline-block;
  line-height: 30px;
  max-width: 224px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  vertical-align: middle;
}

.ahan-shell-action-link:hover {
  background: var(--ahan-surface-soft);
  border-color: var(--ahan-border-strong);
  text-decoration: none;
}

.ahan-shell-action-link.is-active {
  background: var(--ahan-shell-active-bg);
  border-color: var(--ahan-shell-active-line);
  color: var(--ahan-shell-active-ink);
}

.ahan-shell-theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--ahan-border);
  background: var(--ahan-surface);
  color: var(--ahan-shell-ink);
  font: 600 12px/1 var(--ahan-font-sans);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.ahan-shell-theme-btn:hover {
  background: var(--ahan-surface-soft);
  border-color: var(--ahan-border-strong);
}

.ahan-shell-theme-ico {
  width: 14px;
  height: 14px;
  flex: none;
}

/* ---------------- Owner Console (/app/me) Shell & Migration Bridge ---------------- */
.ahan-console-bridge {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border-bottom: 1px solid var(--ahan-accent-line);
  background: var(--ahan-accent-soft);
  color: var(--ahan-text-primary);
  font: 500 12.5px/1.4 var(--ahan-font-sans);
}

.ahan-console-bridge-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 7px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.ahan-console-bridge-copy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.ahan-console-bridge-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--ahan-surface);
  border: 1px solid var(--ahan-accent-line);
  color: var(--ahan-accent);
  font: 700 11px/1.2 var(--ahan-font-mono);
  white-space: nowrap;
}

.ahan-console-bridge-text {
  color: var(--ahan-text-secondary);
}

.ahan-console-bridge-links {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ahan-bridge-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--ahan-accent-line);
  background: var(--ahan-surface);
  color: var(--ahan-accent);
  font: 600 12px/1.25 var(--ahan-font-sans);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.ahan-bridge-link:hover {
  background: var(--ahan-surface-subtle);
  text-decoration: none;
}

.ahan-bridge-link.is-primary {
  background: var(--ahan-accent);
  border-color: var(--ahan-accent);
  color: var(--ahan-accent-ink);
}

.ahan-bridge-link.is-primary:hover {
  background: var(--ahan-accent-hover);
  border-color: var(--ahan-accent-hover);
}

body.has-ahan-shell[data-ahan-shell-page="me"] .side {
  top: var(--ahan-shell-h, 54px);
  height: calc(100vh - var(--ahan-shell-h, 54px));
}

body.has-ahan-shell[data-ahan-shell-page="me"] .top {
  top: var(--ahan-shell-h, 54px);
}

[data-theme="dark"] body[data-ahan-shell-page="me"] .side {
  background: rgba(15, 23, 42, 0.92);
}

[data-theme="dark"] body[data-ahan-shell-page="me"] .mark,
[data-theme="dark"] body[data-ahan-shell-page="me"] .seal,
[data-theme="dark"] body[data-ahan-shell-page="me"] .wt-ic {
  background: var(--ahan-surface-soft);
  color: var(--ahan-ink);
}

/* ---------------- Account Menu Portal (z=1040) & Global Connect Drawer Portal (z=1050/1055) ---------------- */
.ahan-shell-account-menu {
  position: fixed;
  z-index: 1040;
  min-width: 176px;
  padding: 5px;
  border-radius: 12px;
  border: 1px solid var(--ahan-border);
  background: var(--ahan-surface);
  color: var(--ahan-text-primary);
  box-shadow: var(--ahan-shadow-md);
  font: 500 13px/1.3 var(--ahan-font-sans);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ahan-shell-account-menu[hidden] {
  display: none !important;
}

.ahan-shell-menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ahan-text-primary);
  text-decoration: none;
  text-align: left;
  font: 500 13px/1.25 var(--ahan-font-sans);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.ahan-shell-menu-item:hover {
  background: var(--ahan-shell-hover-bg);
  color: var(--ahan-accent);
  text-decoration: none;
}

.ahan-shell-menu-item.is-danger {
  color: var(--ahan-danger);
}

.ahan-shell-menu-item.is-danger:hover {
  background: var(--ahan-danger-soft);
  color: var(--ahan-danger);
}

.ahan-shell-menu-sep {
  height: 1px;
  margin: 4px 6px;
  background: var(--ahan-border);
}

/* ---------------- Unified Centered Focus Modal System (z=1050/1052/1055/1070) ---------------- */
@keyframes ahanModalPop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.ahan-modal-backdrop,
.ahan-cd-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 14px;
  background: rgba(13, 21, 38, 0.44);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.ahan-modal-backdrop.is-service-layer {
  z-index: 1052;
}

.ahan-modal-backdrop.is-connect-layer {
  z-index: 1055;
}

.ahan-modal-backdrop.is-auth-layer {
  z-index: 1070;
}

.ahan-modal-backdrop[hidden],
.ahan-cd-backdrop[hidden],
.ahan-modal-card[hidden],
.ahan-cd-drawer[hidden] {
  display: none !important;
}

.ahan-modal-card,
.ahan-cd-drawer {
  position: relative;
  top: auto;
  right: auto;
  bottom: auto;
  left: auto;
  z-index: 1055;
  width: min(520px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: min(86vh, 720px);
  border-radius: 16px;
  background: var(--ahan-surface);
  color: var(--ahan-text-primary);
  border: 1px solid var(--ahan-border);
  box-shadow: 0 24px 64px -20px rgba(13, 21, 38, 0.32), 0 4px 16px rgba(13, 21, 38, 0.08), 0 0 0 1px rgba(13, 21, 38, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font: 400 13.5px/1.5 var(--ahan-font-sans);
  box-sizing: border-box;
  animation: ahanModalPop 0.16s ease-out;
}

.ahan-modal-card.is-service {
  z-index: 1052;
  width: min(520px, calc(100vw - 24px));
}

.ahan-modal-card.is-auth {
  width: min(440px, calc(100vw - 24px));
}

.ahan-modal-card *,
.ahan-modal-card *::before,
.ahan-modal-card *::after,
.ahan-cd-drawer *,
.ahan-cd-drawer *::before,
.ahan-cd-drawer *::after {
  box-sizing: border-box;
}

.ahan-modal-head,
.ahan-cd-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--ahan-border);
  background: var(--ahan-surface);
  flex: none;
}

.ahan-cd-head-l {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.ahan-cd-title {
  margin: 0;
  font: 700 17px/1.3 var(--ahan-font-sans);
  letter-spacing: -0.015em;
  color: var(--ahan-text-primary);
}

.ahan-cd-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--ahan-border);
  background: var(--ahan-surface-soft);
  color: var(--ahan-text-secondary);
  font: 600 18px/1 var(--ahan-font-sans);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  transition: border-color 0.12s ease, color 0.12s ease, background-color 0.12s ease;
}

.ahan-cd-close:hover {
  border-color: var(--ahan-border-strong);
  color: var(--ahan-text-primary);
  background: var(--ahan-surface-subtle);
}

.ahan-modal-body,
.ahan-cd-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.ahan-modal-foot {
  flex: none;
  padding: 10px 20px 13px;
  border-top: 1px solid var(--ahan-border);
  background: var(--ahan-surface-soft);
  color: var(--ahan-text-muted);
  font: 400 11.5px/1.45 var(--ahan-font-sans);
}

.ahan-cd-note {
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--ahan-border);
  background: var(--ahan-surface-soft);
  color: var(--ahan-text-secondary);
  font-size: 12px;
  line-height: 1.5;
}

.ahan-cd-banner {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.45;
  border: 1px solid var(--ahan-ok-line);
  background: var(--ahan-ok-soft);
  color: var(--ahan-ok);
}

.ahan-cd-banner.is-err {
  border-color: var(--ahan-err-line);
  background: var(--ahan-err-soft);
  color: var(--ahan-err);
}

.ahan-cd-banner.is-warn {
  border-color: var(--ahan-warn-line);
  background: var(--ahan-warn-soft);
  color: var(--ahan-warn);
}

/* Hydrated Existing Agents Strip */
.ahan-agent-chips {
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--ahan-border);
  background: var(--ahan-surface-soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ahan-agent-chips-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 600;
  color: var(--ahan-text-secondary);
}

.ahan-agent-chips-list {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ahan-agent-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--ahan-border);
  background: var(--ahan-surface);
  color: var(--ahan-text-primary);
  font: 600 12px/1.2 var(--ahan-font-mono);
  text-decoration: none;
}

a.ahan-agent-chip {
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease, color 0.12s ease;
}

a.ahan-agent-chip:hover {
  border-color: var(--ahan-accent-line);
  background: var(--ahan-accent-soft);
  color: var(--ahan-accent);
  text-decoration: none;
}

.ahan-agent-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ahan-text-muted);
  flex: none;
}

.ahan-agent-dot.is-online {
  background: var(--ahan-ok);
  box-shadow: 0 0 0 2px var(--ahan-ok-soft);
}

/* Prompt-First Hero Card */
.ahan-prompt-hero {
  padding: 16px;
  border-radius: 13px;
  border: 1px solid var(--ahan-accent-line);
  background: linear-gradient(180deg, var(--ahan-accent-soft) 0%, var(--ahan-surface) 100%);
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.ahan-prompt-hero-title {
  margin: 0;
  font: 700 15px/1.35 var(--ahan-font-sans);
  color: var(--ahan-text-primary);
}

.ahan-prompt-hero-sub {
  margin: 0;
  font: 400 12.5px/1.55 var(--ahan-font-sans);
  color: var(--ahan-text-secondary);
}

.ahan-prompt-box {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--ahan-border-strong);
  background: var(--ahan-surface);
  color: var(--ahan-text-primary);
  font: 500 12.5px/1.6 var(--ahan-font-mono);
  white-space: pre-wrap;
  word-break: break-word;
  user-select: all;
}

.ahan-prompt-copy-cta {
  width: 100%;
  height: 42px;
  font-size: 13.5px;
  font-weight: 700;
  border-radius: 10px;
}

/* Magic Claim 1-Click Confirm Card */
.ahan-claim-hero {
  padding: 18px 16px;
  border-radius: 13px;
  border: 1px solid var(--ahan-accent-line);
  background: linear-gradient(180deg, var(--ahan-accent-soft) 0%, var(--ahan-surface) 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ahan-claim-actor {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--ahan-accent-line);
  background: var(--ahan-surface);
  color: var(--ahan-accent);
  font: 700 12.5px/1.2 var(--ahan-font-mono);
}

.ahan-claim-question {
  margin: 0;
  font: 700 15.5px/1.4 var(--ahan-font-sans);
  color: var(--ahan-text-primary);
}

.ahan-claim-meta {
  margin: 0;
  font: 400 12.5px/1.5 var(--ahan-font-sans);
  color: var(--ahan-text-secondary);
}

.ahan-claim-acts {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

.ahan-claim-acts .ahan-cd-btn.is-pri {
  flex: 1 1 auto;
  height: 40px;
  font-size: 13.5px;
  font-weight: 700;
}

/* Guest Subtle Secondary Row */
.ahan-guest-auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 13px;
  border-radius: 10px;
  border: 1px solid var(--ahan-border);
  background: var(--ahan-surface-soft);
  color: var(--ahan-text-secondary);
  font: 500 12.5px/1.4 var(--ahan-font-sans);
}

/* Advanced Collapsible Accordion (<details>) */
.ahan-adv-details {
  border: 1px solid var(--ahan-border);
  border-radius: 11px;
  background: var(--ahan-surface-soft);
  overflow: hidden;
}

.ahan-adv-summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 13px;
  font: 600 12.5px/1.3 var(--ahan-font-sans);
  color: var(--ahan-text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  transition: color 0.12s ease, background-color 0.12s ease;
}

.ahan-adv-summary::-webkit-details-marker {
  display: none;
}

.ahan-adv-summary:hover {
  color: var(--ahan-text-primary);
  background: var(--ahan-surface-subtle);
}

.ahan-adv-body {
  padding: 12px;
  border-top: 1px solid var(--ahan-border);
  background: var(--ahan-surface);
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.ahan-adv-details:not([open]) > .ahan-adv-body {
  display: none;
}

/* In-Place Quick Auth Modal */
.ahan-auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--ahan-border);
  background: var(--ahan-surface-soft);
}

.ahan-auth-tab {
  height: 34px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ahan-text-muted);
  font: 600 13px/1 var(--ahan-font-sans);
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.ahan-auth-tab:hover {
  color: var(--ahan-text-primary);
}

.ahan-auth-tab.is-active {
  background: var(--ahan-surface);
  color: var(--ahan-text-primary);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(13, 21, 38, 0.10);
}

.ahan-auth-form {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.ahan-auth-fld {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font: 600 12.5px/1.25 var(--ahan-font-sans);
  color: var(--ahan-text-secondary);
}

.ahan-auth-fld .ahan-cd-input {
  flex: none;
  width: 100%;
  height: 38px;
  font-size: 13.5px;
  padding: 0 12px;
}

.ahan-auth-agree {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 400 12px/1.4 var(--ahan-font-sans);
  color: var(--ahan-text-muted);
  cursor: pointer;
}

.ahan-auth-agree input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--ahan-accent);
  flex: none;
}

.ahan-auth-submit {
  width: 100%;
  height: 40px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 10px;
  margin-top: 2px;
}

.ahan-cd-card {
  padding: 13px 14px;
  border-radius: 11px;
  border: 1px solid var(--ahan-border);
  background: var(--ahan-surface);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.ahan-cd-card.is-subtle {
  background: var(--ahan-surface-soft);
}

.ahan-cd-card-head {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 13px;
}

.ahan-cd-card-title {
  font: 600 13px/1.3 var(--ahan-font-sans);
  color: var(--ahan-text-primary);
}

.ahan-cd-card-desc {
  margin: 0;
  font-size: 12px;
  color: var(--ahan-text-muted);
  line-height: 1.5;
}

.ahan-cd-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--ahan-border);
  background: var(--ahan-surface-soft);
  color: var(--ahan-text-secondary);
  font: 600 11px/1.25 var(--ahan-font-mono);
  white-space: nowrap;
}

.ahan-cd-pill.is-accent {
  border-color: var(--ahan-accent-line);
  background: var(--ahan-accent-soft);
  color: var(--ahan-accent);
}

.ahan-cd-pill.is-ok {
  border-color: var(--ahan-ok-line);
  background: var(--ahan-ok-soft);
  color: var(--ahan-ok);
}

.ahan-cd-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ahan-cd-form-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ahan-cd-input {
  flex: 1 1 180px;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--ahan-border-strong);
  background: var(--ahan-surface);
  color: var(--ahan-text-primary);
  font: 400 12.5px/1 var(--ahan-font-sans);
}

.ahan-cd-input:focus {
  outline: none;
  border-color: var(--ahan-accent);
  box-shadow: 0 0 0 2px var(--ahan-accent-soft);
}

.ahan-cd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--ahan-border);
  background: var(--ahan-surface);
  color: var(--ahan-text-primary);
  text-decoration: none;
  font: 600 12.5px/1 var(--ahan-font-sans);
  cursor: pointer;
  white-space: nowrap;
  flex: none;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.ahan-cd-btn:hover {
  border-color: var(--ahan-border-strong);
  background: var(--ahan-surface-soft);
  text-decoration: none;
}

.ahan-cd-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ahan-cd-btn.is-sm {
  height: 28px;
  padding: 0 9px;
  font-size: 11.5px;
}

.ahan-cd-btn.is-pri {
  border-color: var(--ahan-accent);
  background: var(--ahan-accent);
  color: var(--ahan-accent-ink);
}

.ahan-cd-btn.is-pri:hover {
  border-color: var(--ahan-accent-hover);
  background: var(--ahan-accent-hover);
  color: var(--ahan-accent-ink);
}

.ahan-cd-btn.is-accent {
  border-color: var(--ahan-accent-line);
  background: var(--ahan-accent-soft);
  color: var(--ahan-accent);
}

.ahan-cd-btn.is-copied {
  border-color: var(--ahan-ok-line);
  background: var(--ahan-ok-soft);
  color: var(--ahan-ok);
}

.ahan-cd-acts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ahan-cd-codebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid var(--ahan-border);
  background: var(--ahan-surface-soft);
  min-width: 0;
}

.ahan-cd-code {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  font: 500 11.5px/1.35 var(--ahan-font-mono);
  color: var(--ahan-text-primary);
}

.ahan-cd-issued {
  padding: 10px 11px;
  border-radius: 10px;
  border: 1px solid var(--ahan-ok-line);
  background: var(--ahan-ok-soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ahan-cd-issued-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.ahan-cd-tag {
  font: 600 11.5px/1.2 var(--ahan-font-mono);
  color: var(--ahan-text-primary);
}

.ahan-cd-issued-foot {
  display: flex;
  justify-content: flex-end;
}

.ahan-cd-link {
  color: var(--ahan-accent);
  font: 600 12px/1.2 var(--ahan-font-sans);
  text-decoration: none;
}

.ahan-cd-link:hover {
  text-decoration: underline;
}

/* Provider / Service-Supply Wake-up Modal (.is-service) */
.ahan-svc-head-pills {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ahan-svc-pack-tag {
  font-family: var(--ahan-font-mono);
}

.ahan-svc-pack-tag[hidden] {
  display: none !important;
}

.ahan-svc-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ahan-svc-agents {
  padding: 9px 12px;
}

.ahan-svc-agents-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ahan-svc-agents-lbl {
  font: 600 12px/1.2 var(--ahan-font-sans);
  color: var(--ahan-text-secondary);
  white-space: nowrap;
  flex: none;
}

.ahan-svc-agent-chip {
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.ahan-svc-agent-chip:hover {
  border-color: var(--ahan-accent-line);
  background: var(--ahan-accent-soft);
  color: var(--ahan-accent);
}

.ahan-svc-agent-chip:focus-visible {
  outline: 2px solid var(--ahan-accent);
  outline-offset: 2px;
}

.ahan-svc-agent-chip.is-selected {
  border-color: var(--ahan-accent);
  background: var(--ahan-accent-soft);
  color: var(--ahan-accent);
  box-shadow: 0 0 0 1px var(--ahan-accent-line);
}

.ahan-svc-hero {
  padding: 14px;
  gap: 10px;
}

.ahan-svc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 11px 20px;
}

.ahan-svc-foot-l {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ahan-svc-market-link {
  white-space: nowrap;
}

[data-theme="dark"] .ahan-modal-backdrop,
[data-theme="dark"] .ahan-cd-backdrop {
  background: rgba(3, 6, 14, 0.68);
}

[data-theme="dark"] .ahan-modal-card,
[data-theme="dark"] .ahan-cd-drawer {
  border-color: var(--ahan-border-strong);
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(148, 163, 184, 0.14);
}

[data-theme="dark"] .ahan-modal-head,
[data-theme="dark"] .ahan-cd-head {
  border-bottom-color: var(--ahan-border-strong);
}

[data-theme="dark"] .ahan-modal-foot {
  border-top-color: var(--ahan-border-strong);
}

[data-theme="dark"] .ahan-svc-agent-chip {
  background: rgba(7, 11, 20, 0.55);
  border-color: var(--ahan-border-strong);
}

[data-theme="dark"] .ahan-svc-agent-chip:hover,
[data-theme="dark"] .ahan-svc-agent-chip.is-selected {
  background: var(--ahan-accent-soft);
  border-color: var(--ahan-accent);
  color: var(--ahan-accent);
}

[data-theme="dark"] .ahan-prompt-hero,
[data-theme="dark"] .ahan-claim-hero {
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.14) 0%, var(--ahan-surface) 100%);
}

[data-theme="dark"] .ahan-prompt-box {
  background: rgba(7, 11, 20, 0.72);
  border-color: var(--ahan-border-strong);
}

[data-theme="dark"] .ahan-auth-tab.is-active {
  background: var(--ahan-surface-elevated);
  color: var(--ahan-text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .ahan-cd-input {
  background: rgba(7, 11, 20, 0.65);
}

/* ---------------- Responsive Shell Breakpoints (0 horizontal overflow down to 360px) ---------------- */
@media (max-width: 1380px) {
  .ahan-shell-inner {
    gap: 10px;
    padding: 0 14px;
  }

  .ahan-shell-tab {
    padding: 0 10px;
  }

  .ahan-shell-actions {
    gap: 6px;
  }

  .ahan-shell-account-btn {
    max-width: 148px;
  }
}

@media (max-width: 960px) {
  .ahan-shell-inner {
    display: flex;
    justify-content: space-between;
    padding: 0 12px;
    gap: 8px;
  }

  .ahan-shell-status {
    display: none;
  }

  .ahan-shell-tab {
    padding: 0 9px;
    font-size: 12.5px;
  }
}

@media (max-width: 680px) {
  .ahan-shell-inner {
    padding: 0 8px;
    gap: 6px;
  }

  .ahan-shell-brand-sep,
  .ahan-shell-brand-name {
    display: none;
  }

  .ahan-shell-nav {
    justify-content: flex-start;
    gap: 2px;
  }

  .ahan-shell-tab {
    height: 28px;
    padding: 0 7px;
    font-size: 12px;
  }

  .ahan-shell-actions {
    gap: 4px;
  }

  .ahan-shell-cta,
  .ahan-shell-action-link,
  .ahan-shell-theme-btn {
    height: 28px;
    padding: 0 7px;
    font-size: 11.5px;
  }

  .ahan-shell-credits {
    height: 26px;
    padding: 0 7px;
    font-size: 11px;
  }

  .ahan-shell-account-btn {
    max-width: 112px;
    line-height: 26px;
  }

  .ahan-shell-theme-lbl {
    display: none;
  }

  .ahan-console-bridge-inner {
    padding: 7px 12px;
  }

  .ahan-modal-backdrop,
  .ahan-cd-backdrop {
    padding: 12px 10px;
  }

  .ahan-modal-card,
  .ahan-cd-drawer,
  .ahan-modal-card.is-service,
  .ahan-modal-card.is-auth {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    max-height: 90vh;
    border-radius: 14px;
  }

  .ahan-modal-head,
  .ahan-cd-head {
    padding: 14px 16px 12px;
  }

  .ahan-modal-body,
  .ahan-cd-body {
    padding: 14px 16px 16px;
    gap: 11px;
  }

  .ahan-modal-foot,
  .ahan-svc-foot {
    padding: 9px 16px 12px;
  }

  .ahan-guest-auth-row {
    flex-direction: column;
    align-items: stretch;
  }

  .ahan-claim-acts {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 440px) {
  .ahan-shell-cta {
    display: none;
  }

  .ahan-shell-account-btn {
    max-width: 92px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
  }

  .ahan-modal-card,
  .ahan-cd-drawer {
    animation: none !important;
  }
}
