/* TidyOne V13.4 — global theme, motion and premium scrollbars */
:root{
  --tidy-scroll-thumb:rgba(100,116,139,.48);
  --tidy-scroll-thumb-hover:rgba(71,85,105,.72);
}

/* Elegant scrollbars everywhere in the app. */
*{scrollbar-width:thin!important;scrollbar-color:var(--tidy-scroll-thumb) transparent!important}
*::-webkit-scrollbar{width:9px!important;height:9px!important}
*::-webkit-scrollbar-track{background:transparent!important;border-radius:999px!important;margin:7px!important}
*::-webkit-scrollbar-thumb{background:var(--tidy-scroll-thumb)!important;border:2px solid transparent!important;background-clip:padding-box!important;border-radius:999px!important}
*::-webkit-scrollbar-thumb:hover{background:var(--tidy-scroll-thumb-hover)!important;background-clip:padding-box!important}

/* Subtle but visible motion for interactive controls. `scale` does not overwrite existing transforms. */
button,.btn,[role="button"],.mnx-navlink,.link-card,.tab-btn,.v8-tab,.doc-card-action,.gallery-action,.gallery-zoom-btn{
  transition:background-color .18s ease,border-color .18s ease,color .18s ease,box-shadow .18s ease,filter .18s ease,scale .16s ease,opacity .18s ease!important;
}
button:not(:disabled):hover,.btn:not(:disabled):hover,[role="button"]:not([aria-disabled="true"]):hover,.link-card:hover,.tab-btn:hover,.v8-tab:hover,.doc-card-action:hover,.gallery-action:hover,.gallery-zoom-btn:hover{scale:1.015;filter:brightness(1.025)}
button:not(:disabled):active,.btn:not(:disabled):active,[role="button"]:not([aria-disabled="true"]):active,.link-card:active,.tab-btn:active,.v8-tab:active,.doc-card-action:active,.gallery-action:active,.gallery-zoom-btn:active{scale:.975;filter:brightness(.985)}
button:focus-visible,.btn:focus-visible,[role="button"]:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:2px solid #60A5FA!important;outline-offset:2px!important}
@media(prefers-reduced-motion:reduce){button,.btn,[role="button"],.mnx-navlink,.link-card,.tab-btn,.v8-tab,.doc-card-action,.gallery-action,.gallery-zoom-btn{transition:none!important;scale:1!important}}

