.portal{
  max-width:1240px;
  margin:0 auto;
  color:var(--ink);
  overflow-wrap:anywhere;
}

.portal *{box-sizing:border-box}

.portal-hero{
  padding:clamp(22px,3.2vw,38px);
  margin:0 0 22px;
  border:1px solid #dfe3ff;
  border-radius:var(--ui-card-radius);
  background:var(--ui-hero);
  color:var(--navy);
  box-shadow:var(--shadow);
}

.portal-hero h1{
  max-width:820px;
  margin:9px 0 10px;
  color:var(--navy);
  font-size:clamp(1.8rem,3.8vw,2.75rem);
  font-weight:800;
  letter-spacing:-.025em;
  line-height:1.08;
}

.portal-hero p{
  max-width:760px;
  margin:0;
  color:var(--muted);
  font-size:clamp(1rem,1.8vw,1.08rem);
  line-height:1.55;
}

.portal-kicker,
.portal-hero .eyebrow{
  display:block;
  color:var(--blue);
  font-size:.72rem;
  font-weight:850;
  letter-spacing:.16em;
  line-height:1.4;
  text-transform:uppercase;
}

.portal-columns,
.portal-intake-layout{
  display:grid;
  grid-template-columns:minmax(0,1.25fr) minmax(290px,.75fr);
  gap:22px;
  align-items:start;
}

.portal-intake-layout{grid-template-columns:minmax(0,1.45fr) minmax(270px,.55fr)}
.portal-columns>*,.portal-intake-layout>*{min-width:0}

.portal-card{
  min-width:0;
  margin:0 0 22px;
  padding:clamp(18px,2.5vw,26px);
  border:1px solid var(--line);
  border-radius:var(--ui-card-radius);
  background:#fff;
  box-shadow:var(--shadow);
}

.portal-card h2{
  margin:0 0 16px;
  color:var(--navy);
  font-size:1.28rem;
  font-weight:800;
  line-height:1.25;
}

.portal-card h3{margin:22px 0 13px;color:var(--navy)}
.portal p,.portal li{line-height:1.58}
.portal p:first-child{margin-top:0}
.portal p:last-child{margin-bottom:0}

.portal-card-title{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  margin-bottom:18px;
}

.portal-card-title h2{margin:4px 0 0}
.portal-count,.portal-time{
  flex:none;
  min-width:36px;
  padding:7px 10px;
  border-radius:999px;
  background:var(--blue-soft);
  color:#1717a8;
  font-size:.78rem;
  font-weight:800;
  text-align:center;
}

.portal-form{display:grid;gap:16px}
.portal-intake-card{padding:clamp(18px,3vw,30px)}
.portal-intake-card>.portal-form{gap:14px}

.portal label{
  display:grid;
  min-width:0;
  gap:7px;
  color:#34435d;
  font-size:.92rem;
  font-weight:720;
}

.portal label>span em{
  color:#7b879b;
  font-size:.76rem;
  font-style:normal;
  font-weight:550;
}

.portal input,.portal textarea,.portal select{
  display:block;
  width:100%;
  min-width:0;
  min-height:var(--ui-field-height);
  padding:12px 14px;
  border:1px solid #d4dceb;
  border-radius:var(--ui-field-radius);
  background:#fff;
  color:var(--ink);
  font:inherit;
  font-size:var(--ui-control-size);
  font-weight:450;
  line-height:1.4;
}

