/* T-FIRM-THEME (owner 11-21-2026): the firm's own colors in its workspace (.shell) and client portal (.tdp-shell).
   firm-theme.js sets data-df-theme / data-df-menu / data-df-tone and the --dft-* variables on <html> only while one of
   those screens is open and the firm chose something other than the DashFirm theme with the dark menu, so with no
   choice nothing here applies. Loaded last on both pages. Every color text sits on is checked by firm-theme.js
   (WCAG AA 4.5:1). Tones: gradient (two-tone), solid (one tone), pastel, gray. */

/* ===================== Firm workspace ===================== */
html[data-df-theme]{--accent:var(--dft-a);--accent2:var(--dft-tint);--td-violet:var(--dft-a);--td-blue:var(--dft-b);--td-cyan:var(--dft-c);--td-grad:var(--dft-grad)}
html[data-df-theme] .shell{--tdl-ink:var(--dft-icon)}
html[data-df-theme] .shell .btn:not(.secondary):not(.danger){background:var(--dft-a)}
html[data-df-theme] .shell .btn:not(.secondary):not(.danger):hover{background:var(--dft-hover)}
html[data-df-theme] .shell .field input:focus,html[data-df-theme] .shell .field textarea:focus,html[data-df-theme] .shell .field select:focus{border-color:var(--dft-a);box-shadow:0 0 0 3px var(--dft-ring)}
html[data-df-theme] .shell .badge.open,html[data-df-theme] .shell .badge.active{background:var(--dft-tint);color:var(--dft-tint-ink)}

