/* Stackt theme layer: high-contrast light/dark surfaces without changing product logic. */
html{color-scheme:light}
html[data-theme="dark"]{color-scheme:dark}

.theme-toggle{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  min-height:38px;
  white-space:nowrap;
}
.theme-icon{font-size:15px;line-height:1}
.theme-label{font-size:11px;font-weight:850;letter-spacing:.01em}

/* Extra visual depth shared by both themes. */
.page-title,.hero-panel>div:first-child{position:relative}
.page-title::before,.hero-panel>div:first-child::before{
  content:'';
  position:absolute;
  width:46px;
  height:3px;
  left:0;
  top:-10px;
  border-radius:999px;
  background:linear-gradient(90deg,var(--emerald),rgba(0,200,150,.12));
}
.content-card,.wallet-card,.obligation-card,.summary-grid article,.stat-grid article,.action-card,.workspace-card{
  transition:transform .18s ease,border-color .18s ease,box-shadow .18s ease,background-color .18s ease;
}
.content-card:hover,.wallet-card:hover,.obligation-card:hover,.summary-grid article:hover,.stat-grid article:hover{
  transform:translateY(-1px);
}
.section-head h2{letter-spacing:-.025em}
.list-row b,.claim-main b,.bucket-tree-main b{letter-spacing:-.01em}
.status,.status-chip{font-weight:850}

/* LIGHT: explicit semantic surfaces for stable contrast. */
html[data-theme="light"]{
  --ink:#0B0E14;
  --ink2:#232831;
  --paper:#F6F5F0;
  --card:#FFFFFF;
  --line:#E4E2DA;
  --muted:#5F635F;
  --emerald:#00C896;
  --emerald-dark:#067A5D;
  --mint:#E7FAF4;
  --amber-bg:#FFF5D8;
  --red:#A33B3B;
  --red-bg:#FBEAEA;
  --blue:#2E6DE6;
  --blue-bg:#EAF1FF;
}

/* DARK: all core text/surface tokens are replaced, then hard-coded light surfaces are neutralised below. */
html[data-theme="dark"]{
  --ink:#F5F8F6;
  --ink2:#D7DEDA;
  --paper:#0B0F0E;
  --card:#121816;
  --line:#29332F;
  --muted:#AEB9B4;
  --emerald:#2AD9AD;
  --emerald-dark:#7BE7C9;
  --mint:#143329;
  --amber:#F1BF47;
  --amber-bg:#332A13;
  --red:#FF9696;
  --red-bg:#351D20;
  --blue:#8CB7FF;
  --blue-bg:#172A46;
  --warm-gray:#171C1A;
  --brand-green-soft:#102920;
  --brand-green-line:#245440;
  --brand-surface-soft:#101513;
  --brand-ink-deep:#F5F8F6;
  --brand-emerald-bright:#4FE1BB;
  --brand-emerald-glow:rgba(42,217,173,.18);
  --brand-surface-luxe:#141A18;
  --brand-hairline:rgba(255,255,255,.09);
  --brand-shadow-soft:0 16px 42px rgba(0,0,0,.24);
  --brand-shadow-float:0 20px 54px rgba(0,0,0,.34);
}

