/* HAVAL LAWYER / CLIENT PORTAL — Essential navigation and appearance controls */
#portalView .hv-portal-top-start,
#portalView .hv-portal-navigation-actions,
#portalView .hv-portal-utility-actions{display:flex;align-items:center;gap:6px;min-width:0}
#portalView .hv-portal-top-start{gap:9px}
#portalView .hv-portal-navigation-actions{padding-inline-end:9px;border-inline-end:1px solid var(--line)}
#portalView .hv-portal-control,
#portalView #mobileMenu{
 flex:0 0 38px;width:38px;height:38px;min-width:38px;
 display:inline-grid;place-items:center;padding:0;position:relative;
 border:1px solid var(--line);border-radius:10px;
 color:var(--ink);background:var(--panel);
 box-shadow:none;transition:background .15s ease,border-color .15s ease,color .15s ease;
}
#portalView .hv-portal-control svg,
#portalView #mobileMenu svg{width:17px;height:17px;stroke-width:1.9}
#portalView .hv-portal-control:hover,
#portalView #mobileMenu:hover{color:var(--ok);border-color:var(--accent);background:var(--accent-soft)}
#portalView .hv-portal-control:focus-visible,
#portalView #mobileMenu:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
#portalView .hv-portal-control:disabled{opacity:.55;cursor:wait}
#portalView #portalThemeBtn{color:var(--accent);background:var(--accent-soft)}
#portalView #portalThemeBtn:hover{border-color:var(--accent)}
#portalView .hv-control-loading svg{animation:hvPortalSpin .9s linear infinite}
@keyframes hvPortalSpin{to{transform:rotate(360deg)}}
#portalView #portalBackBtn.hidden{display:none!important}
html[dir="ltr"] #portalView #portalBackBtn svg{transform:rotate(180deg)}
#portalView .hv-portal-top-start .topbar-brandmark{flex:none}

/* A two-row mobile toolbar keeps company/language selectors visible, not hidden
   behind extra icon controls. Navigation semantics are identical on every device. */
