/* portal.css — the Client Portal's own visual language. Loaded after
   style.css (which still supplies shared primitives this reuses on purpose:
   .btn, .badge/.badge-*, form input base styles, .helper-text/.error-text/
   .empty-state, .hidden, table styles) so a badge or button still looks
   consistent with the rest of the firm's tools, but everything structural —
   the hero, the dashboard shell, cards, the tab bar — is bespoke to the
   portal rather than reusing the staff app's admin-tool chrome. The staff
   app's own stylesheet is untouched by this file (all portal-* prefixed
   classes, nothing here overrides a bare .card/.topbar/.content rule other
   than the ones explicitly re-scoped below).

   Reuses the same --navy/--teal/... custom properties style.css already
   defines at :root (loaded first) so the portal stays visually on-brand
   with zero color drift, and only adds new tokens for things that didn't
   exist yet (shadows, radii, the hero gradient). */

:root {
  --p-shadow-sm: 0 1px 2px rgba(15, 60, 58, 0.05);
  --p-shadow-md: 0 10px 28px rgba(15, 60, 58, 0.08);
  --p-shadow-lg: 0 28px 72px rgba(8, 30, 29, 0.22);
  --p-radius-lg: 20px;
  --p-radius: 16px;
  --p-radius-sm: 10px;
}

/* ---- Shell ---- */
.portal-topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.portal-topbar .brand { font-size: 16px; }

/* ---- Hero (landing page) ---- */
.portal-hero {
  position: relative;
  overflow: hidden;
  background: radial-gradient(1100px 480px at 12% -10%, rgba(255,255,255,0.10), transparent 60%),
              linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 75%);
  padding: 64px 32px 80px;
}
/* Soft decorative rings — purely visual depth, clipped by the hero's own
   overflow:hidden so they never affect layout or scroll size. */
.portal-hero::before, .portal-hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.08);
  pointer-events: none;
}
.portal-hero::before { width: 620px; height: 620px; right: -220px; top: -260px; }
.portal-hero::after { width: 420px; height: 420px; right: -120px; bottom: -220px; border-color: rgba(255,255,255,0.06); }

.portal-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 56px;
  align-items: center;
}

.portal-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #bfe9e1;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 18px;
}
.portal-hero-eyebrow::before {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: #4fd8c4;
  box-shadow: 0 0 0 4px rgba(79, 216, 196, 0.2);
}

.portal-hero-title {
  margin: 0 0 16px;
  font-size: 40px;
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.6px;
  color: #fff;
}
.portal-hero-sub {
  margin: 0 0 28px;
  font-size: 16px;
  line-height: 1.6;
  color: rgba(255,255,255,0.78);
  max-width: 480px;
}

