*{box-sizing:border-box}

:root{
  --portal-bg:#f3f6fa;
  --portal-card:#fff;
  --portal-line:#dce4ed;
  --portal-ink:#162235;
  --portal-muted:#667487;
  --portal-blue:#123f69;
  --portal-blue-2:#1f65a6;
  --portal-teal:#128078;
  --portal-success:#176b45;
  --portal-success-bg:#e9f7ef;
  --portal-danger:#a1303e;
  --portal-danger-bg:#fff0f2;
  --portal-warning:#995d12;
  --portal-shadow:0 12px 34px rgba(21,47,82,.08);
  --portal-radius:16px;
  --portal-radius-lg:22px;
  --portal-focus:0 0 0 4px rgba(31,101,166,.16);
}

html{scroll-behavior:smooth}

body.portal-body{
  margin:0;
  background:var(--portal-bg);
  color:var(--portal-ink);
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,
    BlinkMacSystemFont,"Segoe UI",sans-serif;
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
}

.portal-topbar{
  position:sticky;
  top:0;
  z-index:60;
  min-height:68px;
  padding:10px 24px;
  background:rgba(255,255,255,.95);
  border-bottom:1px solid var(--portal-line);
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:20px;
  backdrop-filter:blur(14px);
}

.portal-brand{
  text-decoration:none;
  color:var(--portal-ink);
}

.portal-brand strong,
.portal-brand span{display:block}

.portal-brand strong{
  color:var(--portal-blue);
  font-size:1.05rem;
  font-weight:900;
}

.portal-brand span{
  color:var(--portal-muted);
  font-size:.72rem;
}

.portal-topbar nav{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.portal-topbar nav a{
  padding:8px 10px;
  border-radius:9px;
  color:var(--portal-blue);
  text-decoration:none;
  font-weight:800;
}

.portal-topbar nav a:hover{
  background:#edf3f8;
}

.portal-layout{
  display:grid;
  grid-template-columns:245px minmax(0,1fr);
  min-height:calc(100vh - 110px);
}

.portal-sidebar{
  position:sticky;
  top:68px;
  height:calc(100vh - 68px);
  overflow:auto;
  padding:20px 14px;
  background:linear-gradient(180deg,#102f4d,#123f69);
  display:grid;
  align-content:start;
  gap:6px;
}

.portal-sidebar a{
  display:flex;
  align-items:center;
  min-height:43px;
  padding:10px 12px;
  border-radius:11px;
  color:#edf5fb;
  text-decoration:none;
  font-weight:760;
  transition:background .16s ease,transform .16s ease;
}

.portal-sidebar a:hover,
.portal-sidebar a.active{
  background:rgba(255,255,255,.12);
  transform:translateX(2px);
}

.portal-main{
  width:100%;
  max-width:1500px;
  margin:auto;
  padding:28px;
}

.portal-hero{
  padding:30px;
  border-radius:var(--portal-radius-lg);
  color:#fff;
  background:
    radial-gradient(circle at 85% 20%,rgba(255,255,255,.16),transparent 32%),
    linear-gradient(135deg,var(--portal-blue),var(--portal-blue-2) 65%,var(--portal-teal));
  box-shadow:0 18px 44px rgba(20,70,95,.18);
}

.portal-hero h1{
  margin:0;
  color:#fff;
  letter-spacing:-.025em;
}

.portal-hero p{margin:7px 0 0}

.portal-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
  margin-top:16px;
}

.portal-card,
.portal-panel{
  background:var(--portal-card);
  border:1px solid var(--portal-line);
  box-shadow:var(--portal-shadow);
}

.portal-card{
  padding:18px;
  border-radius:var(--portal-radius);
  transition:transform .16s ease,box-shadow .16s ease;
}

.portal-card:hover{
  transform:translateY(-2px);
  box-shadow:0 16px 38px rgba(21,47,82,.11);
}

.portal-card strong,
.portal-card span{display:block}

.portal-card strong{
  color:var(--portal-blue);
  font-size:1.45rem;
}

.portal-card span{
  margin-top:5px;
  color:var(--portal-muted);
}

.portal-panel{
  margin-top:16px;
  padding:22px;
  border-radius:18px;
}

.portal-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  overflow:hidden;
  border:1px solid var(--portal-line);
  border-radius:13px;
}

.portal-table th,
.portal-table td{
  padding:11px 12px;
  border-bottom:1px solid var(--portal-line);
  text-align:left;
  vertical-align:top;
}

