/* Shared UI components (layout + components). */

@import url("https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200");
@import url("https://fonts.googleapis.com/icon?family=Material+Icons");


/* ---- Header / Nav ---- */
.header {
  background: var(--primary-focused);
  color: var(--n-0);
  padding: 0 calc(24px + 1rem);
  min-height: 104px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-logo { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.header-logo img { height: 46px; width: auto; display: block; }

.header-nav {
  display: flex;
  gap: 24px;
  align-items: center;
  align-self: stretch;
}
.header-nav a {
  color: var(--header-nav-item-fg);
  text-decoration: none;
  font-size: var(--type-lg-body-size);
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 14px;
}
.header-nav a:hover {
  background: var(--header-nav-item-hover-bg);
  color: var(--header-nav-item-hover-fg);
}
.header-nav a:visited { color: var(--header-nav-item-fg); }
.header-nav a:focus-visible,
.header-nav a:active {
  color: var(--header-nav-item-hover-fg);
}
.header-nav .divider { color: var(--header-nav-item-fg); }
.header-menu-toggle {
  display: none;
}

.header-account-dropdown {
  position: relative;
  height: 100%;
  display: inline-flex;
  align-items: stretch;
}

.header-account-toggle {
  border: 0;
  background: transparent;
  color: var(--header-nav-item-fg);
  text-decoration: none;
  font-size: var(--type-lg-body-size);
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 14px;
  cursor: pointer;
}

.header-account-toggle:hover {
  background: var(--header-nav-item-hover-bg);
  color: var(--header-nav-item-hover-fg);
}

.header-account-chevron {
  display: inline-block;
  margin-left: 4px;
  font-size: var(--type-body-size);
  line-height: 1;
  width: 16px;
  height: 16px;
  transition: transform 120ms ease;
}

.header-account-menu {
  display: none;
  position: absolute;
  top: calc(100% - 2px);
  right: calc(-1 * (24px + 1rem));
  min-width: 222px;
  background: var(--primary-focused);
  border: 0;
  border-radius: 0 0 0 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
  padding: 12px 0;
  z-index: 200;
}

.header-account-menu.show {
  display: block;
}

.header-account-menu a {
  display: flex;
  align-items: center;
  min-height: 44px;
  margin: 2px 10px;
  border-radius: 8px;
  padding: 0 16px;
  color: var(--n-0);
  text-decoration: none;
  font-size: var(--type-lg-body-size);
  line-height: var(--type-lg-body-line);
  font-weight: var(--font-weight-regular);
  transition: background-color 120ms ease, color 120ms ease;
}

.header-account-menu a:hover {
  background: #0077b8;
  color: var(--n-0);
}

.header-account-menu a:focus-visible {
  background: #0077b8;
  color: var(--n-0);
  outline: none;
}

.header-account-menu a.is-active {
  background: var(--header-nav-item-selected-bg);
  color: var(--header-nav-item-selected-fg);
}

.header-mobile-menu[hidden],
.header-mobile-backdrop[hidden] {
  display: none !important;
}

.header-menu-toggle {
  border: 0;
  background: transparent;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
}

.header-menu-toggle img {
  width: 24px;
  height: 24px;
  display: block;
  filter: brightness(0) invert(1);
}

.header-menu-toggle:focus-visible,
.header-menu-close:focus-visible {
  outline: 2px solid var(--n-0);
  outline-offset: 2px;
}

@media (max-width: 48rem) {
  .header {
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 12px 16px;
  }

  .header-logo {
    min-width: 0;
  }

  .header-logo span {
    font-size: var(--type-sm-body-size);
  }

  .header-nav {
    width: 100%;
    flex-wrap: wrap;
    gap: 10px 16px;
  }
}

/* ---- Breadcrumb ---- */
.breadcrumb {
  padding: 12px 24px;
  margin-bottom: 0;
  font-size: var(--type-sm-body-size);
  border-bottom: 1px solid var(--border-primary);
  background: var(--n-0);
}
.breadcrumb span { color: var(--text-primary); }
.breadcrumb a { margin-right: 8px; color: var(--primary-default); }
.breadcrumb a:visited { color: var(--primary-default); }

/* ---- Layout ---- */
/* Updated as requested: wider desktop container */
.container { max-width: 1200px; margin: 24px auto; padding: 0 24px; }

/* ---- Card ---- */
.card {
  background: var(--n-0);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  padding: 24px;
  margin-bottom: 16px;
}
.card h2 { font-size: var(--type-title-size); margin-bottom: 16px; font-weight: var(--font-weight-bold); color: var(--text-primary); }
.card h3 { font-size: var(--type-subtitle-size); margin-bottom: 12px; font-weight: var(--font-weight-bold); color: var(--text-primary); }

/* ---- Timeline Cards ---- */
.portal-timeline-group {
  margin-top: 16px;
}

.portal-timeline-group:first-of-type {
  margin-top: 0;
}

.portal-timeline-heading {
  margin: 0;
  padding: 0 18px 8px;
  color: var(--n-90);
  font-size: var(--type-lg-body-size);
  line-height: var(--type-lg-body-line);
  font-weight: var(--font-weight-regular);
}

.portal-timeline-group-body {
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--n-0);
  box-shadow: var(--shadow-app-default-subtle);
}

.portal-timeline-card {
  position: relative;
  border-bottom: 1px solid var(--border-primary);
  border-radius: 0;
  transition: background-color 160ms ease;
}

.portal-timeline-card:last-child {
  border-bottom: 0;
}

.portal-timeline-card:first-child {
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
}

.portal-timeline-card:last-child {
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

.portal-timeline-card:hover,
.portal-timeline-card.is-hover {
  background: var(--n-20);
  box-shadow: var(--shadow-app-default), inset 0 0 0 1px var(--primary-accent);
  z-index: 1;
}

.portal-timeline-card:hover .portal-link,
.portal-timeline-card.is-hover .portal-link,
.portal-timeline-card:hover .activity-message-link,
.portal-timeline-card.is-hover .activity-message-link {
  text-decoration: underline;
}

.portal-timeline-message {
  min-width: 0;
}

.portal-timeline-title-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.portal-timeline-title-copy {
  min-width: 0;
}

.portal-timeline-icon {
  display: none;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 20px;
  line-height: 1;
  flex: 0 0 auto;
  margin-top: 2px;
}

.portal-timeline-icons-on .portal-timeline-icon {
  display: inline-flex;
}

.portal-timeline-subtext,
.portal-timeline-meta {
  color: var(--text-secondary);
}

.portal-timeline-subtext {
  display: block;
  margin-top: 4px;
  font-size: var(--type-sm-body-size);
  line-height: var(--type-sm-body-line);
}

.portal-timeline-meta {
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  white-space: nowrap;
}

.portal-timeline-status {
  display: flex;
  justify-content: flex-start;
}

.portal-timeline-card.portal-timeline-origin--applicant::before,
.portal-timeline-card.portal-timeline-origin--respondent::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--n-50);
  pointer-events: none;
}

.portal-timeline-card.portal-timeline-origin--applicant::before {
  left: 0;
}

.portal-timeline-card.portal-timeline-origin--respondent::after {
  right: 0;
}

/* ================================
   Create Case – Stepper (responsive + fits)
================================ */

.case-header {
  margin: 0 0 8px;
}

.case-header.has-save-close {
  position: relative;
  padding-right: 0;
}

.case-header.has-save-close .case-header__title,
.case-header.has-save-close .case-header__subtitle,
.case-header.has-save-close .case-header__case-type {
  max-width: calc(100% - 190px);
}

.case-header .case-header__title {
  margin: 0;
  color: var(--text-h2);
  font-size: var(--type-lg-body-size);
  line-height: var(--type-lg-body-line);
  font-weight: var(--font-weight-semibold);
}

.case-header .case-header__subtitle {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  font-weight: var(--font-weight-regular);
}

.case-header .case-header__case-type {
  margin: 2px 0 0;
  color: var(--primary-default);
  font-size: var(--type-xl-size);
  line-height: var(--type-xl-line);
  font-weight: var(--font-weight-semibold);
}

.case-header .case-header__save-close {
  position: absolute;
  top: 0;
  right: 0;
  display: inline-flex;
}

.portal-progress-stepper {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 2px 0 32px;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--border-subtle);
  max-width: 100%;
}

.case-header .portal-progress-stepper {
  margin-bottom: 20px;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.progress-step .number {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--type-body-size);
  font-weight: var(--font-weight-bold);
  border: 0;
}

.progress-step .label {
  font-size: var(--type-lg-body-size);
  font-weight: var(--font-weight-regular);
}

/* connectors between steps (fill/shrink instead of forcing width) */
.progress-connector {
  flex: 1 1 auto;
  height: 4px;
  background: var(--n-40);
  border-radius: 999px;
  opacity: 1;
  min-width: 24px;
}

/* states */
.progress-step.inactive .number {
  background: var(--n-40);
  color: var(--text-primary);
}
.progress-step.inactive .label {
  color: var(--text-secondary);
  font-weight: var(--font-weight-regular); /* regular */
}

.progress-step.active .number {
  background: var(--primary-highlight);
  color: var(--text-primary);
}
.progress-step.active .label {
  color: var(--primary-focused);
  font-weight: var(--font-weight-bold);
}

.progress-step.completed .number {
  background: var(--success);
  color: var(--n-0);
}
.progress-step.completed .label {
  color: var(--text-primary);
  font-weight: var(--font-weight-semibold);
}

.progress-connector.completed {
  background: var(--success);
  opacity: 1;
}

/* Responsive: use horizontal scroll only when needed (keeps connectors sane) */
@media (max-width: 900px) {
  .portal-progress-stepper {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 12px;
  }

  .progress-step { flex: 0 0 auto; }
  .progress-connector { flex: 0 0 24px; min-width: 24px; height: 3px; }

  .progress-step .number { width: 32px; height: 32px; font-size: var(--type-sm-body-size); }
  .progress-step .label { font-size: var(--type-sm-body-size); }
}

.portal-progress-stepper::-webkit-scrollbar { height: 8px; }
.portal-progress-stepper::-webkit-scrollbar-thumb { background: var(--n-40); border-radius: 999px; }
.portal-progress-stepper::-webkit-scrollbar-track { background: transparent; }

/* Material Symbols utility */
.md-icon,
.material-icons {
  font-family: "Material Icons", "Material Icons Outlined", "Material Symbols Outlined", sans-serif;
  font-weight: var(--font-weight-regular);
  font-style: normal;
  font-size: var(--type-title-size);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  direction: ltr;
  text-transform: none;
  letter-spacing: normal;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "liga";
  -webkit-font-feature-settings: "liga";
  text-rendering: optimizeLegibility;
}