.portal-hero-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.portal-hero-features li {
  display: flex; align-items: flex-start; gap: 12px;
  color: rgba(255,255,255,0.92); font-size: 14.5px; font-weight: 500;
}
.portal-hero-check {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(79, 216, 196, 0.18); color: #6fe4d1;
  display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.portal-hero-check svg { width: 13px; height: 13px; }

/* ---- Sign-in card ---- */
.portal-signin-wrap { position: relative; }
.portal-signin-card {
  background: #fff;
  border: none;
  border-radius: var(--p-radius-lg);
  box-shadow: var(--p-shadow-lg);
  padding: 36px 34px 30px;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}
.portal-signin-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 5px;
  background: linear-gradient(90deg, var(--teal) 0%, #6fe4d1 100%);
}
.portal-signin-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--teal-light); color: var(--teal-dark);
  display: flex; align-items: center; justify-content: center;
  margin: 4px 0 16px;
}
.portal-signin-icon svg { width: 20px; height: 20px; }
.portal-signin-card h1 { margin: 0 0 4px; font-size: 21px; color: var(--navy); letter-spacing: -0.3px; text-align: left; }
.portal-signin-card > p.muted { margin: 0 0 22px; color: var(--muted); font-size: 13.5px; text-align: left; }
.portal-signin-card label { display: block; font-size: 12px; font-weight: 600; margin: 14px 0 5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.portal-signin-card input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; background: #fafcfc; transition: border-color .15s ease, background .15s ease;
}
.portal-signin-card input:focus { outline: none; border-color: var(--teal); background: #fff; box-shadow: 0 0 0 3px var(--teal-light); }

.portal-signin-card .btn-block { border-radius: 10px; padding: 11px; margin-top: 20px; font-size: 14px; }
.portal-signin-recovery-link { text-align: center; margin-top: 14px; }

/* Plain text "Forgot password?" / "Back to sign in" link under the
   password form — password sign-in is the only everyday method, so this
   is a quiet way out to the reset flow rather than a persistent toggle
   competing with it for attention. */
.portal-forgot-link {
  display: block; width: 100%; text-align: center; margin-top: 14px; padding: 4px;
  border: none; background: none; color: var(--muted); font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit; text-decoration: underline; text-underline-offset: 2px;
}
.portal-forgot-link:hover { color: var(--teal); }

/* Mandatory password-setup/reset panel shown in place of the dashboard
   right after a magic-link click, until a password is saved — same visual
   language as the sign-in card so it doesn't feel like a different app. */
.portal-setup-card {
  max-width: 420px; margin: 60px auto; background: #fff; border-radius: var(--p-radius-lg);
  box-shadow: var(--p-shadow-md); padding: 32px 28px;
}
.portal-setup-card h1 { font-size: 20px; margin: 0 0 6px; }
.portal-setup-card .btn-block { border-radius: 10px; padding: 11px; margin-top: 8px; font-size: 14px; width: 100%; }

/* ---- Landing page: below-the-fold info (Practice Areas / Contact) ---- */
.portal-landing-info { max-width: 1080px; margin: 0 auto; padding: 44px 32px 60px; }
.portal-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.portal-info-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--p-radius);
  padding: 24px; box-shadow: var(--p-shadow-sm);
}
.portal-info-card-icon {
  width: 38px; height: 38px; border-radius: 10px; background: var(--teal-light); color: var(--teal-dark);
  display: flex; align-items: center; justify-content: center; margin-bottom: 14px;
}
.portal-info-card-icon svg { width: 18px; height: 18px; }
.portal-info-card h3 { margin: 0 0 10px; font-size: 15px; color: var(--navy); }
.portal-info-card .empty-state { padding: 10px 0; text-align: left; }
.portal-contact-line { font-size: 14px; color: var(--text); margin: 0 0 6px; line-height: 1.5; }
.portal-contact-line a { color: var(--teal-dark); text-decoration: none; font-weight: 600; }
.portal-contact-line a:hover { text-decoration: underline; }

/* ---- Dashboard shell ---- */
#portal-app .content { background: var(--bg); padding: 32px 36px 60px; }

.portal-dash-header { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 26px; }
.portal-dash-header .page-title { margin-bottom: 2px; }
.portal-dash-date { font-size: 13px; color: var(--muted); font-weight: 500; }

/* Tab bar — pill-style underline with icons, replaces the plain text tabs. */
.portal-tabs {
  display: flex; gap: 2px; padding: 0 36px; background: #fff;
  border-bottom: 1px solid var(--border); overflow-x: auto; flex-shrink: 0;
}
.portal-tab {
  display: flex; align-items: center; gap: 7px;
  background: none; border: none; padding: 15px 16px; font-size: 13.5px; font-weight: 600;
  color: var(--muted); cursor: pointer; border-bottom: 2.5px solid transparent;
  white-space: nowrap; font-family: inherit; margin-bottom: -1px; transition: color .15s ease;
}
.portal-tab svg { width: 16px; height: 16px; color: inherit; opacity: 0.75; }
.portal-tab:hover { color: var(--text); }
.portal-tab.active { color: var(--teal-dark); border-bottom-color: var(--teal); }
.portal-tab.active svg { opacity: 1; }

.portal-view { animation: portalFadeIn .25s ease; }
@keyframes portalFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Stat cards — icon badge + value, color-coded per metric. */
.portal-stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-top: 4px; }
.portal-stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--p-radius);
  padding: 18px; text-align: left; cursor: pointer; font-family: inherit;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--p-shadow-sm);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.portal-stat-card:hover { border-color: var(--teal); transform: translateY(-2px); box-shadow: var(--p-shadow-md); }