.portal-table th{
  background:#f7f9fc;
  color:#35455a;
  font-size:.77rem;
  text-transform:uppercase;
  letter-spacing:.035em;
}

.portal-table tr:last-child td{border-bottom:0}
.portal-table tbody tr:hover td{background:#fafcfe}

.portal-button{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:42px;
  padding:10px 15px;
  border:1px solid transparent;
  border-radius:10px;
  background:linear-gradient(135deg,var(--portal-blue),var(--portal-blue-2));
  color:#fff;
  text-decoration:none;
  font-weight:850;
  cursor:pointer;
  transition:transform .16s ease,box-shadow .16s ease;
}

.portal-button:hover{
  transform:translateY(-1px);
  box-shadow:0 8px 20px rgba(18,63,105,.18);
  color:#fff;
}

.portal-button.secondary,
.portal-button-secondary{
  background:#edf3f8;
  color:var(--portal-blue);
  border-color:#d8e4ee;
}

.portal-form{
  display:grid;
  gap:12px;
}

.portal-form label{
  display:grid;
  gap:7px;
  color:var(--portal-ink);
  font-weight:800;
}

.portal-form input,
.portal-form select,
.portal-form textarea{
  width:100%;
  min-height:43px;
  padding:10px 12px;
  border:1px solid #cbd5df;
  border-radius:10px;
  background:#fff;
  color:var(--portal-ink);
  font:inherit;
  transition:border-color .16s ease,box-shadow .16s ease;
}

.portal-form textarea{min-height:120px;resize:vertical}

.portal-form input:focus,
.portal-form select:focus,
.portal-form textarea:focus,
.portal-button:focus-visible,
.portal-topbar a:focus-visible,
.portal-sidebar a:focus-visible{
  outline:none;
  border-color:var(--portal-blue-2);
  box-shadow:var(--portal-focus);
}

.portal-alert,
.portal-success{
  padding:13px 15px;
  margin-bottom:14px;
  border:1px solid transparent;
  border-radius:11px;
}

.portal-alert{
  color:var(--portal-danger);
  background:var(--portal-danger-bg);
  border-color:#f0c2c8;
}

.portal-success{
  color:var(--portal-success);
  background:var(--portal-success-bg);
  border-color:#c7e7d3;
}

.portal-footer{
  padding:15px;
  text-align:center;
  background:#fff;
  border-top:1px solid var(--portal-line);
  color:var(--portal-muted);
  font-size:.76rem;
}

.portal-section-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:14px;
  flex-wrap:wrap;
  margin-bottom:14px;
}

.portal-badge,
.portal-status{
  display:inline-flex;
  align-items:center;
  padding:5px 9px;
  border-radius:999px;
  background:#edf3f8;
  color:var(--portal-blue);
  font-size:.72rem;
  font-weight:850;
}

.portal-empty{
  padding:24px;
  border:1px dashed #cbd5df;
  border-radius:13px;
  text-align:center;
  color:var(--portal-muted);
  background:#fafbfd;
}

.portal-stat-row{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
  margin-top:12px;
}

.portal-stat{
  padding:13px;
  border-radius:13px;
  border:1px solid var(--portal-line);
  background:#f8fafc;
}

.portal-stat strong,
.portal-stat span{display:block}

.portal-stat strong{
  color:var(--portal-blue);
  font-size:1.18rem;
}

.portal-stat span{
  margin-top:4px;
  color:var(--portal-muted);
  font-size:.76rem;
}

.portal-table-wrap{overflow:auto}

@media(max-width:900px){
  .portal-layout{grid-template-columns:1fr}
  .portal-sidebar{
    position:static;
    height:auto;
    display:flex;
    overflow:auto;
    padding:10px;
  }
  .portal-sidebar a{
    flex:0 0 auto;
    white-space:nowrap;
  }
  .portal-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .portal-main{padding:20px}
}

@media(max-width:620px){
  .portal-topbar{
    align-items:stretch;
    flex-direction:column;
    padding:13px 14px;
  }
  .portal-topbar nav{justify-content:space-between}
  .portal-main{padding:14px 10px}
  .portal-grid,
  .portal-stat-row{grid-template-columns:1fr}
  .portal-panel,.portal-card{padding:16px}
  .portal-table{display:block;overflow-x:auto}
}

/* RC1.2.1 — Client portal authentication UI */
.portal-auth-shell{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:32px 18px;
  background:
    radial-gradient(circle at 12% 12%,rgba(31,101,166,.10),transparent 28%),
    radial-gradient(circle at 88% 85%,rgba(18,128,120,.09),transparent 30%),
    var(--portal-bg);
}

