/* ============================================================================
   Sherry AI 商城 Personal Center (/me/*) — Plan A: Obsidian & Gold Flagship Theme
   Applies to html.dark body .personal-workspace + universal overflow/grid fixes
   ============================================================================ */

/* ----------------------------------------------------------------------------
   1. UNIVERSAL LAYOUT & OVERFLOW FIXES (both Dark & Light modes)
   Fixes right-side clipping caused by `.partner-main.affiliate-gold-shell`
   having `width: 100%` + `margin: 24px` (+48px horizontal overflow!).
   ---------------------------------------------------------------------------- */
html body .personal-workspace {
  overflow-x: clip !important;
}
html body .personal-workspace .workspace-content {
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow-x: clip !important;
}
html body .personal-workspace .partner-workspace {
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
html body .personal-workspace .partner-main,
html body .personal-workspace .partner-main.affiliate-gold-shell {
  width: auto !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 24px 28px 32px !important;
  box-sizing: border-box !important;
  border-radius: 0 !important;
}
html body .personal-workspace .overview,
html body .personal-workspace .partner-analytics,
html body .personal-workspace .partner-orders,
html body .personal-workspace .pricing-page,
html body .personal-workspace .operations {
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Responsive 4-Card KPI / Metrics Grid — ZERO right-edge clipping */
html body .personal-workspace .metrics,
html body .personal-workspace .kpis {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 14px !important;
  min-width: 0 !important;
  max-width: 100% !important;
}
html body .personal-workspace .metrics article,
html body .personal-workspace .kpis article {
  min-width: 0 !important;
  padding: 18px 16px !important;
  gap: 12px !important;
  border-radius: 14px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}
html body .personal-workspace .metrics article > div,
html body .personal-workspace .kpis article > div {
  min-width: 0 !important;
  flex: 1 1 0% !important;
}
html body .personal-workspace .metrics strong,
html body .personal-workspace .kpis strong {
  font-size: clamp(18px, 1.55vw, 26px) !important;
  line-height: 1.25 !important;
  font-variant-numeric: tabular-nums !important;
  letter-spacing: -0.02em !important;
}
@media (max-width: 1240px) {
  html body .personal-workspace .metrics,
  html body .personal-workspace .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 900px) {
  html body .personal-workspace .partner-main,
  html body .personal-workspace .partner-main.affiliate-gold-shell {
    padding: 16px 14px 24px !important;
  }
  html body .personal-workspace .metrics,
  html body .personal-workspace .kpis {
    gap: 10px !important;
  }
  html body .personal-workspace .metrics article,
  html body .personal-workspace .kpis article {
    padding: 14px 12px !important;
  }
}

/* Withdrawal notice banner universal spacing & crisp legibility */
#tc-aff-payout-banner {
  margin: 20px 28px 0 28px !important;
  padding: 13px 16px !important;
  border-radius: 12px !important;
  display: flex !important;
  align-items: flex-start !important;
  gap: 12px !important;
  box-sizing: border-box !important;
  max-width: calc(100% - 56px) !important;
}
@media (max-width: 900px) {
  #tc-aff-payout-banner {
    margin: 14px 14px 0 14px !important;
    max-width: calc(100% - 28px) !important;
  }
}
html:not(.dark) #tc-aff-payout-banner {
  background: linear-gradient(90deg, #0d2b22 0%, #10372b 70%, #193b2d 100%) !important;
  border: 1px solid rgba(16, 185, 129, 0.45) !important;
}
html:not(.dark) #tc-aff-payout-banner .tc-aff-pb-title {
  color: #6ee7b7 !important;
}
html:not(.dark) #tc-aff-payout-banner .tc-aff-pb-sub {
  color: #e2e8f0 !important;
}
html:not(.dark) #tc-aff-payout-banner .tc-aff-pb-sub b {
  color: #fbbf24 !important;
}