.portal-stat-icon { width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.portal-stat-icon svg { width: 20px; height: 20px; }
.portal-stat-icon.p-teal { background: var(--teal-light); color: var(--teal-dark); }
.portal-stat-icon.p-blue { background: #e8eefd; color: #2f6fed; }
.portal-stat-icon.p-amber { background: #fef3c7; color: #b45309; }
.portal-stat-icon.p-violet { background: #ede9fe; color: #6d28d9; }
.portal-stat-value { font-size: 22px; font-weight: 800; color: var(--navy); line-height: 1.15; }
.portal-stat-label { font-size: 12px; color: var(--muted); margin-top: 1px; }

.portal-split-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; margin-top: 22px; }
.portal-panel {
  background: #fff; border: 1px solid var(--border); border-radius: var(--p-radius);
  padding: 22px; box-shadow: var(--p-shadow-sm);
}
.portal-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.portal-panel-head h3 { margin: 0; font-size: 14.5px; color: var(--navy); display: flex; align-items: center; gap: 8px; }
.portal-panel-head h3 svg { width: 16px; height: 16px; color: var(--teal-dark); }

/* Mini matter rows on the Overview panel */
.portal-mini-matter { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.portal-mini-matter:last-child { border-bottom: none; padding-bottom: 0; }
.portal-mini-matter-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.portal-mini-matter-stage { font-size: 11.5px; color: var(--teal-dark); font-weight: 600; }

/* Timeline-style event list on the Overview panel */
.portal-timeline { list-style: none; margin: 0; padding: 0; }
.portal-timeline-item { display: flex; gap: 12px; padding: 0 0 16px; position: relative; }
.portal-timeline-item:last-child { padding-bottom: 0; }
.portal-timeline-item::before {
  content: ''; position: absolute; left: 5px; top: 16px; bottom: -2px; width: 1px; background: var(--border);
}
.portal-timeline-item:last-child::before { display: none; }
.portal-timeline-dot { flex-shrink: 0; width: 11px; height: 11px; border-radius: 50%; margin-top: 4px; background: var(--teal); box-shadow: 0 0 0 3px var(--teal-light); }
.portal-timeline-dot.p-court { background: var(--danger); box-shadow: 0 0 0 3px #fee2e2; }
.portal-timeline-dot.p-deadline { background: var(--warn); box-shadow: 0 0 0 3px #fef3c7; }
.portal-timeline-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.portal-timeline-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---- Matter cards (Matters tab) ---- */
.portal-matter-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--p-radius);
  padding: 22px 24px; box-shadow: var(--p-shadow-sm); margin-bottom: 16px;
}
.portal-matter-card:last-child { margin-bottom: 0; }
.portal-matter-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 4px; }
.portal-matter-icon { width: 40px; height: 40px; border-radius: 11px; background: var(--teal-light); color: var(--teal-dark); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.portal-matter-icon svg { width: 18px; height: 18px; }
.portal-matter-title-row { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.portal-matter-name { font-size: 15.5px; font-weight: 700; color: var(--navy); }
.portal-matter-sub { font-size: 12.5px; color: var(--muted); margin: 3px 0 0 54px; }
.portal-matter-card .stage-bar { margin-top: 22px; }

/* ---- Documents tab: upload dropzone ---- */
.portal-upload-card {
  background: linear-gradient(180deg, #fff 0%, var(--teal-light) 220%);
  border: 1px solid var(--border); border-radius: var(--p-radius); padding: 24px; box-shadow: var(--p-shadow-sm);
  margin-bottom: 18px;
}
.portal-upload-card h3 { margin: 0 0 4px; font-size: 15px; color: var(--navy); }
.portal-upload-card > p { margin: 0 0 16px; }
.portal-upload-row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.portal-upload-field { flex: 1; min-width: 220px; }
.portal-upload-field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }

.portal-dropzone {
  border: 2px dashed var(--border); border-radius: var(--p-radius-sm);
  padding: 26px 20px; text-align: center; cursor: pointer;
  background: #fff; transition: border-color .15s ease, background .15s ease;
}
.portal-dropzone:hover, .portal-dropzone.p-dragover { border-color: var(--teal); background: var(--teal-light); }
.portal-dropzone-icon { width: 40px; height: 40px; margin: 0 auto 10px; border-radius: 50%; background: var(--teal-light); color: var(--teal-dark); display: flex; align-items: center; justify-content: center; }
.portal-dropzone-icon svg { width: 19px; height: 19px; }
.portal-dropzone-text { font-size: 13.5px; font-weight: 600; color: var(--text); }
.portal-dropzone-text span { color: var(--teal-dark); text-decoration: underline; }
.portal-dropzone-hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

/* Document rows — file-type icon + name/meta, replaces a plain bulleted list. */
.portal-doc-list { display: flex; flex-direction: column; gap: 2px; }
.portal-doc-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 6px;
  border-bottom: 1px solid var(--border); text-decoration: none; color: inherit;
  transition: background .12s ease;
}
.portal-doc-row:last-child { border-bottom: none; }
.portal-doc-row:hover { background: var(--bg); border-radius: 10px; }
.portal-doc-icon { width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: #eef2f2; color: #556; }
.portal-doc-icon svg { width: 17px; height: 17px; }
.portal-doc-icon.p-pdf { background: #fee2e2; color: #b91c1c; }
.portal-doc-icon.p-doc { background: #e8eefd; color: #2f6fed; }
.portal-doc-icon.p-img { background: #ede9fe; color: #6d28d9; }
.portal-doc-icon.p-sheet { background: #dcfce7; color: #15803d; }
.portal-doc-info { flex: 1; min-width: 0; }
.portal-doc-name { font-size: 13.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-doc-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.portal-doc-download { flex-shrink: 0; color: var(--muted); }
.portal-doc-download svg { width: 17px; height: 17px; }
.portal-doc-row:hover .portal-doc-download { color: var(--teal-dark); }

/* ---- Invoices tab ---- */
.portal-invoices-summary {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
  border-radius: var(--p-radius); padding: 22px 26px; margin-bottom: 20px; color: #fff;
}
.portal-invoices-summary-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; color: rgba(255,255,255,0.65); font-weight: 700; }
.portal-invoices-summary-value { font-size: 28px; font-weight: 800; margin-top: 4px; }
.portal-invoices-summary-count { font-size: 13px; color: rgba(255,255,255,0.85); }

.portal-invoice-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--p-radius);
  padding: 20px 22px; box-shadow: var(--p-shadow-sm); margin-bottom: 14px;
}
.portal-invoice-card:last-child { margin-bottom: 0; }

/* ---- Account tab ---- */
.portal-account-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--p-radius);
  padding: 26px; box-shadow: var(--p-shadow-sm); max-width: 460px;
}
.portal-account-status { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--p-radius-sm); background: var(--bg); margin: 10px 0 4px; }
.portal-account-status-icon { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.portal-account-status-icon.p-set { background: #dcfce7; color: #15803d; }
.portal-account-status-icon.p-unset { background: #fef3c7; color: #b45309; }
.portal-account-status-icon svg { width: 16px; height: 16px; }
.portal-account-status-text { font-size: 13px; color: var(--text); line-height: 1.4; }

/* ---- Empty states get a touch more presence ---- */
.portal-view .empty-state { padding: 34px 20px; }

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .portal-hero-inner { grid-template-columns: 1fr; gap: 40px; }
  .portal-hero-title { font-size: 32px; }
  .portal-signin-wrap { display: flex; justify-content: center; }
}

@media (max-width: 640px) {
  .portal-hero { padding: 40px 18px 56px; }
  .portal-hero-eyebrow { margin-bottom: 12px; }
  .portal-hero-title { font-size: 27px; }
  .portal-landing-info { padding: 32px 16px 40px; }
  #portal-app .content { padding: 20px 16px 40px; }
  .portal-tabs { padding: 0 16px; }
  .portal-signin-card { padding: 28px 22px 24px; }
  .portal-matter-sub { margin-left: 0; }
  .portal-invoices-summary { flex-direction: column; align-items: flex-start; }
}