.material-symbols-outlined {
  font-family: "Material Symbols Outlined", "Material Icons Outlined", "Material Icons", sans-serif;
  font-weight: var(--font-weight-regular);
  font-style: normal;
  font-size: var(--type-title-size);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  direction: ltr;
  text-transform: none;
  letter-spacing: normal;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "liga";
  -webkit-font-feature-settings: "liga";
  text-rendering: optimizeLegibility;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

.portal-message__icon {
  overflow: hidden;
}

.portal-message {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: var(--space-4);
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  color: var(--text-primary);
}

.portal-message.is-mobile {
  max-width: 380px;
}

.portal-message.is-removable {
  box-shadow: var(--shadow-app-default-medium);
}

.portal-message:has(.portal-message__title):not(:has(.portal-message__body)),
.portal-message:has(.portal-message__body):not(:has(.portal-message__title)) {
  align-items: center;
}

.portal-message__icon {
  flex: 0 0 auto;
  font-size: var(--space-6);
  line-height: 1;
  width: var(--space-6);
  height: var(--space-6);
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.portal-message__text {
  flex: 1 1 auto;
  margin: 0;
}

.portal-message__close {
  flex: 0 0 auto;
  align-self: flex-start;
  border: 0;
  background: transparent;
  color: inherit;
  width: var(--space-6);
  height: var(--space-6);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.portal-message__close .material-symbols-outlined {
  font-size: var(--space-6);
}

.portal-message__title,
.portal-message__body {
  margin: 0;
}

.portal-message__title + .portal-message__body {
  margin-top: var(--space-2);
}

.portal-message:not(.is-mobile) .portal-message__icon {
  font-size: var(--space-7);
  width: var(--space-7);
  height: var(--space-7);
}

.portal-message.is-removable .portal-message__close {
  width: var(--space-7);
  height: var(--space-7);
}

.portal-message.is-removable .portal-message__close .material-symbols-outlined {
  font-size: var(--space-7);
}

.portal-message--attention {
  background: var(--attention-bg);
  border-color: var(--border-attention);
}

.portal-message--error {
  background: var(--error-bg);
  border-color: var(--border-error);
}

.portal-message--help {
  background: var(--primary-bg);
  border-color: var(--primary-default);
}

.portal-message--information {
  background: var(--info-bg);
  border-color: var(--border-info);
}

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

.portal-message--system {
  background: var(--n-10);
  border-color: var(--border-subtle);
}

.portal-message--attention .portal-message__icon {
  color: var(--attention);
}

.portal-message--error .portal-message__icon {
  color: var(--error);
}

.portal-message--help .portal-message__icon {
  color: var(--primary-default);
}

.portal-message--information .portal-message__icon {
  color: var(--info);
}

.portal-message--success .portal-message__icon {
  color: var(--success);
}

/* --------------------------------
   Buttons – link-safe versions
-------------------------------- */

a.btn,
a.btn-primary,
a.btn-secondary,
a.btn-tertiary,
a.btn-success,
a.btn-error {
  text-decoration: none;
  white-space: nowrap;
  flex-wrap: nowrap;
  width: fit-content;
}

/* Base component */
.btn,
.btn-primary,
.btn-secondary,
.btn-tertiary,
.btn-success,
.btn-error {
  --btn-bg: var(--n-0);
  --btn-border: var(--n-100);
  --btn-fg: var(--n-100);
  --btn-bg-hover: var(--n-20);
  --btn-border-hover: var(--n-100);
  --btn-fg-hover: var(--n-100);
  --btn-bg-active: var(--n-40);
  --btn-border-active: var(--n-100);
  --btn-fg-active: var(--n-100);
  --btn-bg-focus: var(--btn-bg);
  --btn-border-focus: var(--primary-accent);
  --btn-fg-focus: var(--btn-fg);
  --btn-focus-ring: 0 0 0 4px var(--primary-accent);
  --btn-height: 48px;
  --btn-px: 24px;
  --btn-font-size: var(--type-body-size);
  --btn-line-height: var(--type-body-line);
  --btn-radius: var(--radius-md);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: var(--btn-height);
  padding: 0 var(--btn-px);
  border-radius: var(--btn-radius);
  font-size: var(--btn-font-size);
  line-height: var(--btn-line-height);
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  user-select: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
  flex-wrap: nowrap;
  width: fit-content;
}

.btn .md-icon,
.btn .btn-icon {
  display: none;
  flex: 0 0 auto;
}

.btn.has-icon .md-icon,
.btn.has-icon .btn-icon {
  display: inline-flex;
}

.btn:hover,
.btn-primary:hover,
.btn-secondary:hover,
.btn-tertiary:hover,
.btn-success:hover,
.btn-error:hover {
  background: var(--btn-bg-hover);
  border-color: var(--btn-border-hover);
  color: var(--btn-fg-hover);
}

.btn:active,
.btn-primary:active,
.btn-secondary:active,
.btn-tertiary:active,
.btn-success:active,
.btn-error:active {
  background: var(--btn-bg-active);
  border-color: var(--btn-border-active);
  color: var(--btn-fg-active);
}

.btn:visited,
.btn-primary:visited,
.btn-secondary:visited,
.btn-tertiary:visited,
.btn-success:visited,
.btn-error:visited {
  color: var(--btn-fg);
}

.btn:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-tertiary:focus-visible,
.btn-success:focus-visible,
.btn-error:focus-visible {
  outline: none;
  background: var(--btn-bg-focus);
  border-color: var(--btn-border-focus);
  color: var(--btn-fg-focus);
  box-shadow: var(--btn-focus-ring);
}

/* Variants */
.btn-primary,
.btn--primary {
  --btn-bg: var(--primary-default);
  --btn-border: var(--primary-default);
  --btn-fg: var(--n-0);
  --btn-bg-hover: var(--primary-hover);
  --btn-border-hover: var(--primary-hover);
  --btn-fg-hover: var(--n-0);
  --btn-bg-active: var(--primary-pressed);
  --btn-border-active: var(--primary-pressed);
  --btn-fg-active: var(--n-0);
  --btn-bg-focus: var(--primary-focused);
  --btn-border-focus: var(--primary-accent);
  --btn-fg-focus: var(--n-0);
}

.btn-secondary,
.btn--secondary {
  --btn-bg: var(--n-0);
  --btn-border: var(--n-100);
  --btn-fg: var(--n-100);
  --btn-bg-hover: var(--n-20);
  --btn-border-hover: var(--n-100);
  --btn-bg-active: var(--n-0);
  --btn-border-active: var(--primary-accent);
  --btn-bg-focus: var(--n-0);
  --btn-border-focus: var(--primary-accent);
  --btn-fg-focus: var(--n-100);
}

.btn-tertiary,
.btn--tertiary {
  --btn-bg: transparent;
  --btn-border: transparent;
  --btn-fg: var(--primary-default);
  --btn-bg-hover: var(--n-20);
  --btn-border-hover: transparent;
  --btn-fg-hover: var(--primary-default);
  --btn-bg-active: var(--n-40);
  --btn-border-active: transparent;
  --btn-fg-active: var(--primary-pressed);
  --btn-bg-focus: transparent;
  --btn-border-focus: var(--primary-accent);
  --btn-fg-focus: var(--primary-pressed);
}

.btn-success,
.btn--success {
  --btn-bg: var(--success);
  --btn-border: var(--success);
  --btn-fg: var(--n-0);
  --btn-bg-hover: var(--success-hover);
  --btn-border-hover: var(--success-hover);
  --btn-fg-hover: var(--n-0);
  --btn-bg-active: var(--success-pressed);
  --btn-border-active: var(--success-pressed);
  --btn-fg-active: var(--n-0);
  --btn-bg-focus: var(--success-focused);
  --btn-border-focus: var(--success);
  --btn-fg-focus: var(--n-0);
  --btn-focus-ring: 0 0 0 4px var(--success);
}

.btn-error,
.btn--error {
  --btn-bg: var(--error);
  --btn-border: var(--error);
  --btn-fg: var(--n-0);
  --btn-bg-hover: var(--error-hover);
  --btn-border-hover: var(--error-hover);
  --btn-fg-hover: var(--n-0);
  --btn-bg-active: var(--error-pressed);
  --btn-border-active: var(--error-pressed);
  --btn-fg-active: var(--n-0);
  --btn-bg-focus: var(--error-focused);
  --btn-border-focus: var(--error);
  --btn-fg-focus: var(--n-0);
  --btn-focus-ring: 0 0 0 4px var(--error);
}

/* Sizes */
.btn-sm,
.btn--sm {
  --btn-height: 40px;
  --btn-px: 16px;
}

.btn-md,
.btn--md {
  --btn-height: 48px;
  --btn-px: 24px;
}

.btn-lg,
.btn--lg {
  --btn-height: 56px;
  --btn-px: 28px;
}

/* Party Details chips */
/* Party Details header */
.party-header-title {
  margin: 12px 0 8px;
  font-size: var(--type-subtitle-size);
  font-weight: var(--font-weight-bold);
}

/* Party tabs */
.party-chips {
  display: flex;
  gap: 12px;
  margin: 12px 0 20px;
}

.party-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--n-100);
  background: var(--n-0);
  color: var(--text-primary);
  font-size: var(--type-sm-body-size);
  line-height: var(--type-sm-body-line);
  font-weight: var(--font-weight-regular);
  text-decoration: none;
  white-space: nowrap;
  flex-wrap: nowrap;
  width: fit-content;
}

/* prevent visited purple */
.party-chip:visited {
  color: var(--text-primary);
}

/* active */
.party-chip.active {
  background: var(--primary-bg);
  border-color: var(--primary-default);
  color: var(--text-primary);
  font-weight: var(--font-weight-regular);
}

.party-chip.active:visited {
  color: var(--text-primary);
}

.party-chip.is-disabled {
  background: var(--n-20);
  border-color: var(--n-40);
  color: var(--text-disabled);
  pointer-events: none;
  cursor: not-allowed;
}

/* Completed/visited chips are neutral (not success/green). */
.party-chip.is-complete,
.party-chip.is-complete:visited {
  background: var(--n-0);
  border-color: var(--n-100);
  color: var(--text-primary);
}

.party-chip.active.is-complete,
.party-chip.active.is-complete:visited {
  background: var(--primary-bg);
  border-color: var(--primary-default);
  color: var(--text-primary);
}

.before-start-tabs {
  margin: 12px 0 0;
  padding-bottom: 1rem;
}

.before-start-tabs-divider {
  margin: 0 0 1rem;
  border-top: 1px solid var(--n-40);
}

.tabs-with-divider {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--n-40);
  margin-bottom: 1rem;
}

/* Party Details applicant blocks */
.applicant-section { margin-top: 6px; }

.party-section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.party-section-title {
  font-size: var(--type-lg-body-size);
  font-weight: var(--font-weight-bold);
  margin: 0;
}

.party-section-divider {
  border: 0;
  border-top: 1px solid #d9dde3;
  margin: 12px 0 20px;
}

.page-header {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-right: 170px;
  margin-bottom: 6px;
}

.page-header .reset-flow {
  margin: 0;
  color: var(--text-h2);
  font-size: var(--type-lg-body-size);
  line-height: var(--type-lg-body-line);
  font-weight: var(--font-weight-semibold);
}

.page-header + .case-type-display {
  margin-top: 2px;
  margin-bottom: 8px;
  color: var(--primary-default);
  font-size: var(--type-xl-size);
  line-height: var(--type-xl-line);
  font-weight: var(--font-weight-semibold);
}