/* Theme toggle used in Settings. */
.tidy-theme-toggle{display:inline-flex;align-items:center;gap:10px;min-height:42px;padding:8px 12px;border:1px solid var(--border,#E2E8F0);border-radius:12px;background:var(--surface,#fff);color:var(--navy,#0F172A);font:800 12px Inter,sans-serif;cursor:pointer;box-shadow:0 6px 18px rgba(15,23,42,.06)}
.tidy-theme-toggle .theme-switch-track{width:42px;height:24px;border-radius:999px;background:#CBD5E1;padding:3px;display:flex;align-items:center;transition:.2s ease}
.tidy-theme-toggle .theme-switch-dot{width:18px;height:18px;border-radius:50%;background:#fff;box-shadow:0 2px 7px rgba(15,23,42,.22);transition:transform .2s ease}
html[data-theme="dark"] .tidy-theme-toggle .theme-switch-track{background:linear-gradient(135deg,#2563EB,#4F8DFF)}
html[data-theme="dark"] .tidy-theme-toggle .theme-switch-dot{transform:translateX(18px);background:#EAF2FF}

html[data-theme="dark"]{
  color-scheme:dark;
  --navy:#E8F0FA;
  --navy-light:#CAD7E6;
  --blue:#64A5FF;
  --blue-light:#102A49;
  --teal:#2DD4BF;
  --green:#4ADE80;
  --green-light:#103928;
  --red:#FB7185;
  --red-light:#3A1721;
  --purple:#B18CFF;
  --purple-light:#2B1D49;
  --amber:#FBBF24;
  --bg:#07111F;
  --surface:#0D1B2A;
  --border:#21364D;
  --text-sec:#9AAEC3;
  --muted:#9AAEC3;
  --soft:#102237;
  --amber-light:#3A2A12;
  --purpleSoft:#2B1D49;
  --blueSoft:#102A49;
  --shadow-sm:0 0 0 1px rgba(100,165,255,.05),0 5px 16px rgba(0,0,0,.15);
  --shadow-md:0 0 0 1px rgba(100,165,255,.07),0 12px 28px rgba(0,0,0,.24);
  --shadow-lg:0 0 0 1px rgba(100,165,255,.08),0 20px 50px rgba(0,0,0,.34);
  --mn-nav-blue:#64A5FF;
  --mn-nav-blue-light:#102A49;
  --mn-nav-purple:#B18CFF;
  --mn-nav-purple-light:#2B1D49;
  --mn-nav-navy:#E8F0FA;
  --mn-nav-muted:#9AAEC3;
  --mn-nav-border:#21364D;
  --mn-nav-surface:#0B1827;
  --tidy-scroll-thumb:rgba(100,165,255,.38);
  --tidy-scroll-thumb-hover:rgba(118,178,255,.68);
}
html[data-theme="dark"] body{background:radial-gradient(circle at 78% -15%,rgba(37,99,235,.12),transparent 33%),linear-gradient(180deg,#07111F,#081522)!important;color:var(--navy)!important}
html[data-theme="dark"] .main-content{color:var(--navy)}
html[data-theme="dark"] #mn-desktop-nav,html[data-theme="dark"] #mn-mobile-nav,html[data-theme="dark"] #mnx-page-brand{background:rgba(9,23,38,.97)!important;border-color:var(--border)!important;box-shadow:none!important}
html[data-theme="dark"] .mnx-logo,html[data-theme="dark"] .mnx-page-brand-home,html[data-theme="dark"] .mnx-page-org-name,html[data-theme="dark"] .mnx-profile-btn{color:var(--navy)!important}
html[data-theme="dark"] .mnx-switch,html[data-theme="dark"] #mn-mobile-workspace-switch{background:#0E2135!important;border-color:#263D56!important;box-shadow:none!important}
html[data-theme="dark"] .mnx-switch .ws-btn.active-personal,html[data-theme="dark"] #mn-mobile-workspace-switch .ws-btn.active-personal{background:#142A42!important;color:#86B9FF!important;box-shadow:inset 0 0 0 1px rgba(100,165,255,.16)!important}
html[data-theme="dark"] .mnx-navlink:hover,html[data-theme="dark"] .mnx-profile-btn:hover,html[data-theme="dark"] .mnx-profile-menu a:hover,html[data-theme="dark"] .mnx-profile-menu button:hover{background:#102237!important;color:#EDF5FF!important}
html[data-theme="dark"] .mnx-profile{background:linear-gradient(180deg,rgba(9,23,38,.92),#091726 28%)!important;border-color:var(--border)!important;box-shadow:0 -12px 28px rgba(0,0,0,.18)!important}
html[data-theme="dark"] .mnx-profile-menu,html[data-theme="dark"] .mnx-sheet,html[data-theme="dark"] .mnx-share-sheet,html[data-theme="dark"] .mnx-quick-card{background:#0D1B2A!important;border-color:var(--border)!important;color:var(--navy)!important}

html[data-theme="dark"] :is(.card,.v8-card,.v8-item,.list,.link-card,.stat-card,.summary-card,.metric-card,.chart-card,.chart-container,.panel,.top-action-bar,.doc-card,.profile-summary,.modal-box,.modal-card,.modal-overlay>.modal,.doc-share-sheet,.ai-review-center,.ai-review-item,.ai-review-warnings,.upload-zone,.single-beneficiary-profile,.plan-card,.upcoming-card,.transaction-list,.article,.member,.contact-card,.debt,.fund-row,.beneficiary-link-row,.addon-family,.plan,.guide-item,.form-container,.preview,.preview-main,.fake-card,.footer){
  background:linear-gradient(180deg,#0E1E30,#0C1928)!important;
  color:var(--navy)!important;
  border-color:var(--border)!important;
  box-shadow:0 0 0 1px rgba(100,165,255,.025),0 12px 28px rgba(0,0,0,.18)!important;
}
html[data-theme="dark"] :is(.v8-empty,.empty,.row.header,.quick,.composer,.v8-chat){background:#0A1726!important;color:var(--navy)!important;border-color:var(--border)!important}
html[data-theme="dark"] :is(input,select,textarea,.form-control,.input,.select,.v8-input,.mnx-quick-input){background:#091725!important;color:#EAF2FC!important;border-color:#29435F!important;box-shadow:none}
html[data-theme="dark"] :is(input,textarea)::placeholder{color:#71879D!important}
html[data-theme="dark"] :is(input,select,textarea,.form-control,.input,.select,.v8-input,.mnx-quick-input):focus{border-color:#5EA3FF!important;box-shadow:0 0 0 3px rgba(94,163,255,.14)!important}
html[data-theme="dark"] :is(.btn-outline,.btn-light,.v8-tab,.doc-smart-btn,.quick button,.gallery-action:not(.primary):not(.danger)){background:#102237!important;color:#DDEAFF!important;border-color:#29435F!important}
html[data-theme="dark"] :is(.btn-outline,.btn-light,.v8-tab,.quick button):hover{background:#142B44!important;border-color:#3B5D7F!important}
html[data-theme="dark"] .btn-primary,html[data-theme="dark"] .mnx-add{background:linear-gradient(135deg,#347FF4,#205BC8)!important;box-shadow:0 8px 22px rgba(37,99,235,.18)!important}
html[data-theme="dark"] .mn-association .btn-primary{background:linear-gradient(135deg,#8B5CF6,#6D3DCE)!important}
html[data-theme="dark"] :is(.page-head p,.header p,.v8-muted,.text-muted,.sub,.privacy-note,.doc-meta-line,.gallery-detail,.metric-label,.link-card small){color:var(--text-sec)!important}
html[data-theme="dark"] :is(.badge,.badge-ws,.v8-chip,.doc-meta-pill){border-color:#29435F!important}
html[data-theme="dark"] .bubble.ai{background:#102237!important;color:#E8F0FA!important}
html[data-theme="dark"] .bubble.system{background:#322313!important;color:#FCD9A5!important;border-color:#5A3C1C!important}
html[data-theme="dark"] .composer{background:rgba(10,23,38,.94)!important;border-color:#29435F!important;box-shadow:0 16px 42px rgba(0,0,0,.34),0 0 0 1px rgba(100,165,255,.06)!important}
html[data-theme="dark"] .gallery-side{background:linear-gradient(180deg,rgba(9,21,35,.96),rgba(7,17,31,.98))!important}
html[data-theme="dark"] .gallery-side-scroll{background:transparent!important}
html[data-theme="dark"] .doc-preview-info{background:linear-gradient(180deg,rgba(7,17,31,0),rgba(7,17,31,.28) 20%,rgba(7,17,31,.83) 65%,rgba(7,17,31,.96))!important}
html[data-theme="dark"] .v8-progress{background:#13263B!important}
html[data-theme="dark"] hr{border-color:var(--border)!important}
html[data-theme="dark"] a:not(.btn):not(.mnx-navlink):not(.mnx-logo):not(.mnx-page-brand-home){color:#7CB5FF}

/* Public/auth/onboarding surfaces also follow the saved preference. */
html[data-theme="dark"] :is(.form-side,.step,.choice-card,.price-tile,.ong-mode-card,.summary-box,.motivational,.topbar,.wrap .callout,.wrap .callout-sensitive){background:#0D1B2A!important;color:var(--navy)!important;border-color:var(--border)!important;box-shadow:0 0 0 1px rgba(100,165,255,.035),0 14px 34px rgba(0,0,0,.2)!important}
html[data-theme="dark"] .brand-side{background:linear-gradient(145deg,#07111F,#0D2B55 58%,#174C94)!important}
html[data-theme="dark"] :is(.btn-social,.auth-mode-tab,.password-help,.price-tile.disabled){background:#102237!important;color:var(--navy)!important;border-color:#29435F!important}
html[data-theme="dark"] .auth-mode-tab.active{background:#173456!important;color:#8FC0FF!important}
html[data-theme="dark"] :is(.choice-card p,.price-tile-label,.footer-text,.updated,.wrap p,.wrap li){color:var(--text-sec)!important}
html[data-theme="dark"] .choice-card ul li{color:#C7D4E2!important}
html[data-theme="dark"] .summary-row{color:#A7F3D0!important}
html[data-theme="dark"] .motivational{color:#BFD9FF!important;background:#0D2745!important}
html[data-theme="dark"] .bubble.sources{background:#0B1A2A!important;color:#9FB2C8!important;border-color:#29435F!important}

html[data-theme="dark"] :is(.sidebar,.sidebar-workspace-switcher,.more-org-switch,.billing-toggle){background:#0B1827!important;border-color:var(--border)!important;color:var(--navy)!important;box-shadow:none!important}
html[data-theme="dark"] :is(.doc-share-options button,.icon-btn,.chip-btn,.mini,.control){background:#102237!important;color:#DDEAFF!important;border-color:#29435F!important}
html[data-theme="dark"] :is(.notice,.quick-note){background:#0D2745!important;color:#BFD9FF!important;border-color:#234A70!important}
html[data-theme="dark"] :is(.warning,.consent){background:#321B20!important;color:#FFD5DD!important;border-color:#64303D!important}

/* =========================================================
   V13.4.1 — dark-mode completeness & review polish
   ========================================================= */
html[data-theme="dark"] :is(
  .metric,.filter,.workspace,.price-card,.pay-card,.beneficiary-item,.case-item,.event,
  .row,.detail-empty,.white,.plan-group,.bundle-card,.bundle-box,.usage,.addon,.contract-option,
  .source-note,.legal-note,.addon-explain,.ai-credit,.mnx-action,.v13-create-box,.ai-review-original,
  .ai-review-actions,.ai-review-total,.project-card,.project-summary,.project-panel,.case-card,
  .beneficiary-card,.report-card,.report-panel,.donor-card,.stats-card,.stat,.stat-box
){
  background:linear-gradient(180deg,#0E1E30,#0B1928)!important;
  color:#E8F0FA!important;
  border-color:#29435F!important;
  box-shadow:0 0 0 1px rgba(100,165,255,.035),0 12px 26px rgba(0,0,0,.18)!important;
}
html[data-theme="dark"] :is(.metric span,.bundle-box span,.addon-detail,.feature,.contract-item,.limit-row span,.plan-details summary,.source-note,.legal-note,.addon-explain,.mnx-action small){color:#9FB2C8!important}
html[data-theme="dark"] :is(.metric strong,.bundle-box strong,.feature strong,.limit-row strong,.plan-group h3,.plan h4,.addon h3,.contract-option strong,.mnx-action strong){color:#EAF2FC!important}
html[data-theme="dark"] :is(.billing-toggle button,.chip-btn,.filter,.type,.money-pill,.state-pill.off,.close,.mnx-sheet-close){background:#102237!important;color:#DDEAFF!important;border-color:#29435F!important;box-shadow:none!important}
html[data-theme="dark"] .billing-toggle button.active{background:linear-gradient(135deg,#2768C8,#6D49D8)!important;color:#fff!important;border-color:#4C7FC5!important}
html[data-theme="dark"] .plan.current{border-color:#6B8EFF!important;box-shadow:0 0 0 2px rgba(100,165,255,.16)!important}
html[data-theme="dark"] .plan.pro{background:linear-gradient(180deg,#10233A,#0D1B2C)!important}
html[data-theme="dark"] .bundle-card{background:linear-gradient(135deg,#102642,#171F45)!important;border-color:#385A8C!important}
html[data-theme="dark"] .bundle-box{background:rgba(12,30,49,.78)!important;border-color:#31557A!important}
html[data-theme="dark"] .addon-explain{background:#0D2745!important;color:#BFD9FF!important;border-color:#234A70!important}
html[data-theme="dark"] .addon-family-head span{background:#382B12!important;color:#FDE68A!important}
html[data-theme="dark"] .addon-icon{background:#241C42!important;color:#C4B5FD!important}
html[data-theme="dark"] .addon-gain{background:#0D2745!important;color:#A9D2FF!important}
html[data-theme="dark"] .saving{background:#103424!important;color:#9FF1BE!important}
html[data-theme="dark"] .state-pill{background:#103424!important;color:#9FF1BE!important}
html[data-theme="dark"] .bar{background:#13263B!important}
html[data-theme="dark"] .limit-row{border-bottom-color:#29435F!important}
html[data-theme="dark"] .ai-credit{background:#211A3D!important;border-color:#4B3E71!important}
html[data-theme="dark"] .source-note,html[data-theme="dark"] .legal-note{background:#0A1726!important}

/* Add / Quick-add sheet */
html[data-theme="dark"] .mnx-action{background:#0E2033!important;border-color:#29435F!important;color:#EAF2FC!important}
html[data-theme="dark"] .mnx-action:hover{background:#142B44!important;border-color:#49739E!important}
html[data-theme="dark"] .mnx-action-ico{background:#173657!important;color:#8EC1FF!important}
html[data-theme="dark"] .mn-association .mnx-action-ico{background:#2B214C!important;color:#C4A7FF!important}
html[data-theme="dark"] .mnx-sheet-close{background:#13263B!important;color:#DDEAFF!important}
html[data-theme="dark"] .mnx-org-name{background:#171D3A!important;color:#C6B5FF!important;border-color:#493E71!important}
html[data-theme="dark"] .mnx-org-select{background:#0E2033!important;color:#D4C7FF!important;border-color:#493E71!important}

/* AI review: keep quick-create controls aligned with their selects. */
.v13-inline-row{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;gap:8px!important;align-items:stretch!important}
.v13-inline-row>select{width:100%!important;min-width:0!important;margin-bottom:0!important}
.v13-mini-btn{min-height:46px!important;height:46px!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;padding:0 13px!important;border-radius:11px!important;line-height:1!important;box-sizing:border-box!important}
@media(max-width:520px){
  .v13-inline-row{grid-template-columns:minmax(0,1fr) auto!important;gap:7px!important}
  .v13-mini-btn{width:auto!important;min-width:74px!important;padding:0 10px!important;font-size:11px!important}
}
html[data-theme="dark"] .v13-mini-btn{background:#201A3D!important;color:#CBB9FF!important;border-color:#4D3F79!important;box-shadow:none!important}
html[data-theme="dark"] .v13-mini-btn:hover{background:#2A2250!important;border-color:#69579F!important}
html[data-theme="dark"] .v13-create-box{background:#101C2D!important;border-color:#4D3F79!important}
html[data-theme="dark"] .v13-ai-explain{background:#0D2745!important;border-color:#234A70!important;color:#BFD9FF!important}
html[data-theme="dark"] .v13-intake-badge{background:#201A3D!important;color:#CBB9FF!important}
html[data-theme="dark"] .ai-review-original{background:#0A1726!important;border-color:#29435F!important}
html[data-theme="dark"] .ai-review-warnings{background:#332A14!important;border-color:#6A5622!important;color:#F7D98A!important}
html[data-theme="dark"] .ai-review-warnings strong{color:#FFE6A6!important}
html[data-theme="dark"] .ai-review-item.low-confidence .form-control{background:#2C2515!important;border-color:#B88722!important;color:#FFF1C9!important}
html[data-theme="dark"] .ai-review-item.low-confidence::before{color:#F5C451!important}
html[data-theme="dark"] .ai-review-actions{background:#0D1B2A!important;border-color:#29435F!important;box-shadow:0 -12px 28px rgba(0,0,0,.18)!important}

/* Keep dark UI calm: replace bright white hover surfaces with blue/navy layers. */
html[data-theme="dark"] :is(.chip-btn.active,.type,.money-pill){background:#132A42!important;color:#BFD9FF!important;border-color:#31557A!important}
html[data-theme="dark"] .empty{background:#0B1928!important;border-color:#31506D!important;color:#9FB2C8!important}
html[data-theme="dark"] .mnx-quick-scan-card{background:#0D1B2A!important;border-color:#29435F!important;color:#EAF2FC!important;box-shadow:0 24px 70px rgba(0,0,0,.38)!important}
html[data-theme="dark"] .mnx-quick-scan-actions>button{background:#0E2033!important;color:#EAF2FC!important;border-color:#29435F!important}
html[data-theme="dark"] .mnx-quick-scan-actions>button:hover{background:#142B44!important;border-color:#49739E!important}
html[data-theme="dark"] .mnx-quick-scan-actions small{color:#9FB2C8!important}
html[data-theme="dark"] .mnx-quick-scan-status{background:#0D2745!important;color:#BFD9FF!important;border-color:#234A70!important}
html[data-theme="dark"] .chip{background:#17233F!important;color:#B9C9FF!important;border:1px solid #334C70!important}
html[data-theme="dark"] #notice.status{background:#0D2745!important;color:#BFD9FF!important;border:1px solid #234A70!important}
html[data-theme="dark"] .plan-details summary:after{color:#9FB2C8!important}
html[data-theme="dark"] .sub{border-color:#29435F!important}
html[data-theme="dark"] .share-url{background:#102237!important;color:#DDEAFF!important;border-color:#29435F!important}


/* =========================================================
   V13.4.2 — Document page dark-mode completion
   ========================================================= */
html[data-theme="dark"] :is(
  .v12-toolbar,.v12-modal-card,.v12-desktop-guide,.v12-email-field,.v12-card-menu,.v12-doc-empty,
  .doc-share-sheet,.doc-share-options button,.gallery-side,.gallery-ai-box,.gallery-action,
  .v13-ong-doc-context,.v12-pagination button
){border-color:#29435F!important}
html[data-theme="dark"] .doc-share-sheet{background:#0D1B2A!important;color:#EAF2FC!important;box-shadow:0 24px 70px rgba(0,0,0,.42)!important}
html[data-theme="dark"] .doc-share-sheet strong{color:#F0F6FF!important}
html[data-theme="dark"] .doc-share-options button{background:#102237!important;color:#EAF2FC!important;border-color:#29435F!important}
html[data-theme="dark"] .doc-share-options button:hover{background:#17314D!important;border-color:#49739E!important}
html[data-theme="dark"] .gallery-side{background:rgba(7,18,31,.96)!important;border-color:#29435F!important}
html[data-theme="dark"] .gallery-ai-box{background:#0D2745!important;border-color:#234A70!important;color:#D9E9FA!important}
html[data-theme="dark"] .gallery-action{background:#102237!important;color:#EAF2FC!important;border-color:#36536F!important}
html[data-theme="dark"] .gallery-action:hover{background:#17314D!important;border-color:#557DA7!important}
html[data-theme="dark"] .gallery-action.primary{background:linear-gradient(135deg,#2388D6,#315FE1)!important;border-color:transparent!important}
html[data-theme="dark"] .gallery-action.danger{background:#351923!important;color:#FFC0CB!important;border-color:#66313E!important}