.portal textarea{min-height:112px;resize:vertical}
.portal input::placeholder,.portal textarea::placeholder{color:#98a2b3}
.portal input:focus,.portal textarea:focus,.portal select:focus{
  border-color:#514cff;
  outline:3px solid #e2e1ff;
  outline-offset:1px;
}

.portal label small,.portal small,.portal-muted,.portal dt{
  color:#68768e;
  font-size:.82rem;
  font-weight:450;
  line-height:1.48;
}

.portal-fields{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
}

.portal-step{
  min-width:0;
  margin:0;
  padding:16px;
  border:1px solid #e2e7f1;
  border-radius:15px;
  background:#fbfcff;
}

.portal-step legend{
  display:flex;
  align-items:center;
  gap:10px;
  max-width:100%;
  padding:0 8px 0 0;
  color:var(--navy);
}

.portal-step legend>span{
  display:inline-grid;
  width:28px;
  height:28px;
  flex:none;
  place-items:center;
  border-radius:9px;
  background:var(--blue-soft);
  color:var(--blue);
  font-size:.8rem;
  font-weight:850;
}

.portal-step legend strong{font-size:1rem;font-weight:800}
.portal-step-intro{margin:0 0 13px;color:#65718a;font-size:.88rem;line-height:1.48}
.portal-evidence-step{border-color:#dcdcff;background:#fafaff}

.portal-file-picker{
  padding:14px;
  border:1px dashed #a9b5cc;
  border-radius:13px;
  background:#fff;
  cursor:pointer;
}

.portal-file-picker:hover{border-color:#5f5aff;background:#fcfcff}
.portal-file-picker input[type=file]{min-height:var(--ui-touch-height,48px);padding:8px;background:#f7f8fc;font-size:.85rem}

.portal-selected-files{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:9px;
  margin-top:12px;
}

.portal-selected-files[hidden]{display:none}
.portal-selected-file{
  min-width:0;
  padding:8px;
  border:1px solid #e1e6ef;
  border-radius:11px;
  background:#fff;
}

.portal-selected-file img{
  display:block;
  width:100%;
  aspect-ratio:4/3;
  border-radius:8px;
  object-fit:cover;
}

.portal-selected-file span{
  display:block;
  margin-top:6px;
  overflow:hidden;
  color:#52617a;
  font-size:.72rem;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.portal-submit{
  display:grid;
  gap:13px;
  padding:17px;
  border-radius:15px;
  background:#f2f4ff;
}

.portal-submit .button{justify-self:start}
.portal-form .button{min-height:var(--ui-touch-height,48px);justify-self:start}

.portal .portal-check{
  display:flex;
  align-items:flex-start;
  min-height:var(--ui-touch-height,48px);
  gap:11px;
  color:#35425b;
  font-weight:480;
  line-height:1.48;
}

.portal-check input[type=checkbox]{
  width:22px;
  height:22px;
  min-height:22px;
  flex:none;
  margin:1px 0 0;
  padding:0;
  accent-color:var(--blue);
}

.portal-process{position:sticky;top:20px}
.portal-explanation{
  display:grid;
  gap:13px;
  margin:0 0 20px;
  padding:0;
  counter-reset:portal-process;
  list-style:none;
}

.portal-explanation li{
  position:relative;
  min-height:36px;
  padding:7px 0 7px 46px;
  color:#40506a;
  counter-increment:portal-process;
}

.portal-explanation li::before{
  position:absolute;
  top:2px;
  left:0;
  display:grid;
  width:34px;
  height:34px;
  place-items:center;
  border-radius:11px;
  background:#f0efff;
  color:var(--blue);
  content:counter(portal-process);
  font-weight:850;
}

.portal-alert{
  margin:0 0 18px;
  padding:14px 16px;
  border:1px solid #c7d8f1;
  border-radius:var(--ui-field-radius);
  background:#eef4ff;
  color:#2c4d76;
  overflow-wrap:anywhere;
}

.portal [role=alert]{border-color:#eecaca;background:#fff5f5;color:#922727}

.portal-stages{
  display:grid;
  gap:8px;
  margin:0 0 22px;
  padding:0;
  list-style:none;
}

.portal-stages[data-stage-count="4"]{grid-template-columns:repeat(4,minmax(0,1fr))}
.portal-stages[data-stage-count="5"]{grid-template-columns:repeat(5,minmax(0,1fr))}

.portal-stages li{
  min-width:0;
  padding:10px 11px;
  border:1px solid #dbe1ed;
  border-radius:12px;
  background:#fff;
  color:#66748d;
  font-size:.8rem;
  line-height:1.3;
  text-align:center;
}

.portal-stages li[aria-current]{border-color:var(--status-bg,var(--blue));background:var(--status-bg,var(--blue));color:var(--status-ink,#fff);font-weight:750}

.portal-files{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
  margin:0;
  padding:0;
  list-style:none;
}

.portal-files li{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;
  gap:11px;
  min-width:0;
  padding:12px;
  border:1px solid #e5e9f1;
  border-radius:13px;
  background:#fff;
}

.portal-files li.portal-file-evidence{grid-template-columns:72px minmax(0,1fr)}
.portal-files li.portal-file-evidence>.button{grid-column:2}
.portal-files li>div{min-width:0}
.portal-files li strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.portal-files .button{min-height:44px;padding:9px 13px}
.portal-request-info{display:grid;justify-items:start;gap:6px}

.portal-thumb{
  display:block;
  grid-row:1/3;
  width:72px;
  height:72px;
  border-radius:10px;
  background:#eef1f7;
  overflow:hidden;
}

.portal-thumb img{display:block;width:100%;height:100%;object-fit:cover}

.portal-facts{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:0 18px;
  margin:0;
}

.portal-facts div{min-width:0;padding:11px 0;border-bottom:1px solid #edf0f5}
.portal-facts dd{margin:4px 0 0;color:#273550;font-weight:650;white-space:pre-wrap}

.portal-history{margin:0;padding:0;list-style:none}
.portal-history li{position:relative;padding:0 0 22px 24px;border-left:2px solid #e2e6f0}
.portal-history li:last-child{padding-bottom:0;border-color:transparent}
.portal-history li::before{position:absolute;top:3px;left:-6px;width:10px;height:10px;border:2px solid #fff;border-radius:50%;background:var(--blue);box-shadow:0 0 0 1px #cbcfff;content:""}

.portal-history-note{margin-top:10px;padding:10px 12px;border:1px solid #dce3f0;border-radius:12px;background:#f8faff}
.portal-history-note small{display:block;margin-bottom:4px;color:#65718a;font-size:.7rem;font-weight:850;letter-spacing:.08em;text-transform:uppercase}
.portal-history-note p{margin:0}
.portal-history-note-internal{border-color:#eadfbd;background:#fffaf0}
.portal-history-note-customer{border-color:#cfcaff;background:#f7f6ff}
.portal-history time{display:block;margin-bottom:3px;color:#77839a;font-size:.75rem}
.portal-history p{margin:5px 0;white-space:pre-wrap}

.portal-access-key{border:2px solid #514cff;background:linear-gradient(135deg,#fff,#f6f5ff)}
.portal-access-key input{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:.82rem}
.portal-key-fallback{margin-top:22px;padding-top:12px;border-top:1px solid var(--line)}
.portal-key-fallback summary{display:flex;align-items:center;min-height:44px;color:var(--navy);font-weight:750;cursor:pointer}
.portal-key-fallback summary:focus-visible{outline:3px solid #e2e1ff;outline-offset:2px;border-radius:var(--ui-field-radius)}
.portal-key-fallback[open] summary{margin-bottom:12px}
.portal-color-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:16px}
.portal-color-grid input[type=color]{min-height:48px;padding:6px;cursor:pointer}
.portal-color-grid .portal-badge{justify-self:start;max-width:100%}
.portal-inline-actions{display:flex;align-items:center;flex-wrap:wrap;gap:10px}
.portal-compact-card{padding:14px}
.portal-delivery{border-left:4px solid #514cff}

.portal-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin-bottom:20px;
  flex-wrap:wrap;
}

.portal-toolbar h2{margin:4px 0 0;color:var(--navy);font-size:1.65rem}
.portal-toolbar>strong{color:var(--navy)}

.portal-filter{
  display:flex;
  gap:8px;
  margin:0 0 20px;
  padding:2px 0;
  overflow-x:auto;
  scrollbar-width:thin;
}

.portal-filter a{
  display:inline-flex;
  align-items:center;
  min-height:44px;
  flex:none;
  padding:9px 13px;
  border:1px solid var(--line);
  border-radius:var(--ui-field-radius);
  background:#fff;
  color:inherit;
  text-decoration:none;
}

.portal-filter a[aria-current]{border-color:var(--blue);background:#f1f0ff;color:var(--blue)}
.portal-filter-state{width:12px;height:12px;flex:none;margin-right:7px;border:1px solid #64748b;border-radius:50%;background:var(--status-bg)}
.portal-filter span{margin-left:6px;padding:2px 7px;border-radius:8px;background:#eef1f7}

.portal-case-list{display:grid;gap:10px;margin:0;padding:0;list-style:none}
.portal-case-card{
  padding:15px;
  border:1px solid #e1e6ef;
  border-radius:14px;
  background:#fff;
  transition:border-color .16s ease,box-shadow .16s ease;
}

.portal-case-card:hover{border-color:#c8caff;box-shadow:0 8px 22px rgba(11,25,59,.06)}
.portal-case-card header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding-bottom:11px;border-bottom:1px solid #edf0f5}
.portal-case-card header>div{display:grid;gap:2px;min-width:0}
.portal-case-reference{color:#10224c;font-weight:850}
.portal-case-card time{color:#77839a;font-size:.75rem}
.portal-case-main{display:grid;grid-template-columns:1.5fr 1fr .55fr;gap:16px;padding:12px 0}
.portal-case-main>div{display:grid;align-content:start;min-width:0;gap:2px}
.portal-case-main small{margin:0;color:#77839a;text-transform:uppercase;letter-spacing:.06em}
.portal-case-main span{overflow:hidden;color:#5d6b83;font-size:.82rem;text-overflow:ellipsis;white-space:nowrap}
.portal-case-card footer{display:flex;justify-content:flex-end}
.portal-case-card footer .button{min-height:44px}

.portal-badge{
  display:inline-flex;
  align-items:center;
  min-height:32px;
  flex:none;
  padding:5px 10px;
  border-radius:10px;
  background:var(--status-bg,#edefff);
  color:var(--status-ink,#183896);
  font-size:.78rem;
  font-weight:750;
}

.portal-note-box{display:grid;gap:9px;padding:14px;border-radius:13px}
.portal-note-internal{border:1px solid #e4e7ec;background:#f8f9fb}
.portal-note-customer{border:1px solid #cbd0ff;background:#f6f5ff}
.portal-note-box label{gap:6px}
.portal-note-box textarea{background:#fff}

.portal-mail-list{display:grid;gap:9px;margin:15px 0 0;padding:0;list-style:none}
.portal-mail-list li{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:12px;border:1px solid #e5e9f1;border-radius:12px}
.portal-mail-list li>div{min-width:180px;flex:1}
.portal-mail-list form{display:block;margin:0}
.portal-mail-list .button{min-height:44px;padding:9px 12px}

.portal-empty{margin:0;padding:28px 0;color:#6b7890;text-align:center}
.portal-upload-status{margin:0;color:#4b5d78;font-size:.86rem}
.portal-upload-status:empty{display:none}

@media(max-width:900px){
  .portal-columns,.portal-intake-layout{grid-template-columns:minmax(0,1fr)}
  .portal-process{position:static}
  .portal-intake-layout .portal-process{padding:18px}
  .portal-intake-layout .portal-process .portal-explanation{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
  .portal-intake-layout .portal-process .portal-explanation li{padding:42px 5px 5px;text-align:center;font-size:.84rem}
  .portal-intake-layout .portal-process .portal-explanation li::before{left:50%;transform:translateX(-50%)}
}

@media(max-width:760px){
  .portal-hero{margin-bottom:16px;padding:20px}
  .portal-card{margin-bottom:16px;padding:18px}
  .portal-fields,.portal-facts{grid-template-columns:minmax(0,1fr)}
  .portal-stages{display:flex;gap:6px;overflow-x:auto;padding-bottom:3px}
  .portal-stages li{min-width:104px;flex:1 0 auto;padding:8px}
  .portal-files{grid-template-columns:minmax(0,1fr)}
  .portal-case-main{grid-template-columns:minmax(0,1fr) minmax(110px,.55fr)}
  .portal-case-main>div:first-child{grid-column:1/-1}
  .portal-case-card footer .button{width:100%}
  .portal-toolbar{align-items:flex-start}
  .portal-toolbar>.portal-inline-actions{width:100%}
  .portal-toolbar>.portal-inline-actions .button{flex:1}
}

@media(max-width:520px){
  .portal-intake-layout .portal-process .portal-explanation{grid-template-columns:minmax(0,1fr);gap:6px}
  .portal-intake-layout .portal-process .portal-explanation li{min-height:34px;padding:6px 0 6px 44px;text-align:left}
  .portal-intake-layout .portal-process .portal-explanation li::before{left:0;transform:none}
  .portal-selected-files{grid-template-columns:repeat(2,minmax(0,1fr))}
  .portal-step{padding:14px 12px}
  .portal-submit{padding:14px}
  .portal-submit .button{width:100%}
  .portal-files li.portal-file-evidence{grid-template-columns:64px minmax(0,1fr)}
  .portal-thumb{width:64px;height:64px}
  .portal-case-main{grid-template-columns:minmax(0,1fr)}
  .portal-case-main>div:first-child{grid-column:auto}
  .portal-case-card header{align-items:center}
  .portal-mail-list li{align-items:stretch;flex-direction:column}
  .portal-mail-list .button{width:100%}
}

@media(max-width:350px){
  .portal-card,.portal-hero{padding:15px}
  .portal-selected-files{grid-template-columns:minmax(0,1fr)}
  .portal-inline-actions{align-items:stretch;flex-direction:column}
  .portal-inline-actions .button{width:100%}
}