/* Menu and rail */
html[data-df-theme] .shell>.side{background:var(--dft-side-bg);color:var(--dft-side-ink)}
html[data-df-theme] .shell>.rail{background:var(--dft-side-solid);color:var(--dft-side-ink)}
html[data-df-theme] .shell .side label,html[data-df-theme] .shell .side-nav>label[data-dfg]{color:var(--dft-side-muted)}
html[data-df-theme] .shell .side-nav>label[data-dfg]:hover{color:var(--dft-side-hover-ink);background:var(--dft-side-hover)}
html[data-df-theme] .shell .side .firm-name{color:var(--dft-side-ink)}
html[data-df-theme] .shell .side button{color:var(--dft-side-ink)}
html[data-df-theme] .shell .side button:hover:not(.active),html[data-df-theme] .shell .rail button:hover:not(.active){background:var(--dft-side-hover);color:var(--dft-side-hover-ink)}
html[data-df-theme] .shell .side button.active,html[data-df-theme] .shell .rail button.active{background:var(--dft-grad);color:#fff;box-shadow:0 8px 20px color-mix(in srgb,var(--dft-a) 28%,transparent)}
html[data-df-theme] .shell .side .bottom{border-top-color:var(--dft-side-line)}
html[data-df-theme] .shell .td-nav-badge{background:var(--dft-a);color:#fff;box-shadow:0 0 0 2px var(--dft-side-solid)}
html[data-df-theme] .shell .side button.active .td-nav-badge{background:#fff;color:var(--dft-a);box-shadow:none}
html[data-df-menu="light"] .shell>.side,html[data-df-menu="light"] .shell>.rail,html[data-df-menu="soft"] .shell>.side,html[data-df-menu="soft"] .shell>.rail{border-right:1px solid var(--dft-side-line)}
html[data-df-menu="light"] .shell .side button:hover:not(.active)>span:first-of-type,html[data-df-menu="soft"] .shell .side button:hover:not(.active)>span:first-of-type,
html[data-df-menu="light"] .shell .rail button:hover:not(.active)::before,html[data-df-menu="soft"] .shell .rail button:hover:not(.active)::before{background:var(--dft-side-hover-ink)}
/* The DashFirm wordmark is drawn for a dark menu: on a light menu it sits on a dark plate so it stays legible. */
html[data-df-menu="light"] .shell .side-logo,html[data-df-menu="soft"] .shell .side-logo{background:#0f172a;border-radius:10px;padding:8px 10px;box-sizing:border-box}

/* Dashboard metric cards */
html[data-df-theme] #content>.cards>.card.metric{background:var(--dft-m1);color:var(--dft-m-ink);box-shadow:0 10px 24px color-mix(in srgb,var(--dft-a) 16%,transparent)}
html[data-df-theme] #content>.cards>.card.metric:nth-child(2){background:var(--dft-m2)}
html[data-df-theme] #content>.cards>.card.metric:nth-child(3){background:var(--dft-m3)}
html[data-df-theme] #content>.cards>.card.metric:nth-child(4){background:var(--dft-m4)}
html[data-df-theme] #content>.cards>.card.metric strong{color:var(--dft-m-ink)}
html[data-df-theme] #content>.cards>.card.metric .label,html[data-df-theme] #content>.cards>.card.metric span{color:var(--dft-m-sub)}
html[data-df-tone="pastel"] #content>.cards>.card.metric,html[data-df-tone="gray"] #content>.cards>.card.metric{border:1px solid color-mix(in srgb,var(--dft-a) 14%,#fff)}
html[data-df-tone="pastel"] #content>.cards>.card.metric::after,html[data-df-tone="gray"] #content>.cards>.card.metric::after{background:color-mix(in srgb,var(--dft-a) 6%,transparent)}
/* One tone, pastel and gray: no glow behind the menu. */
html[data-df-tone="solid"] .shell .side button.active,html[data-df-tone="gray"] .shell .side button.active,html[data-df-tone="pastel"] .shell .side button.active{box-shadow:none}

/* ===================== Client portal ===================== */
html[data-df-theme] .tdp-shell{--tdp-grad:var(--dft-grad)}
html[data-df-theme] .tdp-side{background:var(--dft-side-bg);color:var(--dft-side-ink)}
html[data-df-theme] .tdp-side .tdp-brandbar.top{border-bottom-color:var(--dft-side-line)!important}
html[data-df-theme] .tdp-side .tdp-brandbar .portal-brand-copy strong{color:var(--dft-side-ink)}
html[data-df-theme] .tdp-side .tdp-brandbar .portal-brand-copy small{color:var(--dft-side-muted)}
html[data-df-theme] .tdp-pin{color:var(--dft-side-muted)}
html[data-df-theme] .tdp-pin:hover{background:var(--dft-side-hover);color:var(--dft-side-hover-ink)}
html[data-df-theme] .tdp-nav a{color:var(--dft-side-ink)}
html[data-df-theme] .tdp-nav a:hover{background:var(--dft-side-hover);color:var(--dft-side-hover-ink)}
html[data-df-theme] .tdp-nav a.active{background:var(--dft-grad);color:#fff;box-shadow:0 8px 20px color-mix(in srgb,var(--dft-a) 28%,transparent)}
html[data-df-theme] .tdp-nav a.active .tdp-badge-count{background:#fff;color:var(--dft-a)}
html[data-df-theme] .tdp-badge-count{background:var(--dft-a);color:#fff}
html[data-df-theme] .tdp-line-ico{--tdp-ink:var(--dft-icon)}
html[data-df-menu="light"] .tdp-nav a:hover .tdp-line-ico,html[data-df-menu="soft"] .tdp-nav a:hover .tdp-line-ico{background:var(--dft-side-hover-ink)}
html[data-df-theme] .tdp-side-foot .btn.secondary{background:transparent;border-color:var(--dft-side-line);color:var(--dft-side-ink)}
html[data-df-theme] .tdp-side-foot .btn.secondary:hover{background:var(--dft-side-hover)}
html[data-df-menu="light"] .tdp-side,html[data-df-menu="soft"] .tdp-side{box-shadow:inset -1px 0 0 var(--dft-side-line)}
html[data-df-theme] .tdp-main .btn:not(.secondary){background:var(--dft-a);box-shadow:none}
html[data-df-theme] .tdp-main .btn:not(.secondary):hover{background:var(--dft-hover);filter:none}
html[data-df-theme] .tdp-main .card.hero{background:var(--dft-grad);box-shadow:0 14px 32px color-mix(in srgb,var(--dft-a) 22%,transparent)}
html[data-df-tone="pastel"] .tdp-main .card.hero,html[data-df-tone="gray"] .tdp-main .card.hero{background:var(--dft-m1);color:var(--dft-m-ink);border:1px solid color-mix(in srgb,var(--dft-a) 14%,#fff)}
html[data-df-tone="pastel"] .tdp-main .card.hero p,html[data-df-tone="gray"] .tdp-main .card.hero p{color:var(--dft-m-sub)}
html[data-df-theme] .tdp-metric{background:var(--dft-m1);color:var(--dft-m-ink);--card-accent:var(--dft-a)}
html[data-df-theme] .tdp-metric:nth-child(2){background:var(--dft-m2)}
html[data-df-theme] .tdp-metric:nth-child(3){background:var(--dft-m3)}
html[data-df-theme] .tdp-metric:nth-child(4){background:var(--dft-m4)}
html[data-df-tone="pastel"] .tdp-metric,html[data-df-tone="gray"] .tdp-metric{border:1px solid color-mix(in srgb,var(--dft-a) 14%,#fff)}
html[data-df-theme] .tdp-metric small{color:var(--dft-m-sub)}
html[data-df-tone="pastel"] .tdp-metric-icon,html[data-df-tone="gray"] .tdp-metric-icon{background:#ffffffb3}
html[data-df-tone="pastel"] .tdp-metric .tdp-line-ico,html[data-df-tone="gray"] .tdp-metric .tdp-line-ico{background:var(--dft-a)}
html[data-df-theme] .tdp-dot.violet{background:var(--dft-a)}
html[data-df-theme] .tdp-dot.blue{background:var(--dft-b)}
html[data-df-theme] .tdp-dot.cyan{background:var(--dft-c)}

/* ===================== Themes card (Firm settings) ===================== */
.dft-card .dft-lead{margin:6px 0 14px;color:#5a6576;line-height:1.5}
.dft-group{border:0;padding:0;margin:0 0 16px}
.dft-group legend{font-weight:700;font-size:13px;margin-bottom:4px;padding:0}
.dft-sub{margin:12px 0 8px;font-size:12px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:#64748b}
.dft-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(128px,1fr));gap:10px}
.dft-menus{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:10px;max-width:560px}
.dft-opt{position:relative;display:flex;flex-direction:column;gap:6px;padding:9px;border:1px solid #dfe5ec;border-radius:12px;background:#fff;cursor:pointer;transition:border-color .15s ease,box-shadow .15s ease}
.dft-opt:hover{border-color:#b8c3d1}
.dft-opt>input[type="radio"]{position:absolute;opacity:0;pointer-events:none}
.dft-opt:has(>input[type="radio"]:checked){border-color:#0f172a;box-shadow:0 0 0 2px #0f172a}
.dft-opt:has(>input[type="radio"]:focus-visible){outline:3px solid #2563eb;outline-offset:2px}
.dft-opt:has(>input[type="radio"]:disabled){cursor:default}
.dft-opt b{font-size:13px}
.dft-opt small{position:absolute;top:13px;right:13px;background:#fff;border-radius:20px;padding:1px 7px;font-size:10.5px;font-weight:700;color:#334155}
.dft-sw{display:block;height:40px;border-radius:8px;border:1px solid #0000000f}
.dft-own input[type="color"]{width:100%;height:28px;padding:0 2px;border:1px solid #cfd7e2;border-radius:6px;background:#fff;cursor:pointer}
.dft-mini{display:block;height:40px;border-radius:8px;border:1px solid #e3e8ef}
.dft-mini-dark{background:linear-gradient(90deg,#1e293b 0 30%,#f5f7fa 30%)}
.dft-mini-light{background:linear-gradient(90deg,#fff 0 30%,#e3e8ef 30% calc(30% + 1px),#f5f7fa calc(30% + 1px))}
.dft-mini-soft{background:linear-gradient(90deg,#e6e9fb 0 30%,#f5f7fa 30%)}
.dft-check{display:flex;align-items:center;gap:8px;margin:0 0 12px;font-weight:600;font-size:13px;color:#334155}
.dft-check input{width:auto;margin:0}
.dft-note{margin:0 0 12px;color:#5a6576;font-size:13px}
.dft-note.dft-ok{color:#166534;font-weight:600}
.dft-note.dft-err{color:#b42318;font-weight:600}
.dft-actions{display:flex;flex-wrap:wrap;gap:10px}
@media(prefers-reduced-motion:reduce){.dft-opt{transition:none}}