.portal-auth-card{
  width:min(780px,100%);
  padding:32px;
  border-radius:var(--portal-radius-lg);
}

.portal-auth-card--narrow{width:min(500px,100%)}

.portal-auth-brand{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  margin-bottom:24px;
}

.portal-auth-brand a{
  color:var(--portal-blue);
  text-decoration:none;
  font-weight:900;
  letter-spacing:-.015em;
}

.portal-auth-kicker{
  display:inline-flex;
  align-items:center;
  min-height:28px;
  padding:5px 10px;
  border-radius:999px;
  background:#eaf2f9;
  color:var(--portal-blue);
  font-size:.72rem;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.045em;
}

.portal-auth-card h1{
  margin:0;
  color:var(--portal-blue);
  font-size:clamp(1.8rem,3vw,2.35rem);
  line-height:1.15;
  letter-spacing:-.03em;
}

.portal-auth-intro{
  max-width:650px;
  margin:10px 0 26px;
  color:var(--portal-muted);
}

.portal-auth-section{
  padding:20px;
  border:1px solid var(--portal-line);
  border-radius:15px;
  background:#fbfcfe;
}

.portal-auth-section + .portal-auth-section{margin-top:16px}

.portal-auth-section h2{
  margin:0 0 16px;
  color:var(--portal-blue);
  font-size:1rem;
  letter-spacing:-.01em;
}

.portal-form-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:16px;
}

.portal-form-field{
  display:grid;
  gap:7px;
  min-width:0;
}

.portal-form-field--full{grid-column:1/-1}

.portal-form-field label{
  color:var(--portal-ink);
  font-weight:800;
}

.portal-form-field input,
.portal-form-field select{
  width:100%;
  min-height:48px;
  padding:11px 13px;
  border:1px solid #cbd5df;
  border-radius:11px;
  background:#fff;
  color:var(--portal-ink);
  font:inherit;
}

.portal-form-field input:focus,
.portal-form-field select:focus{
  outline:none;
  border-color:var(--portal-blue-2);
  box-shadow:var(--portal-focus);
}

.portal-form-help{
  margin:0;
  color:var(--portal-muted);
  font-size:.79rem;
}

.portal-password-wrap{
  position:relative;
  display:flex;
  align-items:stretch;
}

.portal-password-wrap input{padding-right:104px}

.portal-password-wrap .password-toggle{
  position:absolute;
  top:5px;
  right:5px;
  bottom:5px;
  min-width:92px;
  padding:0 12px;
  border:1px solid #c7d4df;
  border-radius:8px;
  background:#edf3f8;
  color:var(--portal-blue);
  font-weight:850;
  cursor:pointer;
}

.portal-password-wrap .password-toggle:hover,
.portal-password-wrap .password-toggle:focus-visible{
  background:var(--portal-blue);
  color:#fff;
  outline:none;
}

.portal-auth-actions{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin-top:22px;
  flex-wrap:wrap;
}

.portal-auth-actions .portal-button{
  min-width:210px;
  min-height:48px;
}

.portal-auth-links{
  display:flex;
  gap:12px;
  align-items:center;
  flex-wrap:wrap;
  margin:0;
}

.portal-auth-links a{
  color:var(--portal-blue);
  font-weight:800;
  text-decoration:none;
}

.portal-auth-links a:hover{text-decoration:underline}

.portal-password-strength{
  height:8px;
  border-radius:999px;
  overflow:hidden;
  background:#e3e9ef;
}

.portal-password-strength span{
  display:block;
  width:0;
  height:100%;
  background:var(--portal-danger);
  transition:width .2s ease,background .2s ease;
}

