:root{
  --portal-ink:#102235;
  --portal-navy:#0b2f4a;
  --portal-navy-2:#123f60;
  --portal-teal:#0d817b;
  --portal-teal-dark:#08655f;
  --portal-gold:#c8a24a;
  --portal-soft:#f4f8fa;
  --portal-line:#d8e2e8;
  --portal-muted:#5b6d7a;
  --portal-white:#fff;
  --portal-danger:#8c2d25;
  --portal-success:#176b52;
  --portal-warn:#7a5a11;
  --portal-shadow:0 18px 48px rgba(16,34,53,.08);
  --portal-radius:18px;
  --portal-shell:min(1120px,calc(100% - 32px));
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;background:#eef4f7;color:var(--portal-ink);font-family:Arial,Helvetica,sans-serif;line-height:1.55}
a{color:var(--portal-teal-dark)}
a:focus-visible,button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid rgba(13,129,123,.3);outline-offset:3px}
.portal-skip{position:fixed;left:12px;top:-80px;z-index:999;background:#fff;color:#000;padding:10px 14px;border-radius:8px}
.portal-skip:focus{top:12px}
.portal-shell{width:var(--portal-shell);margin-inline:auto}
.portal-topbar{background:var(--portal-white);border-bottom:1px solid var(--portal-line)}
.portal-topbar-inner{min-height:76px;display:flex;justify-content:space-between;align-items:center;gap:24px}
.portal-brand{display:inline-flex;align-items:center;gap:12px;text-decoration:none;color:var(--portal-navy)}
.portal-brand-mark{display:block;width:44px;height:44px;object-fit:contain;flex:0 0 44px;background:#fff;border-radius:7px}
.portal-brand span:last-child{display:grid;line-height:1.2}
.portal-brand strong{font-size:17px}
.portal-brand small{font-size:11px;color:var(--portal-muted);text-transform:uppercase;letter-spacing:.08em;margin-top:3px}
.portal-topnav{display:flex;gap:18px;align-items:center}
.portal-topnav a{text-decoration:none;font-weight:700;font-size:14px}
.portal-stage-banner{background:#fff3cd;color:#5e490e;border-bottom:1px solid #e5cf89;text-align:center;padding:7px 14px;font-size:12px;font-weight:800;letter-spacing:.01em}
.portal-main{padding-block:48px 70px}
.portal-page-head{max-width:780px;margin-bottom:26px}
.portal-eyebrow{margin:0 0 7px;color:var(--portal-teal-dark);font-size:12px;font-weight:900;letter-spacing:.12em;text-transform:uppercase}
.portal-page-head h1{margin:0;color:var(--portal-navy);font-size:clamp(34px,6vw,58px);line-height:1.02;letter-spacing:-.025em}
.portal-page-head>p:last-child{margin:14px 0 0;color:var(--portal-muted);font-size:17px}
.portal-card{background:#fff;border:1px solid var(--portal-line);border-radius:var(--portal-radius);box-shadow:var(--portal-shadow);padding:clamp(22px,4vw,34px)}
.portal-auth-card{max-width:640px}
.portal-grid{display:grid;gap:22px}
.portal-grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.portal-grid-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.portal-field{display:grid;gap:7px}
.portal-field label{font-weight:800;color:var(--portal-navy);font-size:14px}
.portal-field input,.portal-field select,.portal-field textarea{width:100%;border:1px solid #bfcdd6;border-radius:10px;background:#fff;color:var(--portal-ink);padding:12px 13px;font:inherit}
.portal-field input:hover,.portal-field select:hover,.portal-field textarea:hover{border-color:#8fa6b5}
.portal-help{margin:0;color:var(--portal-muted);font-size:13px}
.portal-actions{display:flex;align-items:center;gap:14px;flex-wrap:wrap;margin-top:22px}
.portal-button{display:inline-flex;align-items:center;justify-content:center;min-height:44px;border:0;border-radius:10px;background:var(--portal-teal);color:#fff;text-decoration:none;padding:11px 18px;font-weight:900;cursor:pointer}
.portal-button:hover{background:var(--portal-teal-dark)}
.portal-button-secondary{background:#fff;color:var(--portal-navy);border:1px solid var(--portal-line)}
.portal-button-danger{background:#fff;color:var(--portal-danger);border:1px solid #deb9b5}
.portal-text-link{font-weight:800;text-decoration:none}
.portal-alert{border-radius:12px;padding:14px 16px;margin-bottom:20px;border:1px solid;font-weight:700}
.portal-alert-error{background:#fff4f1;border-color:#e3b4ac;color:#6f2d27}
.portal-alert-success{background:#edf8f5;border-color:#a9d9cf;color:#174c45}
.portal-alert-info{background:#edf5fb;border-color:#b8d5e8;color:#164867}
.portal-test-link{margin-top:16px;padding:14px;border:1px dashed #c8a24a;background:#fffaf0;border-radius:12px}
.portal-test-link strong{display:block;color:#624a12;margin-bottom:5px}
.portal-dashboard-head{display:flex;justify-content:space-between;gap:20px;align-items:flex-start;margin-bottom:24px}
.portal-dashboard-head h2{margin:0;color:var(--portal-navy);font-size:30px}
.portal-dashboard-head p{margin:5px 0 0;color:var(--portal-muted)}
.portal-section{margin-top:26px}
.portal-section>header{display:flex;justify-content:space-between;align-items:end;gap:20px;margin-bottom:13px}
.portal-section h2,.portal-section h3{margin:0;color:var(--portal-navy)}
.portal-section-note{margin:0;color:var(--portal-muted);font-size:13px}
.portal-kpi{background:linear-gradient(145deg,var(--portal-navy),var(--portal-navy-2));color:#fff;border-radius:16px;padding:20px}
.portal-kpi small{display:block;color:#c9d7df;text-transform:uppercase;letter-spacing:.08em;font-weight:800;font-size:10px}
.portal-kpi strong{display:block;font-size:24px;margin-top:5px}
.portal-kpi p{margin:7px 0 0;color:#dce7ed;font-size:13px}
.portal-list{display:grid;gap:10px}
.portal-item{border:1px solid var(--portal-line);border-radius:14px;padding:15px;background:#fbfdfe}
.portal-item-head{display:flex;justify-content:space-between;gap:16px;align-items:flex-start}
.portal-item h3{font-size:16px}
.portal-item p{margin:6px 0 0;color:var(--portal-muted);font-size:14px}
.portal-status{display:inline-flex;align-items:center;border-radius:999px;padding:5px 9px;background:#e9f3f2;color:var(--portal-teal-dark);font-size:11px;font-weight:900;white-space:nowrap}
.portal-status-warn{background:#fff4d6;color:var(--portal-warn)}
.portal-status-done{background:#ebf8f0;color:var(--portal-success)}
.portal-meta{display:flex;flex-wrap:wrap;gap:8px 16px;margin-top:9px;color:var(--portal-muted);font-size:12px}
.portal-document{display:grid;grid-template-columns:1fr auto;gap:16px;align-items:center}
.portal-empty{border:1px dashed #b9c9d2;border-radius:14px;padding:18px;color:var(--portal-muted);background:#fbfdfe}
.portal-footer{padding:26px 0 36px;border-top:1px solid var(--portal-line);color:var(--portal-muted);font-size:12px;background:#fff}
.portal-footer .portal-shell{display:flex;justify-content:space-between;gap:20px;flex-wrap:wrap}
.portal-footer p{margin:0}
.portal-inline-form{display:inline}
.portal-divider{height:1px;background:var(--portal-line);margin:24px 0}
.portal-security-note{font-size:13px;color:var(--portal-muted);margin-top:18px}
.portal-password-rules{margin:8px 0 0;padding-left:20px;color:var(--portal-muted);font-size:13px}
@media(max-width:820px){
  .portal-topbar-inner{align-items:flex-start;padding-block:14px}
  .portal-topnav{flex-direction:column;align-items:flex-end;gap:6px}
  .portal-grid-2,.portal-grid-3{grid-template-columns:1fr}
  .portal-dashboard-head{flex-direction:column}
  .portal-document{grid-template-columns:1fr}
}
@media(max-width:560px){
  :root{--portal-shell:min(100% - 22px,1120px)}
  .portal-main{padding-block:34px 52px}
  .portal-card{padding:20px 16px}
  .portal-page-head h1{font-size:38px}
  .portal-actions{align-items:stretch;flex-direction:column}
  .portal-actions .portal-button,.portal-actions .portal-button-secondary{width:100%}
  .portal-topbar-inner{gap:12px}
  .portal-topnav{font-size:12px}
}
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}}

/* Phase 2.1i — client password creation feedback */
.portal-password-field-group{align-content:start}
.portal-password-wrap{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:stretch}
.portal-password-wrap .portal-password-toggle{
  min-width:68px;
  border:1px solid #bfcdd6;
  border-radius:10px;
  background:#fff;
  color:var(--portal-navy);
  padding:0 14px;
  font:inherit;
  font-weight:800;
  cursor:pointer
}
.portal-password-wrap .portal-password-toggle:hover{border-color:#8fa6b5;background:#f8fbfc}
.portal-password-wrap .portal-password-toggle:focus-visible{outline:3px solid rgba(13,129,123,.3);outline-offset:3px}
.portal-password-assist{
  margin-top:2px;
  border:1px solid var(--portal-line);
  border-radius:12px;
  background:var(--portal-soft);
  padding:13px 14px
}
.portal-password-strength-row{
  display:flex;
  justify-content:space-between;
  gap:14px;
  align-items:center;
  color:var(--portal-muted);
  font-size:12px
}
.portal-password-strength-row strong{color:var(--portal-navy);font-size:12px}
.portal-password-strength-meter{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:5px;
  margin:9px 0 12px
}
.portal-password-strength-meter span{
  display:block;
  height:5px;
  border-radius:999px;
  background:#d5e0e6;
  transition:background-color .16s ease
}
.portal-password-strength-meter span.is-active{background:var(--portal-teal)}
.portal-password-requirements{
  list-style:none;
  margin:0;
  padding:0;
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px 14px;
  color:var(--portal-muted);
  font-size:12px
}
.portal-password-requirements li{
  position:relative;
  min-height:20px;
  padding-left:21px
}
.portal-password-requirements li::before{
  content:"";
  position:absolute;
  left:0;
  top:.18em;
  width:13px;
  height:13px;
  border-radius:50%;
  border:2px solid #b7c8d2;
  background:#fff;
  box-sizing:border-box
}
.portal-password-requirements li.is-met{color:var(--portal-success)}
.portal-password-requirements li.is-met::before{
  content:"✓";
  display:grid;
  place-items:center;
  border-color:var(--portal-success);
  background:var(--portal-success);
  color:#fff;
  font-size:9px;
  font-weight:900;
  line-height:1
}
.portal-password-match-status{
  display:block;
  min-height:20px;
  color:var(--portal-muted);
  font-size:12px
}
.portal-password-match-status.is-match{color:var(--portal-success);font-weight:800}
.portal-password-match-status.is-mismatch{color:var(--portal-danger);font-weight:800}
@media(max-width:560px){
  .portal-password-requirements{grid-template-columns:1fr}
  .portal-password-wrap .portal-password-toggle{min-width:64px;padding-inline:11px}
}
@media(prefers-reduced-motion:reduce){
  .portal-password-strength-meter span{transition:none}
}

/* Phase 2.1i2 — portal-controlled field validation; no browser-native popups */
.portal-field-validation-callout{
  position:absolute;
  z-index:220;
  display:flex;
  align-items:flex-start;
  gap:8px;
  padding:8px 10px;
  border:1px solid #c8a98a;
  border-radius:8px;
  background:#fffdf9;
  color:#573522;
  box-shadow:0 5px 16px rgba(7,21,34,.14);
  font-size:13px;
  font-weight:600;
  line-height:1.35
}
.portal-field-validation-callout-icon{
  display:inline-grid;
  place-items:center;
  flex:0 0 18px;
  width:18px;
  height:18px;
  border-radius:4px;
  background:#e86f27;
  color:#fff;
  font-size:12px;
  font-weight:900;
  line-height:1
}
.portal-field input[aria-invalid="true"]{
  border-color:#b35d4c;
  box-shadow:0 0 0 2px rgba(179,93,76,.10)
}
@media(max-width:620px){
  .portal-field-validation-callout{font-size:12.5px}
}

/* Phase 3.3x2 — controlled validation responsive flow-anchor standard */
.portal-field-validation-callout{
  position:static;
  left:auto;
  top:auto;
  width:100%;
  max-width:100%;
  margin:6px 0 0;
  box-sizing:border-box;
}

/* Phase 3.3x3 — requested client authentication form centering */
.portal-auth-card-centered{
  margin-inline:auto;
}

/* Phase 3.9a3 — Client file-card action alignment */
.portal-document-body{min-width:0}
.portal-document-body>p{overflow-wrap:anywhere}
.portal-document-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
}
.portal-document-actions .portal-status{flex:0 0 auto}
.portal-document-actions .portal-button{flex:0 0 auto;margin:0}
@media(max-width:820px){
  .portal-document-actions{width:100%;justify-content:flex-start}
}
@media(max-width:560px){
  .portal-document-actions{
    display:grid;
    grid-template-columns:max-content minmax(0,1fr);
    align-items:center;
    gap:10px;
  }
  .portal-document-actions .portal-button{
    width:100%;
    min-width:0;
    text-align:center;
  }
}


/* Phase 3.9a4 — Client deliverable review acknowledgment */
.portal-deliverable-card{align-items:start}
.portal-deliverable-review{
  grid-column:1 / -1;
  border-top:1px solid var(--portal-line);
  padding-top:14px;
  margin-top:2px;
}
.portal-deliverable-review>p{
  margin:0;
  color:var(--portal-muted);
  line-height:1.55;
}
.portal-deliverable-review .portal-alert{margin:0}
.portal-review-response-form{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:12px;
}
@media(max-width:560px){
  .portal-review-response-form{
    display:grid;
    grid-template-columns:1fr;
  }
  .portal-review-response-form .portal-button{
    width:100%;
  }
}


/* Phase 3.9a6a — honor dynamic hidden state in Client Review controls */
.portal-deliverable-review [hidden]{
  display:none !important;
}

/* Phase 5.5 — client-visible KPI dashboard */
.portal-performance-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px
}
.portal-performance-card{
  min-width:0;
  border:1px solid var(--portal-line);
  border-radius:14px;
  padding:16px;
  background:linear-gradient(180deg,#fff,#f8fbfc)
}
.portal-performance-card-head{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start
}
.portal-performance-card-head>div{min-width:0}
.portal-performance-card-head small{
  display:block;
  color:var(--portal-muted);
  font-size:9px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.7px
}
.portal-performance-card h3{
  margin:4px 0 0;
  color:var(--portal-navy);
  font-size:16px;
  overflow-wrap:anywhere
}
.portal-performance-value{
  display:block;
  margin-top:14px;
  color:var(--portal-navy);
  font-size:27px;
  line-height:1.05;
  overflow-wrap:anywhere
}
.portal-performance-card>p{
  margin:8px 0 0;
  color:var(--portal-muted);
  font-size:13px;
  line-height:1.5
}
.portal-performance-meta{
  display:flex;
  flex-wrap:wrap;
  gap:7px 12px;
  margin-top:13px;
  padding-top:10px;
  border-top:1px solid var(--portal-line);
  color:var(--portal-muted);
  font-size:11px
}
.portal-performance-meta strong{color:var(--portal-navy)}
.portal-kpi-status-on-target{background:#ebf8f0;color:var(--portal-success)}
.portal-kpi-status-attention{background:#fff4d6;color:var(--portal-warn)}
.portal-kpi-status-awaiting{background:#edf2f5;color:#536f80}
.portal-kpi-status-tracking{background:#e9f3f2;color:var(--portal-teal-dark)}
@media(max-width:1000px){
  .portal-performance-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:820px){
  .portal-performance-grid{grid-template-columns:1fr}
}
@media(max-width:560px){
  .portal-performance-card-head{display:grid}
  .portal-performance-card-head .portal-status{justify-self:start}
}



/* Phase 5.6 — scheduled advisory reviews */
.portal-review-copy{
  margin-top:11px;
  padding-top:10px;
  border-top:1px solid var(--portal-line)
}
.portal-review-copy strong{
  display:block;
  color:var(--portal-navy);
  font-size:12px
}
.portal-review-copy p{
  margin:5px 0 0;
  color:var(--portal-muted);
  line-height:1.55;
  overflow-wrap:anywhere
}
.portal-status-cancelled{background:#f0f2f3;color:#5b6971}


/* Phase 5.7 — client action plan */
.portal-action-plan-summary{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px;margin:12px 0}
.portal-action-plan-summary>div{border:1px solid var(--portal-line);border-radius:10px;background:#f8fbfc;padding:10px 11px}
.portal-action-plan-summary span{display:block;color:var(--portal-muted);font-size:10px;font-weight:800;text-transform:uppercase;letter-spacing:.45px}
.portal-action-plan-summary strong{display:block;margin-top:3px;color:var(--portal-navy);font-size:20px}
.portal-action-item-badges{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:6px}
.portal-action-item-overdue{border-left:4px solid #b97822;background:#fffdf8}
@media(max-width:680px){
  .portal-action-plan-summary{grid-template-columns:repeat(2,minmax(0,1fr))}
  .portal-action-item-badges{justify-content:flex-start;margin-top:6px}
}


/* Phase 5.6a — transparent client notice after an advisory review is reopened */
.portal-review-reopened{
  margin:10px 0;
  padding:10px 11px;
  border:1px solid #d9e4e8;
  border-radius:9px;
  background:#f7fbfc
}
.portal-review-reopened strong{
  display:block;
  color:var(--portal-navy)
}
.portal-review-reopened p{
  margin:4px 0 0;
  color:var(--portal-muted);
  font-size:12px;
  line-height:1.45
}

/* Phase 6.2a — electronic agreement consent alignment + controlled validation */
.portal-agreement-consent{
  display:grid;
  grid-template-columns:22px minmax(0,1fr);
  gap:11px;
  align-items:start;
  margin:18px 0 4px;
  padding:16px;
  border:1px solid var(--portal-line);
  border-radius:10px;
  background:#f8fbfc
}
.portal-agreement-consent input[type="checkbox"]{
  width:18px;
  height:18px;
  margin:2px 0 0;
  padding:0;
  accent-color:var(--portal-teal);
  cursor:pointer
}
.portal-agreement-consent label{
  color:var(--portal-navy);
  font-size:14px;
  font-weight:700;
  line-height:1.55;
  cursor:pointer
}
.portal-agreement-consent input[aria-invalid="true"]{outline:2px solid rgba(179,93,76,.35);outline-offset:2px}
.portal-agreement-consent + .portal-field-validation-callout{margin-top:8px}

/* Phase 6.2a3 — mobile-safe electronic-agreement hashes */
.portal-agreement-hash{
  white-space:normal;
  overflow-wrap:anywhere;
  word-break:break-word;
  max-width:100%;
}