@media(max-width:800px){
 #portalView .topbar{
   display:grid!important;grid-template-columns:auto minmax(0,1fr) auto auto auto;
   grid-template-rows:42px 40px;column-gap:5px;row-gap:7px;
   align-items:center;padding:7px max(10px,env(safe-area-inset-right))
     9px max(10px,env(safe-area-inset-left));
   min-width:0;height:auto;
 }
 #portalView .hv-portal-top-start{grid-column:1/3;grid-row:1;gap:5px}
 #portalView .topactions{display:contents!important}
 #portalView .hv-portal-utility-actions{grid-column:3;grid-row:1;gap:4px}
 #portalView .topactions>.notifywrap{grid-column:4;grid-row:1}
 #portalView .topactions>.accountwrap{grid-column:5;grid-row:1}
 #portalView .topactions>.hv-portal-language{
    grid-column:1/3;grid-row:2;min-width:0;max-width:100%;justify-self:start
 }
 #portalView .topactions>.companyselect{
    grid-column:3/6;grid-row:2;min-width:0;max-width:100%!important;
    width:100%;display:flex;justify-self:stretch;gap:4px
 }
 #portalView .companyselect select{flex:1;min-width:0;width:100%;max-width:none!important}
 #portalView .topactions>.portal-privacy-chip{display:none!important}
 #portalView .hv-portal-navigation-actions{border:0;padding:0;gap:3px}
 #portalView .hv-portal-navigation-actions #portalHomeBtn{display:none!important}
 #portalView .hv-portal-control,#portalView #mobileMenu{width:34px;height:36px;min-width:34px;flex-basis:34px}
 #portalView .hv-portal-control svg,#portalView #mobileMenu svg{width:16px;height:16px}
 #portalView .hv-portal-top-start .topbar-brandmark{width:38px;height:27px}
 #portalView .topbar h2{display:none}
 #portalView #notifyBtn{width:34px;height:36px;min-width:34px}
 #portalView .top-account-chip{min-width:34px;min-height:36px;padding:2px 4px;gap:2px}
 #portalView .top-account-avatar{width:25px;height:26px}
 #portalView .hv-portal-language .lang-cycle{min-width:0;max-width:100%}
}
@media(max-width:365px){
 #portalView .topbar{column-gap:3px}
 #portalView .hv-portal-top-start{gap:3px}
 #portalView .hv-portal-top-start .topbar-brandmark{width:31px}
 #portalView .hv-portal-utility-actions{gap:2px}
 #portalView .hv-portal-control,#portalView #mobileMenu{width:32px;min-width:32px;flex-basis:32px}
 #portalView #notifyBtn{width:32px;min-width:32px}
}
@media(prefers-reduced-motion:reduce){#portalView .hv-control-loading svg{animation:none}}

/* Appearance: scoped exclusively to the authenticated client workspace.
   The administrator, authentication screen and public pages are unaffected. */
html[data-client-theme="dark"] #portalView{
 color-scheme:dark;
 --bg:#0c1713;--panel:#172820;--ink:#eaf1eb;--muted:#a6b7ac;
 --line:#304638;--nav:#0c201a;--nav2:#204332;--accent:#d5a557;
 --accent-soft:#293827;--ok:#8bdfbb;--danger:#f49d99;--warn:#f0c27b;
 --dash-line:#34473e;--shadow:0 14px 38px rgba(0,0,0,.21);
 --hv2-forest:#b7e3cb;--hv2-ink:#e9f3eb;--hv2-muted:#a3b9a8;
 --hv2-line:#31493a;--hv2-surface:#192d23;--hv2-subtle:#1b3227;
 --hv2-success:#9be4ba;--hv2-warning:#f6cc7b;--hv2-danger:#ffa6a6;
 background:var(--bg);color:var(--ink);
}
html[data-client-theme="dark"] body[data-client-view="workspace"]{background:#0c1713;color:#eaf1eb}
html[data-client-theme="dark"] #portalView .main,
html[data-client-theme="dark"] #portalView .content{background:var(--bg);color:var(--ink)}
html[data-client-theme="dark"] #portalView .topbar,
html[data-client-theme="dark"] #portalView :is(.card,.stat,.finance-summary .mini,.task-card,.task-lane,.modalbox,.accountpanel,
 .company-info-section,.company-info-item,.company-person,.company-info-empty,.dash-panel,.dash-stat,.dash-priority,.dash-finance-item,
 .hv-v2-section,.hv-v2-cert,.hv-v2-summary>div,.hv-v2-permit,.hv-v2-error,.hv-v2-empty),
html[data-client-theme="dark"] #portalView .hv-portal-control,
html[data-client-theme="dark"] #portalView #mobileMenu{
 background:#182b22!important;color:var(--ink)!important;
 border-color:var(--line)!important;box-shadow:none!important
}
html[data-client-theme="dark"] #portalView .topbar{background:#14251e!important}
html[data-client-theme="dark"] #portalView .sidebar{background:#0c201a!important;color:#dceee1}
html[data-client-theme="dark"] #portalView .sidebar .nav button.active{background:#254a38;color:#fff}
html[data-client-theme="dark"] #portalView .sidebar .nav button:hover{background:#213d30;color:#fff}
html[data-client-theme="dark"] #portalView .hv-portal-control:hover{background:#2a4432!important;color:#f2c576!important}
html[data-client-theme="dark"] #portalView #portalThemeBtn{background:#2b3928!important;color:#efc77e!important}
html[data-client-theme="dark"] #portalView :is(
 .companyselect select,.top-account-chip,.lang-cycle,.portal-back,
 .field input,.field select,.field textarea,.hv-password-field input,
 input,select,textarea
){background:#172b22!important;color:#f0f6f1!important;border-color:#385243!important}
html[data-client-theme="dark"] #portalView input::placeholder{color:#9cb3a2!important}
html[data-client-theme="dark"] #portalView .accountpanel,
html[data-client-theme="dark"] #portalView .hv-portal-language-menu{
 background:#182b22!important;color:var(--ink)!important;border-color:var(--line)!important;
}
html[data-client-theme="dark"] #portalView :is(.accountpanel button,.hv-portal-language-menu button){
 background:transparent;color:var(--ink);border-color:var(--line)
}
html[data-client-theme="dark"] #portalView :is(.pagehead h1,.pagehead h2,.company-info-section h3,.company-info-item b,
 .company-person b,.dash-stat-value,.dash-task-title,.dash-panel-head h3,.dash-update b,.dash-finance-item b,
 .hv-v2-cert-name,.hv-v2-permit-title strong,.hv-v2-section h2,.hv-v2-data-line b){color:var(--ink)!important}