html[data-theme="dark"] body{
  color:#F5F8F6;
  background:
    radial-gradient(circle at 14% -8%,rgba(42,217,173,.10),transparent 28rem),
    radial-gradient(circle at 90% 8%,rgba(16,119,91,.10),transparent 25rem),
    #0B0F0E;
}
html[data-theme="dark"] .app-header{
  background:rgba(11,15,14,.88);
  border-bottom-color:rgba(255,255,255,.08);
  box-shadow:0 10px 32px rgba(0,0,0,.18);
}
html[data-theme="dark"] .brand-lockup b,
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] b,
html[data-theme="dark"] strong,
html[data-theme="dark"] label,
html[data-theme="dark"] .form-grid label,
html[data-theme="dark"] .form-grid fieldset{
  color:#F5F8F6;
}
html[data-theme="dark"] .muted,
html[data-theme="dark"] .page-title>p,
html[data-theme="dark"] .hero-panel>div>p,
html[data-theme="dark"] .setup-shell>p,
html[data-theme="dark"] .list-row span,
html[data-theme="dark"] .section-head p,
html[data-theme="dark"] .claim-note,
html[data-theme="dark"] .budget-line span,
html[data-theme="dark"] .wallet-card span,
html[data-theme="dark"] .wallet-card small,
html[data-theme="dark"] .obligation-numbers span,
html[data-theme="dark"] .bucket-tree-main span:not(.bucket-tree-mark),
html[data-theme="dark"] .summary-grid span,
html[data-theme="dark"] .stat-grid span,
html[data-theme="dark"] .action-card span{
  color:#AEB9B4!important;
}
html[data-theme="dark"] a{color:#7BE7C9}

html[data-theme="dark"] .content-card,
html[data-theme="dark"] .action-card,
html[data-theme="dark"] .summary-grid article,
html[data-theme="dark"] .stat-grid article,
html[data-theme="dark"] .workspace-card,
html[data-theme="dark"] .wallet-card,
html[data-theme="dark"] .obligation-card,
html[data-theme="dark"] .inset-card{
  background:linear-gradient(180deg,#151C19 0%,#111614 100%);
  border-color:rgba(255,255,255,.085);
  color:#F5F8F6;
  box-shadow:0 14px 38px rgba(0,0,0,.18);
}
html[data-theme="dark"] .content-card:hover,
html[data-theme="dark"] .action-card:hover,
html[data-theme="dark"] .wallet-card:hover,
html[data-theme="dark"] .obligation-card:hover{
  border-color:rgba(42,217,173,.24);
  box-shadow:0 18px 44px rgba(0,0,0,.25);
}
html[data-theme="dark"] .workspace-card.business{
  background:linear-gradient(145deg,#0A0E0D 0%,#10231D 100%);
}
html[data-theme="dark"] .workspace-card small{color:#AEB9B4}
html[data-theme="dark"] .workspace-card.business small{color:#C3CDC8}
html[data-theme="dark"] .workspace-card em{color:#7BE7C9}

html[data-theme="dark"] .hero-number{
  background:linear-gradient(145deg,#050807 0%,#0C1713 58%,#103128 100%);
  border-color:rgba(123,231,201,.16);
  box-shadow:0 24px 58px rgba(0,0,0,.38);
}
html[data-theme="dark"] .hero-number span,
html[data-theme="dark"] .hero-number small{color:#BAC7C1}
html[data-theme="dark"] .hero-number strong{color:#FFFFFF}

html[data-theme="dark"] .wallet-card.protected{
  background:linear-gradient(145deg,#112A21 0%,#15372B 100%);
  border-color:#285B47;
  box-shadow:inset 3px 0 0 #2AD9AD,0 10px 24px rgba(0,0,0,.18);
}
html[data-theme="dark"] .obligation-numbers div{
  background:#171E1B;
  border-color:#2D3934;
}

html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select,
html[data-theme="dark"] .header-controls select,
html[data-theme="dark"] .form-grid input,
html[data-theme="dark"] .form-grid textarea,
html[data-theme="dark"] .form-grid select,
html[data-theme="dark"] .inline-form input,
html[data-theme="dark"] .onboarding-wrap .field input,
html[data-theme="dark"] .onboarding-wrap .field select{
  background:#151B19;
  border-color:#34423C;
  color:#F5F8F6;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.035);
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder{color:#84918B;opacity:1}
html[data-theme="dark"] select option{background:#151B19;color:#F5F8F6}
html[data-theme="dark"] input:hover,
html[data-theme="dark"] textarea:hover,
html[data-theme="dark"] select:hover{background:#19221E;border-color:#486057}
html[data-theme="dark"] input:focus,
html[data-theme="dark"] textarea:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] select:focus-visible{
  background:#17211D;
  border-color:#2AD9AD;
  color:#FFFFFF;
  box-shadow:0 0 0 4px rgba(42,217,173,.13),0 8px 20px rgba(0,0,0,.16);
}
html[data-theme="dark"] select:disabled,
html[data-theme="dark"] input:disabled{background:#101513;color:#7E8A84}

html[data-theme="dark"] .btn{
  background:#171E1B;
  border-color:#36423D;
  color:#F5F8F6;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04);
}
html[data-theme="dark"] .btn:hover{background:#1E2924;border-color:#50655C}
html[data-theme="dark"] .btn.primary,
html[data-theme="dark"] .debt-row .btn,
html[data-theme="dark"] button[data-pay]{
  background:linear-gradient(180deg,#F6F8F7 0%,#DEE5E1 100%);
  border-color:#F5F8F6;
  color:#0B0F0E;
  box-shadow:0 8px 20px rgba(0,0,0,.22);
}
html[data-theme="dark"] .btn.primary:hover,
html[data-theme="dark"] .debt-row .btn:hover,
html[data-theme="dark"] button[data-pay]:hover{background:#FFFFFF;border-color:#FFFFFF;color:#070A09}
html[data-theme="dark"] .btn.ghost{background:transparent;color:#EAF0ED}
html[data-theme="dark"] .btn.ghost:hover{background:rgba(42,217,173,.08);border-color:rgba(123,231,201,.27)}
html[data-theme="dark"] .btn.danger{background:#241417;border-color:#6E353C;color:#FFACAC}
html[data-theme="dark"] .btn.danger:hover{background:#351D20;border-color:#8F4850}

html[data-theme="dark"] .tab-strip button{
  background:#141A18;
  border-color:#33403A;
  color:#DDE5E1;
  box-shadow:none;
}
html[data-theme="dark"] .tab-strip button:hover{background:#1A2420;border-color:#49705F;color:#FFFFFF}
html[data-theme="dark"] .tab-strip button.active{
  background:linear-gradient(180deg,#168565 0%,#0E674F 100%);
  border-color:#2AD9AD;
  color:#FFFFFF;
  box-shadow:0 8px 18px rgba(0,0,0,.22),inset 0 1px 0 rgba(255,255,255,.10);
}

html[data-theme="dark"] .progress{background:#26312C;box-shadow:inset 0 1px 2px rgba(0,0,0,.34)}
html[data-theme="dark"] .progress i{background:linear-gradient(90deg,#27C99F 0%,#55E5BE 100%)}
html[data-theme="dark"] .bucket-tree-row:hover,
html[data-theme="dark"] .list-row:hover,
html[data-theme="dark"] .budget-line:hover,
html[data-theme="dark"] .claim-card:hover{background:rgba(42,217,173,.035)}
html[data-theme="dark"] .bucket-tree-row .icon-btn:hover{background:#193027;border-color:#2D5A49;color:#7BE7C9}

html[data-theme="dark"] .status.good,
html[data-theme="dark"] .status-chip{background:#15372B;color:#91E9D1!important}
html[data-theme="dark"] .status.info{background:#172A46;color:#A8C9FF}
html[data-theme="dark"] .status.bad{background:#351D20;color:#FFAEAE}
html[data-theme="dark"] .status.neutral{background:#292E2B;color:#D2D9D5}
html[data-theme="dark"] .status.warn,
html[data-theme="dark"] .obligation-card .status.neutral,
html[data-theme="dark"] .claim-card .status.neutral{background:#332A13;color:#FFD77A}
html[data-theme="dark"] .claim-flag{background:#332A13;color:#FFD77A;border-color:#5B481E}
html[data-theme="dark"] .notice{background:#332A13;border-color:#5D4A20;color:#F5F8F6}
html[data-theme="dark"] .notice span{color:#E6D39B}
html[data-theme="dark"] .notice.good{background:#15372B;border-color:#285B47}
html[data-theme="dark"] .notice.good span{color:#B8E6D7}
html[data-theme="dark"] .error-text{background:#351D20;color:#FFB2B2}

html[data-theme="dark"] .empty-mini{
  background:linear-gradient(180deg,#121916 0%,#0F1513 100%);
  border-color:#35423C;
  color:#AEB9B4;
}
html[data-theme="dark"] .legal-box{
  background:linear-gradient(180deg,#171D1A 0%,#131816 100%);
  border-color:#313B37;
}
html[data-theme="dark"] .legal-box p{color:#C1CBC6}

html[data-theme="dark"] .modal-backdrop{background:rgba(0,0,0,.70)}
html[data-theme="dark"] .modal-card{
  background:linear-gradient(180deg,#171D1A 0%,#101513 100%);
  border-color:#34413B;
  color:#F5F8F6;
  box-shadow:0 32px 90px rgba(0,0,0,.52),0 0 0 1px rgba(255,255,255,.035);
}

html[data-theme="dark"] .bottom-nav{
  background:rgba(5,8,7,.95);
  border-color:rgba(255,255,255,.10);
  box-shadow:0 20px 52px rgba(0,0,0,.48),inset 0 1px 0 rgba(255,255,255,.05);
}
html[data-theme="dark"] .nav-button{color:#9EAAA4}
html[data-theme="dark"] .nav-button:hover{color:#FFFFFF;background:rgba(255,255,255,.05)}
html[data-theme="dark"] .nav-button.active{
  background:linear-gradient(180deg,#173027 0%,#10241D 100%);
  color:#FFFFFF;
  box-shadow:inset 0 0 0 1px rgba(42,217,173,.20),0 6px 16px rgba(0,0,0,.24);
}
html[data-theme="dark"] .nav-button.active span{color:#4FE1BB}

html[data-theme="dark"] .eyebrow{
  background:rgba(42,217,173,.09);
  color:#7BE7C9;
}
html[data-theme="dark"] .action-card::after{background:rgba(42,217,173,.10);color:#7BE7C9}
html[data-theme="dark"] .toast{background:#EEF4F1;color:#0B0F0E;border-color:rgba(255,255,255,.12)}
html[data-theme="dark"] .toast.error{background:#FF9C9C;color:#26080A}

@media(max-width:760px){
  .header-controls{grid-template-columns:minmax(0,1fr) auto auto!important}
  #workspace-switch{grid-column:1!important;grid-row:1!important}
  #theme-toggle{grid-column:2!important;grid-row:1!important;min-height:44px;padding:9px 11px}
  #account-button{grid-column:3!important;grid-row:1!important}
  #company-switch{grid-column:1/-1!important;grid-row:2!important}
  #member-switch{grid-column:1/-1!important;grid-row:3!important}
  .theme-label{display:none}
  .theme-toggle{min-width:44px}
}

@media(max-width:390px){
  #theme-toggle,#account-button{padding-left:9px;padding-right:9px}
}

@media(prefers-reduced-motion:reduce){
  .content-card,.wallet-card,.obligation-card,.summary-grid article,.stat-grid article,.action-card,.workspace-card{transform:none!important}
}
