:root{
  --ink:#0F1C2B; --navy:#0C2E51; --navy-tint:#E4EAF1; --gold:#AD9362; --gold-soft:#F4EEE2; --gold-ink:#6B5528; --on-gold:#071E38;
  --paper:#F5F6F8; --sheet:#FFFFFF; --rule:#D6DCE3; --muted:#5E6E80; --ok:#2F6B3D; --ok-tint:#E3EFE6; --danger:#9B3524; --danger-tint:#F7E6E2;
  --focus:#AD9362;
  box-sizing:border-box;
  padding-top:env(safe-area-inset-top,0px);
  padding-bottom:env(safe-area-inset-bottom,0px);
  color-scheme:light;
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    --ink:#E8EDF2; --navy:#6FA3DC; --navy-tint:#152B42; --gold:#C9AE79; --gold-soft:#241E12; --gold-ink:#D9C08E; --on-gold:#071E38;
    --paper:#0A121C; --sheet:#101C29; --rule:#25384A; --muted:#93A2B1; --ok:#77BD86; --ok-tint:#132A1B; --danger:#E09484; --danger-tint:#2E1612;
    --focus:#C9AE79; color-scheme:dark;
  }
}
:root[data-theme="dark"]{
  --ink:#E8EDF2; --navy:#6FA3DC; --navy-tint:#152B42; --gold:#C9AE79; --gold-soft:#241E12; --gold-ink:#D9C08E; --on-gold:#071E38;
  --paper:#0A121C; --sheet:#101C29; --rule:#25384A; --muted:#93A2B1; --ok:#77BD86; --ok-tint:#132A1B; --danger:#E09484; --danger-tint:#2E1612;
  --focus:#C9AE79; color-scheme:dark;
}
*,*::before,*::after{box-sizing:inherit}
html{scroll-padding-top:env(safe-area-inset-top,0px);-webkit-text-size-adjust:100%}
body{margin:0;background:var(--paper);color:var(--ink);font-family:"IBM Plex Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif;font-size:1rem;line-height:1.5}
a{color:var(--navy)}
:focus-visible{outline:3px solid var(--focus);outline-offset:2px}
[hidden]{display:none!important}
h1,h2,h3{font-family:"Spectral",Georgia,"Times New Roman",serif;font-weight:500;line-height:1.15;margin:0}
.wrap{max-width:72rem;margin:0 auto;padding:0 1.25rem}

/* Header */
.top{background:#0C2E51;border-bottom:1px solid #2C4E75;color:#FFFFFF}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) .top{background:#081524;border-color:#1E3450}}
:root[data-theme="dark"] .top{background:#081524;border-color:#1E3450}
.top .wrap{display:flex;align-items:center;justify-content:space-between;gap:1rem;min-height:84px;padding-top:.6rem;padding-bottom:.6rem;flex-wrap:wrap}
.logo{display:block;height:56px;width:auto}
@media (max-width:40rem){.logo{height:44px}}
.top .who{color:#B6C8DC}
.top .btn.ghost{color:#FFFFFF;box-shadow:inset 0 0 0 1.5px #2C4E75}
.top .btn.ghost:hover{box-shadow:inset 0 0 0 1.5px #C9AE79;color:#C9AE79}
.top select{background:#081524;color:#FFFFFF;border-color:#2C4E75}
.top-right{display:flex;align-items:center;gap:.75rem;flex-wrap:wrap}
.who{font-size:.9rem;color:var(--muted)}

/* Buttons and inputs */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:.4rem;min-height:44px;background:var(--navy);color:var(--sheet);border:0;border-radius:6px;padding:.55rem 1rem;font:inherit;font-weight:600;text-decoration:none;cursor:pointer}
.btn:hover{filter:brightness(1.1)}
.btn.ghost{background:transparent;color:var(--navy);box-shadow:inset 0 0 0 1.5px var(--navy)}
.btn.gold{background:var(--gold);color:var(--on-gold)}
.btn.small{min-height:36px;padding:.35rem .75rem;font-size:.9rem}
.btn[disabled]{opacity:.5;cursor:not-allowed;filter:none}
label{display:block;font-weight:600;font-size:.9rem;margin-bottom:.3rem}
input[type=text],input[type=email],input[type=password],input[type=month],input[type=date],input[type=number],select,textarea{width:100%;font:inherit;color:var(--ink);background:var(--sheet);border:1px solid var(--rule);border-radius:6px;padding:.55rem .7rem;min-height:44px}
textarea{min-height:5rem;resize:vertical}
.field-row{display:grid;gap:.9rem;grid-template-columns:1fr}
@media (min-width:44rem){.field-row.two{grid-template-columns:1fr 1fr}.field-row.three{grid-template-columns:repeat(3,minmax(0,1fr))}}
.msg{margin:.5rem 0 0;font-size:.92rem}
.msg.err{color:var(--danger)}
.msg.ok{color:var(--ok)}

/* Layout */
main{padding:1.75rem 0 3rem}
.card{background:var(--sheet);border:1px solid var(--rule);border-radius:10px;padding:1.25rem}
.card h2{font-size:1.35rem;margin-bottom:.9rem}
.stack{display:grid;gap:1.25rem}
.grid-app{display:grid;gap:1.25rem;grid-template-columns:1fr;align-items:start}
@media (min-width:64rem){.grid-app{grid-template-columns:minmax(0,1fr) minmax(0,2.2fr)}}
.page-title{display:flex;justify-content:space-between;align-items:flex-end;gap:1rem;flex-wrap:wrap;margin-bottom:1.25rem}
.page-title h1{font-size:clamp(1.6rem,3.6vw,2.2rem)}
.page-title p{margin:.25rem 0 0;color:var(--muted)}

/* Summary */
.summary{display:grid;gap:1rem;grid-template-columns:repeat(2,minmax(0,1fr));margin-bottom:1.25rem}
@media (min-width:52rem){.summary{grid-template-columns:repeat(4,minmax(0,1fr))}}
.stat{background:var(--sheet);border:1px solid var(--rule);border-radius:10px;padding:1rem 1.1rem}
.stat b{display:block;font-family:"Spectral",Georgia,serif;font-weight:500;font-size:1.9rem;line-height:1.1;color:var(--navy)}
.stat span{font-size:.88rem;color:var(--muted)}
.stat.alert b{color:var(--danger)}

/* States */
.states{display:flex;flex-wrap:wrap;gap:.5rem}
.state-btn{display:flex;flex-direction:column;align-items:center;justify-content:center;min-width:64px;min-height:56px;border:1.5px solid var(--rule);background:var(--navy-tint);color:var(--navy);border-radius:8px;font:inherit;font-weight:700;cursor:pointer;padding:.35rem .5rem}
.state-btn small{font-weight:500;font-size:.72rem;color:#4A5968}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) .state-btn small{color:var(--muted)}}
:root[data-theme="dark"] .state-btn small{color:var(--muted)}
.state-btn[aria-pressed="true"]{background:var(--gold);border-color:var(--gold);color:var(--on-gold)}
.state-btn[aria-pressed="true"] small{color:var(--on-gold)}

/* Tabs */
.tabs{display:flex;gap:.35rem;flex-wrap:wrap;margin-bottom:1rem}
.tab{min-height:40px;border:1px solid var(--rule);background:var(--sheet);color:var(--ink);border-radius:99px;padding:.3rem .9rem;font:inherit;font-size:.9rem;cursor:pointer}
.tab[aria-selected="true"]{background:var(--navy);border-color:var(--navy);color:var(--sheet)}

/* Deadlines */
.dl-list{list-style:none;margin:0;padding:0;display:grid;gap:.6rem}
.dl{border:1px solid var(--rule);border-radius:10px;background:var(--sheet)}
.dl-head{display:grid;grid-template-columns:auto 1fr auto;gap:.9rem;align-items:center;width:100%;padding:.8rem 1rem;background:none;border:0;color:inherit;font:inherit;text-align:left;cursor:pointer;border-radius:10px}
.dl-state{display:grid;place-items:center;width:44px;height:44px;border-radius:8px;background:var(--navy-tint);color:var(--navy);font-weight:700}
.dl-title{font-weight:600}
.dl-sub{font-size:.88rem;color:var(--muted)}
.dl-right{text-align:right;display:flex;flex-direction:column;align-items:flex-end;gap:.3rem}
.dl-due{font-size:.88rem;color:var(--muted);white-space:nowrap}
.dl-body{padding:0 1rem 1rem 4.9rem;display:grid;gap:.75rem}
@media (max-width:40rem){.dl-head{grid-template-columns:auto 1fr}.dl-right{grid-column:2;align-items:flex-start;text-align:left}.dl-body{padding-left:1rem}}
.dl-body dl{display:grid;grid-template-columns:auto 1fr;gap:.25rem 1rem;margin:0;font-size:.92rem}
.dl-body dt{color:var(--muted)}
.dl-body dd{margin:0}
.actions{display:flex;gap:.5rem;flex-wrap:wrap}
.badge{display:inline-block;border-radius:99px;padding:.15rem .6rem;font-size:.78rem;font-weight:600;white-space:nowrap}
.b-upcoming{background:var(--navy-tint);color:var(--navy)}
.b-in_preparation{background:var(--gold-soft);color:var(--gold-ink)}
.b-awaiting_approval{background:var(--danger-tint);color:var(--danger)}
.b-approved{background:var(--navy-tint);color:var(--navy)}
.b-filed{background:var(--ok-tint);color:var(--ok)}
.b-late{background:var(--danger);color:var(--sheet)}
.empty{color:var(--muted);margin:0;padding:1rem 0}

/* Documents */
.doc-list{list-style:none;margin:0;padding:0;display:grid}
.doc{display:grid;grid-template-columns:1fr auto;gap:.75rem;align-items:center;padding:.7rem 0;border-top:1px solid var(--rule)}
.doc:first-child{border-top:0}
.doc-name{font-weight:600;word-break:break-word}
.doc-meta{font-size:.85rem;color:var(--muted)}
.dir{font-size:.75rem;font-weight:600;border-radius:4px;padding:.05rem .4rem;margin-right:.35rem}
.dir-firm{background:var(--gold-soft);color:var(--gold-ink)}
.dir-client{background:var(--navy-tint);color:var(--navy)}

/* Banners */
.banner{border-radius:10px;padding:.9rem 1.1rem;margin-bottom:1.25rem;border:1px solid var(--rule);background:var(--sheet)}
.banner.gold{background:var(--gold-soft);border-color:var(--gold);color:var(--ink)}
.banner.alert{background:var(--danger-tint);border-color:var(--danger)}

/* Login */
.login{max-width:28rem;margin:3rem auto}
.login p{color:var(--muted)}

/* Tables (admin) */
.table-wrap{overflow-x:auto}
table{border-collapse:collapse;width:100%;font-size:.92rem}
th,td{text-align:left;padding:.55rem .5rem;border-top:1px solid var(--rule);vertical-align:middle}
th{color:var(--muted);font-weight:600;border-top:0}
td select,td input{min-height:36px;padding:.3rem .5rem}
.client-list{list-style:none;margin:0;padding:0;display:grid;gap:.4rem}
.client-list button{width:100%;text-align:left;border:1px solid var(--rule);background:var(--sheet);color:var(--ink);border-radius:8px;padding:.6rem .8rem;font:inherit;cursor:pointer;display:flex;justify-content:space-between;gap:.5rem;min-height:44px}
.client-list button[aria-current="true"]{border-color:var(--navy);box-shadow:inset 3px 0 0 var(--navy)}

footer.foot{border-top:1px solid var(--rule);padding:1.5rem 0 2.5rem;font-size:.85rem;color:var(--muted)}
footer.foot p{margin:0 0 .4rem;max-width:52rem}

/* Fixes and admin layout */
main.wrap{padding-top:1.75rem;padding-bottom:3rem}
.grid-admin{display:grid;gap:1.25rem;grid-template-columns:1fr;align-items:start}
@media (min-width:64rem){.grid-admin{grid-template-columns:17rem minmax(0,1fr)}}
.grid-admin table{min-width:62rem}
td select{min-width:10.5rem}
td input[type=text]{min-width:9rem}
td input[type=date]{min-width:9.5rem}
.stack>*,.grid-app>*,.grid-admin>*{min-width:0}
.grid-admin td:nth-child(3){white-space:nowrap}
.grid-admin td:nth-child(2){min-width:9rem}

.skip{position:absolute;left:-999px;top:0;z-index:100;background:#AD9362;color:#071E38;padding:.6rem 1rem;border-radius:0 0 6px 0;font-weight:700}.skip:focus{left:0}

/* Staff console: website requests */
.lead-list{list-style:none;margin:0 0 .5rem;padding:0;display:grid;gap:.5rem}
.lead-list>li{border:1px solid var(--rule);border-radius:8px;background:var(--sheet)}
.lead-list summary{display:flex;justify-content:space-between;gap:.75rem;align-items:baseline;padding:.6rem .75rem;cursor:pointer;font-weight:600;min-height:44px}
.lead-list details[open] summary{border-bottom:1px solid var(--rule)}
.lead-list details>*:not(summary){margin-left:.75rem;margin-right:.75rem}
.lead-dl{display:grid;grid-template-columns:5.5rem 1fr;gap:.25rem .75rem;margin:.6rem .75rem;font-size:.9rem}
.lead-dl dt{color:var(--muted);font-weight:600}.lead-dl dd{margin:0;overflow-wrap:anywhere}
.row-actions{display:flex;gap:.5rem;align-items:center;flex-wrap:wrap;margin-bottom:.6rem}
.row-actions select{width:auto}
.fine{font-size:.85rem;color:var(--muted)}
.linkbtn{background:none;border:0;padding:0;font:inherit;font-size:.9rem;color:var(--navy);text-decoration:underline;cursor:pointer}
.count-badge{display:inline-block;margin-left:.5rem;min-width:1.4rem;padding:0 .4rem;border-radius:99px;background:var(--gold);color:var(--on-gold);font-size:.8rem;font-weight:700;text-align:center;vertical-align:3px;font-family:inherit}

/* Client portal sections */
.ptabs{display:flex;gap:.25rem;overflow-x:auto;margin:0 0 1.25rem;border-bottom:1px solid var(--rule);scrollbar-width:thin}
.ptab{flex:none;display:inline-flex;align-items:center;gap:.4rem;min-height:44px;padding:.5rem .9rem;color:var(--muted);text-decoration:none;font-weight:600;font-size:.95rem;border-bottom:3px solid transparent;margin-bottom:-1px}
.ptab:hover{color:var(--ink)}
.ptab[aria-current="page"]{color:var(--navy);border-bottom-color:var(--gold)}
.pcount{display:inline-grid;place-items:center;min-width:1.35rem;height:1.35rem;padding:0 .35rem;border-radius:99px;background:var(--gold);color:var(--on-gold);font-size:.75rem;font-weight:700}
.narrow{max-width:52rem}
@media (min-width:64rem){.grid-app.even{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-app.home{grid-template-columns:minmax(0,1.4fr) minmax(0,1fr)}}
.card-head{display:flex;justify-content:space-between;align-items:baseline;gap:1rem}
.todo{list-style:none;margin:0;padding:0;display:grid;gap:.6rem}
.todo li{display:flex;justify-content:space-between;align-items:center;gap:1rem;flex-wrap:wrap;border:1px solid var(--rule);border-left:4px solid var(--rule);border-radius:8px;padding:.75rem .9rem;background:var(--sheet)}
.todo li>div{flex:1 1 16rem;min-width:0}
.todo b{display:block}.todo span{display:block;font-size:.9rem;color:var(--muted);margin-top:.15rem}
.todo .todo-alert{border-left-color:var(--deadline)}
.todo .todo-warn{border-left-color:var(--gold)}
.todo .todo-setup{border-left-color:var(--navy)}
.allclear{border:1px solid var(--rule);border-left:4px solid var(--leaf, var(--navy));border-radius:8px;padding:.9rem 1rem}
.allclear b{display:block}.allclear span{color:var(--muted);font-size:.92rem}
.mini-dl{list-style:none;margin:0;padding:0;display:grid;gap:.4rem}
.mini-dl button{width:100%;display:grid;grid-template-columns:44px minmax(0,1fr) auto;gap:.75rem;align-items:center;text-align:left;background:none;border:0;border-top:1px solid var(--rule);padding:.55rem 0;font:inherit;color:var(--ink);cursor:pointer}
.mini-dl li:first-child button{border-top:0}
.mini-dl .mini-t b{display:block;font-weight:600;overflow-wrap:anywhere}.mini-dl .mini-t small{color:var(--muted)}
.dz-wrap{margin-top:.9rem}
.dropzone{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.2rem;text-align:center;min-height:96px;border:2px dashed var(--rule);border-radius:10px;padding:1rem;cursor:pointer;background:var(--paper);font-weight:400}
.dropzone b{color:var(--navy)}.dropzone span{font-size:.85rem;color:var(--muted)}
.dropzone:hover,.dropzone.over,.dropzone:focus-within{border-color:var(--navy);background:var(--navy-tint)}
.dropzone.busy{opacity:.6;pointer-events:none}
.dz-input{position:absolute;width:1px;height:1px;opacity:0;overflow:hidden}
.todo-act{display:flex;flex-direction:column;align-items:flex-end;gap:.35rem}
.setup-prog{margin:0 0 1rem;font-size:.9rem;color:var(--muted)}
.setup-prog .bar{height:8px;background:var(--rule);border-radius:99px;overflow:hidden;margin:.35rem 0}
.setup-prog .bar i{display:block;height:100%;background:var(--gold)}
.setup-prog small{display:block}