html[data-client-theme="dark"] #portalView :is(.pagehead p,.company-info-item span,.company-person small,.dash-stat-label,.dash-stat-sub,
 .dash-panel-head p,.dash-update p,.dash-update time,.dash-doc-row span,.dash-task-date,.hv-v2-data-line span,
 .hv-v2-summary span,.hv-v2-policy,.hv-v2-empty){color:var(--muted)!important}
html[data-client-theme="dark"] #portalView :is(.company-info-section-head,.cardhead,.dash-panel-head,.task-lane-head,
 .modalhead,.modalfoot){border-color:var(--line)!important;color:var(--ink)}
html[data-client-theme="dark"] #portalView .dash-doc-row,
html[data-client-theme="dark"] #portalView :is(.dash-task-row,.dash-update,.timeline .item){border-color:var(--line)!important;color:var(--ink)}
html[data-client-theme="dark"] #portalView :is(.dash-stats,.dash-primary-grid,.dash-secondary-grid){--dash-line:#34493d}
html[data-client-theme="dark"] #portalView .dash-stat-icon,
html[data-client-theme="dark"] #portalView .dash-doc-icon{background:#293d30!important;color:#ebc176!important}
html[data-client-theme="dark"] #portalView .dash-priority,
html[data-client-theme="dark"] #portalView .dash-priority.urgent{background:#1b2f25!important}
html[data-client-theme="dark"] #portalView .dash-priority-copy b{color:#e9f2ed!important}
html[data-client-theme="dark"] #portalView .dash-priority-copy span{color:#abbcae!important}
html[data-client-theme="dark"] #portalView .dash-finance-item{background:#1b2d24!important}
html[data-client-theme="dark"] #portalView .dash-finance-item.paid b{color:#a2e1bf!important}
html[data-client-theme="dark"] #portalView .dash-finance-item.remaining b{color:#ffadab!important}
html[data-client-theme="dark"] #portalView .dash-command,
html[data-client-theme="dark"] #portalView .dash-lawyer-card{
 background:linear-gradient(135deg,#071813,#123326)!important;color:#fff!important;border-color:#365143!important
}
html[data-client-theme="dark"] #portalView .dash-meta-card{background:#213c2f!important;border-color:#345445!important}
html[data-client-theme="dark"] #portalView .dash-quick{color:#f7f6ec!important;border-color:#355543!important;background:#234536!important}
html[data-client-theme="dark"] #portalView .dash-quick:hover{background:#2e5945!important}
html[data-client-theme="dark"] #portalView .dash-private-label{color:#f1c476}
html[data-client-theme="dark"] #portalView .badge{background:#344638;color:#e3eee5}
html[data-client-theme="dark"] #portalView .badge.ok{background:#184e38;color:#b4f4d5}
html[data-client-theme="dark"] #portalView .badge.warn{background:#524327;color:#ffe2a4}
html[data-client-theme="dark"] #portalView .badge.danger{background:#572d2e;color:#ffbebe}
html[data-client-theme="dark"] #portalView th{background:#21362a!important;color:#d3e2d5!important}
html[data-client-theme="dark"] #portalView td{border-color:#354b3c;color:var(--ink)}
html[data-client-theme="dark"] #portalView .btn.secondary,
html[data-client-theme="dark"] #portalView .btn.ghost{background:#284235;color:#ecf3ed;border-color:#476351}
html[data-client-theme="dark"] #portalView .hv-v2-state.valid{background:#184e37;color:#b9f4d5}
html[data-client-theme="dark"] #portalView .hv-v2-state.warning{background:#493b21;color:#ffe2aa}
html[data-client-theme="dark"] #portalView .hv-v2-state.expired{background:#51282c;color:#ffb9b9}
html[data-client-theme="dark"] #portalView .hv-v2-state.undated{background:#2e4037;color:#c5d8cc}
html[data-client-theme="dark"] #portalView .hv-v2-file{color:#b0e2c6}
html[data-client-theme="dark"] #portalView .hv-v2-policy{color:#bac7bd}
html[data-client-theme="dark"] #portalView .hv-v2-error button{background:#284235;color:#eaf4eb;border-color:#476351}
html[data-client-theme="dark"] #portalView .hv-client-compliance-skeleton{
 background:linear-gradient(100deg,#21372b 25%,#2c4838 40%,#21372b 60%);background-size:200% 100%
}
html[data-client-theme="dark"] #portalView .bottom-nav{
 background:#14251eeF!important;border-top:1px solid #395241!important;box-shadow:0 -6px 25px #050c0940!important
}
html[data-client-theme="dark"] #portalView .bottom-nav button{background:transparent!important;color:#aebfaf!important}
html[data-client-theme="dark"] #portalView .bottom-nav button.active{color:#ecc37f!important}
/* Notification UI has its own high-specificity !important legacy colors. */
html[data-client-theme="dark"] #portalView #notifyPanel{
 background:#182b23!important;border-color:#42604a!important;color:#ecf3eb!important
}
html[data-client-theme="dark"] #portalView #notifyPanel .hv-notif-head,
html[data-client-theme="dark"] #portalView #notifyPanel .hv-notif-toolbar{
 background:#21392c!important;border-color:#3a5644!important;color:#ebf2ec!important
}
html[data-client-theme="dark"] #portalView #notifyPanel :is(.hv-notif-titles>strong,.hv-notif-total){
 color:#eaf5ed!important
}
html[data-client-theme="dark"] #portalView #notifyPanel :is(.hv-notif-filters,.hv-notif-filters button.active,.hv-notif-close,
 .hv-notif-item,.notifitem,.hv-notif-mark-all){background:#254133!important;color:#eaf3ed!important;border-color:#385545!important}
html[data-client-theme="dark"] #portalView #notifyPanel .hv-notif-list{background:#182b23!important;color:#e4efe5!important}
html[data-client-theme="dark"] #portalView #notifyPanel #notifyCount{border-color:#182b23!important}
/* Modal dialogs and DMS widgets are mounted dynamically outside #portalView. */
html[data-client-theme="dark"] body[data-client-view="workspace"] :is(.modalbox,.task-detail-box,.hv-v2-preview>section){
 background:#192d23!important;color:#eef5ed!important;border-color:#395344!important
}
html[data-client-theme="dark"] body[data-client-view="workspace"] :is(.modalhead,.modalfoot,.task-detail-head,
 .hv-v2-preview header,.hv-v2-preview footer){background:#223a2c!important;color:#eff4ee!important;border-color:#3d5946!important}
html[data-client-theme="dark"] body[data-client-view="workspace"] .hv-v2-preview header button{background:#22382b;border-color:#49634d;color:#f2f3e8}
html[data-client-theme="dark"] body[data-client-view="workspace"] :is(.hv-v2-preview-content,.hv-v2-preview-footer){background:#1b3126!important;color:#eaf5ef!important}
html[data-client-theme="dark"] body[data-client-view="workspace"] :is(.modal input,.modal select,.modal textarea){
 background:#22382c!important;color:#f2f7ef!important;border-color:#405e4a!important
}
html[data-client-theme="dark"] #portalView .hv-dms-layout,
html[data-client-theme="dark"] #portalView :is(.hv-dms-main,.hv-dms-tabs,.hv-dms-toolbar,.hv-dms-metric,.hv-dms-request,.hv-dms-tablewrap){
 background:#182d24!important;color:#edf5ef!important;border-color:#365345!important
}
html[data-client-theme="dark"] #portalView .hv-dms-table :is(th,td){color:#e8f1e9!important;border-color:#345044!important;background:#1d3429!important}
html[data-client-theme="dark"] #portalView .hv-dms-title-row h1{color:#eef6ee!important}
html[data-client-theme="dark"] #portalView .hv-dms-tabs button{color:#e0eddf!important}
html[data-client-theme="dark"] #portalView .hv-dms-find input{background:#223b2e!important;color:#eaf3ed!important}