.page-header + .case-type-display span {
  color: inherit;
  font-size: inherit;
  line-height: inherit;
  font-weight: inherit;
}
.save-close {
  position: absolute;
  top: 0;
  right: 0;
  padding: 8px 14px;
  font-size: var(--type-sm-body-size);
}

@media (max-width: 760px) {
  .case-header.has-save-close {
    padding-right: 0;
  }

  .case-header.has-save-close .case-header__title,
  .case-header.has-save-close .case-header__subtitle,
  .case-header.has-save-close .case-header__case-type {
    max-width: none;
  }

  .case-header .case-header__save-close {
    position: static;
    margin-top: 12px;
  }

  .page-header {
    padding-right: 0;
  }

  .save-close {
    position: static;
  }
}

.applicant-section + .applicant-section {
  margin-top: 32px;
}

/* Review details */
.review-section {
  margin-bottom: 24px;
}
.review-section + .review-section {
  margin-top: 32px;
}
.review-details-gap {
  margin-top: 32px;
}
.review-title {
  color: var(--primary-default);
  font-size: var(--type-lg-body-size);
  font-weight: var(--font-weight-bold);
  margin: 18px 0 8px;
}
.review-rule {
  border: 0;
  border-top: 1px solid var(--n-40);
  margin: 8px 0 0;
}
.review-row {
  display: grid;
  grid-template-columns: 240px 1fr 140px;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--n-40);
}
.review-label {
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}
.review-value {
  color: var(--text-primary);
}
.review-value a,
.review-value a:visited,
.exhibit-link:visited {
  color: var(--link-active);
}
.review-action {
  text-align: right;
  color: var(--link-active);
  text-decoration: underline;
  cursor: pointer;
  font-weight: var(--font-weight-semibold);
}
.review-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
}
.review-input:focus {
  outline: none;
  border-color: var(--border-selected);
  box-shadow: var(--focus-ring);
}

/* Signature */
.signature-box {
  border: 1px solid #2b7fff;
  background: #f7fbff;
  border-radius: 6px;
  padding: 16px;
  margin: 12px 0 20px;
}
.signature-line {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.signature-dot { color: var(--primary-default); font-size: var(--type-lg-body-size); line-height: 1; }
.signature-confirm {
  display: flex;
  gap: 4px;
  align-items: center;
  font-weight: var(--font-weight-regular);
}
.signature-confirm.is-checked { font-weight: var(--font-weight-bold); }
.signature-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  background: var(--n-0);
}
.signature-select:disabled {
  background: var(--n-20);
  color: var(--text-disabled);
}

.btn-danger {
  background: var(--error);
  border-color: var(--error);
  color: var(--n-0);
}
.btn-danger:hover {
  background: var(--error-hover);
  border-color: var(--error-hover);
  color: var(--n-0);
}
.btn-danger:active {
  background: var(--error-pressed);
  border-color: var(--error-pressed);
  color: var(--n-0);
}
.btn-danger:visited {
  color: var(--n-0);
}

/* Backward compatibility alias; prefer .btn-error in markup */
.btn-danger {
  --btn-bg: var(--error);
  --btn-border: var(--error);
  --btn-fg: var(--n-0);
  --btn-bg-hover: var(--error-hover);
  --btn-border-hover: var(--error-hover);
  --btn-fg-hover: var(--n-0);
  --btn-bg-active: var(--error-pressed);
  --btn-border-active: var(--error-pressed);
  --btn-fg-active: var(--n-0);
}

.filing-form .form-group + .form-group {
  margin-top: 32px;
}

.filing-info-banner {
  margin: 1.5rem 0;
  padding: 1rem;
  border: 1px solid var(--attention);
  border-radius: var(--radius-sm);
  background: #f8f4e8;
}

.filing-info-banner-title {
  margin: 0 0 0.5rem;
  color: var(--text-primary);
  font-size: var(--type-subtitle-size);
  line-height: var(--type-subtitle-line);
  font-weight: var(--font-weight-regular);
}

.filing-info-banner-text {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
}

/* Remove native datalist dropdown arrow */
.input-with-icon input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: none;
}

.party-form .form-group {
  margin: 0 0 32px 0;
}

.party-form .form-group:last-of-type {
  margin-bottom: 0;
}

body[data-case-type] .party-form .form-group:last-of-type {
  margin-bottom: 1.5rem;
}

/* Stacked form spacing (used on docs/review pages) */
.form-stack .form-group + .form-group {
  margin-top: 32px;
}

.signature-request-form {
  margin-top: 16px;
  margin-bottom: 8px;
}

.party-nav {
  align-items: center;
  gap: 16px;
}

body[data-case-type] .nav-buttons.party-nav {
  margin-top: 3rem;
}

.party-actions-right {
  align-items: center;
  gap: 24px;
}

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--n-100);
  background: var(--n-0);
  color: var(--text-primary);
  font-size: var(--type-sm-body-size);
  line-height: var(--type-sm-body-line);
  font-weight: var(--font-weight-regular);
  white-space: nowrap;
}
.badge-warning { background: var(--attention-bg); border-color: var(--attention); color: var(--text-primary); }
.badge-success { background: var(--success-bg); border-color: var(--success); color: var(--text-primary); }
.badge-info    { background: var(--info-bg); border-color: var(--info); color: var(--text-h2); }

/* ---- Alerts ---- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: var(--type-sm-body-size);
  border: 1px solid transparent;
}
.alert-warning { background: var(--attention-bg); border-color: var(--border-attention); color: var(--attention-pressed); }
.alert-error   { background: var(--error-bg);     border-color: var(--border-error);     color: var(--error-focused); }
.alert-inline {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 16px 0 16px;
  padding: 16px 16px 8px;
}
.alert-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--attention);
  color: var(--n-0);
  font-weight: var(--font-weight-bold);
  font-size: var(--type-xs-body-size);
  line-height: 1;
}

.create-case-subtitle {
  margin: 0 0 8px;
}
.create-case-divider {
  margin: 0 0 24px;
}
.case-type-group {
  max-width: 460px;
  margin: 40px 0;
}
.case-type-actions {
  border-top: none;
  padding-top: 0;
  margin-top: 16px;
  justify-content: space-between;
}
.case-type-display {
  margin-top: -8px;
  color: var(--text-secondary);
}
.requirements-section { margin: 20px 0; }
.requirements-section h4 { margin: 0 0 8px; }
.requirements-section .alert-inline { margin-top: 12px; }

.signatory-question,
.portal-question__prompt {
  margin: 20px 0 20px;
  font-size: var(--type-body-size);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}
.signatory-block {
  padding-top: 20px;
}
.signatory-options {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-left: 0;
  margin-left: 0;
  align-items: flex-start;
  max-width: 720px;
}
.signatory-option {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: center;
  column-gap: 12px;
  padding: 0;
  margin: 0;
  font-weight: var(--font-weight-semibold);
  width: 100%;
  text-align: left;
}
.signatory-option input {
  width: 18px;
  height: 18px;
  margin: 0;
  flex: 0 0 auto;
}
.signatory-option label {
  display: block;
  margin: 0;
  font-size: var(--type-body-size);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.confirm-box {
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: var(--n-0);
  margin: 24px 0 20px;
}
.signature-sent-title {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--success);
  margin-bottom: 8px;
}

/* ---- Prototype screens ---- */
.screen { display: none; }
.screen.active { display: block; }

.nav-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

/* Filing progress */
.filing-chips {
  display: flex;
  gap: 12px;
  margin: 12px 0 24px;
}
.filing-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--n-100);
  background: var(--n-0);
  color: var(--text-primary);
  font-size: var(--type-sm-body-size);
  line-height: var(--type-sm-body-line);
  font-weight: var(--font-weight-regular);
}
.filing-chip.active {
  background: var(--primary-bg);
  border-color: var(--primary-default);
  color: var(--text-primary);
  font-weight: var(--font-weight-regular);
}

.filing-chip.is-disabled {
  background: var(--n-20);
  border-color: var(--n-40);
  color: var(--text-disabled);
  pointer-events: none;
  cursor: not-allowed;
}

.filing-chip.is-complete {
  background: var(--n-0);
  border-color: var(--n-100);
  color: var(--text-primary);
}

/* Upload filings block */
.upload-card {
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: var(--n-0);
}
.upload-card.dragover .upload-drop {
  border-color: var(--primary-default);
  background: var(--primary-bg-tint);
}
.upload-drop.dragover {
  border-color: var(--primary-default);
  background: var(--primary-bg-tint);
}

/* Exhibits */
.exhibits-wrap {
  margin-top: 20px;
}
.exhibits-title {
  font-weight: var(--font-weight-bold);
  margin-bottom: 12px;
}
.exhibits-list {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.exhibit-row {
  display: grid;
  grid-template-columns: 28px 28px 1fr 32px;
  gap: 4px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--n-0);
}
.exhibit-row:last-child { border-bottom: none; }
.exhibit-handle {
  cursor: grab;
  color: var(--text-secondary);
  font-size: var(--type-body-size);
}
.exhibit-index {
  color: var(--text-secondary);
}
.exhibit-link {
  color: var(--link-active);
  text-decoration: underline;
}
.exhibit-trash {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--text-primary);
}
.exhibit-row.dragging {
  opacity: 0.6;
  background: #f5f7fa;
}
.upload-drop {
  border: 1px dashed #2b7fff;
  border-radius: 6px;
  padding: 18px;
  background: #f7fbff;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  text-align: center;
}
.upload-icon {
  font-size: var(--type-subtitle-size);
}
.upload-text {
  font-size: var(--type-sm-body-size);
  color: var(--text-secondary);
}
.upload-link {
  color: var(--link-active);
  text-decoration: underline;
  cursor: pointer;
}
.upload-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.upload-success {
  margin-top: 16px;
  border: 1px solid #2b7a2b;
  background: #edf7ed;
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.upload-success.hidden { display: none; }
.file-meta { display: flex; gap: 12px; align-items: center; }
.file-icon { font-size: var(--type-subtitle-size); }
.file-name { font-weight: var(--font-weight-semibold); }
.file-size { font-size: var(--type-xs-body-size); color: var(--text-secondary); }

/* Filings table */
.filings-table {
  border-top: 1px solid var(--border-subtle);
}
.filings-header,
.filings-row,
.filings-total {
  display: grid;
  grid-template-columns: 1fr 32px 160px 120px;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.filings-header {
  font-weight: var(--font-weight-bold);
  color: var(--text-secondary);
}
.filing-trash {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--text-primary);
}
.filing-trash svg,
.exhibit-trash svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: currentColor;
}
.filings-total {
  grid-template-columns: 1fr 120px;
  justify-content: end;
  border-bottom: none;
}
.filings-total div:first-child {
  text-align: right;
  color: var(--text-secondary);
}

.filings-nav {
  align-items: center;
}
.filings-nav-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.filing-nav-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.link-action.is-disabled,
.link-action.is-disabled:hover,
.link-action.is-disabled:visited {
  color: var(--text-disabled);
  text-decoration: none;
  pointer-events: none;
}

