/* Client portal: own frame with the case header and tabs. Warm paper, one dark hero per
   page, white cards with soft shadows; site.css provides the tokens and base elements. */
[hidden] { display: none !important; }
fieldset.field { margin: 0; padding: 0; border: 0; min-width: 0; }
fieldset.field legend { margin-bottom: 6px; padding: 0; }

.portal-body { background: #fbfaf6; }

/* Header: logo, case number, sign-out; tabs as pills underneath */
.portal-header { position: sticky; top: 0; z-index: 20; background: rgb(255 255 255 / 0.92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.portal-header-row { display: flex; align-items: center; gap: 16px; padding-top: 10px; padding-bottom: 10px; }
.portal-header .logo img { width: 100px; }
.portal-caseline { display: flex; align-items: baseline; gap: 8px; margin: 0 0 0 auto; padding: 5px 12px; border-radius: 999px; background: #f3f1ea; font-size: 0.86rem; }
.portal-caseline span { color: var(--ink-3); }
.portal-caseline strong { font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.portal-signout { margin: 0; }
.portal-signout-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font: inherit; font-size: 0.86rem; cursor: pointer; }
.portal-signout-btn:hover { border-color: var(--ink-3); color: var(--ink); }
.portal-signout-btn .icon { width: 16px; height: 16px; }
.portal-home { margin-left: auto; font-size: 0.92rem; color: var(--ink-2); }

.portal-tabs { display: flex; gap: 4px; padding-bottom: 10px; overflow-x: auto; scrollbar-width: none; }
.portal-tabs::-webkit-scrollbar { display: none; }
.portal-tabs a {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 0.93rem;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
}
.portal-tabs a .icon { width: 17px; height: 17px; opacity: 0.8; }
.portal-tabs a:hover { background: #f3f1ea; color: var(--ink); }
.portal-tabs a[aria-current="page"] { background: #dff5e8; color: #135c40; }
.portal-tabs a[aria-current="page"] .icon { opacity: 1; }

.portal-staffbar { margin: 0; padding: 8px var(--gutter); background: #f7e3d4; color: #6b2f0e; font-size: 0.88rem; text-align: center; }
.portal-main { padding: 28px 0 48px; }
.portal-flash { margin-bottom: 18px; }
.portal-footer { display: flex; flex-wrap: wrap; gap: 8px 20px; padding-bottom: 28px; font-size: 0.84rem; color: var(--ink-3); }
.portal-footer a { color: var(--ink-3); }

/* Shared card look */
.portal-main .panel { border: 1px solid rgb(13 34 29 / 0.06); box-shadow: 0 1px 2px rgb(13 34 29 / 0.04), 0 8px 24px -12px rgb(13 34 29 / 0.12); }
.portal-main .panel-mint { border-color: transparent; box-shadow: none; background: #eaf7ef; }

/* Sign-in pages */
.portal-narrow { max-width: 640px; margin: 0 auto; }
.portal-narrow > .panel + .panel { margin-top: 18px; }
.portal-narrow h1 { font-size: clamp(1.5rem, 3vw, 2rem); }
.portal-narrow .lead { margin-top: 10px; }
.portal-narrow .panel h2 { margin-bottom: 8px; font-size: 1.25rem; }
.portal-narrow .portal-facts { margin-top: 20px; }
.portal-narrow .portal-upload { margin-top: 16px; }
.portal-inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-top: 18px; }
.portal-inline-form .field { flex: 1 1 260px; }

/* Page heading for the inner tabs */
.portal-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 22px; }
.portal-head .kicker { margin: 0; }
.portal-head h1 { margin: 4px 0 0; font-size: clamp(1.55rem, 3vw, 2.2rem); letter-spacing: -0.01em; }
.portal-head .badge { margin-bottom: 6px; }
.portal-downloads { display: flex; flex-wrap: wrap; gap: 8px; }

/* Overview hero: status and progress on a light, warm card with a photo */
.portal-hero {
  position: relative;
  display: grid;
  gap: 24px;
  overflow: hidden;
  padding: 28px 30px 26px;
  border-radius: var(--radius-l);
  background: linear-gradient(115deg, #e4f7ec 0%, #f4fbf2 45%, #fff3e2 100%);
  border: 1px solid rgb(13 34 29 / 0.06);
  box-shadow: 0 14px 40px -24px rgb(29 91 71 / 0.35);
  color: var(--ink);
}
@media (min-width: 980px) { .portal-hero { grid-template-columns: minmax(0, 1fr) 300px; align-items: center; } }
.portal-hero-photo { display: none; }
@media (min-width: 980px) {
  .portal-hero-photo { display: block; align-self: stretch; margin: -28px -30px -26px 0; }
  .portal-hero-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 55% center; border-radius: 0 var(--radius-l) var(--radius-l) 0; -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 22%); mask-image: linear-gradient(90deg, transparent 0, #000 22%); }
}
.portal-hero-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.portal-hero-meta { margin: 0; color: var(--forest); font-size: 0.92rem; font-weight: 650; }
.portal-hero h1 { max-width: 22ch; margin: 10px 0 0; font-size: clamp(1.7rem, 3.4vw, 2.5rem); line-height: 1.15; letter-spacing: -0.015em; }
.portal-hero-text { max-width: 58ch; margin: 10px 0 0; color: var(--ink-2); font-size: 1.04rem; }
.portal-hero .badge { background: #fff; color: var(--forest); box-shadow: 0 1px 2px rgb(13 34 29 / 0.08); }
.portal-hero .badge-warn { background: #ffe2c7; color: #8a3b0c; }

.portal-tracker { position: relative; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 26px 0 0; padding: 0; list-style: none; }
.portal-tracker li { position: relative; display: grid; justify-items: center; gap: 8px; text-align: center; color: var(--ink-3); font-size: 0.86rem; }
.portal-tracker li + li::before { content: ""; position: absolute; top: 15px; right: 50%; width: 100%; height: 3px; border-radius: 2px; background: rgb(29 91 71 / 0.14); }
.portal-tracker li.done + li::before { background: #22a06b; }
.portal-tracker-dot { position: relative; z-index: 1; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #fff; border: 2px solid rgb(29 91 71 / 0.18); color: var(--ink-3); font-size: 0.84rem; font-weight: 700; }
.portal-tracker-dot svg { width: 18px; height: 18px; }
.portal-tracker li.done { color: var(--ink-2); }
.portal-tracker li.done .portal-tracker-dot { background: #22a06b; border-color: #22a06b; color: #fff; }
.portal-tracker li.current { color: var(--ink); font-weight: 650; }
.portal-tracker li.current .portal-tracker-dot { background: #ea580c; border-color: #ea580c; color: #fff; box-shadow: 0 0 0 6px rgb(234 88 12 / 0.16); }

/* One clear next step */
.portal-next { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; margin-top: 16px; padding: 22px 26px; border-radius: var(--radius); background: #fff6ec; border: 1px solid #ffdcbc; }
.portal-next > div { flex: 1 1 320px; }
.portal-next-kicker { margin: 0; color: #c2560f; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.portal-next h2 { margin: 4px 0 0; font-size: 1.3rem; }
.portal-next p:last-child { margin: 6px 0 0; color: var(--ink-2); }


/* Three quick cards */
.portal-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 16px 0 22px; }
.portal-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 14px;
  align-items: center;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid rgb(13 34 29 / 0.06);
  box-shadow: 0 1px 2px rgb(13 34 29 / 0.04);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.portal-card:hover { transform: translateY(-2px); box-shadow: 0 10px 26px -14px rgb(13 34 29 / 0.3); }
.portal-card-icon { grid-row: span 2; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: #dff5e8; color: #17845a; }
.portal-card-blue .portal-card-icon { background: #e3eeff; color: #2f63c9; }
.portal-card-peach .portal-card-icon { background: #ffeadb; color: #d05f1c; }
.portal-card-icon .icon { width: 22px; height: 22px; }
.portal-card-title { font-weight: 650; }
.portal-card-text { font-size: 0.9rem; color: var(--ink-3); }
@media (prefers-reduced-motion: reduce) { .portal-card { transition: none; } .portal-card:hover { transform: none; } }

/* Two-column body */
.portal-grid { display: grid; gap: 20px; align-items: start; }
.portal-grid > * { min-width: 0; }
.portal-grid > * > .panel + .panel, .portal-grid > * > * + .panel, .portal-grid > * > .panel + * { margin-top: 20px; }
@media (min-width: 980px) { .portal-grid { grid-template-columns: minmax(0, 1fr) 340px; } }
.portal-grid .panel { padding: 24px; }
.portal-grid .panel h2 { margin-bottom: 12px; font-size: 1.2rem; }
.portal-grid .panel h3 { margin: 18px 0 8px; font-size: 1rem; }
.portal-panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.portal-panel-head a { font-size: 0.9rem; }
.portal-grid .panel p + form, .portal-grid .panel p + .btn { margin-top: 14px; }
.portal-help { margin: 18px 4px 0; color: var(--ink-3); font-size: 0.92rem; }

.portal-list { margin: 0; padding-left: 1.1em; display: grid; gap: 8px; }
.portal-checklist { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.portal-checklist li { position: relative; padding-left: 28px; }
.portal-checklist li::before { content: ""; position: absolute; left: 0; top: 2px; width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--forest); }

.portal-facts { display: grid; gap: 12px; margin: 0 0 16px; }
.portal-facts > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; }
.portal-facts dt { font-size: 0.88rem; color: var(--ink-3); }
.portal-facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.portal-grid aside .portal-facts > div { grid-template-columns: 96px minmax(0, 1fr); }
.portal-mono { font-variant-numeric: tabular-nums; letter-spacing: 0.01em; white-space: nowrap; }

/* Updates on the overview */
.portal-updates { margin: 0; padding: 0; list-style: none; }
.portal-updates li { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 14px; padding: 11px 0 11px 22px; border-top: 1px solid var(--line); }
.portal-updates li:first-child { border-top: 0; padding-top: 2px; }
.portal-updates li::before { content: ""; position: absolute; left: 2px; top: 18px; width: 9px; height: 9px; border-radius: 50%; background: var(--mint-2); }
.portal-updates li:first-child::before { top: 9px; background: #22a06b; box-shadow: 0 0 0 4px #dff5e8; }
.portal-updates strong { font-weight: 600; }
.portal-updates time { font-size: 0.84rem; color: var(--ink-3); white-space: nowrap; }

.portal-events { margin: 0; padding: 0; list-style: none; }
.portal-events li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.portal-events li:first-child { border-top: 0; padding-top: 0; }
.portal-events time { font-size: 0.84rem; color: var(--ink-3); }

/* Full timeline */
.portal-timeline { margin: 0; padding: 0 0 0 18px; list-style: none; border-left: 2px solid var(--mint-2); }
.portal-timeline li { position: relative; padding: 0 0 20px 16px; }
.portal-timeline li:last-child { padding-bottom: 2px; }
.portal-timeline li::before { content: ""; position: absolute; left: -26px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: #22a06b; box-shadow: 0 0 0 4px var(--surface); }
.portal-timeline li.pending::before { background: var(--surface); border: 2px solid var(--mint-2); width: 10px; height: 10px; }
.portal-timeline li.pending { color: var(--ink-2); }
.portal-timeline time { display: block; font-size: 0.84rem; color: var(--ink-3); }
.portal-timeline p { margin: 4px 0 0; color: var(--ink-2); }

.portal-cases { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.portal-cases a { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: var(--radius-s); background: var(--paper); color: var(--ink); text-decoration: none; }
.portal-cases a span { font-size: 0.84rem; color: var(--ink-3); }
.portal-cases li.current a { background: var(--mint); }

/* Letter: shown as a sheet of paper */
.portal-letter { margin-bottom: 20px; padding: clamp(24px, 5vw, 56px); border-radius: 4px; background: #fffefb; box-shadow: 0 1px 2px rgb(13 34 29 / 0.06), 0 18px 40px -22px rgb(13 34 29 / 0.35); font-size: 1.04rem; }
.portal-letter-pending { position: relative; display: grid; gap: 12px; margin-bottom: 0; }
.portal-letter-pending > p { margin: 0 0 8px; color: var(--ink-2); font-family: var(--font); font-size: 1rem; }
.portal-letter-pending > i { display: block; height: 11px; border-radius: 6px; background: linear-gradient(90deg, #eef2ef, #e3e9e5, #eef2ef); }
.portal-letter-pending > i:nth-of-type(3n) { width: 82%; }
.portal-letter-pending > i:nth-of-type(4n) { width: 64%; }
.portal-letter-pending .badge { justify-self: start; font-family: var(--font); }
.portal-letter p + p, .portal-letter ul, .portal-letter ol, .portal-letter blockquote { margin-top: 12px; }

/* Evidence */
.portal-files { margin: 0; padding: 0; list-style: none; }
.portal-files li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.portal-files li:first-child { border-top: 0; padding-top: 0; }
.portal-files strong { display: block; overflow-wrap: anywhere; }
.portal-file-actions { display: flex; gap: 14px; }

.portal-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.portal-drop { flex: 1 1 280px; display: grid; justify-items: start; gap: 6px; padding: 22px; border: 2px dashed var(--mint-2); border-radius: var(--radius); background: #f6fbf8; cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease; }
.portal-drop:hover, .portal-drop:focus-within { border-color: var(--forest); background: var(--mint); }
.portal-drop span { font-weight: 650; color: var(--forest); }
.portal-drop small { color: var(--ink-3); }
.portal-drop input { max-width: 100%; font: inherit; font-size: 0.92rem; }

/* Messages as a chat */
.portal-thread { margin: 0 0 18px; padding: 0; list-style: none; display: grid; gap: 12px; }
.portal-thread li { max-width: 86%; padding: 12px 16px; border-radius: 16px 16px 16px 4px; background: var(--paper); }
.portal-thread li.from-client { justify-self: end; border-radius: 16px 16px 4px 16px; background: var(--mint); }
.portal-thread p { margin: 4px 0 0; overflow-wrap: anywhere; }
.portal-reply { padding-top: 18px; border-top: 1px solid var(--line); }

/* Payments */
.portal-offers { margin: 0; padding: 0; list-style: none; }
.portal-offers li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.portal-offers li:first-child { border-top: 0; padding-top: 0; }
.portal-offers li > div { flex: 1 1 240px; }
.portal-offers strong { display: block; }
.portal-offers span { font-size: 0.92rem; color: var(--ink-2); }
.portal-offers form { margin: 0; }

.portal-wait { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.portal-wait::before { content: ""; width: 16px; height: 16px; border: 3px solid var(--mint-2); border-top-color: var(--forest); border-radius: 50%; animation: portal-spin 0.9s linear infinite; }
@keyframes portal-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .portal-wait::before { animation: none; } }

@media (max-width: 820px) {
  .portal-cards { grid-template-columns: 1fr; gap: 10px; }
  .portal-card { padding: 12px 14px; }
  .portal-card-icon { width: 40px; height: 40px; }
}
@media (max-width: 560px) {
  .portal-caseline { display: none; }
  .portal-signout { margin-left: auto; }
  .portal-signout-btn span { display: none; }
  .portal-tabs a { padding: 8px 12px; }
  .portal-main { padding-top: 18px; }
  .portal-hero { padding: 22px 20px; border-radius: var(--radius); }
  .portal-tracker li { font-size: 0.72rem; }
  .portal-tracker-dot { width: 28px; height: 28px; }
  .portal-tracker li + li::before { top: 13px; }
  .portal-next { padding: 18px 20px; }
  .portal-next .btn { width: 100%; justify-content: center; }
  .portal-facts > div { grid-template-columns: 1fr; gap: 2px; }
  .portal-grid .panel { padding: 20px; }
  .portal-thread li { max-width: 100%; }
}
.panel > h2 + .portal-timeline { margin-top: 16px; }