/* ----------------------------------------------------------------------------
   2. PLAN A: OBSIDIAN & GOLD FLAGSHIP DARK THEME (html.dark)
   ---------------------------------------------------------------------------- */
html.dark body .personal-workspace {
  --tc-canvas: #0d0f14;
  --tc-sidebar: #11141c;
  --tc-card: #151923;
  --tc-card-2: #191e2a;
  --tc-input: #0c0e14;
  --tc-border: rgba(255, 255, 255, 0.08);
  --tc-border-strong: rgba(255, 255, 255, 0.14);
  --tc-gold: #f5c451;
  --tc-gold-soft: rgba(245, 196, 81, 0.14);
  --tc-gold-border: rgba(245, 196, 81, 0.42);
  --tc-green: #10b981;
  --tc-green-bright: #34d399;
  --tc-green-soft: rgba(16, 185, 129, 0.14);
  --tc-ink: #f8fafc;
  --tc-ink-2: #cbd5e1;
  --tc-ink-3: #94a3b8;
  --tc-muted: #64748b;

  background: radial-gradient(circle at 82% -6%, rgba(245, 196, 81, 0.06), transparent 36rem),
              radial-gradient(circle at 18% 12%, rgba(16, 185, 129, 0.05), transparent 32rem),
              #0d0f14 !important;
  color: var(--tc-ink) !important;
  color-scheme: dark;
}

html.dark body .personal-workspace .workspace-content,
html.dark body .personal-workspace .partner-workspace,
html.dark body .personal-workspace .partner-main,
html.dark body .personal-workspace .partner-main.affiliate-gold-shell,
html.dark body .personal-workspace .operations {
  background: transparent !important;
  color: var(--tc-ink) !important;
}

/* Sidebar — Obsidian Rail + Gold Active State */
html.dark body .personal-workspace .workspace-sidebar,
html.dark body .personal-workspace .partner-sidebar {
  background: var(--tc-sidebar) !important;
  border-right: 1px solid var(--tc-border) !important;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}
html.dark body .personal-workspace .workspace-brand {
  color: var(--tc-ink) !important;
}
html.dark body .personal-workspace .workspace-brand span,
html.dark body .personal-workspace .workspace-sidebar .group-label,
html.dark body .personal-workspace .workspace-user small {
  color: var(--tc-muted) !important;
}
html.dark body .personal-workspace .workspace-sidebar nav a,
html.dark body .personal-workspace .workspace-sidebar summary,
html.dark body .personal-workspace .partner-navigation a,
html.dark body .personal-workspace .partner-navigation summary {
  color: var(--tc-ink-2) !important;
  border-radius: 10px !important;
  position: relative;
  transition: background 0.18s ease, color 0.18s ease;
}
html.dark body .personal-workspace .workspace-sidebar nav a:hover,
html.dark body .personal-workspace .workspace-sidebar summary:hover,
html.dark body .personal-workspace .partner-navigation a:hover,
html.dark body .personal-workspace .partner-navigation summary:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #ffffff !important;
}
html.dark body .personal-workspace .workspace-sidebar nav a.selected,
html.dark body .personal-workspace .partner-navigation a.selected {
  background: linear-gradient(90deg, rgba(245, 196, 81, 0.18) 0%, rgba(245, 196, 81, 0.03) 100%) !important;
  color: var(--tc-gold) !important;
  font-weight: 700 !important;
  box-shadow: inset 3px 0 0 var(--tc-gold) !important;
}
html.dark body .personal-workspace .workspace-sidebar details,
html.dark body .personal-workspace .partner-sidebar-bottom details,
html.dark body .personal-workspace .workspace-user {
  border-top-color: var(--tc-border) !important;
}
html.dark body .personal-workspace .workspace-user {
  color: var(--tc-ink-2) !important;
}
html.dark body .personal-workspace .workspace-user > span {
  background: var(--tc-gold-soft) !important;
  color: var(--tc-gold) !important;
  border: 1px solid var(--tc-gold-border);
}
html.dark body .personal-workspace .workspace-mobile {
  color: var(--tc-gold) !important;
}
html.dark body .personal-workspace .preview-controls {
  background: #171b26 !important;
  border-color: var(--tc-gold-border) !important;
}
html.dark body .personal-workspace .preview-controls label {
  color: var(--tc-gold) !important;
}
html.dark body .personal-workspace .preview-controls select {
  background: var(--tc-input) !important;
  border-color: var(--tc-border-strong) !important;
  color: var(--tc-ink) !important;
}