/* Payment */
.payment-card {
  background: var(--n-0);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 16px 0;
}
.payment-card h4 {
  margin-bottom: 12px;
  font-size: var(--type-body-size);
}
.payment-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.payment-row:last-child { border-bottom: none; }
.radio-cards {
  display: grid;
  gap: 12px;
}
.radio-card {
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  gap: 12px;
  cursor: pointer;
  background: var(--n-0);
}
.radio-card input { margin-top: 2px; }
.radio-card-body { display: flex; flex-direction: column; gap: 2px; }
.radio-title { font-weight: var(--font-weight-semibold); }
.radio-sub { font-size: var(--type-xs-body-size); color: var(--text-secondary); }
.payment-fields { margin-top: 16px; }
.payment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.field-error {
  color: var(--error);
  font-size: var(--type-xs-body-size);
  margin-top: 6px;
}
.payment-success {
  padding: 24px 0 8px;
}
.success-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--success);
  position: relative;
}
.success-icon--small {
  width: 36px;
  height: 36px;
  margin: 0;
}
.success-icon:before {
  content: "";
  position: absolute;
  width: 14px;
  height: 28px;
  border-right: 6px solid #fff;
  border-bottom: 6px solid #fff;
  transform: rotate(45deg);
  left: 22px;
  top: 10px;
}
.success-icon--small:before {
  width: 8px;
  height: 16px;
  border-right: 4px solid #fff;
  border-bottom: 4px solid #fff;
  left: 13px;
  top: 7px;
}

.case-success { text-align: left; }
.case-success-title {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--success);
  margin-bottom: 12px;
}
.case-success-title h3 { margin: 0; }
.case-success-subtitle {
  font-weight: var(--font-weight-semibold);
  margin: 20px 0 12px;
}
.case-success-rule {
  margin: 12px 0 0;
}
.case-ref-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 6px;
}
.case-ref-row--stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.case-ref-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  background: #eef3f6;
  border-radius: 8px;
  font-size: var(--type-lg-body-size);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.5px;
}
.copy-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--primary);
  text-decoration: underline;
  font-size: var(--type-sm-body-size);
}
.copy-link:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.copy-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
}
.case-success-note {
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.case-success-divider {
  border-top: 1px solid var(--border-primary);
  margin: 16px 0;
}
.case-next h4 {
  margin: 0 0 8px;
}
.case-next ul {
  margin: 0 0 16px 18px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.case-success-actions {
  justify-content: flex-end;
  gap: 16px;
}

/* Welcome banner */
.welcome-banner-shell {
  width: 100%;
  background: var(--primary-bg);
}

.welcome-banner {
  background: transparent;
  color: var(--text-h2);
  max-width: 1200px;
  margin: 0 auto;
  padding: 26px 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.welcome-banner h1 {
  font-size: var(--type-xxl-size);
  line-height: var(--type-xxl-line);
  margin-bottom: 8px;
  font-weight: var(--font-weight-bold);
  color: var(--text-h2);
}
.welcome-banner p {
  font-size: var(--type-lg-body-size);
  line-height: var(--type-lg-body-line);
  color: var(--text-h2);
}
.welcome-banner p a,
.welcome-banner p a:visited,
.welcome-banner p a:hover {
  color: var(--text-h2);
  text-decoration: underline;
}
/* Form controls */
.form-group { margin: 0 0 32px 0; }
.form-group label {
  display: block;
  font-size: var(--type-lg-body-size);
  line-height: var(--type-lg-body-line);
  font-weight: var(--font-weight-semibold);
  margin-bottom: 8px;
  color: var(--text-primary);
}
.req {
  color: var(--error);
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  background: var(--n-0);
  color: var(--text-primary);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--border-selected);
  box-shadow: var(--focus-ring);
}
.form-group input:disabled { background: var(--n-20); color: var(--text-disabled); }

.form-group__helper {
  display: flex;
  align-items: flex-start;
  gap: 0.375rem;
  margin: 0.5rem 0 0;
  color: var(--text-secondary);
}

.form-group__helper-icon {
  flex: 0 0 auto;
  font-size: 1rem;
  line-height: 1.25rem;
  margin-top: 1px;
  color: var(--text-secondary);
}

/* Stage 5D pilot: BS5 .form-select adoption guard.
   BS5 sets appearance:none + a background-image SVG chevron to replace the native
   browser arrow. Portal selects keep their native arrow, so we suppress both here.
   Specificity 0,2,0 beats BS5's .form-select at 0,1,0.
   Padding/border/colour are already covered by .form-group select at 0,1,1. */
.form-group .form-select {
  background-image: none;
  appearance: auto;
}

/* Default vertical spacing for stacked fields inside a single form-group. */
.form-group > :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) + label {
  margin-top: 1.5rem;
}

.form-group > :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) + :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  margin-top: 1.5rem;
}

/* Reusable address block spacing across flows. */
.form-group > :is(.input-address1, [id$="Address1"]) ~ :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  margin-top: 8px !important;
}

/* Reusable checkbox component */
.portal-checkbox-group {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.form-group label.portal-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  margin-bottom: 0;
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  font-weight: var(--font-weight-regular);
  color: var(--text-primary);
  cursor: pointer;
}

.form-group input.portal-checkbox-input {
  width: 18px;
  min-width: 18px;
  height: 18px;
  margin: 3px 0 0;
  padding: 0;
  border: 2px solid var(--n-80);
  border-radius: 4px;
  background: var(--n-0);
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
  cursor: pointer;
  position: relative;
}

.form-group input.portal-checkbox-input:hover {
  border-color: var(--border-selected);
}

.form-group input.portal-checkbox-input:focus-visible {
  outline: none;
  border-color: var(--border-selected);
  box-shadow: var(--focus-ring);
}

.form-group input.portal-checkbox-input:checked {
  background: var(--primary-default);
  border-color: var(--primary-default);
}

.form-group input.portal-checkbox-input:checked::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 8px;
  border: solid var(--n-0);
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -58%) rotate(45deg);
}

.portal-checkbox-text {
  display: inline-block;
}

.form-group input.portal-checkbox-input:checked + .portal-checkbox-text {
  font-weight: var(--font-weight-semibold);
}

.portal-checkbox-empty-note {
  margin: 8px 0 0;
  color: var(--text-secondary);
}

/* Reusable radio component */
.portal-radio-group {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.form-group label.portal-radio {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  margin-bottom: 0;
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  font-weight: var(--font-weight-regular);
  color: var(--text-primary);
  cursor: pointer;
}

.form-group input.portal-radio-input {
  width: 18px;
  min-width: 18px;
  height: 18px;
  margin: 3px 0 0;
  padding: 0;
  border: 2px solid var(--n-80);
  border-radius: 50%;
  background: var(--n-0);
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
  cursor: pointer;
  position: relative;
}

.form-group input.portal-radio-input:hover {
  border-color: var(--border-selected);
}

.form-group input.portal-radio-input:focus-visible {
  outline: none;
  border-color: var(--border-selected);
  box-shadow: var(--focus-ring);
}

.form-group input.portal-radio-input:checked {
  background: var(--primary-default);
  border-color: var(--primary-default);
}

.form-group input.portal-radio-input:checked::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--n-0);
  transform: translate(-50%, -50%);
}

.portal-radio-text {
  display: inline-block;
}

.form-group input.portal-radio-input:checked + .portal-radio-text {
  font-weight: var(--font-weight-semibold);
}

.portal-radio-empty-note {
  margin: 8px 0 0;
  color: var(--text-secondary);
}


/* ================================
   Dashboard layout components
================================ */

/* Action cards */
.action-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}

.action-card {
  background: var(--n-0);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  padding: 24px;
}

.action-card h3 {
  margin-bottom: 8px;
  font-weight: var(--font-weight-bold);
}

.action-card p {
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: var(--type-sm-body-size);
}

.action-card ul { padding-left: 18px; }
.action-card li { margin-bottom: 8px; }

/* Two-column dashboard section */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

/* List panels */
.list-panel {
  background: var(--n-0);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
}

.list-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.list-panel-header h3 { margin: 0; }
.list-panel-header a { font-size: var(--type-sm-body-size); }

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.list-item:last-child { border-bottom: none; }

.list-item .title { font-weight: var(--font-weight-semibold); }
.list-item .meta { font-size: var(--type-xs-body-size); color: var(--text-secondary); }

/* Responsive dashboard */
@media (max-width: 900px) {
  .action-cards { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
}

/* ================================
   Modal (Onboarding)
================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none; /* only shows when .hidden removed */
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-overlay:not(.hidden) { display: flex; }

/* ── Legacy portal modal pattern (.modal-overlay > .modal) ───────────────────
   Stage 2A BS5 collision overrides, now scoped to legacy portal structure.
   In the BS5-native pattern (Stage 5A+), .modal is owned by Bootstrap 5 and
   .modal-content receives the portal card styles instead.              ── */
.modal-overlay .modal {
  display: block;     /* BS5: display:none  */
  position: static;   /* BS5: position:fixed — .modal-overlay handles positioning */
  top: auto;          /* BS5: top:0 */
  left: auto;         /* BS5: left:0 */
  z-index: auto;      /* BS5: z-index:1055 — not needed on the inner card */
  height: auto;       /* BS5: height:100% */
  overflow: visible;  /* BS5: overflow-x:hidden; overflow-y:auto */
  /* Portal card properties */
  background: var(--n-0);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 600px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
}

/* ── BS5-native modal: portal card styles on .modal-content ──────────────── */
.modal-dialog { max-width: 600px; }   /* portal dialog width */

.modal-content {
  background: var(--n-0);
  border: none;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
}

.modal-backdrop { --bs-backdrop-opacity: 0.4; }  /* match portal overlay opacity */

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
}


/* Override global visited link colour for Party Details UI */
.party-chip:visited { color: var(--text-primary); }
.party-chip.is-active:visited { color: var(--text-primary); }
.link-action:visited { color: var(--primary); }

.link-action {
  color: var(--primary-default);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  white-space: nowrap;
  flex-wrap: nowrap;
  width: fit-content;
}

.link-action:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.link-action:visited {
  color: var(--primary-default);
}

/* Notice party toggle */
.notice-toggle-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 14px 0 22px;
}


.notice-party-section {
  margin-top: 12px;
}

.delete-link {
  color: var(--error);
  font-weight: var(--font-weight-regular);
  text-decoration: none;
  white-space: nowrap;
  flex-wrap: nowrap;
  width: fit-content;
}

.delete-link:visited {
  color: var(--error);
}

.delete-link:hover {
  text-decoration: underline;
}

/* Signature decision spacing */
.signature-decision { padding: 32px 0; }

/* DISABLED */
.btn-disabled,
.btn[aria-disabled="true"],
a.btn[aria-disabled="true"],
a.btn.disabled,
button.btn:disabled,
button.btn-primary:disabled,
button.btn-secondary:disabled,
button.btn-tertiary:disabled,
button.btn-success:disabled,
button.btn-error:disabled {
  background: var(--n-30);
  border-color: transparent;
  color: var(--n-80);
  cursor: not-allowed;
  box-shadow: none;
  pointer-events: none;
}

