/* Portal layout only. Navigation markup remains controlled by app.js. */
.workspace { width:100%; }
.portal-navigation { display:block; }
.portal-home,.module-card { display:flex; align-items:center; gap:8px; width:100%; min-height:28px; margin:0 0 2px; padding:4px 8px; border:0; border-radius:9px; color:var(--dq-ink); background:transparent; text-decoration:none; text-align:left; font-size:14px; font-weight:500; }
.portal-home { background:var(--dq-active); }
.portal-nav-label { margin:16px 8px 8px; color:var(--dq-muted); font-size:12px; }
.module-card:hover { background:var(--dq-hover); }
.module-card.unavailable { color:var(--dq-faint); }
.module-card h3 { flex:1; margin:0; font-size:14px; line-height:20px; font-weight:500; }
.portal-navigation :is(.portal-home,.module-card,.module-card h3) { font:500 14px/20px var(--dq-font); letter-spacing:normal; white-space:nowrap; }
.module-card p,.card-foot { display:none; }
.module-card.unavailable p { display:block; margin:0; font-size:11px; white-space:nowrap; }
.icon-box { display:grid; place-items:center; flex:0 0 auto; width:16px; height:16px; color:var(--dq-sub); }
.icon-box svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:var(--dq-icon-stroke,1.5); stroke-linecap:round; stroke-linejoin:round; }
.empty { padding:12px 8px; color:var(--dq-muted); font-size:13px; line-height:22px; }
.password-dialog .logout { border:0; border-radius:6px; background:transparent; color:var(--dq-ink); padding:6px 8px; font-size:13px; }
.password-dialog .logout:hover { background:var(--dq-hover); }
.portal-heading { display:flex; align-items:center; gap:8px; font-weight:500; }
.portal-heading .dq-icon { color:var(--dq-sub); }
.portal-content { max-width:1000px; margin:0 auto; padding:32px; container-type:inline-size; }
/* Module loading must not expose the retained home content underneath. */
#portalShell[content-header] .portal-content { visibility:hidden; }
.portal-intro { display:flex; align-items:center; gap:16px; margin-bottom:24px; flex-wrap:wrap; }
.portal-intro>div:first-child { min-width:0; }
.portal-intro h1 { margin:0; font-size:22px; line-height:30px; font-weight:600; letter-spacing:-.02em; }
.portal-intro p { margin:6px 0 0; color:var(--dq-muted); }
.portal-datetime { margin-left:auto; display:flex; align-items:baseline; flex-wrap:wrap; gap:8px; text-align:right; }
#portalDate { color:var(--dq-sub); font:12px/20px var(--dq-font); white-space:nowrap; }
.portal-clock { min-width:8ch; color:var(--dq-sub); font:500 12px/20px var(--dq-mono); font-variant-numeric:tabular-nums; white-space:nowrap; }
.portal-summary h2 { display:flex; align-items:center; gap:8px; margin:0 0 14px; font-size:15px; font-weight:600; }
.portal-metrics { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(260px,100%),1fr)); gap:18px 8px; }
.portal-metrics > section:has(> .portal-metric[hidden]) { display:none; }
.portal-metric,.portal-summary-card { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; column-gap:16px; min-height:52px; padding:10px 16px; border:1px solid var(--dq-line); border-radius:9px; background:var(--dq-surface); color:var(--dq-ink); font-size:13px; line-height:20px; }
.portal-metric { min-height:60px; background:linear-gradient(105deg,var(--dq-accent-a10),var(--dq-surface) 85%); text-decoration:none; }
.portal-metric[hidden],.portal-ledger[hidden],.portal-count-note[hidden] { display:none; }
.portal-metric-label { display:flex; align-items:center; gap:5px; color:var(--dq-sub); }
.portal-metric-label .dq-icon { flex:none; width:13px; height:13px; }
.portal-metric-value,.portal-summary-card dd { margin:0; color:var(--dq-sub); font-size:12px; font-variant-numeric:tabular-nums; }
.portal-metric-value,#portalPayroll dd { text-align:right; }
.portal-metric-value strong,.portal-summary-card strong { font-weight:600; color:var(--dq-ink); }
.portal-metric-value strong,#portalPayroll strong { font-size:24px; line-height:1.15; letter-spacing:-.035em; }
a.portal-metric:hover { border-color:var(--dq-accent-a40); }
a.portal-metric:focus-visible { outline:2px solid var(--dq-accent); outline-offset:2px; }
.portal-metrics:has(.portal-metric:not([hidden])) + #portalHrAttention .portal-ledger,
.portal-ledger:not([hidden]) ~ .portal-ledger { margin-top:18px; }
.portal-summary h3 { margin:0 0 7px; color:var(--dq-ink); font-size:13px; font-weight:600; line-height:20px; }
.portal-card-list { display:grid; gap:6px; margin:0; padding:0; list-style:none; }
.portal-card-month { font-weight:550; font-variant-numeric:tabular-nums; white-space:nowrap; }
.portal-benefit-month { grid-template-columns:6em repeat(2,minmax(0,1fr)); align-items:start; align-content:center; }
.portal-benefit-summary { display:grid; grid-template-columns:max-content minmax(0,1fr); gap:10px; align-items:baseline; min-width:0; margin:0; }
.portal-benefit-summary dt { color:var(--dq-ink); font-size:13px; font-weight:550; }
.portal-benefit-statuses { display:grid; justify-items:start; gap:3px; text-align:left; }
.portal-benefit-statuses strong { white-space:nowrap; }
.portal-status-warn { color:var(--dq-warn-tx); }
.portal-status-quiet,.portal-count-note { color:var(--dq-muted); font-size:12px; }
.portal-count-note { margin:10px 0 0; }
@container (max-width:540px) {
  .portal-datetime { width:100%; margin-left:0; }
  .portal-benefit-month { grid-template-columns:5em minmax(0,1fr); gap:6px 10px; }
  .portal-benefit-summary { grid-column:2; grid-template-columns:3em minmax(0,1fr); gap:8px; }
  .portal-benefit-summary + .portal-benefit-summary { padding-top:6px; border-top:1px solid var(--dq-line-soft); }
}
@container (max-width:360px) {
  .portal-benefit-month { grid-template-columns:minmax(0,1fr); }
  .portal-benefit-summary { grid-column:1; }
}
.password-dialog { width:440px; max-height:calc(100dvh - 28px); overflow-y:auto; padding:24px; border:1px solid var(--dq-line); border-radius:12px; color:var(--dq-ink); background:#fff; box-shadow:var(--dq-pop); }
.password-dialog::backdrop { background:rgba(16,17,18,.32); }
.password-dialog-head { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.password-dialog h2 { margin:0; font-size:20px; line-height:28px; font-weight:600; }
.password-dialog p { color:var(--dq-muted); font-size:13px; line-height:22px; }
.password-field { display:block; margin:16px 0; }
.password-field span { display:block; margin-bottom:6px; font-size:13px; font-weight:500; }
.password-field input { width:100%; height:36px; padding:0 12px; border:1px solid var(--dq-line); border-radius:8px; color:var(--dq-ink); }
.password-dialog .password-error { color:var(--dq-danger-tx); background:var(--dq-danger-bg); padding:9px 12px; border-radius:8px; }
.password-submit { width:100%; min-height:36px; border:0; border-radius:8px; color:#fff; background:var(--dq-accent); font-weight:500; box-shadow:var(--dq-raised-pri); }
.password-submit:hover { background:var(--dq-accent-dark); }
.password-dialog button:disabled { opacity:.6; cursor:wait; }
.finance-workspace { position:fixed; inset:0; left:276px; z-index:20; background:#fff; transition:left .18s ease; }
.finance-workspace[data-ready] { left:0; }
.finance-workspace[hidden] { display:none; }
.finance-frame-host,.finance-frame-host iframe { width:100%; height:100%; }
.finance-frame-host iframe { display:block; border:0; opacity:0; transition:opacity .18s ease; }
.finance-workspace[data-ready] iframe { opacity:1; }
.finance-entry-status { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:12px; color:var(--dq-sub); background:#fff; }
.finance-entry-status[hidden] { display:none; }
.finance-entry-status p { margin:0; }
.finance-entry-status button { margin:0 4px; padding:6px 12px; border:1px solid var(--dq-line); border-radius:8px; background:#fff; color:var(--dq-ink); }
.finance-entry-status .finance-entry-primary { background:var(--dq-accent); color:#fff; border-color:var(--dq-accent); }
.project-entry-fallback { display:inline-block; margin:0 4px; padding:6px 12px; border-radius:8px; background:var(--dq-accent); color:#fff; text-decoration:none; }
.project-entry-fallback[hidden] { display:none; }
/* Keep the business viewport stable while the portal sidebar slides away. */
.project-workspace { left:0; background:transparent; transition:none; }
.project-workspace iframe { opacity:1; visibility:hidden; transition:none; }
.project-workspace[data-ready] iframe { visibility:visible; }
.project-workspace:not([data-ready]) .finance-entry-status { left:276px; }
/* The portal keeps the same navigation nodes and vertical grid in both widths. */
#portalShell[navigation-grid] .portal-nav-label { display:none; }
#portalShell[navigation-grid] .portal-home,#portalShell[navigation-grid] .portal-navigation .module-card { height:36px; min-height:36px; margin:0; border-radius:8px; }
#portalShell[navigation-grid] .portal-home { margin-bottom:8px; }
#portalShell[navigation-grid] .module-grid { display:flex; flex-direction:column; gap:8px; }
#portalShell[navigation-mode="rail"] .portal-home>span:not(.icon-box),#portalShell[navigation-mode="rail"] .portal-navigation .module-card :is(h3,p,.card-foot) { display:none; }
#portalShell[navigation-mode="rail"] .portal-navigation :is(.portal-home,.module-card) { justify-content:center; width:36px; padding:0; margin-left:2px; }
#portalShell .portal-home:not([aria-current="page"]) { background:transparent; }
#portalShell .portal-navigation .module-card[aria-current="page"] { background:var(--dq-active); }
.portal-rail-note { position:fixed; z-index:1200; width:270px; max-width:calc(100vw - 16px); padding:10px 12px; border:1px solid #292a2b; border-radius:10px; color:#fff; background:var(--dq-ink); box-shadow:0 8px 24px rgba(0,0,0,.2); font:13px/20px var(--dq-font); user-select:text; }
.portal-rail-note[hidden] { display:none; }
.portal-rail-note::before { content:""; position:absolute; top:-1px; bottom:-1px; left:-12px; width:12px; }
.portal-rail-note-heading { display:flex; align-items:center; gap:8px; }
.portal-rail-note-heading strong { font-size:14px; font-weight:500; }
.portal-rail-note-heading svg { flex:0 0 auto; width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:var(--dq-icon-stroke,1.5); stroke-linecap:round; stroke-linejoin:round; color:rgba(255,255,255,.8); }
.portal-rail-note p { margin:6px 0 0; color:rgba(255,255,255,.72); overflow-wrap:anywhere; }
.project-workspace,.project-workspace[data-ready] { left:56px; }
.project-workspace:not([data-ready]) .finance-entry-status { left:0; }
.project-workspace:not([data-ready]):not([data-loading]) { visibility:hidden; }
.personnel-workspace,.personnel-workspace[data-ready] { left:56px; background:transparent; transition:none; }
.personnel-workspace iframe { opacity:1; visibility:hidden; transition:none; }
.personnel-workspace[data-ready] iframe { visibility:visible; }
.personnel-workspace:not([data-ready]) .finance-entry-status { left:0; }
.personnel-workspace:not([data-ready]):not([data-loading]) { visibility:hidden; }
#financeWorkspace,#financeWorkspace[data-ready] { left:56px; transition:none; }
#financeWorkspace iframe { opacity:1; visibility:hidden; transition:none; }
#financeWorkspace[data-ready] iframe { visibility:visible; }
@media(prefers-reduced-motion:reduce) { .finance-workspace,.finance-frame-host iframe { transition:none; } }
/* Keep retained module documents out of layout until their navigation entry is active. */
.finance-frame-host iframe[hidden] { display:none !important; }
/* Modules without a business sidebar retain the full portal navigation. */
#moduleWorkspace[data-navigation="global"],#moduleWorkspace[data-navigation="global"][data-ready] { left:276px; }
#portalShell[navigation-mode="rail"]~#moduleWorkspace[data-navigation="global"] { left:56px; }
@media(max-width:600px) {
  #portalShell:not([navigation-mode="module"]):not([navigation-mode="collapsed"]) .portal-home>span:not(.icon-box),
  #portalShell:not([navigation-mode="module"]):not([navigation-mode="collapsed"]) .portal-navigation .module-card :is(h3,p,.card-foot) { display:none; }
  #portalShell:not([navigation-mode="module"]):not([navigation-mode="collapsed"]) .portal-navigation :is(.portal-home,.module-card) { justify-content:center; width:36px; padding:0; margin-left:2px; }
  .portal-content { padding:24px 16px; }
  .portal-intro { align-items:flex-start; flex-wrap:wrap; gap:8px; margin-bottom:20px; }
  .portal-datetime { margin-left:0; text-align:left; }
  #moduleWorkspace[data-navigation="global"],#moduleWorkspace[data-navigation="global"][data-ready] { left:56px; }
}