/* Withdrawal Banner — Emerald-Gold Dark Glass */
html.dark #tc-aff-payout-banner {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.16) 0%, rgba(16, 185, 129, 0.06) 65%, rgba(245, 196, 81, 0.10) 100%) !important;
  border: 1px solid rgba(52, 211, 153, 0.34) !important;
  box-shadow: 0 10px 28px -18px rgba(16, 185, 129, 0.45) !important;
}
html.dark #tc-aff-payout-banner .tc-aff-pb-title {
  color: #6ee7b7 !important;
}
html.dark #tc-aff-payout-banner .tc-aff-pb-sub {
  color: #e2e8f0 !important;
}
html.dark #tc-aff-payout-banner .tc-aff-pb-sub b {
  color: #fbbf24 !important;
}

/* Page Headings & Tier Badges */
html.dark body .personal-workspace h1,
html.dark body .personal-workspace h2,
html.dark body .personal-workspace h3,
html.dark body .personal-workspace h4 {
  color: var(--tc-ink) !important;
}
html.dark body .personal-workspace h2::before {
  background: var(--tc-gold) !important;
}
html.dark body .personal-workspace .heading p,
html.dark body .personal-workspace .page-heading p,
html.dark body .personal-workspace .pricing-heading p,
html.dark body .personal-workspace .workspace-heading p,
html.dark body .personal-workspace .workspace-heading span,
html.dark body .personal-workspace .scope-note,
html.dark body .personal-workspace .meta,
html.dark body .personal-workspace .text-muted-foreground {
  color: var(--tc-ink-3) !important;
}
html.dark body .personal-workspace .tier,
html.dark body .personal-workspace .title > span,
html.dark body .personal-workspace .target-tag {
  background: var(--tc-gold-soft) !important;
  border: 1px solid var(--tc-gold-border) !important;
  color: var(--tc-gold) !important;
  border-radius: 999px !important;
  padding: 6px 14px !important;
  font-weight: 700 !important;
}

/* Elevated Obsidian Cards across ALL /me views */
html.dark body .personal-workspace .metrics article,
html.dark body .personal-workspace .kpis article,
html.dark body .personal-workspace .link-panel,
html.dark body .personal-workspace .orders-panel,
html.dark body .personal-workspace .chart-panel,
html.dark body .personal-workspace .panel,
html.dark body .personal-workspace .order-panel,
html.dark body .personal-workspace .price-table,
html.dark body .personal-workspace .fixed-card,
html.dark body .personal-workspace .customer-display,
html.dark body .personal-workspace .todos,
html.dark body .personal-workspace .inventory,
html.dark body .personal-workspace .details,
html.dark body .personal-workspace .secondary,
html.dark body .personal-workspace .upgrade-offer,
html.dark body .personal-workspace .support-list,
html.dark body .personal-workspace .bg-card,
html.dark body .personal-workspace [class*="bg-card"] {
  background: var(--tc-card) !important;
  border: 1px solid var(--tc-border) !important;
  border-radius: 14px !important;
  box-shadow: 0 12px 30px -22px rgba(0, 0, 0, 0.85) !important;
  color: var(--tc-ink) !important;
}