button.btn-primary:disabled,
button.btn-secondary:disabled,
button.btn-tertiary:disabled,
.btn-primary[aria-disabled="true"],
.btn-secondary[aria-disabled="true"],
.btn-tertiary[aria-disabled="true"],
a.btn-primary[aria-disabled="true"],
a.btn-secondary[aria-disabled="true"],
a.btn-tertiary[aria-disabled="true"] {
  color: var(--n-90);
}

button.btn-success:disabled,
button.btn-error:disabled,
.btn-success[aria-disabled="true"],
.btn-error[aria-disabled="true"],
a.btn-success[aria-disabled="true"],
a.btn-error[aria-disabled="true"] {
  color: var(--n-80);
}

/* ================================
   You've Been Served
================================ */

.served-card {
  padding: 32px;
}

.served-header h2 {
  margin-bottom: 8px;
}

.served-header p {
  color: var(--text-secondary);
}

.served-divider {
  height: 1px;
  background: var(--border-primary);
  margin: 20px 0;
}

.served-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.served-option-card {
  display: flex;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--primary-accent);
  border-radius: var(--radius-md);
  background: var(--n-0);
  text-decoration: none;
  color: var(--text-primary);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.06);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  min-height: 140px;
}

.served-option-card:hover {
  border-color: var(--primary-default);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.served-option-icon {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  border: 2px solid var(--primary-default);
  color: var(--primary-default);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.served-option-icon img {
  width: 30px;
  height: 30px;
}

.served-option-content h3 {
  margin-bottom: 6px;
  font-size: var(--type-lg-body-size);
}

.served-option-content p {
  color: var(--text-secondary);
}

.served-actions {
  display: flex;
  justify-content: flex-start;
  gap: 16px;
}

.served-actions-split {
  justify-content: space-between;
  align-items: center;
}

.served-code-block h3 {
  margin-bottom: 18px;
  font-size: var(--type-lg-body-size);
}

.code-inputs {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 12px 0 24px;
}

.code-input {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  border: 1px solid var(--n-50);
  text-align: center;
  font-size: var(--type-lg-body-size);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  background: var(--n-0);
}

.code-input:focus {
  outline: none;
  border-color: var(--primary-accent);
  box-shadow: var(--focus-ring);
}

.code-separator {
  font-size: var(--type-subtitle-size);
  color: var(--text-secondary);
  font-weight: var(--font-weight-bold);
}

.served-physical-body {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.served-about {
  padding: 0;
}

.served-about-title {
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin-bottom: 6px;
}

.served-about-text {
  color: var(--text-primary);
}

.served-warning {
  display: flex;
  gap: 12px;
  border: 1px solid var(--attention);
  background: var(--n-0);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.served-warning-icon {
  width: 24px;
  height: 24px;
  color: var(--attention-focused);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.served-warning-icon img {
  width: 24px;
  height: 24px;
}

.served-warning-title {
  font-weight: var(--font-weight-bold);
  color: var(--attention-focused);
  margin-bottom: 4px;
}

.served-warning-text {
  color: var(--text-primary);
}

@media (max-width: 900px) {
  .served-options {
    grid-template-columns: 1fr;
  }

  .served-card {
    padding: 24px;
  }

  .served-actions-split {
    flex-direction: column;
    align-items: stretch;
  }

  .code-inputs {
    justify-content: flex-start;
  }
}

.served-overlay {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--n-60) 70%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}

.served-overlay-card {
  width: min(720px, 100%);
  background: var(--n-0);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.16);
}

.served-overlay-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.served-overlay-icon {
  width: 32px;
  height: 32px;
  color: var(--success);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.served-overlay-icon img {
  width: 28px;
  height: 28px;
}

.served-overlay-card h3 {
  margin: 0;
  font-size: var(--type-lg-body-size);
  color: var(--success);
}

@media (max-width: 700px) {
  .served-overlay-card {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ================================
   Filing Page
================================ */

.filing-page {
  background: #f6f7f8;
}

.filing-header {
  background: #0a3d5e;
  color: var(--n-0);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
}

.filing-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.filing-brand img {
  height: 38px;
  width: auto;
}

.filing-brand-divider {
  width: 1px;
  height: 28px;
  background: rgba(255, 255, 255, 0.4);
}

.filing-brand-portal {
  font-size: var(--type-body-size);
  font-weight: var(--font-weight-semibold);
}

.filing-nav {
  display: flex;
  gap: 26px;
  align-items: center;
}

.filing-nav a {
  color: var(--n-0);
  text-decoration: none;
  font-size: var(--type-sm-body-size);
}

.filing-nav a:hover {
  text-decoration: underline;
}

.filing-breadcrumb {
  padding: 16px 28px;
  font-size: var(--type-sm-body-size);
  color: var(--text-secondary);
  background: #fff;
  border-bottom: 1px solid #e3e7eb;
}

.filing-breadcrumb a {
  color: var(--link-active);
  text-decoration: underline;
}

.filing-breadcrumb a:visited {
  color: var(--link-active);
}

.filing-breadcrumb span {
  color: var(--text-primary);
}

.filing-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  padding: 0 28px 40px;
}

.filing-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
}

.filing-side-link {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: var(--type-sm-body-size);
}

.filing-side-link.active {
  background: #cfe4f5;
  color: var(--text-h2);
  font-weight: var(--font-weight-bold);
}

.filing-side-link:hover {
  background: #e7eef4;
  color: var(--text-h2);
}

.filing-content {
  min-width: 0;
}

.filing-card {
  background: #fff;
  border: 1px solid #d8dee4;
  border-radius: 6px;
  padding: 22px 0 8px;
}

.filing-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0 24px 14px;
  border-bottom: 1px solid #e3e7eb;
}

.filing-case-title {
  font-size: var(--type-sm-body-size);
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.filing-card h2 {
  font-size: var(--type-title-size);
  margin-bottom: 8px;
  color: var(--text-h2);
}

.filing-meta {
  font-size: var(--type-xs-body-size);
  color: var(--text-secondary);
  display: flex;
  gap: 8px;
}

.filing-actions {
  display: flex;
  gap: 12px;
}

.filing-btn {
  white-space: nowrap;
}

.filing-btn.primary {
  white-space: nowrap;
}

.filing-table {
  display: flex;
  flex-direction: column;
}

.filing-row {
  display: grid;
  grid-template-columns: 1.8fr 0.4fr 0.4fr 0.6fr;
  gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid #eef1f4;
  align-items: center;
  font-size: var(--type-sm-body-size);
}

.filing-row a {
  color: var(--link-active);
  text-decoration: underline;
}

.filing-row-head {
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  background: #fafbfc;
}

.filing-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--info);
  font-size: var(--type-sm-body-size);
  line-height: var(--type-sm-body-line);
  font-weight: var(--font-weight-regular);
}

.filing-badge.info {
  background: var(--info-bg);
  color: var(--text-h2);
}

.filing-tabs {
  display: flex;
  gap: 8px;
  padding: 14px 24px 0;
  border-bottom: 1px solid #e3e7eb;
}

.filing-tab-btn {
  border: 1px solid #c9ced3;
  border-bottom: none;
  background: #f5f7f9;
  color: var(--text-primary);
  border-radius: 8px 8px 0 0;
  padding: 10px 14px;
  font-size: var(--type-sm-body-size);
  font-weight: var(--font-weight-semibold);
}

.filing-tab-btn.active {
  background: #ffffff;
  color: var(--text-h2);
  border-color: var(--border-primary);
}

.filing-tab-panel {
  padding: 0 0 8px;
}

.filing-pdf-wrap {
  padding: 18px 24px 24px;
}

.filing-pdf-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.filing-pdf-frame {
  width: 100%;
  height: 72vh;
  border: 1px solid #d8dee4;
  border-radius: 8px;
  background: #fff;
}

@media (max-width: 1100px) {
  .filing-layout {
    grid-template-columns: 1fr;
  }

  .filing-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }
}

@media (max-width: 800px) {
  .filing-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .filing-row {
    grid-template-columns: 1.5fr 0.6fr;
    grid-auto-rows: auto;
  }

  .filing-row > div:nth-child(3),
  .filing-row > div:nth-child(4) {
    display: none;
  }

  .filing-tabs {
    padding: 12px 16px 0;
  }

  .filing-pdf-wrap {
    padding: 14px 16px 18px;
  }

  .filing-pdf-frame {
    height: 62vh;
  }
}

/* ================================
   Cases / Updates / Listings Pages
================================ */

.header-nav a.nav-active {
  background: var(--header-nav-item-selected-bg);
  color: var(--header-nav-item-selected-fg);
}

.header-nav a.nav-active:visited {
  color: var(--header-nav-item-selected-fg);
}

.header.header--prototype {
  padding-left: 28px;
  padding-right: 28px;
}

.header.header--prototype .header-logo img {
  display: block;
  width: auto;
  height: 46px;
  max-width: 272px;
}

.header.header--prototype .header-nav {
  gap: 0;
}

.header.header--prototype .header-nav a {
  font-size: 16px;
  padding: 0 18px;
  text-decoration: underline;
}

.header.header--prototype .header-nav a:hover,
.header.header--prototype .header-nav a:focus-visible,
.header.header--prototype .header-nav a:active {
  background: transparent;
  color: var(--header-nav-item-fg);
}

.header.header--prototype .header-nav a.nav-active,
.header.header--prototype .header-nav a.nav-active:hover,
.header.header--prototype .header-nav a.nav-active:focus-visible,
.header.header--prototype .header-nav a.nav-active:active {
  background: var(--header-nav-item-selected-bg);
  color: var(--header-nav-item-selected-fg);
}

.header.header--prototype .header-nav .divider {
  padding: 0 10px;
}

@media (max-width: 900px) {
  body.mobile-menu-open {
    overflow: hidden;
  }

  .header {
    padding: 0 16px;
    min-height: 72px;
  }

  .header-logo img {
    height: 32px;
  }

  .header-nav {
    display: none;
  }

  .header-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .header-mobile-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 119;
    background: rgba(0, 0, 0, 0.22);
  }

  .header-mobile-menu {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 80vw;
    background: var(--primary-focused);
    color: var(--n-0);
    z-index: 120;
    padding: 20px;
  }

  .header-mobile-menu-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
  }

  .header-mobile-menu-head h3 {
    margin: 0;
    font-size: var(--type-lg-title-size);
    line-height: var(--type-lg-title-line);
    font-weight: var(--font-weight-regular);
    color: var(--n-0);
  }

  .header-menu-close {
    border: 0;
    border-radius: 999px;
    background: var(--n-0);
    color: var(--primary-focused);
    width: 30px;
    height: 30px;
    font-size: var(--type-subtitle-size);
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
  }

  .header-mobile-nav {
    display: grid;
    gap: 8px;
    border-top: 1px solid var(--primary-accent);
    padding-top: 18px;
    margin-bottom: 24px;
  }

  .header-mobile-nav a {
    color: var(--n-0);
    text-decoration: none;
    font-size: var(--type-title-size);
    line-height: var(--type-title-line);
    font-weight: var(--font-weight-regular);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
  }

  .header-mobile-nav a:visited,
  .header-mobile-nav a:hover,
  .header-mobile-nav a:focus-visible {
    color: var(--n-0);
  }

  .header-mobile-nav a.mobile-nav-active {
    background: var(--header-nav-item-selected-bg);
    color: var(--header-nav-item-selected-fg);
    font-weight: var(--font-weight-semibold);
    text-decoration: none;
  }

  .header-mobile-divider {
    border-top: 1px solid var(--primary-accent);
    margin: 0 0 24px;
  }

  .header-mobile-account {
    display: grid;
    gap: 22px;
  }

  .header-mobile-account a {
    display: inline-flex;
    align-items: center;
    color: var(--n-0);
    text-decoration: none;
    font-size: var(--type-title-size);
    line-height: var(--type-title-line);
    border-radius: 8px;
    padding: 8px 12px;
  }

  .header-mobile-account a:visited,
  .header-mobile-account a:hover,
  .header-mobile-account a:focus-visible {
    color: var(--n-0);
  }

  .header-mobile-account a:hover,
  .header-mobile-account a:focus-visible {
    background: #0077b8;
    color: #003a59;
  }

  .header-mobile-account a.is-active {
    background: #71bce7;
    color: #003a59;
  }
}