.portal-password-strength[data-level="medium"] span{width:66%;background:#c77a16}
.portal-password-strength[data-level="strong"] span{width:100%;background:var(--portal-success)}
.portal-password-strength[data-level="weak"] span{width:33%}

@media(max-width:700px){
  .portal-auth-shell{padding:18px 10px;place-items:start center}
  .portal-auth-card{padding:22px 16px}
  .portal-auth-brand{align-items:flex-start;flex-direction:column}
  .portal-form-grid{grid-template-columns:1fr}
  .portal-form-field--full{grid-column:auto}
  .portal-auth-section{padding:16px}
  .portal-auth-actions{align-items:stretch;flex-direction:column}
  .portal-auth-actions .portal-button{width:100%}
  .portal-auth-links{justify-content:center}
}
/* RC1.6.0 — Client Portal Enterprise */
.portal-hero-enterprise,.portal-hero{display:flex;justify-content:space-between;align-items:center;gap:22px}.portal-eyebrow{display:block;margin-bottom:6px;font-size:.74rem;font-weight:900;letter-spacing:.09em;text-transform:uppercase;opacity:.82}.portal-button-light{background:#fff;color:var(--portal-blue);border-color:#fff}.portal-kpi-grid{grid-template-columns:repeat(4,minmax(0,1fr))}.portal-kpi{text-decoration:none;color:inherit}.portal-kpi strong{font-size:2rem}.portal-alert-list{display:grid;gap:10px}.portal-warning-card{padding:13px 15px;border-radius:12px;background:#fff7e8;border:1px solid #efd6aa;color:#7d4b08;font-weight:750}.portal-list{display:grid;border:1px solid var(--portal-line);border-radius:14px;overflow:hidden}.portal-list-row{display:grid;grid-template-columns:minmax(220px,1fr) auto auto;align-items:center;gap:16px;padding:14px 16px;color:var(--portal-ink);text-decoration:none;border-bottom:1px solid var(--portal-line)}.portal-list-row:last-child{border-bottom:0}.portal-list-row:hover{background:#f8fbfd}.portal-list-row strong,.portal-list-row small{display:block}.portal-list-row small{margin-top:3px;color:var(--portal-muted)}.portal-intervention-row{grid-template-columns:minmax(220px,1fr) auto auto auto}.portal-status{display:inline-flex;padding:5px 9px;border-radius:999px;background:#eaf0f6;color:#36516e;font-size:.76rem;font-weight:900}.portal-status-in_progress{background:#fff0d6;color:#8a5300}.portal-status-completed,.portal-status-closed{background:#e7f6ee;color:#176b45}.portal-status-cancelled{background:#fff0f2;color:#a1303e}.portal-status-confirmed,.portal-status-scheduled{background:#eaf2fb;color:#1d5d99}.portal-quick-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-top:16px}.portal-quick{padding:18px;border:1px solid var(--portal-line);border-radius:16px;background:#fff;color:var(--portal-blue);text-decoration:none;box-shadow:var(--portal-shadow)}.portal-quick strong,.portal-quick span{display:block}.portal-quick span{margin-top:5px;color:var(--portal-muted)}.portal-empty{padding:24px;text-align:center;color:var(--portal-muted)}.portal-detail-grid{display:grid;grid-template-columns:1.35fr 1fr;gap:16px}.portal-definition{display:grid;gap:0;margin:0}.portal-definition div{display:grid;grid-template-columns:150px 1fr;gap:14px;padding:11px 0;border-bottom:1px solid var(--portal-line)}.portal-definition div:last-child{border-bottom:0}.portal-definition dt{color:var(--portal-muted);font-weight:800}.portal-definition dd{margin:0}.portal-report-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.portal-report-grid article{padding:16px;border:1px solid var(--portal-line);border-radius:13px;background:#fafcfe}.portal-timeline{display:grid;gap:0}.portal-timeline>div{position:relative;padding:0 0 22px 28px;color:var(--portal-muted)}.portal-timeline>div:before{content:"";position:absolute;left:3px;top:5px;width:12px;height:12px;border-radius:50%;background:#c7d1dc}.portal-timeline>div:after{content:"";position:absolute;left:8px;top:18px;bottom:0;width:2px;background:#dce4ed}.portal-timeline>div:last-child:after{display:none}.portal-timeline>div.done{color:var(--portal-ink)}.portal-timeline>div.done:before{background:var(--portal-success)}.portal-timeline span{display:block;color:var(--portal-muted);font-size:.85rem}@media(max-width:980px){.portal-kpi-grid,.portal-quick-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.portal-detail-grid{grid-template-columns:1fr}.portal-list-row,.portal-intervention-row{grid-template-columns:1fr auto}.portal-list-row time{grid-column:1/-1}}@media(max-width:640px){.portal-hero,.portal-hero-enterprise{align-items:flex-start;flex-direction:column}.portal-kpi-grid,.portal-quick-grid,.portal-report-grid{grid-template-columns:1fr}.portal-section-header{align-items:flex-start;flex-direction:column;gap:12px}.portal-list-row,.portal-intervention-row{grid-template-columns:1fr}.portal-definition div{grid-template-columns:1fr;gap:4px}}
