:root{font-family:"Segoe UI",system-ui,sans-serif;color:#202b3c;background:#f2f5fa;font-size:15px;line-height:1.55;--blue:#075caa;--muted:#53647b;--line:#dce3ed}*{box-sizing:border-box}body{margin:0}button,input{font:inherit}button,a,input,summary{-webkit-tap-highlight-color:transparent}button,summary{cursor:pointer}button{border-radius:6px;border:1px solid #c9d3df;padding:9px 15px;min-height:42px;background:white;color:#20314a;font-weight:600}button:hover{background:#eaf2fb}button:active{transform:translateY(1px)}:focus-visible{outline:3px solid #1267b9;outline-offset:3px}a{color:var(--blue)}h1,h2,h3,p{margin:0}h1{font-size:34px;line-height:1.25;letter-spacing:-1px;font-weight:650}h2{font-size:21px;font-weight:650;line-height:1.35}h3{font-size:15px;line-height:1.5;font-weight:650}p{color:var(--muted)}[hidden]{display:none!important}.topbar{height:76px;display:flex;align-items:center;justify-content:space-between;padding:0 32px;background:#fbfcfe;border-bottom:1px solid var(--line)}.brand{display:flex;gap:12px;align-items:center;color:#19304d;text-decoration:none;font-size:19px;font-weight:700}.brand small{display:block;font-size:11px;font-weight:400;color:var(--muted);letter-spacing:.3px}.offline-badge{font-size:12px;color:#35604b;background:#edf7f1;border:1px solid #d2e8db;border-radius:20px;padding:6px 12px}.offline-badge span{display:inline-block;background:#218452;width:6px;height:6px;border-radius:50%;margin-right:5px}.app-shell{max-width:1600px;margin:auto;display:grid;grid-template-columns:228px minmax(0,1fr)}.sidebar{padding:31px 18px;background:#edf2f8;border-right:1px solid var(--line)}.nav-label{font-size:10px;letter-spacing:1.3px;font-weight:700;margin:2px 12px 18px}nav{display:grid;gap:5px}nav a{display:flex;align-items:center;gap:12px;padding:11px 12px;text-decoration:none;color:#45566c;border-radius:6px}nav a:first-child{background:#deebfb;color:#075499;border-left:3px solid #0968c4}nav a:hover{background:#e0e9f4}.sidebar-note{margin:35px 12px 0;padding-top:22px;border-top:1px solid #d4deea;font-size:12px}.sidebar-note b{font-size:13px}.sidebar-note p{margin:9px 0 18px}.sidebar-note span{color:#53647b;font-size:11px}main{padding:34px 36px 20px;min-width:0}.page-heading{display:flex;justify-content:space-between;align-items:center;gap:20px;margin-bottom:24px}.page-heading p:last-child{margin-top:10px}.eyebrow,.step{font-size:10px;letter-spacing:1.5px;font-weight:700;color:var(--blue);margin-bottom:7px}.notice{display:flex;gap:14px;border:1px solid #c9dff4;background:#eaf3fd;border-radius:8px;padding:17px 20px;margin-bottom:24px;font-size:13px}.notice strong{font-size:14px}.notice p{margin-top:3px;color:#38536f}.info-icon{background:#1267af;color:white;border-radius:50%;width:21px;height:21px;flex-shrink:0;text-align:center;font-weight:700}.panel{background:#fff;border:1px solid var(--line);border-radius:10px;box-shadow:0 2px 4px #1b365b04;padding:24px}.estate{display:grid;grid-template-columns:1.15fr 1fr;gap:32px;align-items:center;border-top:3px solid #1976c9;margin-bottom:32px}.estate p:not(.step){font-size:13px;margin-top:8px}.estate input{font-size:22px;height:54px;background:#f9fbff}.estate .amount-preview{color:#075caa;font-weight:650;min-height:20px}label{display:block;font-size:12px;color:#52627a;font-weight:600;margin-bottom:6px}input{width:100%;min-width:0;border:1px solid #b8c6d6;border-bottom:2px solid #8298af;border-radius:5px;background:#fff;padding:9px 12px;color:#182a41;height:42px}input:hover{border-color:#6c8aaa}input:focus{border-bottom-color:#0866bb}input[aria-invalid=true]{border-color:#b92e30;background:#fff5f5}.section-heading{display:flex;justify-content:space-between;align-items:center;gap:24px;margin-bottom:19px}.section-heading p:not(.step){font-size:13px;margin-top:6px;max-width:680px}.secondary{background:#fff;white-space:nowrap}.primary{background:#0868bc;color:white;border-color:#0868bc}.primary:hover{background:#075494}.family-section{border:1px solid var(--line);border-radius:9px;margin:0 0 18px;overflow:hidden;background:#fff}.family-section summary{display:flex;align-items:center;gap:16px;background:#f9fbfe;padding:17px 20px;list-style:none;border-left:4px solid #2482ce}.family-section:nth-child(2) summary{border-left-color:#6552b8}.family-section:nth-child(3) summary{border-left-color:#298272}.family-section:nth-child(4) summary{border-left-color:#bc7629}.family-section:nth-child(5) summary{border-left-color:#b65389}.family-section summary::-webkit-details-marker{display:none}.family-section summary:after{content:'⌄';font-size:20px;color:#566e8b}.family-section:not([open]) summary:after{content:'›'}.family-section summary>span:first-child{flex:1}.family-section summary strong{font-size:16px;font-weight:650}.family-section summary small{display:block;color:var(--muted);font-size:12px;margin-top:3px}.group-count{font-size:11px;color:#526581;background:#eaf0f7;padding:3px 9px;border-radius:4px;white-space:nowrap}.card-grid{padding:18px;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}.heir-card{border:1px solid #e0e6ef;border-radius:7px;padding:15px;background:#fff;min-width:0;display:flex;flex-direction:column}.heir-card.selected{border-color:#7fb1dd;box-shadow:inset 0 3px #1672bc;background:#fcfdff}.card-heading{display:flex;justify-content:space-between;align-items:flex-start;gap:8px;min-height:60px;margin-bottom:12px}.aid{border-radius:50%;width:28px;min-height:28px;height:28px;padding:0;flex-shrink:0;background:#edf4fc;border-color:#c9dced;color:#0a5ca8;font-size:13px}.field{margin-bottom:10px}.result-field{margin-bottom:5px;padding-top:7px}.result-field label{font-weight:400;font-size:11px;margin:0}.result-field input{display:none}.money{font-size:16px;font-variant-numeric:tabular-nums;font-weight:650;color:#174f82;display:block;overflow-wrap:anywhere}.per-person .money{font-size:14px;font-weight:500;color:#465b72}.card-hint{font-size:11px;border-top:1px solid #edf0f5;padding-top:10px;margin-top:auto;color:#617087}.results{margin-top:30px}.stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin-bottom:18px}.stats>div{border:1px solid #dce7f3;border-radius:7px;background:#f3f7fc;padding:17px}.stats span{font-size:12px;color:#536981;display:block}.stats strong{font-size:21px;display:block;margin-top:5px;color:#125c9d;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}#result-status{font-size:13px;padding:13px;background:#f1f5fa;border-radius:5px;margin-bottom:16px}.table-wrap{overflow-x:auto}table{width:100%;border-collapse:collapse;font-size:13px}caption{text-align:left;font-weight:600;margin-bottom:12px}th{text-align:left;background:#f4f7fa;color:#465c73;font-size:11px}th,td{padding:12px;border-bottom:1px solid #e3e9f1}td:not(:first-child){font-variant-numeric:tabular-nums;white-space:nowrap}td:first-child{min-width:150px}tbody tr:nth-child(even){background:#fafcff}.guide{margin-top:20px;font-size:13px}.guide summary{font-weight:650}.guide li{margin-bottom:8px}.guide p{font-size:12px}footer{font-size:11px;color:#63738a;margin-top:24px;display:flex;justify-content:space-between;gap:16px;flex-wrap:wrap}dialog{border:1px solid #ccd8e7;border-radius:12px;padding:26px;max-width:600px;width:calc(100% - 32px);max-height:85vh;overflow:auto;color:#223149;box-shadow:0 24px 100px #0c25434d}dialog::backdrop{background:#172c4d66;backdrop-filter:blur(3px)}.dialog-head{display:flex;justify-content:space-between;align-items:center;gap:20px;margin-bottom:16px}.dialog-actions{display:flex;justify-content:flex-end;gap:12px;margin-top:24px}dialog h2{margin-bottom:12px}dialog h3{margin-top:20px}dialog p,dialog li{font-size:14px}dialog li{margin-bottom:8px}.help-note{background:#f0f5fc;padding:12px;border-radius:6px;margin-top:20px}.error{background:#fff2ee;border-color:#e6b3a4;color:#933627}.invalid-results .money{visibility:hidden}.skip-link{position:absolute;top:-100px;left:12px;background:white;padding:10px;z-index:5}.skip-link:focus{top:10px}section,details{scroll-margin-top:20px}@media(min-width:1450px){main{padding:36px 48px}}@media(max-width:1150px){.card-grid{grid-template-columns:repeat(2,minmax(0,1fr))}main{padding:28px 24px}.app-shell{grid-template-columns:200px minmax(0,1fr)}.estate{grid-template-columns:1fr;gap:20px}}@media(max-width:800px){.app-shell{display:block}.sidebar{display:none}.card-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.topbar{padding:0 20px}main{padding:24px 20px}.stats strong{font-size:18px}.page-heading{align-items:flex-start}h1{font-size:29px}}@media(max-width:540px){:root{font-size:14px}.topbar{height:70px;padding:0 16px}.offline-badge{display:none}main{padding:24px 14px}.page-heading,.section-heading{align-items:flex-start;flex-direction:column;gap:14px}.page-heading .secondary{align-self:flex-start}.notice{padding:15px;gap:10px}.panel{padding:18px}.card-grid{grid-template-columns:1fr;padding:12px;gap:12px}.card-heading{min-height:0;margin-bottom:14px}.family-section summary{padding:15px 13px;gap:8px}.group-count{display:none}.stats{grid-template-columns:1fr;gap:8px}.stats>div{padding:13px 15px}.stats strong{font-size:22px}.heir-card{padding:16px}.estate{margin-bottom:25px}input{font-size:16px}.dialog-head{gap:12px}dialog{padding:20px}.dialog-actions{flex-wrap:wrap}}@media(prefers-reduced-motion:no-preference){html{scroll-behavior:smooth}}@media print{body{background:white}.topbar,.sidebar,.page-heading button,.notice,#harta,.section-heading:has(#reset),#families,.guide,footer,dialog,.skip-link,#validation{display:none!important}.app-shell{display:block}main{padding:0}.page-heading{margin-bottom:20px}.page-heading .eyebrow{display:none}.results{border:0;padding:0;box-shadow:none}.stats{grid-template-columns:repeat(3,1fr)}.table-wrap{overflow:visible}table{font-size:10px}th,td{padding:8px}tr{break-inside:avoid}.stats strong{font-size:16px}#result-status{color:#222}}
/* Theme controls remain available on desktop and mobile. */
.topbar-actions{display:flex;align-items:center;gap:16px}.theme-control{display:flex;align-items:center;gap:8px}.theme-control label{margin:0}.theme-control select{font:inherit;font-size:13px;min-height:42px;padding:8px 30px 8px 12px;border:1px solid #8298af;border-radius:6px;background:#fff;color:#20314a;cursor:pointer}input::placeholder{color:#64748b;opacity:1}
@media(max-width:800px){.offline-badge{display:none}}
@media(max-width:540px){.topbar{height:auto;min-height:70px;flex-wrap:wrap;gap:12px;padding:14px 16px}.topbar-actions{margin-left:auto}.theme-control select{padding-right:20px}}
@media screen{
  :root[data-theme="light"]{color-scheme:light}
  :root[data-theme="dark"]{color-scheme:dark;color:#edf2fa;background:#111722;--blue:#8bc7ff;--muted:#b8c7db;--line:#3b4b61}
  [data-theme="dark"] .topbar{background:#151c27}
  [data-theme="dark"] .brand{color:#edf2fa}
  [data-theme="dark"] .sidebar{background:#151e2b}
  [data-theme="dark"] nav a{color:#c5d3e5}
  [data-theme="dark"] nav a:first-child{background:#233d59;color:#b9ddff;border-left-color:#79bcff}
  [data-theme="dark"] nav a:hover{background:#27394e}
  [data-theme="dark"] .sidebar-note{border-color:#3b4b61}
  [data-theme="dark"] .sidebar-note span{color:#b8c7db}
  [data-theme="dark"] .panel,[data-theme="dark"] .family-section,[data-theme="dark"] .heir-card{background:#1b2533;border-color:#3b4b61}
  [data-theme="dark"] .estate{border-top-color:#79bcff}
  [data-theme="dark"] .family-section summary{background:#202d3e}
  [data-theme="dark"] .family-section summary:after{color:#c5d3e5}
  [data-theme="dark"] .group-count{color:#c9d9ec;background:#31435b}
  [data-theme="dark"] .heir-card.selected{background:#203249;border-color:#70ade3;box-shadow:inset 0 3px #80c2ff}
  [data-theme="dark"] label,[data-theme="dark"] .card-hint,[data-theme="dark"] footer{color:#b8c7db}
  [data-theme="dark"] .card-hint{border-color:#3b4b61}
  [data-theme="dark"] input,[data-theme="dark"] .estate input{background:#111c2a;color:#f1f5fb;border-color:#647d9b}
  [data-theme="dark"] input::placeholder{color:#a8bbd3}
  [data-theme="dark"] input:hover{border-color:#a4caef}
  [data-theme="dark"] input:focus{border-bottom-color:#92ceff}
  [data-theme="dark"] input[aria-invalid=true]{background:#3c2229;border-color:#ffb1ab}
  [data-theme="dark"] .estate .amount-preview,[data-theme="dark"] .money,[data-theme="dark"] .stats strong{color:#a6d5ff}
  [data-theme="dark"] .per-person .money{color:#d0e0f3}
  [data-theme="dark"] button,[data-theme="dark"] .secondary,[data-theme="dark"] .theme-control select{background:#2b3a4e;color:#edf2fa;border-color:#6a819d}
  [data-theme="dark"] button:hover{background:#3a4f69}
  [data-theme="dark"] .aid{background:#294665;color:#c9e6ff;border-color:#6a9ac6}
  [data-theme="dark"] .primary{background:#9bd0ff;color:#10283e;border-color:#9bd0ff}
  [data-theme="dark"] .primary:hover{background:#c1e2ff}
  [data-theme="dark"] :focus-visible{outline-color:#a0d4ff}
  [data-theme="dark"] .notice{background:#1c324b;border-color:#4c7196;color:#e3efff}
  [data-theme="dark"] .notice p{color:#c4d9f0}
  [data-theme="dark"] .info-icon{background:#a6d5ff;color:#142c43}
  [data-theme="dark"] .error{background:#3c252a;border-color:#b87b75;color:#ffd2c9}
  [data-theme="dark"] .stats>div{background:#223249;border-color:#4c6583}
  [data-theme="dark"] .stats span{color:#c1d2e7}
  [data-theme="dark"] #result-status,[data-theme="dark"] .help-note{background:#26364a;color:#cdddef}
  [data-theme="dark"] th{background:#27394e;color:#d5e4f7}
  [data-theme="dark"] th,[data-theme="dark"] td{border-color:#405570}
  [data-theme="dark"] tbody tr:nth-child(even){background:#223044}
  [data-theme="dark"] dialog{background:#1b2533;color:#edf2fa;border-color:#647d9b}
  [data-theme="dark"] dialog::backdrop{background:#070e19b3}
  [data-theme="dark"] .offline-badge{background:#1b382d;color:#b7e8ca;border-color:#527963}
  [data-theme="dark"] .offline-badge span{background:#83d7a6}
  [data-theme="dark"] .skip-link{background:#203249;color:#b9ddff}
}
/* Printing always uses the existing light palette, regardless of the screen theme. */
@media print{:root{color-scheme:light}}
footer{color:#53647b}
input::placeholder{color:#53647b}

/* MAWARIS FARAID: only added components; existing app palette and layout preserved. */
.estate-mode{display:flex;flex-wrap:wrap;gap:12px;margin-bottom:14px}
.estate-mode label{display:inline-flex;align-items:center;gap:7px;background:var(--surface,#eaf1fb);border:1px solid var(--line,#cad8e8);border-radius:9px;padding:8px 11px;font-weight:650;cursor:pointer;font-size:12px}
.estate-mode input{accent-color:#087e43;width:16px;height:16px;min-height:0;margin:0}
.estate-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px}
.estate-grid label{display:block;font-size:12px;min-width:0}
.estate-grid input{width:100%;margin-top:6px;max-width:100%}
.estate-result{font-size:12px;line-height:1.9;border:1px solid var(--line,#c8d8e9);padding:12px;border-radius:9px;margin:12px 0}
.estate-result b{color:var(--blue,#256ca6)}
.small-caveat{font-size:12px;line-height:1.65;color:var(--muted,#536780);margin:9px 0}
.faraid-options{margin-bottom:18px}
.faraid-options>summary{cursor:pointer;font-weight:700;font-size:14px;line-height:1.5}
.faraid-options-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin:17px 0 8px}
.faraid-options-grid select{width:100%;margin-top:7px;border-radius:7px;padding:10px;font-size:12px;border:1px solid var(--line,#a7b8cb);background:var(--input,#fff);color:inherit}
.faraid-options-grid label{font-size:12px;line-height:1.5}
.estate-special{display:flex;align-items:flex-start;gap:9px;padding-top:4px}
.estate-special input{flex:none;width:18px;height:18px;min-height:0;margin:2px 0 0;accent-color:#087e43}
.blocked-heir{color:#9a4b22!important;font-weight:600}
.basis-row td{font-size:11px;font-style:italic;white-space:normal!important;color:var(--muted,#536780);padding-top:3px!important;padding-bottom:9px!important}
[data-theme=dark] .estate-mode label{background:#26384c;color:#edf2fa;border-color:#556a83}
[data-theme=dark] .estate-result{background:#202e40;color:#e5efff;border-color:#405570}
[data-theme=dark] .estate-result b{color:#a6d5ff}
[data-theme=dark] .faraid-options-grid select{background:#172637;color:#e5efff;border-color:#647d9b}
[data-theme=dark] .blocked-heir{color:#ffb99f!important}
@media(prefers-color-scheme:dark){[data-theme=system] .estate-mode label{background:#26384c;color:#edf2fa;border-color:#556a83}[data-theme=system] .faraid-options-grid select{background:#172637;color:#e5efff;border-color:#647d9b}}
@media(max-width:700px){.estate-grid,.faraid-options-grid{grid-template-columns:1fr}}
@media print{.faraid-options,.estate-mode,#detailed-estate{display:none!important}.basis-row td{color:#333}.small-caveat{color:#333}}