.portal-page-shell {
  background: #f3f4f6;
  min-height: 100vh;
}

.portal-page-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px 24px 40px;
}

.portal-panel {
  background: var(--n-0);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
}

.portal-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 18px 18px;
}

.portal-panel-head h1 {
  font-size: var(--type-xl-size);
  line-height: var(--type-xl-line);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.portal-panel-title-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.portal-panel-subtitle {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
}

.case-listings-intro {
  margin-bottom: 1rem;
}

.portal-panel-actions {
  display: flex;
  gap: 16px;
}

.portal-version-switcher {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  font-family: "Courier New", Courier, monospace;
  font-size: var(--type-sm-body-size);
  line-height: var(--type-sm-body-line);
}

.portal-version-switcher a,
.portal-version-switcher a:visited {
  color: var(--n-80);
  text-decoration: none;
}

.portal-version-switcher a:hover,
.portal-version-switcher a:focus-visible {
  color: var(--n-90);
  text-decoration: underline;
}

.portal-version-switcher a[aria-current="page"] {
  color: var(--n-100);
  text-decoration: underline;
}

.portal-page-version-row {
  position: fixed;
  top: calc(132px + 1rem);
  right: 24px;
  z-index: 40;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}

.portal-page-version-row .portal-version-switcher {
  pointer-events: auto;
}

@media (max-width: 900px) {
  .portal-page-version-row {
    top: calc(124px + 1rem);
    right: 16px;
  }
}

.portal-mini-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.portal-mini-btn:visited {
  color: var(--btn-fg, var(--text-primary));
}

.portal-mini-btn-icon {
  width: 24px;
  height: 24px;
  display: inline-block;
  flex: 0 0 24px;
}

.portal-mini-btn-icon-set {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.portal-search-row {
  display: grid;
  grid-template-columns: 1fr 140px;
  padding: 0 18px;
  margin-bottom: 14px;
  gap: 0;
}

.portal-search-input-wrap {
  position: relative;
}

.portal-search-input {
  border: 1px solid var(--border-primary);
  border-right: 0;
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  padding: 15px 48px 15px 16px;
  font-size: var(--type-body-size);
  background: var(--n-0);
  width: 100%;
  height: 48px;
}

.portal-search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--type-title-size);
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.portal-search-clear:hover {
  background: var(--n-20);
  color: var(--text-primary);
}

.portal-search-clear.is-visible {
  display: inline-flex;
}

.portal-search-btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
  width: 100%;
  height: 48px;
}

.portal-search-input-wrap:hover .portal-search-input {
  border-color: var(--primary-accent);
  background: color-mix(in srgb, var(--primary-bg-tint) 50%, var(--n-0));
}

.portal-search-input:focus {
  outline: none;
  border-color: var(--primary-accent);
  background: var(--n-0);
}

.portal-search-input-wrap.has-value .portal-search-input {
  border-color: var(--primary-accent);
  background: var(--n-0);
}

.cases-page-v2 .cases-v2-search-row {
  grid-template-columns: auto minmax(0, 1fr) 140px;
  gap: 14px;
  align-items: start;
}

.cases-v2-filters {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.cases-v2-filter-control {
  position: relative;
}

.cases-v2-filter-select {
  min-width: 102px;
  height: 46px;
  padding: 0 38px 0 14px;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background-color: var(--n-0);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-primary) 50%),
    linear-gradient(135deg, var(--text-primary) 50%, transparent 50%);
  background-position:
    calc(100% - 23px) calc(50% - 2px),
    calc(100% - 18px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  color: var(--text-primary);
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  appearance: none;
  -webkit-appearance: none;
}

.cases-v2-filter-select:hover {
  border-color: var(--n-80);
}

.cases-v2-filter-select:focus-visible {
  outline: none;
  border-color: var(--primary-accent);
  box-shadow: var(--focus-ring);
}

.cases-page-v2 .cases-v2-search-input-wrap .portal-search-input {
  border-right: 1px solid var(--border-primary);
  border-radius: 8px;
}

.cases-page-v2 .cases-v2-search-input-wrap:hover .portal-search-input,
.cases-page-v2 .cases-v2-search-input-wrap.has-value .portal-search-input {
  border-color: var(--primary-accent);
}

.cases-page-v2 .portal-search-btn {
  border-radius: 8px;
}

.cases-page-v2 .portal-active-filters {
  margin-top: 0;
}

.portal-count-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 18px 12px;
  font-size: var(--type-body-size);
  color: var(--text-secondary);
}

.portal-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--type-sm-body-size);
}

/* Reusable SVG toggle */
.portal-toggle {
  -webkit-appearance: none;
  appearance: none;
  width: 49px;
  height: 26px;
  border: 0;
  border-radius: 13px;
  margin-left: 8px;
  background: url("../../assets/icons/Toggle/Toggle/off/default.svg") no-repeat center / contain;
  cursor: pointer;
  vertical-align: middle;
}

.portal-toggle:hover {
  background-image: url("../../assets/icons/Toggle/Toggle/off/hover.svg");
}

.portal-toggle:checked {
  background-image: url("../../assets/icons/Toggle/Toggle/on/default.svg");
}

.portal-toggle:checked:hover {
  background-image: url("../../assets/icons/Toggle/Toggle/on/hover.svg");
}

.portal-toggle:disabled {
  background-image: url("../../assets/icons/Toggle/Toggle/off/disabled.svg");
  cursor: not-allowed;
}

.portal-toggle:checked:disabled {
  background-image: url("../../assets/icons/Toggle/Toggle/on/disabled.svg");
}

.portal-toggle:focus-visible {
  outline: 2px solid var(--primary-accent);
  outline-offset: 2px;
}

.portal-table {
  border-top: 1px solid var(--border-primary);
}

.portal-row {
  display: grid;
  grid-template-columns: 1.8fr 0.7fr 0.7fr;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-primary);
  align-items: center;
}

.portal-row.listings {
  grid-template-columns: 0.95fr 2.15fr 0.78fr 0.72fr 0.6fr;
}

.portal-row.listings.case-listings {
  grid-template-columns: 1.05fr 0.9fr 0.85fr 0.7fr;
}

.portal-row.listings > :last-child {
  justify-self: start;
  text-align: left;
}

.portal-row.listings:not(.case-listings) > :nth-child(4),
.portal-row.listings:not(.case-listings) > :nth-child(5) {
  padding-left: 1rem;
}

.portal-row.listings:not(.case-listings) > :nth-child(2) {
  padding-left: 1rem;
}

.portal-row.listings:not(.case-listings):not(.head) > :nth-child(2) {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portal-row.listings:not(.head) > :nth-child(1) .portal-link {
  font-weight: var(--font-weight-regular);
}

.portal-row.listings.is-future > :nth-child(1) .portal-link {
  font-weight: var(--font-weight-semibold);
}

.portal-row.updates {
  grid-template-columns: 1.6fr 0.45fr 0.45fr;
}

.portal-row.updates > :last-child {
  justify-self: end;
  text-align: right;
}

.portal-row.cases {
  grid-template-columns: 1.7fr 0.85fr 0.65fr 0.6fr;
}

.portal-row.cases > :last-child {
  justify-self: end;
  text-align: right;
}

.portal-row.cases .portal-status-cell {
  display: flex;
  justify-content: flex-start;
}

.portal-row.cases .portal-cell,
.portal-row.cases .portal-status-cell {
  align-items: center;
  gap: 8px;
}

.portal-row.cases:not(.head),
.portal-row.listings:not(.head) {
  position: relative;
  transition: background-color 160ms ease;
}

.portal-row.cases:not(.head):hover,
.portal-row.listings:not(.head):hover {
  background: var(--n-20);
  box-shadow: var(--shadow-app-default);
  z-index: 1;
}

.portal-row.cases:not(.head):hover .portal-link,
.portal-row.listings:not(.head):hover .portal-link {
  text-decoration: underline;
}

.portal-row.cases:not(.head):hover::after,
.portal-row.listings:not(.head):hover::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--primary-accent);
  border-radius: inherit;
  pointer-events: none;
}

.portal-active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  margin: 12px 0 10px;
}

.portal-active-filters-clear {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--link-active);
  text-decoration: underline;
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  cursor: pointer;
}

.portal-active-filters-clear:hover {
  color: var(--link-hover);
}

.portal-row.head {
  background: #f8f9fa;
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.portal-sort-btn {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.portal-sort-icon {
  font-size: var(--type-lg-body-size);
  line-height: 1;
}

.portal-link {
  color: var(--link-active);
  text-decoration: none;
  font-size: var(--type-body-size);
}

.portal-link:hover {
  text-decoration: underline;
}

.portal-subtext {
  display: block;
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: var(--type-sm-body-size);
}

.portal-date,
.portal-cell {
  font-size: var(--type-body-size);
  color: var(--text-secondary);
}

.portal-row.highlight {
  background: #f7f2e7;
}

.portal-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--n-100);
  background: var(--n-0);
  color: var(--text-primary);
  font-size: var(--type-sm-body-size);
  line-height: var(--type-sm-body-line);
  font-weight: var(--font-weight-regular);
  white-space: nowrap;
}

.portal-tag.warning {
  background: var(--attention-bg);
  border-color: var(--attention);
  color: var(--text-primary);
}

.portal-tag.pending {
  background: var(--attention-bg);
  border-color: var(--attention);
  color: var(--text-primary);
}

.portal-tag.issued {
  background: var(--info-bg);
  border-color: var(--info);
  color: var(--text-h2);
}

.portal-tag.resulted {
  background: var(--primary-bg);
  border-color: var(--primary-default);
  color: var(--text-primary);
}