/* Hero 1st Metric / KPI Card (Withdrawable Commission / Primary Revenue) */
html.dark body .personal-workspace .metrics article:first-child,
html.dark body .personal-workspace .kpis article:first-child {
  background: linear-gradient(155deg, #1b1f2c 0%, #151923 65%, rgba(245, 196, 81, 0.11) 100%) !important;
  border-color: var(--tc-gold-border) !important;
  box-shadow: 0 14px 32px -20px rgba(245, 196, 81, 0.25) !important;
}
html.dark body .personal-workspace .metrics article:first-child strong,
html.dark body .personal-workspace .metrics article .gold,
html.dark body .personal-workspace strong.gold,
html.dark body .personal-workspace span.gold,
html.dark body .personal-workspace .affiliate-id,
html.dark body .personal-workspace .amber {
  color: var(--tc-gold) !important;
  -webkit-text-fill-color: var(--tc-gold) !important;
  background: transparent !important;
  border: 0 !important;
}
html.dark body .personal-workspace .metrics article > svg,
html.dark body .personal-workspace .kpis svg {
  color: var(--tc-gold) !important;
}
html.dark body .personal-workspace .metrics p,
html.dark body .personal-workspace .kpis p,
html.dark body .personal-workspace .kpis small,
html.dark body .personal-workspace .secondary p,
html.dark body .personal-workspace .secondary small,
html.dark body .personal-workspace .link-panel > p {
  color: var(--tc-ink-3) !important;
}
html.dark body .personal-workspace .metrics strong,
html.dark body .personal-workspace .kpis strong,
html.dark body .personal-workspace .secondary strong {
  color: var(--tc-ink) !important;
}
html.dark body .personal-workspace .green,
html.dark body .personal-workspace .kpis strong.green,
html.dark body .personal-workspace .commission,
html.dark body .personal-workspace .purchase {
  color: var(--tc-green-bright) !important;
}

/* Primary & Secondary Buttons */
html.dark body .personal-workspace button.primary,
html.dark body .personal-workspace .primary,
html.dark body .personal-workspace .id-setup-actions button,
html.dark body .personal-workspace .upgrade-cta,
html.dark body .personal-workspace button.gold {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  border: 1px solid rgba(52, 211, 153, 0.45) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  border-radius: 10px !important;
  box-shadow: 0 8px 20px -12px rgba(16, 185, 129, 0.65) !important;
}
html.dark body .personal-workspace button.secondary,
html.dark body .personal-workspace .outline,
html.dark body .personal-workspace .tools button,
html.dark body .personal-workspace .target-toggle,
html.dark body .personal-workspace .target-mult {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid var(--tc-border-strong) !important;
  color: var(--tc-ink-2) !important;
  border-radius: 10px !important;
}
html.dark body .personal-workspace button.secondary:hover,
html.dark body .personal-workspace .outline:hover,
html.dark body .personal-workspace .tools button:hover,
html.dark body .personal-workspace .target-toggle:hover,
html.dark body .personal-workspace .target-toggle.on,
html.dark body .personal-workspace .target-mult.on {
  background: var(--tc-gold-soft) !important;
  border-color: var(--tc-gold-border) !important;
  color: var(--tc-gold) !important;
}
html.dark body .personal-workspace .section-heading button,
html.dark body .personal-workspace .all-orders,
html.dark body .personal-workspace .spec-toggle,
html.dark body .personal-workspace .copy,
html.dark body .personal-workspace .notice button {
  color: var(--tc-gold) !important;
}

/* Inputs, Selects, Search & Exclusive Link Box */
html.dark body .personal-workspace input:not([type="checkbox"]):not([type="radio"]),
html.dark body .personal-workspace select,
html.dark body .personal-workspace textarea,
html.dark body .personal-workspace .link-actions input,
html.dark body .personal-workspace .id-setup-actions input,
html.dark body .personal-workspace .search,
html.dark body .personal-workspace .range,
html.dark body .personal-workspace .custom input {
  background: var(--tc-input) !important;
  border: 1px solid var(--tc-border-strong) !important;
  color: var(--tc-ink) !important;
  border-radius: 10px !important;
}
html.dark body .personal-workspace .search input,
html.dark body .personal-workspace .range select {
  background: transparent !important;
  border: 0 !important;
  color: var(--tc-ink) !important;
}
html.dark body .personal-workspace input::placeholder,
html.dark body .personal-workspace textarea::placeholder {
  color: var(--tc-muted) !important;
}
html.dark body .personal-workspace option {
  background: #151923 !important;
  color: #f8fafc !important;
}

/* Sub-panels, Notices, ID Setup, Steps, Tabs & Segments */
html.dark body .personal-workspace .id-setup,
html.dark body .personal-workspace .notice,
html.dark body .personal-workspace .unlock-paths > div {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid var(--tc-border) !important;
  border-radius: 12px !important;
  color: var(--tc-ink-2) !important;
}
html.dark body .personal-workspace .unlock-paths > div.recommended {
  background: var(--tc-gold-soft) !important;
  border-color: var(--tc-gold-border) !important;
}
html.dark body .personal-workspace .steps,
html.dark body .personal-workspace .toolbar,
html.dark body .personal-workspace .order,
html.dark body .personal-workspace .order-row,
html.dark body .personal-workspace .price-row + .price-row,
html.dark body .personal-workspace .specs,
html.dark body .personal-workspace .spec-row,
html.dark body .personal-workspace .todos article,
html.dark body .personal-workspace .inventory-row,
html.dark body .personal-workspace .secondary article,
html.dark body .personal-workspace footer {
  border-color: var(--tc-border) !important;
}
html.dark body .personal-workspace .steps i {
  border: 1px solid var(--tc-gold-border) !important;
  color: var(--tc-gold) !important;
  background: var(--tc-gold-soft) !important;
}
html.dark body .personal-workspace .steps button,
html.dark body .personal-workspace .steps small,
html.dark body .personal-workspace .id-setup label,
html.dark body .personal-workspace .id-locked {
  color: var(--tc-ink-2) !important;
}
html.dark body .personal-workspace .id-setup small {
  color: var(--tc-gold) !important;
}

html.dark body .personal-workspace .segments,
html.dark body .personal-workspace .ranges,
html.dark body .personal-workspace .strip {
  background: var(--tc-input) !important;
  border: 1px solid var(--tc-border) !important;
  border-radius: 10px !important;
}
html.dark body .personal-workspace .segments button,
html.dark body .personal-workspace .ranges button,
html.dark body .personal-workspace .status-tabs button {
  color: var(--tc-ink-3) !important;
  border-color: var(--tc-border) !important;
}
html.dark body .personal-workspace .segments button.active,
html.dark body .personal-workspace .ranges button.active {
  background: var(--tc-gold-soft) !important;
  color: var(--tc-gold) !important;
  border-color: var(--tc-gold-border) !important;
}
html.dark body .personal-workspace .status-tabs button.active {
  color: var(--tc-gold) !important;
  border-bottom-color: var(--tc-gold) !important;
}

/* Tables, Order Rows & Icons */
html.dark body .personal-workspace table,
html.dark body .personal-workspace td {
  color: var(--tc-ink-2) !important;
  border-color: var(--tc-border) !important;
}
html.dark body .personal-workspace thead,
html.dark body .personal-workspace th,
html.dark body .personal-workspace .order-head,
html.dark body .personal-workspace .table-head,
html.dark body .personal-workspace .column-head {
  background: #191e2b !important;
  color: var(--tc-ink-2) !important;
  border-color: var(--tc-border) !important;
}
html.dark body .personal-workspace tbody tr:hover,
html.dark body .personal-workspace .order-summary:hover,
html.dark body .personal-workspace .order.expanded {
  background: rgba(255, 255, 255, 0.035) !important;
}
html.dark body .personal-workspace .product-icon,
html.dark body .personal-workspace .metrics i,
html.dark body .personal-workspace .product-title i {
  background: rgba(245, 196, 81, 0.10) !important;
  border: 1px solid rgba(245, 196, 81, 0.25) !important;
  color: var(--tc-gold) !important;
}
html.dark body .personal-workspace .product-name small,
html.dark body .personal-workspace .product-title small,
html.dark body .personal-workspace .product-text small,
html.dark body .personal-workspace .details dt,
html.dark body .personal-workspace .details p,
html.dark body .personal-workspace .empty {
  color: var(--tc-ink-3) !important;
}

/* Charts & Tooltips */
html.dark body .personal-workspace .grid-line {
  stroke: rgba(255, 255, 255, 0.08) !important;
}
html.dark body .personal-workspace .axis-text,
html.dark body .personal-workspace .y-axis,
html.dark body .personal-workspace .bar-date,
html.dark body .personal-workspace .bar-value,
html.dark body .personal-workspace .chart-unit,
html.dark body .personal-workspace .chart-meta,
html.dark body .personal-workspace .chart-detail {
  fill: var(--tc-ink-3) !important;
  color: var(--tc-ink-3) !important;
}
html.dark body .personal-workspace .chart-line {
  stroke: var(--tc-gold) !important;
}
html.dark body .personal-workspace .chart-area {
  fill: rgba(245, 196, 81, 0.18) !important;
}
html.dark body .personal-workspace .chart-dot,
html.dark body .personal-workspace .point-value {
  fill: var(--tc-gold) !important;
  stroke: #0d0f14 !important;
}
html.dark body .personal-workspace .bar {
  background: linear-gradient(180deg, #f5c451 0%, #10b981 100%) !important;
  color: #0d0f14 !important;
}
html.dark body .personal-workspace .cursor-tooltip,
html.dark body .personal-workspace .chart-cursor-tooltip {
  background: #1b202e !important;
  border: 1px solid var(--tc-gold-border) !important;
  color: var(--tc-ink) !important;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.65) !important;
}

/* Tailwind utility safeguards inside /me/profile, /me/orders, /me/wallet, /me/api */
html.dark body .personal-workspace [class*="bg-white"],
html.dark body .personal-workspace [class*="bg-slate-50"],
html.dark body .personal-workspace [class*="bg-gray-50"],
html.dark body .personal-workspace [class*="bg-zinc-50"],
html.dark body .personal-workspace [class*="bg-background"] {
  background-color: var(--tc-card) !important;
}
html.dark body .personal-workspace [class*="bg-muted"] {
  background-color: #191e2b !important;
}
html.dark body .personal-workspace [class*="border-slate-"],
html.dark body .personal-workspace [class*="border-gray-"],
html.dark body .personal-workspace [class*="border-zinc-"] {
  border-color: var(--tc-border) !important;
}
html.dark body .personal-workspace .text-foreground,
html.dark body .personal-workspace [class*="text-slate-9"],
html.dark body .personal-workspace [class*="text-gray-9"],
html.dark body .personal-workspace [class*="text-zinc-9"] {
  color: var(--tc-ink) !important;
}
html.dark body .personal-workspace [class*="text-slate-6"],
html.dark body .personal-workspace [class*="text-slate-5"],
html.dark body .personal-workspace [class*="text-gray-6"],
html.dark body .personal-workspace [class*="text-gray-5"] {
  color: var(--tc-ink-3) !important;
}

/* Status pills inside affiliate orders */
html.dark body .personal-workspace .status {
  color: var(--tc-ink-2) !important;
}
html.dark body .personal-workspace .status.pending_confirm {
  color: var(--tc-gold) !important;
}
html.dark body .personal-workspace .status.available {
  color: var(--tc-green-bright) !important;
}
html.dark body .personal-workspace .status.withdrawn {
  color: #7dd3fc !important;
}