.portal-tag.not-heard {
  background: var(--info-bg);
  border-color: var(--info);
  color: var(--text-h2);
}

@media (max-width: 900px) {
  .header-nav a.nav-active {
    padding: 8px 10px;
  }

  .portal-panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .portal-panel-head h1 {
    font-size: var(--type-lg-title-size);
    line-height: var(--type-title-line);
  }

  .portal-mini-btn,
  .portal-search-input,
  .portal-search-btn,
  .portal-count-row,
  .portal-link,
  .portal-subtext,
  .portal-date,
  .portal-cell,
  .portal-tag,
  .portal-switch {
    font-size: var(--type-body-size);
  }

  .portal-search-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .portal-search-input {
    border-right: 1px solid var(--border-primary);
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
  }

  .portal-search-btn {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
  }

  .portal-row,
  .portal-row.listings,
  .portal-row.updates {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .portal-row.head.cases {
    display: none;
  }

  .portal-row.head.listings {
    display: none;
  }

  .portal-row.head.updates {
    display: none;
  }

  .portal-row.cases:not(.head) {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px 10px;
  }

  .portal-row.cases:not(.head) > :nth-child(1) {
    order: 1;
    flex: 1 1 calc(100% - 140px);
    min-width: 0;
  }

  .portal-row.cases:not(.head) > :nth-child(4) {
    order: 2;
    flex: 0 0 auto;
    margin-left: auto;
    text-align: right;
    justify-self: auto;
  }

  .portal-row.cases:not(.head) > :nth-child(2) {
    order: 3;
    flex: 0 0 auto;
    margin-top: 2px;
  }

  .portal-row.cases:not(.head) > :nth-child(3) {
    order: 4;
    flex: 0 0 auto;
    margin-top: 2px;
  }

  .portal-row.listings:not(.case-listings):not(.head) {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px 1.5rem;
  }

  .portal-row.listings:not(.case-listings):not(.head)::after {
    content: "";
    flex-basis: 100%;
    height: 0;
    order: 3;
  }

  .portal-row.listings:not(.case-listings):not(.head) > :nth-child(1) {
    order: 1;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .portal-row.listings:not(.case-listings):not(.head) > :nth-child(2) {
    order: 2;
    flex: 1 1 auto;
    min-width: 0;
    padding-left: 0;
  }

  .portal-row.listings:not(.case-listings):not(.head) > :nth-child(3) {
    order: 4;
    flex: 0 0 auto;
  }

  .portal-row.listings:not(.case-listings):not(.head) > :nth-child(4) {
    order: 5;
    flex: 0 0 auto;
    padding-left: 0;
  }

  .portal-row.listings:not(.case-listings):not(.head) > :nth-child(5) {
    order: 6;
    flex: 0 0 auto;
    padding-left: 0;
    text-align: left;
  }

  .portal-row.listings.case-listings:not(.head) {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px 1.5rem;
  }

  .portal-row.listings.case-listings:not(.head)::after {
    content: "";
    flex-basis: 100%;
    height: 0;
    order: 2;
  }

  .portal-row.listings.case-listings:not(.head) > :nth-child(1) {
    order: 1;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .portal-row.listings.case-listings:not(.head) > :nth-child(2) {
    order: 3;
    flex: 0 0 auto;
    padding-left: 0;
  }

  .portal-row.listings.case-listings:not(.head) > :nth-child(3) {
    order: 4;
    flex: 0 0 auto;
    padding-left: 0;
  }

  .portal-row.listings.case-listings:not(.head) > :nth-child(4) {
    order: 5;
    flex: 0 0 auto;
    padding-left: 0;
    text-align: left;
  }

  .portal-row.updates:not(.head) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    column-gap: 10px;
    row-gap: 8px;
    align-items: start;
  }

  .portal-row.updates:not(.head) > :nth-child(1) {
    grid-column: 1;
    grid-row: 1 / span 2;
    min-width: 0;
  }

  .portal-row.updates:not(.head) > :nth-child(3) {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
    justify-self: end;
  }

  .portal-row.updates:not(.head) > :nth-child(2) {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
    display: flex;
    justify-content: flex-end;
  }
}

/* ================================
   Case Entity (Summary/Filings/Listings/Orders/Judgments/Activity/Persons)
================================ */

.case-entity-shell {
  background: var(--surface-page);
  min-height: 100vh;
}

.case-entity-breadcrumb {
  padding: var(--space-3h) var(--space-5);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid var(--border-primary);
  background: var(--n-0);
  font-size: var(--type-sm-body-size);
}

.case-entity-breadcrumb a {
  color: var(--link-active);
  text-decoration: underline;
}

.case-entity-breadcrumb a:visited {
  color: var(--link-active);
}

.case-entity-breadcrumb span {
  color: var(--text-primary);
}

.case-entity-breadcrumb .slash {
  margin: 0 var(--space-2h);
  color: var(--text-secondary);
}

.case-entity-layout {
  width: 100%;
  margin: 20px 0 36px;
  padding: 0 var(--space-4h);
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 22px;
}

.case-entity-nav {
  padding-top: var(--space-2h);
}

.case-entity-nav a {
  display: block;
  color: var(--n-100);
  text-decoration: none;
  padding: var(--space-2) var(--space-2h);
  margin-bottom: 6px;
  border-radius: var(--radius-sm);
  font-size: var(--type-lg-body-size);
  font-weight: var(--font-weight-regular);
}

.case-entity-nav a:visited {
  color: var(--n-100);
}

.case-entity-nav a:hover {
  background: var(--primary-bg);
  color: var(--n-100);
}

.case-entity-nav a.active {
  background: var(--primary-highlight);
  color: var(--n-100);
  font-weight: var(--font-weight-bold);
}

.case-entity-nav a.active:visited {
  color: var(--n-100);
}

.account-nav-mobile {
  display: none;
}

.account-nav-mobile-toggle {
  width: 100%;
  border: 0;
  background: var(--primary-highlight);
  color: var(--n-100);
  border-radius: var(--radius-sm);
  padding: var(--space-2h) var(--space-3);
  min-height: 48px;
  font-size: var(--type-lg-body-size);
  line-height: var(--type-lg-body-line);
  font-weight: var(--font-weight-semibold);
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
}

.account-nav-mobile-label {
  display: block;
}

.account-nav-mobile-chevron {
  font-size: var(--type-subtitle-size);
  line-height: 1;
}

.account-nav-mobile-menu {
  margin-top: var(--space-1);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  background: var(--n-0);
  overflow: hidden;
}

.account-nav-mobile-menu a {
  display: block;
  margin: 0;
  border-radius: 0;
  padding: var(--space-3);
}

.account-nav-mobile-menu a + a {
  border-top: 1px solid var(--border-primary);
}

.case-nav-mobile {
  display: none;
}

.case-nav-mobile-toggle {
  width: 100%;
  border: 0;
  background: var(--primary-highlight);
  color: var(--n-100);
  border-radius: var(--radius-sm);
  padding: var(--space-2h) var(--space-3);
  min-height: 48px;
  font-size: var(--type-lg-body-size);
  line-height: var(--type-lg-body-line);
  font-weight: var(--font-weight-semibold);
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
}

.case-nav-mobile-label {
  display: block;
}

.case-nav-mobile-chevron {
  font-size: var(--type-subtitle-size);
  line-height: 1;
}

.case-nav-mobile-menu {
  margin-top: var(--space-1);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  background: var(--n-0);
  overflow: hidden;
}

.case-nav-mobile-menu a {
  display: block;
  margin: 0;
  border-radius: 0;
  padding: var(--space-3);
}

.case-nav-mobile-menu a + a {
  border-top: 1px solid var(--border-primary);
}

.case-entity-main {
  min-width: 0;
  max-width: 1220px;
  width: 100%;
  margin: 0 auto;
}

.case-detail-main {
  max-width: 980px;
  margin: 0 auto;
}

.case-top-actions {
  display: flex;
  justify-content: flex-end;
  gap: 22px;
  padding: 0 0 var(--space-2h);
  font-size: var(--type-lg-title-size);
}

.case-top-actions a {
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
  flex-wrap: nowrap;
  width: fit-content;
}

.case-card {
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--n-0);
  overflow: hidden;
}

.case-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-5);
  padding: var(--space-5) var(--space-4h) var(--space-3);
}

.case-card-case-name {
  margin: 0 0 6px;
  color: var(--text-h2);
  font-size: var(--type-lg-body-size);
  line-height: var(--type-lg-body-line);
  font-weight: var(--font-weight-semibold);
}

.case-card h1 {
  font-size: var(--type-xxl-size);
  line-height: var(--type-xxl-line);
  color: var(--primary-default);
  margin-bottom: var(--space-2);
}

.case-card-count {
  color: var(--text-secondary);
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  font-weight: var(--font-weight-regular);
}

.case-small-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.case-head-actions {
  display: flex;
  gap: var(--space-3h);
}

.case-search-row {
  display: grid;
  grid-template-columns: 1fr 140px;
  padding: 0 var(--space-4h);
  margin-bottom: var(--space-3);
}

.case-search-row input {
  border: 1px solid var(--border-primary);
  border-right: 0;
  padding: var(--space-3) var(--space-3h);
  font-size: var(--type-lg-title-size);
}

.case-search-row button {
  --btn-bg: var(--primary-default);
  --btn-border: var(--primary-default);
  --btn-fg: var(--n-0);
  --btn-bg-hover: var(--primary-hover);
  --btn-border-hover: var(--primary-hover);
  --btn-fg-hover: var(--n-0);
  --btn-bg-active: var(--primary-pressed);
  --btn-border-active: var(--primary-pressed);
  --btn-fg-active: var(--n-0);
  --btn-bg-focus: var(--primary-focused);
  --btn-border-focus: var(--primary-focused);
  --btn-fg-focus: var(--n-0);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 var(--space-6);
  border-radius: var(--radius-md);
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  white-space: nowrap;
}

.case-search-row button:hover {
  background: var(--btn-bg-hover);
  border-color: var(--btn-border-hover);
  color: var(--btn-fg-hover);
}

.case-search-row button:active {
  background: var(--btn-bg-active);
  border-color: var(--btn-border-active);
  color: var(--btn-fg-active);
}

.case-search-row button:focus-visible {
  outline: none;
  background: var(--btn-bg-focus);
  border-color: var(--btn-border-focus);
  color: var(--btn-fg-focus);
  box-shadow: var(--focus-ring);
}

.case-subline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 18px 10px;
  color: var(--text-secondary);
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
}

.case-unread {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  color: var(--text-secondary);
}

.case-table {
  border-top: 1px solid var(--border-primary);
}

.case-row {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4h);
  border-bottom: 1px solid var(--border-primary);
  align-items: center;
  font-size: var(--type-lg-body-size);
  line-height: var(--type-lg-body-line);
}

.case-row.head {
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  background: #f8f9fa;
}

.case-row.two {
  grid-template-columns: 1.7fr 0.45fr;
}

.case-row.three {
  grid-template-columns: 1.6fr 0.5fr 0.5fr;
}

.case-row.four {
  grid-template-columns: 1.7fr 0.45fr 0.45fr 0.45fr;
}

.case-link {
  color: var(--link-active);
  text-decoration: none;
  font-size: var(--type-lg-body-size);
  line-height: var(--type-lg-body-line);
  font-weight: var(--font-weight-regular);
  white-space: nowrap;
  flex-wrap: nowrap;
  width: fit-content;
}

.case-link:hover {
  text-decoration: underline;
}

.case-link-with-icon {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.case-row.highlight {
  background: #f7f2e7;
}

.case-indent {
  padding-left: 0;
}

.case-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  border: 1px solid var(--n-100);
  background: var(--n-0);
  color: var(--text-primary);
  font-size: var(--type-sm-body-size);
  line-height: var(--type-sm-body-line);
  font-weight: var(--font-weight-regular);
  white-space: nowrap;
}

.case-tag.warning { background: var(--attention-bg); border-color: var(--attention); color: var(--text-primary); }
.case-tag.issued { background: var(--info-bg); border-color: var(--info); color: var(--text-h2); }
.case-tag.resulted { background: var(--info-bg); border-color: var(--info); color: var(--text-h2); }
.case-row-value { color: var(--text-secondary); }
.case-row-value {
  font-size: var(--type-lg-body-size);
  line-height: var(--type-lg-body-line);
}

.case-summary-block {
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--n-0);
  overflow: hidden;
  margin-bottom: var(--space-5);
}

.case-section-title {
  margin: 0;
  color: var(--primary-default);
}

.case-summary-head {
  padding: var(--space-5) var(--space-4h) var(--space-3);
  border-bottom: 1px solid var(--border-primary);
  display: block;
}

.case-summary-head h2 {
  margin: 0;
}

/* Reusable account/case panel head with optional right-side actions. */
.account-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
}

.account-panel-title {
  min-width: 0;
}

.account-panel-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.case-kv {
  display: grid;
  grid-template-columns: 260px 1fr 120px;
  gap: var(--space-3h);
  padding: 11px 18px;
  border-bottom: 1px solid var(--border-primary);
  font-size: var(--type-lg-body-size);
}

.case-kv:last-child {
  border-bottom: 0;
}

.case-kv .label { font-weight: var(--font-weight-semibold); color: var(--text-primary); }
.case-kv .value { color: var(--text-secondary); font-weight: var(--font-weight-regular); }
.case-kv .action { text-align: right; }

.filing-entity-head {
  border-bottom: 1px solid var(--border-primary);
}

.filing-entity-title {
  margin: 0;
}

.filing-entity-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4h);
  border-bottom: 1px solid var(--border-primary);
}

.filing-entity-detail-head .case-section-title {
  font-size: var(--type-title-size);
  line-height: var(--type-title-line);
}

.filing-entity-detail-status {
  display: inline-flex;
}

.filing-entity-related-row {
  grid-template-columns: 1fr auto;
}

.filing-entity-related-action {
  text-align: right;
}

.filing-entity-link-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: flex-start;
}

.filing-entity-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.filing-external-icon {
  font-size: var(--type-body-size);
  line-height: 1;
}

[data-filing-digital-section] .case-linked-title,
[data-filing-exhibits-section] .case-linked-title {
  position: relative;
  color: var(--text-h2);
  font-size: var(--type-subtitle-size);
  line-height: var(--type-subtitle-line);
  font-weight: var(--font-weight-semibold);
  border-bottom: 0;
}

[data-filing-digital-section] .case-linked-title::after,
[data-filing-exhibits-section] .case-linked-title::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 0;
  border-bottom: 1px solid var(--border-primary);
}

[data-filing-digital-section] .case-kv,
[data-filing-exhibits-section] .case-kv {
  position: relative;
  border-bottom: 0;
  padding-top: 2rem;
  padding-bottom: 2rem;
}

[data-filing-digital-section] .case-kv::after,
[data-filing-exhibits-section] .case-kv::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 0;
  border-bottom: 1px solid var(--border-primary);
}

.filing-secondary-actions {
  padding: 1.5rem var(--space-4h);
}

.case-linked-title {
  color: var(--primary-default);
  padding: var(--space-3h) var(--space-4h) var(--space-2h);
  border-bottom: 1px solid var(--border-primary);
}

body[data-account-page]:not([data-account-page="sign-out"]) .case-summary-head {
  position: relative;
  border-bottom: 0;
}

body[data-account-page]:not([data-account-page="sign-out"]) .case-summary-head::after {
  content: "";
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 0;
  border-bottom: 1px solid var(--border-primary);
}

body[data-account-page]:not([data-account-page="sign-out"]) .case-card-case-name {
  margin: 0 0 6px;
  color: var(--text-h2);
  font-size: var(--type-lg-body-size);
  line-height: var(--type-lg-body-line);
  font-weight: var(--font-weight-semibold);
}

@media (max-width: 1000px) {
  .case-entity-layout {
    grid-template-columns: 1fr;
  }

  .case-entity-shell .case-entity-layout {
    gap: var(--space-3);
  }

  body[data-account-page] .case-entity-layout {
    gap: var(--space-3);
  }

  .case-entity-nav:not([data-account-nav]):not([data-case-nav]) {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-2);
  }

  .case-entity-nav:not([data-account-nav]):not([data-case-nav]) a {
    font-size: var(--type-lg-body-size);
    margin-bottom: 0;
  }

  .case-entity-shell .case-entity-nav[data-case-nav] {
    padding-top: 0;
    margin-bottom: 0;
  }

  .case-entity-shell .case-nav-desktop {
    display: none;
  }

  .case-entity-shell .case-nav-mobile {
    display: block;
  }

  body[data-account-page] .case-entity-nav {
    padding-top: 0;
    margin-bottom: 0;
  }

  body[data-account-page] .account-nav-desktop {
    display: none;
  }

  body[data-account-page] .account-nav-mobile {
    display: block;
  }

  .case-card h1,
  .case-section-title {
    font-size: var(--type-xl-size);
    line-height: var(--type-title-line);
  }

  .account-panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .account-panel-actions {
    justify-content: flex-start;
  }

  .case-card-count,
  .case-search-row input,
  .case-search-row button,
  .case-subline,
  .case-row,
  .case-kv,
  .case-top-actions,
  .case-small-btn {
    font-size: var(--type-body-size);
  }

  .case-row,
  .case-row.two,
  .case-row.three,
  .case-row.four,
  .case-kv {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .case-search-row {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }

  .case-search-row input {
    border-right: 1px solid var(--border-primary);
  }
}

/* --------------------------------
   Chips
-------------------------------- */

.chip {
  --chip-bg: var(--n-0);
  --chip-border: var(--n-100);
  --chip-fg: var(--n-100);
  --chip-bg-hover: var(--n-20);
  --chip-border-hover: var(--chip-border);
  --chip-height: 24px;
  --chip-px: 8px;
  --chip-gap: 4px;
  --chip-font-size: var(--type-sm-body-size);
  --chip-line-height: var(--type-sm-body-line);
  --chip-remove-size: 20px;

  display: inline-flex;
  align-items: center;
  gap: var(--chip-gap);
  min-height: var(--chip-height);
  padding: 0 var(--chip-px);
  border-radius: 999px;
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--chip-fg);
  font-size: var(--chip-font-size);
  line-height: var(--chip-line-height);
  font-weight: var(--font-weight-regular);
  white-space: nowrap;
  width: fit-content;
  user-select: none;
}

.chip.chip--interactive {
  cursor: pointer;
}

.chip:not(.chip--interactive) {
  cursor: default;
}

.chip.chip--interactive:hover,
.chip.is-hover {
  background: var(--chip-bg-hover);
  border-color: var(--chip-border-hover);
}

.chip .chip-label {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.chip .chip-remove {
  display: none;
  align-items: center;
  justify-content: center;
  width: var(--chip-remove-size);
  height: var(--chip-remove-size);
  min-width: var(--chip-remove-size);
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--chip-fg);
  cursor: pointer;
}

.chip.chip--removable .chip-remove {
  display: inline-flex;
}

.chip .chip-remove .md-icon {
  font-size: var(--chip-remove-size);
}

.chip-md,
.chip--md {
  --chip-font-size: var(--type-body-size);
  --chip-line-height: var(--type-body-line);
  --chip-remove-size: 20px;
}

.chip-sm,
.chip--sm {
  --chip-font-size: var(--type-sm-body-size);
  --chip-line-height: var(--type-sm-body-line);
  --chip-remove-size: 16px;
}

.chip-primary,
.chip--primary {
  --chip-bg: var(--primary-bg);
  --chip-border: var(--primary-default);
  --chip-bg-hover: #C1D3DF;
}

.chip-info,
.chip--info {
  --chip-bg: var(--info-bg);
  --chip-border: var(--info);
  --chip-bg-hover: #B7DCE1;
}

.chip-error,
.chip--error {
  --chip-bg: var(--error-bg);
  --chip-border: var(--error);
  --chip-bg-hover: #EBD1D1;
}

.chip-success,
.chip--success {
  --chip-bg: var(--success-bg);
  --chip-border: var(--success);
  --chip-bg-hover: #C0E1C3;
}

.chip-attention,
.chip--attention {
  --chip-bg: var(--attention-bg);
  --chip-border: var(--attention);
  --chip-bg-hover: #EADEC8;
}

.chip-grey,
.chip--grey {
  --chip-bg: #E5E5E5;
  --chip-border: var(--n-100);
  --chip-bg-hover: var(--n-50);
}

.chip-white,
.chip--white {
  --chip-bg: var(--n-0);
  --chip-border: var(--n-100);
  --chip-bg-hover: #ECECEC;
}

.chip-selected,
.chip--selected {
  --chip-bg: var(--chip-selected-bg);
  --chip-border: var(--chip-selected-border);
  --chip-fg: var(--chip-selected-fg);
  --chip-bg-hover: var(--chip-selected-bg-hover);
}


/* ================================================================
   BS5 COLLISION OVERRIDES — Typography & colour helpers (Stage 2C)
   Moved here from utilities.css so these rules load AFTER Bootstrap 5.
   Load order: tokens → utilities → Bootstrap 5 → components (this file).

   .h1–.h5  : BS5 sets own font-sizes (no !important) — load order alone suffices.
   .text-*  : BS5 sets colour with !important — portal rules also need !important.

   Class names and semantics are unchanged. u-* equivalents (u-type-*, u-text-*)
   remain in utilities.css and are the preferred classes for new work.
   ================================================================ */

.h1 { font-size: var(--type-xxl-size);      line-height: var(--type-xxl-line); }
.h2 { font-size: var(--type-xl-size);       line-height: var(--type-xl-line); }
.h3 { font-size: var(--type-lg-title-size); line-height: var(--type-lg-title-line); }
.h4 { font-size: var(--type-title-size);    line-height: var(--type-title-line); }
.h5 { font-size: var(--type-subtitle-size); line-height: var(--type-subtitle-line); }

.text-primary   { color: var(--text-primary)   !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted     { color: var(--text-secondary) !important; }
