:root {
  color-scheme: light;
  --font-size-base: 14px;
  --font-size-desktop-fhd: 12.5px;
  --font-size-desktop-wide: 13px;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --line: #dfe7ef;
  --line-soft: #edf2f7;
  --text: #1f2937;
  --muted: #64748b;
  --soft: #94a3b8;
  --brand: #2296b8;
  --brand-dark: #17677e;
  --shadow: 0 1px 8px rgba(15, 23, 42, 0.06);
  --font-sans: "Plus Jakarta Sans", "Segoe UI", Arial, sans-serif;
}

.task-scope-filters {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr)) auto auto;
  gap: 0.55rem;
  align-items: end;
  padding: 0.7rem;
  border: 1px solid var(--line);
  background: var(--surface);
}

.task-scope-filters label,
.task-attachment-upload label {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
}

.task-scope-filters input,
.task-scope-filters select,
.task-scope-filters button,
.task-scope-filters a,
.task-attachment-upload input,
.task-attachment-upload button {
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.task-scope-filters a,
.task-scope-filters button {
  display: inline-grid;
  place-items: center;
  padding: 0 0.75rem;
  text-decoration: none;
}

.task-finance-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-top: 0;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
}

.task-finance-summary strong {
  color: var(--text);
}

.task-private-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 20px;
  padding: 0.1rem 0.4rem;
  border: 1px solid #c7d2fe;
  border-radius: 4px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 0.66rem;
  font-weight: 800;
}

.task-card__top {
  grid-template-columns: minmax(0, 1fr) auto auto 18px 18px;
}

.task-unset-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.task-attachments-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  width: min(980px, calc(100% - 2rem));
  min-width: 0;
  margin: 1rem auto;
  overflow-wrap: anywhere;
}

.task-attachments-page .workspace-card {
  padding: 24px;
  border-color: var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
}

.task-attachments-page .task-attachments-header {
  align-items: flex-start;
}

.task-attachments-page .task-attachments-header :is(h1, h2, p),
.task-attachments-page .workspace-card > :is(h2, p) {
  margin: 0;
}

.task-attachments-page .task-attachments-header > div {
  display: grid;
  gap: 8px;
}

.task-attachments-page .form-grid label.checkbox-field {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  color: var(--text);
}

.task-attachments-page label.checkbox-field input[type="checkbox"] {
  appearance: auto;
  flex: 0 0 16px;
  width: 16px;
  min-width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 2px 0 0;
  padding: 0;
  accent-color: var(--brand-strong);
}

.task-attachment-privacy {
  display: grid;
  gap: 4px;
}

.task-attachments-form > .button-row {
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.task-attachments-page :is(a.secondary-action, button.primary-action) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

.task-attachments-page form button.primary-action {
  border-color: var(--brand-strong);
  background: var(--brand-strong);
  color: #fff;
}

.task-attachments-page :is(a.secondary-action, button.primary-action):hover {
  border-color: var(--brand-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.task-attachments-page :is(a, button, input, select):focus-visible {
  outline: 2px solid var(--brand-strong);
  outline-offset: 2px;
}

.task-attachments-page .client-note-content {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-wrap: anywhere;
}

.task-attachments-page > *,
.task-attachments-header > div,
.task-result-history > article,
.task-attachments-page form,
.task-attachments-page label,
.task-attachments-page .task-result-files {
  min-width: 0;
}

.task-attachments-page input,
.task-attachments-page textarea,
.task-attachments-page select,
.task-attachments-page button,
.task-attachments-page .primary-action {
  min-width: 0;
  max-width: 100%;
}

.task-attachments-page button,
.task-attachments-page .primary-action {
  white-space: normal;
  overflow-wrap: anywhere;
}

.task-attachments-header,
.task-attachment-upload,
.task-attachment-list > article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.task-attachments-header h1,
.task-attachments-header p {
  margin: 0.25rem 0 0;
}

.task-attachment-upload,
.task-attachment-list {
  padding: 0.8rem;
  border: 1px solid var(--line);
  background: var(--surface);
}

.task-attachment-upload label {
  flex: 1;
}

.task-attachment-list {
  display: grid;
  gap: 0.6rem;
}

.task-attachment-list > article {
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line-soft);
}

.task-attachment-list > article:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.task-attachment-list article > div {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.task-attachment-list a {
  overflow-wrap: anywhere;
}

@media (max-width: 1100px) {
  .task-scope-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .task-attachments-page .workspace-card {
    padding: 16px;
  }
  .task-attachments-page :is(a.secondary-action, button.primary-action) {
    min-height: 44px;
  }
  .task-attachments-form > .button-row > :is(a, button) {
    flex: 1 1 auto;
  }
  .task-scope-filters {
    grid-template-columns: 1fr 1fr;
  }

  .task-attachment-upload,
  .task-attachments-header,
  .task-attachment-list > article {
    align-items: stretch;
    flex-direction: column;
  }
}

* {
  box-sizing: border-box;
}

.ai-settings-editor footer {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
}

.ai-settings-shell {
  grid-template-columns: minmax(0, 1fr);
}

.ai-settings-list {
  width: 100%;
  min-width: 0;
}

.ai-settings-filters {
  display: grid;
  gap: 0.75rem;
}

.ai-settings-filters {
  grid-template-columns: minmax(280px, 1.4fr) repeat(3, minmax(180px, 0.75fr)) auto;
  margin-bottom: 1rem;
}

.ai-settings-filters input,
.ai-settings-filters select,
.ai-settings-editor input,
.ai-settings-editor select,
.ai-settings-editor textarea {
  width: 100%;
  border: 1px solid #d9e3ef;
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  background: #ffffff;
  color: #10233f;
  font: inherit;
}

.ai-settings-list > header {
  align-items: center;
}

.ai-settings-add-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #0f86a7;
  border-radius: 8px;
  background: #0f86a7;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(15, 134, 167, 0.18);
}

.ai-settings-add-button:hover,
.ai-settings-add-button:focus-visible {
  background: #0b6f8a;
  border-color: #0b6f8a;
  outline: 2px solid rgba(15, 134, 167, 0.22);
  outline-offset: 2px;
}

.ai-settings-prompt-table {
  display: grid;
  gap: 0.35rem;
}

.ai-settings-prompt-row {
  display: grid;
  grid-template-columns: minmax(320px, 1.5fr) minmax(170px, 0.55fr) minmax(360px, 1.2fr) minmax(110px, 0.35fr) minmax(82px, 0.25fr);
  gap: 0.75rem;
  align-items: center;
  border: 1px solid #dbe7f3;
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  background: #ffffff;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.ai-settings-prompt-row:not(.ai-settings-prompt-row--head):hover,
.ai-settings-prompt-row:not(.ai-settings-prompt-row--head):focus-visible {
  border-color: #9acfe1;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  outline: 0;
  transform: translateY(-1px);
}

.ai-settings-prompt-row--head {
  border: 0;
  padding: 0 0.75rem 0.25rem;
  background: transparent;
  color: #66728a;
  cursor: default;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  transition: none;
}

.ai-settings-prompt-row.is-paused {
  opacity: 0.68;
}

.ai-settings-prompt-main {
  min-width: 0;
}

.ai-settings-prompt-main strong,
.ai-settings-prompt-main small,
.ai-settings-prompt-main p {
  display: block;
}

.ai-settings-prompt-main strong {
  color: #10233f;
  font-size: 0.93rem;
}

.ai-settings-prompt-main small,
.ai-settings-prompt-kicker {
  color: #66728a;
  font-size: 0.78rem;
  font-weight: 800;
}

.ai-settings-prompt-main p {
  margin: 0.12rem 0 0;
  color: #4b5874;
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-settings-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ai-settings-tags em {
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  background: #eef6ff;
  color: #285c8f;
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 800;
}

.ai-settings-filters .secondary-action,
.ai-settings-editor .secondary-action,
.ai-settings-editor .primary-action {
  min-height: 34px;
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font-weight: 800;
}

.ai-settings-order {
  color: #4b5874;
  font-weight: 800;
}

.ai-settings-editor-dialog {
  width: min(1120px, calc(100vw - 3rem));
  max-width: calc(100vw - 3rem);
  overflow: visible;
}

.ai-settings-editor {
  width: 100%;
  max-width: none;
  max-height: calc(100vh - 3rem);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ai-settings-editor header {
  align-items: flex-start;
  min-width: 0;
}

.ai-settings-editor header > div {
  min-width: 0;
}

.ai-settings-editor header p {
  max-width: 72rem;
  overflow-wrap: anywhere;
  white-space: normal;
}

.ai-settings-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.ai-settings-editor-grid label {
  display: grid;
  gap: 0.35rem;
  color: #4b5874;
  font-size: 0.82rem;
  font-weight: 800;
}

.ai-settings-editor-grid .span-2 {
  grid-column: 1 / -1;
}

.ai-settings-editor textarea {
  resize: vertical;
}

.ai-settings-editor select[multiple] {
  min-height: 7.2rem;
}

.ai-settings-editor footer {
  position: sticky;
  bottom: 0;
  margin: 0 -1rem -1rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid #e1e8f0;
  background: #ffffff;
}

.ai-settings-context-menu {
  position: fixed;
  z-index: 1100;
  min-width: 190px;
  padding: 0.35rem;
  border: 1px solid #d9e3ef;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.ai-settings-context-menu form {
  margin: 0;
}

.ai-settings-context-menu button {
  display: flex;
  width: 100%;
  min-height: 34px;
  align-items: center;
  border: 0;
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  background: transparent;
  color: #10233f;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  text-align: left;
}

.ai-settings-context-menu button:hover,
.ai-settings-context-menu button:focus-visible {
  background: #eef6ff;
  outline: 0;
}

.ai-settings-context-menu .danger-action {
  color: #b42318;
}

html[data-theme="dark"] .ai-settings-filters input,
html[data-theme="dark"] .ai-settings-filters select,
html[data-theme="dark"] .ai-settings-editor input,
html[data-theme="dark"] .ai-settings-editor select,
html[data-theme="dark"] .ai-settings-editor textarea,
html[data-theme="dark"] .ai-settings-prompt-row,
html[data-theme="dark"] .ai-settings-context-menu {
  border-color: #334155;
  background: #111827;
  color: #e5edf7;
}

html[data-theme="dark"] .ai-settings-prompt-row--head {
  background: transparent;
  color: #9fb0c6;
}

html[data-theme="dark"] .ai-settings-prompt-main strong,
html[data-theme="dark"] .ai-settings-context-menu button {
  color: #e5edf7;
}

html[data-theme="dark"] .ai-settings-prompt-main p,
html[data-theme="dark"] .ai-settings-prompt-main small,
html[data-theme="dark"] .ai-settings-prompt-kicker,
html[data-theme="dark"] .ai-settings-order,
html[data-theme="dark"] .ai-settings-editor-grid label {
  color: #a8b5c7;
}

html[data-theme="dark"] .ai-settings-tags em,
html[data-theme="dark"] .ai-settings-context-menu button:hover,
html[data-theme="dark"] .ai-settings-context-menu button:focus-visible {
  background: #16324a;
  color: #b9dcff;
}

html[data-theme="dark"] .ai-settings-editor footer {
  border-color: #334155;
  background: #111827;
}

html[data-theme="dark"] .ai-settings-context-menu .danger-action {
  color: #fca5a5;
}

@media (max-width: 980px) {
  .ai-settings-filters {
    grid-template-columns: 1fr;
  }

  .ai-settings-prompt-row,
  .ai-settings-prompt-row--head {
    grid-template-columns: 1fr;
  }

  .ai-settings-prompt-row--head {
    display: none;
  }

  .ai-settings-editor-grid {
    grid-template-columns: 1fr;
  }

  .ai-settings-editor-dialog {
    width: calc(100vw - 1rem);
    max-width: calc(100vw - 1rem);
  }

  .ai-settings-editor {
    max-height: calc(100vh - 1rem);
  }
}

html {
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  width: 100%;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
}

@media (min-width: 1600px) and (max-width: 2100px) {
  :root {
    --font-size-base: var(--font-size-desktop-fhd);
  }
}

@media (min-width: 2101px) {
  :root {
    --font-size-base: var(--font-size-desktop-wide);
  }
}

a {
  color: inherit;
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

.app-shell {
  display: grid;
  --menu-width: 48px;
  --menu-overlay-width: 248px;
  grid-template-columns: var(--menu-width) minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  min-height: 100vh;
}

.app-shell.is-menu-hovered {
  --menu-width: 48px;
}

.app-shell.is-menu-expanded {
  --menu-width: var(--menu-overlay-width);
}

.icon-sprite {
  position: fixed;
  inset: auto;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  z-index: -1;
  display: none !important;
}

.app-menu,
.topbar,
.work-panel,
.metric-card,
.module-table,
.module-filters {
  background: var(--surface);
}

.app-menu {
  grid-column: 1 !important;
  grid-row: 1;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: var(--menu-width);
  min-height: 100dvh;
  border-right: 1px solid var(--line);
  padding: 0;
  overflow: hidden;
  transition: width 0.14s ease, box-shadow 0.14s ease;
}

.app-shell.is-menu-expanded .app-menu,
.app-shell.is-menu-hovered .app-menu {
  width: var(--menu-overlay-width);
  box-shadow: 10px 0 24px rgba(15, 23, 42, 0.12);
}

.app-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-height: 52px;
  padding: 0.55rem 0.45rem;
  border-bottom: 1px solid var(--line);
}

.app-shell.is-menu-expanded .app-title,
.app-shell.is-menu-hovered .app-title {
  justify-content: flex-start;
  gap: 0.7rem;
  padding-inline: 0.75rem;
}

.app-mark-wrap {
  display: inline-grid;
  place-items: center;
  gap: 0.16rem;
  flex: 0 0 auto;
}

.app-mark {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 5px;
  background: var(--brand);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
}

.app-env-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 18px;
  padding: 0.15rem 0.38rem;
  border: 1px solid color-mix(in srgb, var(--app-environment-accent, #b91c1c) 72%, #fff);
  border-radius: 5px;
  background: var(--app-environment-accent, #b91c1c);
  color: #fff;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.2);
  font-size: 0.65rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.app-title-text,
.menu-label {
  width: 0;
  min-width: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateX(-0.2rem);
  transition: opacity 0.12s ease, transform 0.12s ease;
  white-space: nowrap;
  pointer-events: none;
}

.app-shell.is-menu-expanded .app-title-text,
.app-shell.is-menu-expanded .menu-label,
.app-shell.is-menu-hovered .app-title-text,
.app-shell.is-menu-hovered .menu-label {
  width: auto;
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.app-title strong {
  display: block;
  font-size: 1rem;
}

.app-title small,
.app-menu p {
  color: var(--soft);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
}

.menu-stack {
  display: grid;
  align-content: start;
  gap: 0.08rem;
  padding: 0.45rem 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 116, 139, 0.34) transparent;
}

.menu-stack::-webkit-scrollbar {
  width: 8px;
}

.menu-stack::-webkit-scrollbar-track {
  background: transparent;
}

.menu-stack::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.3);
  background-clip: content-box;
}

.menu-stack::-webkit-scrollbar-thumb:hover {
  background: rgba(14, 116, 144, 0.42);
  background-clip: content-box;
}

.menu-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-height: 44px;
  padding: 0 0.75rem;
  border-left: 3px solid transparent;
  color: var(--muted);
  font-weight: 650;
  overflow: hidden;
}

.app-shell.is-menu-expanded .menu-item,
.app-shell.is-menu-hovered .menu-item {
  justify-content: flex-start;
  gap: 0.9rem;
}

.menu-item svg,
.menu-toggle svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.menu-item:hover,
.menu-item.is-active,
.menu-settings.is-active > .menu-settings-summary {
  border-left-color: var(--brand);
  background: #eef8fc;
  color: var(--brand-dark);
}

.menu-item.is-active,
.menu-settings.is-active > .menu-settings-summary {
  font-weight: 800;
}

.menu-settings {
  display: grid;
}

.menu-settings summary {
  list-style: none;
  cursor: pointer;
}

.menu-settings summary::-webkit-details-marker {
  display: none;
}

.menu-settings-body {
  display: none;
  padding: 0.18rem 0.5rem 0.35rem 2.45rem;
}

.app-shell.is-menu-expanded .menu-settings[open] .menu-settings-body,
.app-shell.is-menu-hovered .menu-settings[open] .menu-settings-body {
  display: grid;
  gap: 0.32rem;
}

.menu-subgroup {
  display: grid;
  gap: 0.06rem;
}

.menu-subgroup p {
  display: block;
  margin: 0.35rem 0 0.08rem;
  color: var(--soft);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.menu-subitem {
  display: block;
  min-width: 0;
  border-radius: 6px;
  padding: 0.36rem 0.5rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.25;
}

.menu-subitem span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-subitem:hover,
.menu-subitem.is-active {
  background: #eef8fc;
  color: var(--brand-dark);
}

.menu-toggle {
  display: inline-grid;
  place-items: center;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-top: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  cursor: pointer;
}

.menu-toggle:hover {
  background: #eef8fc;
  color: var(--brand-dark);
}

.app-shell.is-menu-expanded .menu-toggle,
.app-shell.is-menu-hovered .menu-toggle {
  justify-content: start;
  padding-left: 0.8rem;
}

.app-menu p {
  display: none;
}

.app-main {
  display: flex;
  flex-direction: column;
  grid-column: 2 / -1 !important;
  width: 100%;
  min-width: 0;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  z-index: 1;
}

.app-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
  padding: 12px 24px 18px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.5;
  text-align: right;
}

.app-footer a {
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

.app-footer a:hover,
.app-footer a:focus-visible {
  text-decoration: underline;
}

.app-shell.is-menu-expanded .menu-item:hover,
.app-shell.is-menu-expanded .menu-item.is-active,
.app-shell.is-menu-expanded .menu-settings.is-active > .menu-settings-summary,
.app-shell.is-menu-hovered .menu-item:hover,
.app-shell.is-menu-hovered .menu-item.is-active,
.app-shell.is-menu-hovered .menu-settings.is-active > .menu-settings-summary {
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 52px;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--line);
}

.topbar input {
  width: min(760px, 100%);
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 0.7rem;
  color: var(--text);
  background: #f8fafc;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  min-width: 0;
}

.work-timer {
  display: inline-flex;
  align-items: center;
  gap: 0;
  min-width: max-content;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 2px;
  background: #fff;
}

.work-timer output {
  min-width: 70px;
  min-height: 32px;
  display: inline-grid;
  place-items: center;
  padding-inline: 6px;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  font-weight: 800;
}

.work-timer button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: var(--brand-dark);
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.work-timer button:hover,
.work-timer button:focus {
  background: #eef8fc;
}

.work-timer svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.work-timer[data-running="true"] [data-work-timer-toggle] {
  background: var(--brand);
  color: #fff;
}

.work-timer__pause {
  display: none;
}

.work-timer[data-running="true"] .work-timer__play {
  display: none;
}

.work-timer[data-running="true"] .work-timer__pause {
  display: block;
}

.role-notifications {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.role-notifications a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 0.55rem;
  color: var(--muted);
  background: #f8fafc;
  font-size: 0.78rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.role-notifications strong {
  color: var(--brand-dark);
}

.context-switcher {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 700;
}

.context-switcher select {
  height: 34px;
  min-width: 132px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 2rem 0 0.65rem;
  color: var(--text);
  background: #f8fafc;
  font: inherit;
  font-weight: 750;
}

[data-context-hidden="true"] {
  display: none !important;
}

.dashboard,
.module-page {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.page-header--registry {
  align-items: center;
  padding: 0.95rem 0 0.4rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  box-shadow: none;
}

.page-header--registry h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 850;
}

.page-header p {
  margin: 0;
  color: var(--brand-dark);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 800;
}

.page-header h1 {
  margin: 0.15rem 0;
  font-size: 1.55rem;
}

.page-header span {
  color: var(--muted);
}

.page-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.page-actions a,
.page-actions button {
  align-items: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  display: inline-flex;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  justify-content: center;
  padding: 0.34rem 0.65rem;
  text-decoration: none;
}

.page-actions button {
  cursor: pointer;
}

.page-actions .primary-action {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.status-message {
  margin: 0;
  border: 1px solid #bae6fd;
  border-left: 4px solid var(--brand);
  padding: 0.65rem 0.85rem;
  background: #f0f9ff;
  color: var(--brand-dark);
  font-weight: 750;
}

.status-message--success {
  border-color: rgba(45, 212, 191, 0.42);
  border-left-color: #0f9f92;
  background: #ecfeff;
  color: #0f766e;
}

.status-message--warning {
  border-color: rgba(245, 158, 11, 0.42);
  border-left-color: #d97706;
  background: #fffbeb;
  color: #92400e;
}

.status-message--error {
  border-color: rgba(248, 113, 113, 0.55);
  border-left-color: #dc2626;
  border-left-width: 6px;
  background: #fef2f2;
  color: #991b1b;
  font-weight: 850;
}

html[data-theme="dark"] .status-message--success {
  border-color: rgba(45, 212, 191, 0.36);
  border-left-color: #2dd4bf;
  background: rgba(20, 184, 166, 0.14);
  color: #99f6e4;
}

html[data-theme="dark"] .status-message--warning {
  border-color: rgba(251, 191, 36, 0.36);
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.14);
  color: #fde68a;
}

html[data-theme="dark"] .status-message--error {
  border-color: rgba(248, 113, 113, 0.42);
  border-left-color: #f87171;
  background: rgba(127, 29, 29, 0.34);
  color: #fecaca;
}

.evidence-panel {
  display: grid;
  gap: 0.4rem;
  margin: 0 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.75rem;
  background: #f8fafc;
}

.evidence-panel h3 {
  margin: 0;
  font-size: 0.92rem;
}

.evidence-panel span {
  display: block;
  border-left: 3px solid var(--brand);
  padding: 0.22rem 0 0.22rem 0.55rem;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.decision-gate {
  display: grid;
  gap: 0.18rem;
  margin: 0 0 0.75rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 4px;
  padding: 0.65rem 0.75rem;
  background: var(--surface-soft);
}

.decision-gate strong {
  color: var(--ink);
}

.decision-gate span {
  color: var(--muted);
  font-size: 0.86rem;
}

.decision-gate em {
  color: var(--brand-dark);
  font-style: normal;
  font-weight: 850;
}

.decision-gate.is-blocked {
  border-left-color: var(--danger);
}

.decision-gate.is-blocked em {
  color: var(--danger);
}

.primary-action {
  align-self: start;
  border: 0;
  padding: 0.52rem 0.85rem;
  border-radius: 4px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.primary-action.activity-add-link,
.calendar-add-link .primary-action {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 32px;
}

.primary-action.activity-add-link span,
.calendar-add-link .primary-action span {
  color: inherit;
  line-height: 1;
}

.section-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.secondary-action {
  align-self: start;
  border: 1px solid var(--line);
  padding: 0.48rem 0.72rem;
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 0.75rem;
}

.role-playbook {
  display: grid;
  grid-template-columns: repeat(5, minmax(170px, 1fr));
  gap: 0.75rem;
}

.role-playbook article {
  display: grid;
  gap: 0.35rem;
  min-height: 138px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--brand);
  padding: 0.85rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.role-playbook p {
  margin: 0;
  color: var(--brand-dark);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
}

.role-playbook h2 {
  margin: 0;
  font-size: 1rem;
}

.role-playbook span {
  color: var(--muted);
}

.role-playbook a {
  align-self: end;
  color: var(--brand-dark);
  font-weight: 800;
}

.metric-card {
  display: grid;
  gap: 0.18rem;
  min-height: 88px;
  padding: 0.62rem 0.7rem;
  border: 1px solid var(--line);
  border-top: 2px solid var(--brand);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.metric-card strong {
  font-size: 1.32rem;
  line-height: 1.05;
}

.metric-card--orange {
  border-top-color: #f59e0b;
}

.metric-card--green {
  border-top-color: #22c55e;
}

.metric-card--slate {
  border-top-color: #64748b;
}

.metric-card--purple {
  border-top-color: #7c3aed;
}

.metric-card--high {
  border-top-color: #dc2626;
}

.metric-card--medium {
  border-top-color: #f59e0b;
}

.metric-card--low {
  border-top-color: #22c55e;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 0.75rem;
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 0.75rem;
}

.work-panel {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.work-panel header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--line);
}

.work-panel h2 {
  margin: 0;
  font-size: 1rem;
}

.work-panel header a {
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 800;
}

.work-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.18rem 0.75rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--line-soft);
}

.work-row:last-child {
  border-bottom: 0;
}

.work-row:hover,
.module-table a:hover,
.module-table-row:hover {
  background: #f8fbfd;
}

.work-row.is-active {
  background: var(--brand-soft);
  box-shadow: inset 3px 0 0 var(--brand);
}

.work-row strong,
.work-row span,
.work-row small {
  grid-column: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-row span,
.work-row small {
  color: var(--muted);
}

.work-row em {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: center;
  justify-self: end;
  max-width: 12rem;
  color: var(--brand-dark);
  font-style: normal;
  font-size: 0.76rem;
  font-weight: 800;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-workspace {
  display: grid;
  gap: 0.75rem;
}

.module-shell {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 0.75rem;
}

.module-shell--wide {
  grid-template-columns: 180px minmax(0, 1fr) 300px;
}

.contacts-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.62rem;
  min-width: 0;
}

.contacts-workspace .module-list-header,
.contacts-workspace .registry-toolbar,
.contacts-workspace .modern-list--contacts,
.contacts-workspace .empty-state {
  min-width: 0;
}

.contacts-workspace .registry-toolbar {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(160px, 220px) minmax(160px, 220px) minmax(220px, 320px);
  align-items: end;
  justify-content: stretch;
  gap: 0.55rem;
}

.contacts-workspace .segmented-control {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.contacts-workspace .segmented-control button,
.contacts-workspace .modern-row__side button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--brand-dark);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 850;
  padding: 0 0.65rem;
  cursor: pointer;
}

.contacts-workspace .segmented-control button.is-active,
.contacts-workspace .segmented-control button:hover,
.contacts-workspace .segmented-control button:focus-visible,
.contacts-workspace .modern-row__side button:hover,
.contacts-workspace .modern-row__side button:focus-visible {
  border-color: rgba(14, 165, 196, 0.35);
  background: #e8f8fd;
  color: #075b72;
  outline: none;
}

.contacts-workspace .filter-field,
.contacts-workspace .search-box {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.contacts-workspace .filter-field span,
.contacts-workspace .search-box span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.contacts-workspace .filter-field select,
.contacts-workspace .search-box input {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  padding: 0 0.55rem;
}

.modern-list--contacts {
  display: grid;
  gap: 0.42rem;
}

.modern-list--contacts .modern-row--compact {
  grid-template-columns: minmax(260px, 1.4fr) minmax(320px, 1fr);
  min-height: 58px;
  border-radius: 10px;
  padding: 0.55rem 0.62rem;
}

.modern-list--contacts .modern-row__main {
  grid-template-columns: minmax(0, 1fr);
}

.modern-list--contacts .modern-row__side {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.45rem;
}

.modern-list--contacts .modern-row__side > button {
  flex-shrink: 0;
  margin-inline-start: auto;
}

.modern-list--contacts .modern-row__side a,
.modern-list--contacts .modern-row__side > span:not(.status-pill) {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  color: var(--brand-dark);
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .contacts-workspace .registry-toolbar,
  .modern-list--contacts .modern-row--compact {
    grid-template-columns: minmax(0, 1fr);
  }

  .modern-list--contacts .modern-row__side {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-items: start;
  }

  .modern-list--contacts .modern-row__side > button {
    min-height: 44px;
  }
}

.module-shell--register {
  grid-template-columns: minmax(0, 1fr) 320px;
}

.module-shell--admin-overview {
  grid-template-columns: minmax(0, 1fr);
}

.admin-overview-shell {
  align-items: start;
}

.admin-summary-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 0.45rem;
  margin: 0;
}

.admin-summary-strip div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  min-width: 0;
  padding: 0.48rem 0.55rem;
}

.admin-summary-strip dt {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  margin: 0 0 0.18rem 0;
  text-transform: uppercase;
}

.admin-summary-strip dd {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1;
  margin: 0;
}

.case-registry {
  display: grid;
  gap: 0;
}

.registry-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.registry-toolbar--legaldesk {
  display: grid;
  grid-template-columns: auto minmax(220px, 360px) minmax(0, max-content) minmax(180px, 240px);
  align-items: center;
  justify-content: start;
  padding: 0.1rem 0 0.65rem;
  border-bottom: 1px solid var(--line);
  overflow: visible;
}

.registry-toolbar--legaldesk .registry-tabs {
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
  overflow: visible;
}

.registry-add-link {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  min-height: 32px;
  border: 0;
  background: transparent;
  color: var(--brand-dark);
  padding: 0 0.35rem;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.registry-add-link span {
  color: var(--brand);
  font-size: 1.4rem;
  font-weight: 300;
  line-height: 1;
}

.registry-search-group {
  position: relative;
  min-width: 0;
}

.registry-search--legaldesk {
  width: 100%;
  padding-right: 2rem;
}

.registry-search-icon {
  position: absolute;
  right: 0.55rem;
  top: 50%;
  width: 15px;
  height: 15px;
  border: 2px solid #b8c0ca;
  border-radius: 999px;
  transform: translateY(-58%);
  pointer-events: none;
}

.registry-search-icon::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -4px;
  width: 7px;
  height: 2px;
  border-radius: 999px;
  background: #b8c0ca;
  transform: rotate(45deg);
}

.registry-group-hint {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 42px;
  padding: 0 0.85rem;
  background: #eef8fd;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.registry-group-hint span {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--brand-dark);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 900;
}

.registry-group-hint p {
  margin: 0;
}

.registry-tabs {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  min-width: 0;
  overflow-x: auto;
}

.registry-search {
  width: min(360px, 34vw);
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  padding: 0 0.75rem;
  font: inherit;
}

.registry-search--compact {
  width: min(240px, 24vw);
}

.registry-filter-stack {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-width: min(720px, 48vw);
}

.registry-filter-stack .registry-search {
  width: min(280px, 22vw);
}

.registry-filter-stack .registry-search--compact {
  width: min(170px, 14vw);
}

.registry-tabs button {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
  padding: 0 0.52rem;
  font-size: 0.78rem;
  white-space: nowrap;
  font-weight: 800;
}

.registry-tabs button strong,
.tabs button strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  margin-left: 0.25rem;
  border-radius: 999px;
  padding: 0 0.28rem;
  background: #eef2ff;
  color: #4f46e5;
  font-size: 0.64rem;
  line-height: 1;
  font-weight: 850;
}

.registry-tabs button.is-active,
.registry-tabs button:hover {
  border-color: #b7dcea;
  background: #eef9fc;
  color: var(--brand-dark);
}

.module-filters,
.module-table,
.detail-pane,
.calendar-board,
.agenda-panel,
.kanban-column,
.modal-card {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: var(--surface);
}

.module-filters {
  display: grid;
  align-content: start;
  padding: 0.5rem;
}

.module-filters button {
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 0.55rem;
  text-align: left;
  font-weight: 700;
}

.module-filters button.is-active,
.module-filters button:hover {
  border-left-color: var(--brand);
  background: #f8fbfd;
  color: var(--text);
}

.module-table {
  min-width: 0;
}

.module-table--registry {
  overflow-x: auto;
}

.module-table header,
.module-table > a,
.module-table-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(140px, 1fr) minmax(120px, 0.7fr) minmax(110px, 0.7fr);
  gap: 0.75rem;
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--line-soft);
}

.module-table header {
  color: var(--muted);
  background: #f8fafc;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
}

.module-table > a span,
.module-table > a strong,
.module-table-row span,
.module-table-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-table .inline-form {
  margin: 0;
}

.module-table .inline-form select {
  width: 100%;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 700;
}

.module-table small {
  color: var(--muted);
  font-weight: 500;
}

.module-table-row a {
  display: inline;
  padding: 0;
  border: 0;
  color: var(--brand-dark);
  font-weight: 800;
}

.module-table--matters header,
.module-table--matters a {
  grid-template-columns:
    minmax(330px, 1.8fr)
    minmax(190px, 0.9fr)
    36px
    minmax(105px, 0.5fr)
    minmax(180px, 0.8fr)
    minmax(140px, 0.6fr)
    minmax(300px, 1.25fr);
}

.module-table--matters header {
  background: #eef8fd;
  min-height: 68px;
  align-items: end;
}

.module-table--matters a {
  min-height: 46px;
  padding-block: 0.5rem;
  color: var(--ink);
  font-size: 0.86rem;
}

.module-table--matters a:hover,
.module-table--matters a:focus {
  background: #f8fbfd;
}

.matter-name {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
}

.matter-name > span {
  width: 15px;
  height: 11px;
  border: 1.5px solid #b9c0c7;
  border-radius: 2px;
  flex: 0 0 auto;
}

.matter-name > span::before {
  content: "";
  display: block;
  width: 7px;
  height: 3px;
  margin: -4px 0 0 1px;
  border: 1.5px solid #b9c0c7;
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
  background: var(--surface);
}

.matter-open-icon {
  display: inline-grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border: 2px solid #bde7fb;
  border-radius: 999px;
  justify-self: center;
}

.matter-open-icon::before {
  content: "";
  width: 0;
  height: 0;
  margin-left: 2px;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid #8ecdec;
}

.assignee-stack {
  display: flex;
  align-items: center;
  gap: 0.28rem;
}

.assignee-stack small {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #a8adb3;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 850;
}

.inline-form--owner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.25rem;
  margin-top: 0.35rem;
}

.inline-form--owner select {
  min-width: 0;
  min-height: 28px;
}

.inline-form--owner button {
  min-height: 28px;
  padding: 0 0.4rem;
}

.registry-lookup-form {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.8rem;
}

.registry-lookup-form button {
  width: max-content;
}

.registry-lookup-form small,
.form-hint {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.module-table--clients header,
.module-table--clients a {
  grid-template-columns:
    minmax(170px, 1fr)
    minmax(110px, 0.55fr)
    minmax(150px, 0.8fr)
    minmax(190px, 1fr)
    minmax(120px, 0.65fr)
    minmax(130px, 0.65fr)
    minmax(90px, 0.45fr)
    minmax(210px, 1.2fr)
    minmax(70px, 0.35fr);
}

.module-table--clients header,
.module-table--clients a {
  min-width: 1290px;
}

.module-table--clients a em {
  color: var(--brand-dark);
  font-style: normal;
  font-weight: 800;
}

.module-table--matters a {
  min-width: 1340px;
}

.module-table--matters header {
  min-width: 1340px;
}

.module-table--matters a em {
  color: var(--brand-dark);
  font-style: normal;
  font-weight: 800;
}

.module-table--activities header,
.module-table--activities a {
  grid-template-columns: 90px 90px 120px minmax(240px, 1fr) 110px 90px 100px 120px;
}

.module-table--correspondence header,
.module-table--correspondence a,
.module-table--correspondence .module-table-row {
  grid-template-columns: 90px 90px 120px minmax(280px, 1fr) 150px 82px;
}

.module-table--correspondence .module-table-row > span,
.module-table--correspondence .module-table-row > strong {
  white-space: normal;
}

.module-table--correspondence {
  border-radius: 16px;
}

.module-table--correspondence header {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
}

.module-table--correspondence .module-table-row {
  padding-top: 0.88rem;
  padding-bottom: 0.88rem;
  align-items: start;
}

.module-table--correspondence .module-table-row strong {
  font-size: 1rem;
  line-height: 1.2;
}

.module-table--correspondence .module-table-row > span {
  font-size: 0.98rem;
  line-height: 1.3;
}

.module-table--correspondence .module-table-row small {
  font-size: 0.88rem;
  line-height: 1.35;
}

.module-table--correspondence .status-pill {
  min-height: 28px;
  padding: 0 0.62rem;
  font-size: 0.8rem;
}

.module-table--correspondence .row-actions--compact button {
  min-height: 32px;
  padding: 0 0.66rem;
  font-size: 0.84rem;
  font-weight: 750;
}

.correspondence-process-note {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  padding: 0.7rem 0.85rem;
  color: var(--muted);
}

.correspondence-process-note strong {
  color: var(--ink);
}

.correspondence-process-note span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  background: var(--panel-soft);
  font-size: 0.78rem;
  font-weight: 750;
}

.module-filters button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
}

.module-filters button strong {
  color: var(--brand-dark);
  font-size: 0.74rem;
}

.process-note,
.module-empty,
.correspondence-path {
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.process-note {
  display: grid;
  gap: 0.25rem;
  margin: 0.65rem 0 0;
  padding: 0.65rem;
}

.process-note span,
.correspondence-path strong {
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.process-note p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.module-empty {
  margin: 0.75rem;
  padding: 0.8rem;
  color: var(--muted);
  font-weight: 750;
}

.correspondence-path {
  display: grid;
  gap: 0.38rem;
  margin: 0.75rem 0;
  padding: 0.7rem;
}

.correspondence-path span {
  color: var(--muted);
  font-size: 0.8rem;
}

.stack-form small {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

.inline-check {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}

.inline-check input {
  margin-top: 0.2rem;
}

.module-table--costs header,
.module-table--costs a {
  grid-template-columns: 90px 110px 120px minmax(220px, 1fr) 90px 90px 110px;
}

.compact-summary {
  display: grid;
  gap: 0;
  margin: 0 0 0.75rem;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: var(--surface);
}

.compact-summary div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--line-soft);
}

.compact-summary div:last-child {
  border-bottom: 0;
}

.compact-summary dt {
  color: var(--muted);
  font-weight: 800;
}

.compact-summary dd {
  margin: 0;
  color: var(--ink);
  font-weight: 850;
}

.billing-rates {
  display: grid;
  gap: 0.4rem;
  margin: 0 0 0.9rem;
  padding: 0.65rem;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: var(--surface-soft);
}

.billing-rates header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.billing-rates h3 {
  margin: 0;
  font-size: 0.9rem;
}

.billing-rates span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.billing-rate-row {
  display: grid;
  grid-template-columns: minmax(70px, 1fr) 64px 54px minmax(92px, 1fr) auto;
  gap: 0.3rem;
  align-items: center;
}

.billing-rate-row strong {
  font-size: 0.78rem;
}

.billing-rate-row input,
.billing-rate-row select {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.42rem;
  color: var(--text);
  background: var(--surface);
}

.billing-rate-row button {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.42rem 0.5rem;
  color: var(--ink);
  background: var(--surface);
  font-weight: 850;
}

.personal-cost-fields {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(180px, 1fr) minmax(90px, 0.45fr);
  gap: 0.6rem;
  align-items: end;
  padding: 0.65rem;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #f8fafc;
}

.personal-cost-fields[hidden] {
  display: none;
}

.personal-cost-fields label {
  display: grid;
  gap: 0.25rem;
}

.personal-cost-hint {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.invoice-queue {
  display: grid;
  gap: 0;
  margin: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.invoice-queue > header,
.invoice-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(130px, 0.8fr) minmax(180px, 1fr) minmax(100px, 0.6fr) auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line-soft);
}

.invoice-queue > header {
  grid-template-columns: minmax(0, 1fr) auto;
  background: var(--surface-soft);
}

.invoice-queue h2 {
  margin: 0;
  font-size: 0.95rem;
}

.invoice-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.invoice-actions a {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.42rem 0.6rem;
  color: var(--ink);
  background: var(--surface);
  font-weight: 850;
}

.invoice-queue span,
.invoice-row small {
  color: var(--muted);
}

.invoice-row div {
  display: grid;
  gap: 0.16rem;
}

.invoice-row em {
  font-style: normal;
  color: var(--brand-dark);
  font-weight: 850;
}

.invoice-row form {
  margin: 0;
}

.invoice-row button,
.invoice-row > a {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.48rem 0.65rem;
  color: var(--ink);
  background: var(--surface);
  font-weight: 850;
  text-align: center;
}

.client-relations-panel {
  align-content: start;
}

.relation-map {
  display: grid;
  grid-template-columns: minmax(150px, 0.45fr) minmax(260px, 1fr);
  gap: 0.8rem;
  align-items: stretch;
}

.relation-node,
.relation-lanes section,
.relation-risk {
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: var(--surface-soft);
}

.relation-node {
  display: grid;
  align-content: center;
  gap: 0.35rem;
  padding: 0.85rem;
}

.relation-node strong {
  font-size: 1rem;
}

.relation-node span,
.relation-lanes p,
.relation-chip small,
.relation-empty {
  color: var(--muted);
}

.relation-node--client {
  border-left: 3px solid var(--brand);
}

.relation-lanes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.relation-lanes section {
  display: grid;
  align-content: start;
  gap: 0.35rem;
  padding: 0.65rem;
}

.relation-lanes p {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.relation-chip {
  display: grid;
  gap: 0.1rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.42rem 0.5rem;
  color: var(--ink);
  background: var(--surface);
  font-weight: 850;
}

.relation-chip small {
  font-size: 0.72rem;
  font-weight: 750;
}

.relation-risk {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
  padding: 0.6rem;
}

.relation-risk span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.28rem 0.5rem;
  color: var(--ink);
  background: var(--surface);
  font-size: 0.76rem;
  font-weight: 800;
}

.lead-client-match {
  display: grid;
  gap: 0.5rem;
  margin: 0.8rem 0;
  padding: 0.7rem;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: var(--surface-soft);
}

.lead-client-match header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.lead-client-match h3 {
  margin: 0;
  font-size: 0.95rem;
}

.lead-client-match header span,
.lead-client-match small,
.lead-client-match article span {
  color: var(--muted);
}

.lead-client-match article {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 0.35rem 0.8rem;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
}

.lead-client-match article div {
  display: grid;
  gap: 0.15rem;
}

.lead-client-match article a {
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.38rem 0.55rem;
  color: var(--ink);
  font-weight: 850;
}

.lead-client-match article small {
  grid-column: 1 / -1;
}

.module-table--automation header,
.module-table--automation a,
.module-table--automation .module-table-row {
  grid-template-columns: minmax(160px, 1.1fr) 120px 90px 130px 140px 60px minmax(130px, 0.8fr) minmax(170px, 1fr) 150px;
}

.automation-run-history {
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 0.8rem 0.7rem 0.8rem;
}

.automation-run-history summary {
  align-items: center;
  color: var(--text);
  cursor: pointer;
  display: flex;
  font-size: 0.78rem;
  font-weight: 850;
  gap: 0.45rem;
  justify-content: flex-start;
  list-style: none;
}

.automation-run-history summary::-webkit-details-marker {
  display: none;
}

.automation-run-history summary::before {
  color: var(--brand);
  content: "+";
  font-weight: 900;
}

.automation-run-history[open] summary::before {
  content: "-";
}

.automation-run-history summary strong {
  align-items: center;
  background: #e0f2fe;
  border-radius: 999px;
  color: var(--text);
  display: inline-flex;
  font-size: 0.62rem;
  height: 16px;
  justify-content: center;
  min-width: 16px;
  padding: 0 0.25rem;
}

.automation-run-history ul {
  display: grid;
  gap: 0.35rem;
  list-style: none;
  margin: 0.5rem 0 0 0;
  padding: 0;
}

.automation-run-history li {
  align-items: center;
  background: var(--panel-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: grid;
  gap: 0.35rem;
  grid-template-columns: 135px minmax(180px, 0.8fr) minmax(260px, 1fr);
  min-width: 0;
  padding: 0.42rem 0.55rem;
}

.automation-run-history span,
.automation-run-history small {
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.automation-run-history b {
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.automation-run-history p {
  color: var(--muted);
  margin: 0.5rem 0 0 0;
}

.module-table--admin header,
.module-table--admin a {
  grid-template-columns: minmax(150px, 0.7fr) minmax(260px, 1.5fr) 110px 110px;
}

.module-table--team header,
.module-table--team a {
  grid-template-columns: minmax(150px, 1fr) 100px 120px 140px 110px minmax(180px, 1fr);
}

.team-row--absence {
  box-shadow: inset 3px 0 0 #fb7185;
  background: #fff7f8 !important;
}

.team-control-pane {
  display: grid;
  align-content: start;
  gap: 0.75rem;
}

.team-add-absence {
  justify-self: stretch;
}

.team-side-section {
  display: grid;
  gap: 0.45rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line-soft);
}

.team-side-section header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.team-side-section h3 {
  margin: 0;
  font-size: 0.9rem;
}

.team-side-section header span {
  color: var(--brand-dark);
  font-weight: 900;
}

.absence-wizard {
  gap: 1rem;
}

.wizard-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.wizard-steps button {
  justify-content: flex-start;
  min-height: 40px;
  border-color: var(--line-soft);
  background: #f8fafc;
  text-align: left;
}

.wizard-steps button.is-active {
  border-color: #0ea5a8;
  background: #e6fffb;
  color: var(--brand-dark);
}

.wizard-panel {
  min-height: 250px;
  border: 1px solid var(--line-soft);
  background: #fff;
  padding: 0.9rem;
}

.wizard-note {
  margin-top: 0.75rem;
  border-left: 3px solid var(--brand);
  background: #eef9fc;
  padding: 0.65rem 0.75rem;
  color: var(--brand-dark);
  font-weight: 850;
}

.wizard-collision-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.wizard-collision-grid article {
  display: grid;
  align-content: start;
  gap: 0.5rem;
}

.wizard-collision-list {
  display: grid;
  gap: 0.45rem;
}

.wizard-collision-list div,
.wizard-collision-list em {
  display: grid;
  gap: 0.1rem;
  border: 1px solid var(--line-soft);
  background: #f8fafc;
  padding: 0.6rem;
  font-style: normal;
}

.wizard-collision-list small {
  color: var(--muted);
}

.absence-wizard footer {
  align-items: center;
}

.model-pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border-radius: 999px;
  padding: 0 0.5rem;
  background: #eef2f7;
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 900;
}

.model-pill--primary {
  background: #e0f2fe;
  color: #0369a1;
}

.model-pill--fallback {
  background: #eef2f7;
  color: #64748b;
}

.module-table--documents header,
.module-table--documents .module-table-row {
  grid-template-columns:
    44px
    minmax(260px, 1.35fr)
    minmax(130px, 0.6fr)
    minmax(250px, 1.15fr)
    minmax(180px, 0.82fr)
    minmax(190px, 0.82fr)
    minmax(118px, 0.5fr)
    minmax(90px, 0.42fr)
    minmax(110px, 0.35fr);
  min-width: 1360px;
}

.module-table--documents .module-table-row > span,
.module-table--documents .module-table-row > strong {
  white-space: normal;
}

.module-table--documents header span:first-child {
  text-align: center;
}

.module-table--documents .document-type-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid #bfe3f1;
  border-radius: 4px;
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 900;
}

.document-matter-link {
  display: grid;
  gap: 0.12rem;
}

.document-matter-link a {
  display: grid;
  gap: 0.08rem;
  color: var(--ink);
}

.document-matter-link a:hover strong,
.document-matter-link a:focus strong {
  color: var(--brand);
}

.document-matter-link em {
  color: var(--muted);
  font-style: normal;
  font-weight: 650;
}

.document-matter-link small {
  color: var(--muted);
}

.module-table-row .document-matter-link strong,
.module-table-row .document-matter-link em,
.module-table-row .document-matter-link small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
}

.document-workspace {
  gap: 0.75rem;
}

.document-legaldesk-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.4rem;
  border-bottom: 1px solid var(--line);
  padding: 0 0 0.75rem;
}

.document-legaldesk-toolbar__main {
  display: grid;
  gap: 0.75rem;
  width: min(720px, 100%);
}

.document-legaldesk-toolbar__filters {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.document-searchbox {
  width: min(280px, 34vw);
}

.legaldesk-add-link {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 0;
  background: transparent;
  color: var(--brand-dark);
  padding: 0.25rem 0;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.legaldesk-add-link span {
  color: var(--brand);
  font-size: 1.55rem;
  font-weight: 300;
  line-height: 1;
}

.legaldesk-add-link:hover,
.legaldesk-add-link:focus {
  color: var(--brand);
}

.legaldesk-segmented {
  flex-wrap: nowrap;
  gap: 0;
  border: 1px solid #dbe7ef;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.legaldesk-segmented button {
  border: 0;
  border-radius: 0;
  min-height: 30px;
  padding: 0.35rem 1rem;
}

.legaldesk-segmented button + button {
  border-left: 1px solid #dbe7ef;
}

.document-legaldesk-toolbar__tools {
  justify-content: end;
}

.document-legaldesk-toolbar__tools button,
.document-tool-button {
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fff;
    color: var(--ink);
    min-height: 34px;
    padding: 0.5rem 0.65rem;
    font: inherit;
    font-weight: 750;
    line-height: 1;
    cursor: pointer;
}

.document-legaldesk-toolbar__tools button:hover,
.document-legaldesk-toolbar__tools button:focus,
.document-tool-button:hover,
.document-tool-button:focus {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.document-tool-button--primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.document-tool-button--primary:hover,
.document-tool-button--primary:focus {
  background: var(--brand-dark);
  color: #fff;
}

.document-group-hint {
  background: #eef7fc;
  margin-top: -0.1rem;
}

.module-table--documents .module-table-row {
  cursor: pointer;
}

.module-table--documents .module-table-row:hover {
  background: #f7fbfe;
}

.module-table--documents .module-table-row a {
  display: inline;
  border: 0;
  padding: 0;
  color: var(--brand-dark);
  font-weight: 800;
}

.document-location {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.document-location::before {
  content: "";
  width: 15px;
  height: 10px;
  border-radius: 2px 2px 1px 1px;
  background: #f6c84c;
  box-shadow: inset 0 3px 0 #f8d97a;
}

.document-status-cell {
  align-self: center;
}

.document-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
    width: 100%;
}

.module-table--documents .module-table-row > span:last-child {
    justify-self: end;
    min-width: 0;
}

.document-row-actions .document-more-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 76px;
    min-height: 30px;
    border: 1px solid #cfe1ec;
    border-radius: 4px;
    background: #fff;
    color: var(--brand-dark);
    padding: 0 0.65rem;
    font: inherit;
    font-weight: 850;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
}

.document-row-actions .document-more-button:hover,
.document-row-actions .document-more-button:focus {
  border-color: var(--brand);
  background: #eef8fc;
}
@media (max-width: 1180px) {
  .document-legaldesk-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .document-legaldesk-toolbar__main {
    width: 100%;
  }

  .document-legaldesk-toolbar__filters,
  .document-legaldesk-toolbar__tools {
    flex-wrap: wrap;
  }

  .document-searchbox {
    width: min(100%, 320px);
  }

  .document-legaldesk-toolbar__tools {
    justify-content: start;
  }
}

.document-list-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  min-height: 36px;
  padding: 0 0.25rem;
}

.document-list-summary span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 800;
}

.document-command-strip {
  display: grid;
  grid-template-columns: minmax(240px, 1.2fr) repeat(3, minmax(180px, 0.7fr));
  gap: 0.75rem;
}

.document-command-strip article {
  display: grid;
  gap: 0.22rem;
  padding: 0.75rem 0.85rem;
}

.document-command-strip p,
.document-bottom-grid header p {
  margin: 0;
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.document-command-strip strong {
  color: var(--ink);
  font-size: 1.25rem;
}

.document-command-strip span,
.document-bottom-grid header span {
  color: var(--muted);
  font-size: 0.82rem;
}

.document-bottom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 0.75rem;
}

.document-bottom-grid--collapsed {
  grid-template-columns: 1fr;
}

.document-bottom-grid > article {
  padding: 0.85rem;
}

.document-bottom-grid details {
  padding: 0;
}

.document-bottom-grid summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 46px;
  padding: 0 0.85rem;
  cursor: pointer;
  color: var(--brand-dark);
  font-weight: 900;
}

.document-bottom-grid summary::-webkit-details-marker {
  display: none;
}

.document-bottom-grid summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 0.35rem;
  border: 1px solid #cfe1ed;
  border-radius: 999px;
  color: var(--muted);
}

.document-bottom-grid details[open] summary::before {
  content: "-";
}

.document-bottom-grid details .compact-register {
  padding: 0 0.85rem 0.85rem;
}

.document-bottom-grid header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: start;
  margin-bottom: 0.65rem;
}

.document-bottom-grid h2 {
  margin: 0.2rem 0 0;
}

.document-runs-panel {
  grid-column: 1 / -1;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 0.65rem;
  background: #eef2f7;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
}

.status-pill--document {
  background: #eef8fc;
  color: var(--brand-dark);
}

.row-actions--compact {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.row-actions--compact a,
.row-actions--compact button,
.row-actions--inline a,
.row-actions--inline button {
  min-height: 28px;
}

.row-actions--inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.document-action-modal {
  max-width: 760px;
}

.document-action-modal header span {
  color: var(--muted);
  font-size: 0.84rem;
}

.document-action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.document-action-grid__wide {
  grid-column: 1 / -1;
}

.document-action-grid section {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 0.75rem;
  background: #fff;
}

.document-action-grid h3 {
  margin: 0 0 0.45rem;
  font-size: 0.9rem;
}

.document-action-grid p,
.document-action-grid small {
  overflow-wrap: anywhere;
}

.document-detail-page {
  display: grid;
  gap: 0.75rem;
}

.document-tab-panels {
  display: grid;
  gap: 0.75rem;
}

.document-tab-panels [data-tab-panel] {
  display: none !important;
}

.document-tab-panels [data-tab-panel].is-active {
  display: grid !important;
}


.document-profile-card,
.document-preview-card,
.document-context-card {
  padding: 0.85rem;
}

.document-profile-card > p,
.document-preview-card header p,
.document-context-card header p {
  margin: 0;
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.document-profile-card h2,
.document-preview-card h2,
.document-context-card h2 {
  margin: 0.2rem 0 0;
}

.document-profile-card dl {
  display: grid;
  gap: 0;
  margin: 0.75rem 0 0;
}

.document-profile-card dl div {
  display: grid;
  grid-template-columns: minmax(90px, 0.35fr) minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line-soft);
}

.document-profile-card dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.document-profile-card dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}



.document-preview-card header,
.document-context-card header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: start;
  margin-bottom: 0.65rem;
}

.document-preview-card iframe {
  width: 100%;
  min-height: 56vh;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.document-tab-panels [data-tab-panel="document-preview"] {
  min-height: calc(100vh - 280px);
}

.document-tab-panels [data-tab-panel="document-preview"] iframe {
  min-height: calc(100vh - 360px);
}

.document-context-card {
  display: grid;
  gap: 0.45rem;
}
.document-register-table {
  min-width: 0;
}

.document-register-table > header,
.document-register-table .module-table-row {
  grid-template-columns: minmax(220px, 0.85fr) minmax(320px, 1.35fr) minmax(180px, 0.8fr);
}

.document-register-table .row-actions {
  justify-content: flex-start;
}

.document-search-preview {
  display: block;
  margin-top: 0.18rem;
  max-width: 46rem;
  color: var(--muted);
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-review-card {
  grid-column: auto;
}

.review-panel {
  display: grid;
  gap: 0.55rem;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.review-panel__main {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.review-panel__main > div,
.review-panel__notes {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
  padding: 0.55rem;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: var(--surface);
}

.review-panel p {
  margin: 0;
  color: var(--brand-dark);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.review-panel span,
.review-panel small {
  color: var(--muted);
}

.review-panel__notes small {
  color: #92400e;
}

.limited-trust-review {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1fr);
  gap: 0.7rem;
  padding: 0.6rem;
  border: 1px solid rgba(14, 165, 164, 0.35);
  border-radius: 5px;
  background: #ecfeff;
}

.limited-trust-review > div {
  display: grid;
  gap: 0.25rem;
}

.limited-trust-review label {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
}

.limited-trust-review p {
  align-self: center;
  color: #0f766e;
  font-size: 0.78rem;
  letter-spacing: 0;
  line-height: 1.5;
  text-transform: none;
}

.review-version-preview {
  display: grid;
  gap: 0.4rem;
  padding: 0.55rem;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: var(--surface);
}

.review-version-preview header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.review-version-preview iframe {
  width: 100%;
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.review-panel__actions {
  justify-content: flex-end;
}

.review-decision-form {
  flex: 1 1 100%;
  display: grid;
  gap: 0.45rem;
  width: 100%;
  padding: 0.55rem;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: var(--surface);
}

.review-decision-form__checks {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4rem;
}

.review-decision-form__checks label {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  min-width: 0;
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 750;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 24px;
  border: 1px solid #b7dcea;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  background: #eef9fc;
  color: var(--brand-dark);
  font-style: normal;
  font-size: 0.76rem;
  font-weight: 850;
}

.row-actions--compact {
  justify-content: flex-end;
}

.row-actions--compact button {
  min-height: 28px;
  border-color: #b7dcea;
  background: #fff;
  color: var(--brand-dark);
}

.correspondence-detail-modal header span {
  color: var(--muted);
  font-size: 0.84rem;
}

.correspondence-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.correspondence-modal-actions a {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.38rem 0.55rem;
  color: var(--brand-dark);
  font-weight: 850;
}

.review-decision-form__comment {
  display: grid;
  gap: 0.2rem;
}

.review-decision-form__comment span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.review-decision-form__comment textarea {
  width: 100%;
  min-height: 56px;
  resize: vertical;
}

.review-decision-form__buttons {
  display: flex;
  justify-content: flex-end;
  gap: 0.35rem;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.row-actions .inline-form {
  margin: 0;
}

.row-actions a,
.row-actions button {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  padding: 0.28rem 0.45rem;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.row-actions .primary-action {
  border-color: var(--brand);
  color: #fff;
  background: var(--brand);
}

.row-actions .danger-action {
  border-color: #fecaca;
  color: #b91c1c;
  background: #fff7f7;
}

.confirmation-upload input[type="file"] {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.confirmation-upload label span {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  padding: 0.28rem 0.45rem;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.status-chip {
  border-radius: 4px;
  padding: 0.2rem 0.42rem;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.status-chip--low {
  background: #ecfdf5;
  color: #047857;
}

.status-chip--medium {
  background: #fffbeb;
  color: #b45309;
}

.status-chip--high {
  background: #fff1f2;
  color: #be123c;
}

.compact-stack {
  display: grid;
  gap: 0.25rem;
  margin: 0.75rem 0;
  padding: 0.55rem;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--panel-muted);
  font-size: 0.78rem;
}

.compact-stack strong {
  color: var(--ink);
}

.compact-stack span {
  color: var(--muted);
}

.compact-register {
  display: grid;
  gap: 0.55rem;
  margin: 0 0 1rem;
}

.compact-register div {
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 0.55rem;
  background: #f8fafc;
}

.compact-register dt {
  color: var(--text);
  font-weight: 800;
}

.compact-register dd {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.reroute-preview {
  margin-top: 0.45rem;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #fff;
}

.reroute-preview summary {
  cursor: pointer;
  padding: 0.42rem 0.5rem;
  color: var(--text);
  font-weight: 800;
}

.reroute-preview ul {
  display: grid;
  gap: 0.4rem;
  margin: 0;
  padding: 0 0.5rem 0.5rem;
  list-style: none;
}

.reroute-preview li {
  display: grid;
  gap: 0.08rem;
  padding: 0.42rem;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: #f8fafc;
}

.reroute-preview li strong,
.reroute-preview li span,
.reroute-preview li small,
.reroute-preview__empty {
  display: block;
}

.reroute-preview li strong {
  color: var(--text);
}

.reroute-preview li span,
.reroute-preview li small,
.reroute-preview__empty {
  color: var(--muted);
}

.reroute-preview__empty {
  padding: 0 0.5rem 0.5rem;
}

.history-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 0.35fr) minmax(180px, 0.45fr);
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.history-filters label {
  display: grid;
  gap: 0.24rem;
}

.history-filters span {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
}

.history-filters input,
.history-filters select {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.48rem 0.55rem;
  background: #fff;
  color: var(--text);
}

.scoring-presets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}

.scoring-presets button {
  display: grid;
  gap: 0.2rem;
  min-height: 74px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 6px;
  padding: 0.62rem;
  background: #fff;
  color: var(--text);
  text-align: left;
  font-weight: 850;
}

.scoring-presets button:hover,
.scoring-presets button.is-selected {
  background: #f8fbfd;
  border-color: var(--brand);
}

.scoring-presets small {
  color: var(--muted);
  font-weight: 600;
}

.scoring-history-list {
  display: grid;
  gap: 0.5rem;
}

.scoring-history-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(120px, 0.35fr) minmax(240px, 1fr);
  gap: 0.35rem 0.75rem;
  align-items: start;
  padding: 0.6rem;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #f8fafc;
}

.scoring-history-row strong {
  color: var(--text);
}

.scoring-history-row span {
  color: var(--brand-dark);
  font-weight: 800;
}

.scoring-history-row small {
  color: var(--muted);
}

.scoring-history-row em {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.76rem;
  font-style: normal;
}

.scoring-history-empty {
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 0.75rem;
  color: var(--muted);
  background: #fff;
}

.detail-pane {
  min-width: 0;
  padding: 0.85rem;
}

.detail-pane p,
.agenda-panel p,
.modal-card:where(:not(.intake-dialog *)) p {
  margin: 0 0 0.25rem;
  color: var(--brand-dark);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
}

.detail-pane h2,
.modal-card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.detail-pane dl {
  display: grid;
  gap: 0.55rem;
  margin: 0 0 0.8rem;
}

.detail-pane dl div {
  display: grid;
  gap: 0.12rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line-soft);
}

.detail-pane dt {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.detail-pane dd {
  margin: 0;
}

.tabs,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.32rem;
}

.tabs button,
.button-row button,
.modal-card button {
  min-height: 29px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg, #f8fafc);
  color: var(--text);
  font: inherit;
  font-weight: 750;
}

.modal-card button.primary-action,
.modal-card footer button.primary-action,
.modal-card .form-actions button.primary-action {
  border-color: rgba(14, 165, 196, 0.34);
  background: var(--brand);
  color: #fff;
  box-shadow: 0 8px 18px rgba(14, 165, 196, 0.14);
}

.modal-card button.danger-action,
.modal-card .matter-modal-danger-form button.danger-action {
  border-color: rgba(220, 38, 38, 0.32);
  background: #ef4444;
  color: #fff;
}

.modal-card button.secondary-action,
.modal-card a.secondary-action,
.modal-card footer a.secondary-action,
.modal-card .form-actions a.secondary-action,
.modal-card .form-actions button.secondary-action {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand-dark);
  text-decoration: none;
}

.modal-card .form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.modal-card .form-actions button {
  min-height: 36px;
  padding: 0.45rem 0.75rem;
}

.tabs button {
  padding: 0 0.48rem;
  font-size: 0.78rem;
}

.tabs button.is-active {
  border-color: var(--brand);
  color: var(--brand-dark);
  background: #eef9fc;
}

.risk {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 4px;
  padding: 0 0.45rem;
  background: #e2e8f0;
  color: #334155;
}

.risk-wysoki {
  background: #fee2e2;
  color: #991b1b;
}

.risk-sredni {
  background: #fef3c7;
  color: #92400e;
}

.risk-niski {
  background: #dcfce7;
  color: #166534;
}

.calendar-workspace {
  display: grid;
  gap: 0.75rem;
}

.calendar-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.calendar-period-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.calendar-period-nav button {
  width: 30px;
  min-height: 29px;
  border: 1px solid #b7dcea;
  border-radius: 4px;
  background: #eef9fc;
  color: var(--brand-dark);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.calendar-period-nav strong {
  min-width: 7.5rem;
  color: var(--ink);
  text-align: center;
}

.calendar-period-nav strong.is-pulsing {
  color: var(--brand-dark);
}

.registry-tabs--compact {
  flex: 0 0 auto;
}

.calendar-type-tabs button {
  border-color: #b7dcea;
  background: #eef9fc;
}

.calendar-type-tabs button[data-calendar-filter="hearing"],
.calendar-event--hearing {
  border-color: #0ea5a8 !important;
  background: #e6fffb !important;
}

.calendar-type-tabs button[data-calendar-filter="deadline"],
.calendar-event--deadline {
  border-color: #38bdf8 !important;
  background: #eef9ff !important;
}

.calendar-type-tabs button[data-calendar-filter="consultation"],
.calendar-event--consultation {
  border-color: #14b8a6 !important;
  background: #ecfdf5 !important;
}

.calendar-type-tabs button[data-calendar-filter="internal"],
.calendar-event--internal {
  border-color: #67e8f9 !important;
  background: #ecfeff !important;
}

.calendar-type-tabs button[data-calendar-filter="absence"],
.calendar-event--absence,
.calendar-event--hearing.has-warning,
.calendar-event--deadline.has-warning,
.calendar-event--consultation.has-warning,
.calendar-event--internal.has-warning,
.timeline-row.has-warning {
  border-color: #f59e0b !important;
  background: #fffbeb !important;
}

.calendar-type-tabs button[data-calendar-filter="unavailable"],
.calendar-absence-band {
  border-color: #fb7185 !important;
  background: #ffe4e6 !important;
  color: #881337;
}

.calendar-absence-band {
  display: grid;
  gap: 0.08rem;
  margin-top: 0.35rem;
  border-left: 3px solid #fb7185;
  border-radius: 4px;
  padding: 0.32rem 0.42rem;
  font-size: 0.74rem;
  font-weight: 850;
}

.calendar-absence-band small {
  color: #9f1239;
  font-weight: 750;
}

.calendar-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 0.75rem;
}

.calendar-summary-strip article {
  display: grid;
  gap: 0.22rem;
  padding: 0.75rem 0.85rem;
}

.calendar-summary-strip p {
  margin: 0;
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calendar-summary-strip strong {
  color: var(--ink);
  font-size: 1.25rem;
}

.calendar-summary-strip span {
  color: var(--muted);
  font-size: 0.82rem;
}

.calendar-alert-strip {
  display: grid;
  gap: 0.65rem;
  padding: 0.75rem;
  border-color: #facc15;
  background: #fffbeb;
}

.calendar-alert-strip header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: start;
}

.calendar-alert-strip p {
  margin: 0;
  color: #92400e;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calendar-alert-strip h2 {
  margin: 0.2rem 0 0;
}

.calendar-alert-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.5rem;
}

.calendar-alert-list article {
  display: grid;
  gap: 0.14rem;
  padding: 0.6rem;
  border: 1px solid #fde68a;
  border-radius: 4px;
  background: #fff;
}

.calendar-view-header {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px 6px 0 0;
  display: flex;
  justify-content: space-between;
  padding: 0.65rem 0.75rem;
}

.calendar-view-header p,
.calendar-view-header h2 {
  margin: 0;
}

.calendar-view-header p {
  color: var(--brand-dark);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calendar-view-header h2 {
  font-size: 1rem;
}

.calendar-view-header span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.calendar-day-view,
.calendar-week-view {
  min-width: 0;
}

.calendar-time-grid {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 6px 6px;
  display: grid;
}

.calendar-time-slot {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 74px minmax(0, 1fr);
  min-height: 58px;
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
}

.calendar-time-slot > strong {
  color: var(--muted);
  font-size: 0.76rem;
}

.calendar-time-slot > div {
  display: grid;
  gap: 0.35rem;
}

.calendar-week-grid {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 6px 6px;
  display: grid;
  grid-template-columns: repeat(7, minmax(130px, 1fr));
  overflow-x: auto;
}

.calendar-week-column {
  display: grid;
  align-content: start;
  gap: 0.35rem;
  min-height: 230px;
  padding: 0.55rem;
  border-right: 1px solid var(--line-soft);
  cursor: pointer;
}

.calendar-week-column.is-today {
  background: #eef9fc;
}

.calendar-week-column header {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.76rem;
}

.calendar-event-card {
  border-left: 3px solid var(--brand);
  background: #f8fbfd;
  display: grid;
  gap: 0.08rem;
  padding: 0.4rem;
  font-size: 0.76rem;
}

.calendar-event-card.has-warning {
  border-color: #f59e0b;
  background: #fffbeb;
}

.calendar-muted {
  color: var(--muted);
  font-size: 0.78rem;
}

.calendar-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(96px, 1fr));
  min-width: 0;
  overflow: auto;
}

.calendar-board--wide {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.calendar-weekdays {
  display: contents;
}

.calendar-weekdays span {
  padding: 0.55rem;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calendar-day {
  min-height: 118px;
  padding: 0.5rem;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  background: #fff;
  cursor: pointer;
}

.calendar-day.is-today {
  background: #eef9fc;
}

.calendar-day.has-absence-impact {
  box-shadow: inset 3px 0 0 #f59e0b;
}

.calendar-day strong {
  color: var(--muted);
  font-size: 0.8rem;
}

.calendar-day a,
.agenda-panel a {
  display: grid;
  gap: 0.08rem;
  margin-top: 0.4rem;
  padding: 0.35rem;
  border-left: 3px solid var(--brand);
  background: #f8fbfd;
  font-size: 0.76rem;
}

.calendar-day small,
.agenda-panel small {
  color: var(--muted);
}

.calendar-day a.has-warning,
.timeline-row.has-warning {
  border-color: #fde68a;
  background: #fffbeb;
}

.warning-text {
  color: #92400e !important;
  font-weight: 800;
}

.agenda-panel {
  padding: 0.75rem;
}

.agenda-panel--wide {
  display: grid;
  gap: 0.45rem;
}

.agenda-panel--wide header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.25rem;
}

.agenda-add-button {
  white-space: nowrap;
}

.agenda-panel--wide h2 {
  margin: 0.2rem 0 0;
}

.calendar-matter-context {
  align-items: center;
  background: var(--panel-muted);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  display: grid;
  gap: 0.2rem 0.75rem;
  grid-template-columns: 90px minmax(180px, 1.1fr) minmax(220px, 1.3fr) minmax(220px, 1.2fr) auto;
  margin-top: 0.35rem;
  min-width: 0;
  padding: 0.5rem 0.65rem;
}

.calendar-matter-context span {
  color: var(--brand-dark);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.calendar-matter-context strong,
.calendar-matter-context small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-matter-context a {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  margin-top: 0;
  padding: 0.32rem 0.55rem;
  text-align: center;
}

.agenda-inline-form {
  display: inline-flex;
}

.agenda-select {
  min-height: 32px;
  min-width: 132px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  padding: 0.32rem 1.75rem 0.32rem 0.5rem;
}

.agenda-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(20, 158, 190, 0.16);
  outline: none;
}

.activities-legaldesk {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1rem;
  min-height: calc(100vh - 190px);
}

.activities-inbox,
.activities-register {
  min-width: 0;
  background: #fff;
}

.activities-inbox {
  align-self: start;
  padding: 0.85rem;
}

.activities-inbox h2 {
  margin: 0 0 0.85rem;
  color: #0072bc;
  font-size: 1rem;
  font-weight: 800;
}

.activity-inbox-card {
  position: relative;
  display: grid;
  gap: 0.42rem;
  min-height: 112px;
  margin-bottom: 0.65rem;
  padding: 0.75rem 0.75rem 0.65rem 0.95rem;
  border: 1px solid #dbe7f1;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.activity-inbox-card:hover,
.activity-inbox-card:focus-visible {
  border-color: #9bd4e7;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
  outline: none;
}

.activity-warning-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: #f59e0b;
}

.activity-inbox-card strong,
.activity-description strong {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 850;
}

.activity-inbox-card p,
.activities-empty,
.activity-description small {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.activity-inbox-card footer {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  color: var(--muted);
  font-size: 0.74rem;
}

.avatar-chip {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 999px;
  background: #a3a7aa;
  color: #fff;
  font-size: 0.76rem;
  font-weight: 850;
}

.activities-register {
  display: grid;
  grid-template-rows: auto auto auto auto 1fr auto;
  min-height: 640px;
  overflow: auto;
}

.activities-register-top {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: start;
  justify-content: space-between;
  padding: 0 0 0.95rem;
}

.activities-register-actions {
  display: grid;
  gap: 0.7rem;
  width: min(100%, 560px);
}

.activity-add-link:not(.primary-action) {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  width: max-content;
  min-height: 32px;
  border: 0;
  background: transparent;
  color: #0072bc;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.activity-add-link:not(.primary-action) span {
  color: #0072bc;
  font-size: 1.7rem;
  line-height: 1;
}

.activity-search {
  width: 260px;
  min-height: 34px;
  border: 1px solid #d0d9e2;
  border-radius: 3px;
  padding: 0.45rem 0.65rem;
  background: #fff;
  color: var(--text);
}

.activity-period,
.activity-date-range label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: var(--type-label);
  font-weight: var(--type-medium);
  line-height: 1.5;
}

.activity-status-form select {
  min-height: 32px;
  border: 1px solid #d0d9e2;
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.8rem;
  padding: 0.35rem 1.8rem 0.35rem 0.5rem;
}

.activity-period select,
.activity-date-range input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--muted);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  color-scheme: light;
  font-family: var(--font-sans);
  font-size: var(--type-field);
  font-weight: var(--type-regular);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.activity-period select:focus-visible,
.activity-date-range input:focus-visible {
  outline: 2px solid var(--brand-dark);
  outline-offset: 2px;
}

html[data-theme="dark"] .activity-period select,
html[data-theme="dark"] .activity-date-range input {
  border-color: var(--muted);
  color-scheme: dark;
}

@media (forced-colors: active) {
  .activity-period select,
  .activity-date-range input {
    border-color: ButtonText;
    background: Canvas;
    color: CanvasText;
    forced-color-adjust: auto;
  }

  .activity-period select:focus-visible,
  .activity-date-range input:focus-visible {
    outline-color: Highlight;
  }
}

.activity-filter-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-bottom: 0.7rem;
}

.activity-filter-strip button {
  border: 1px solid #d7e3ee;
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.34rem 0.65rem;
}

.activity-filter-strip button.is-active {
  border-color: #9ad7ea;
  background: #edf8fc;
  color: #006b91;
}

.activity-register-tools {
  display: flex;
  gap: 0.55rem;
  justify-content: flex-end;
  padding: 0.15rem 0 0.65rem;
}

.activity-register-tools button {
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  color: #98a2ad;
  cursor: pointer;
  font-size: 1.1rem;
}

.activity-group-hint {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  min-height: 44px;
  padding: 0 0.85rem;
  background: #eef7fc;
  color: var(--muted);
  font-size: 0.8rem;
}

.activity-group-hint strong {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #0072bc;
  color: #fff;
  font-size: 0.72rem;
}

.activity-grid {
  min-width: 1180px;
}

.activity-grid-header,
.activity-grid-row {
  display: grid;
  grid-template-columns: minmax(250px, 1.5fr) minmax(170px, 0.9fr) minmax(180px, 0.9fr) minmax(120px, 0.65fr) minmax(90px, 0.45fr) minmax(150px, 0.75fr) minmax(190px, 1fr) minmax(150px, 0.8fr);
  align-items: center;
}

.activity-grid-header {
  min-height: 48px;
  background: #eef7fc;
  color: #a0a7ad;
  font-size: 0.74rem;
  font-weight: 850;
}

.activity-grid-header span,
.activity-grid-row > span,
.activity-grid-row > a {
  min-width: 0;
  padding: 0.72rem 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-grid-header span {
  border-right: 1px solid #cfdde8;
}

.activity-grid-row {
  min-height: 54px;
  border-bottom: 1px solid #eef2f6;
  color: var(--text);
  font-size: 0.82rem;
}

.activity-grid-row:hover {
  background: #f9fcfe;
}

.activity-description {
  display: grid;
  gap: 0.14rem;
  color: var(--ink);
  text-decoration: none;
}

.activity-person {
  display: inline-flex;
  gap: 0.55rem;
  align-items: center;
}

.activity-status-form {
  margin: 0;
}

.activities-total-bar {
  display: flex;
  gap: 1.4rem;
  align-items: center;
  justify-content: flex-end;
  padding: 0.95rem 0.25rem 0;
  color: var(--ink);
}

.activities-total-bar span {
  margin-right: auto;
  color: var(--muted);
  font-size: 0.8rem;
}

.activities-total-bar strong {
  font-size: 1.1rem;
}

.app-modal {
  width: min(940px, calc(100vw - 2rem));
  max-height: calc(100vh - 3rem);
  padding: 0;
  border: 0;
  background: transparent;
}

.app-modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.app-modal__panel {
  display: grid;
  overflow: hidden;
  border: 1px solid #d7e3ee;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.25);
}

.app-modal__panel > header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.4rem 0.85rem;
  border-bottom: 1px solid var(--line);
}

.app-modal__panel > header p {
  margin: 0 0 0.2rem;
  color: var(--brand-dark);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.app-modal__panel > header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.modal-close {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid #d7e3ee;
  border-radius: 4px;
  background: #f8fbfd;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 850;
}

.modal-close:focus-visible {
  border-color: #86c9db;
  box-shadow: 0 0 0 2px rgba(8, 145, 178, 0.18);
  outline: none;
}

.activity-modal-form {
  display: grid;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  gap: 1rem;
  padding: 1.1rem 1.4rem 1.2rem;
}

.activity-form-grid {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.activity-form-grid label {
  display: grid;
  min-width: 0;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.activity-form-grid input,
.activity-form-grid select,
.activity-form-grid textarea {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 38px;
  border: 1px solid #d0d9e2;
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 0.45rem 0.65rem;
}

.activity-datetime-picker {
  display: grid;
  grid-template-columns: minmax(118px, 1.1fr) minmax(72px, 0.7fr) auto;
  gap: 0.35rem;
  align-items: center;
  border: 1px solid #d0d9e2;
  border-radius: 6px;
  padding: 0.22rem;
  background: #fff;
}

.activity-datetime-picker input {
  min-height: 32px;
  border: 0;
  border-radius: 4px;
  padding: 0.32rem 0.42rem;
  background: #f8fafc;
  font-size: 0.84rem;
}

.activity-datetime-picker input:focus {
  outline: 2px solid rgba(14, 165, 196, 0.18);
  background: #fff;
}

.activity-datetime-picker button {
  min-height: 32px;
  border: 1px solid rgba(14, 165, 196, 0.22);
  border-radius: 4px;
  padding: 0 0.5rem;
  background: #eef9fc;
  color: var(--brand-dark);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 850;
}

.activity-time-validation {
  grid-column: 1 / -1;
  margin: -0.25rem 0 0;
  border: 1px solid rgba(220, 38, 38, 0.24);
  border-radius: 6px;
  padding: 0.55rem 0.65rem;
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.82rem;
  font-weight: 800;
}

.activity-time-validation:empty,
.activity-time-validation[hidden] {
  display: none;
}

.activity-form-grid textarea {
  resize: vertical;
}

.activities-legaldesk--master-detail {
  grid-template-columns: 320px minmax(0, 1fr);
}

.activities-legaldesk--master-detail .activities-register {
  grid-template-rows: auto auto 1fr auto;
  overflow: hidden;
}

.activity-master-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1rem;
  min-height: 0;
}

.activity-list {
  min-width: 0;
  overflow: auto;
  border: 1px solid #e1ebf3;
  border-radius: 6px;
}

.activity-master-detail .activity-grid {
  min-width: 0;
}

.activity-master-detail .activity-grid-header,
.activity-master-detail .activity-grid-row {
  grid-template-columns: minmax(260px, 1.5fr) minmax(190px, 0.9fr) minmax(190px, 0.9fr) minmax(190px, 0.8fr);
}

.activity-master-detail .activity-grid-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #eef2f6;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.activity-master-detail .activity-grid-row.is-selected {
  background: #edf8fc;
  box-shadow: inset 3px 0 0 #149ebe;
}

.activity-pagination {
  display: inline-flex;
  gap: 0.4rem;
}

.activity-pagination button {
  min-height: 32px;
  border: 1px solid #d7e3ee;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.35rem 0.65rem;
}

.activity-pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.activity-day-stats {
  display: grid;
  gap: 0.45rem;
  margin-top: 1rem;
}

.activity-day-stats button {
  display: grid;
  gap: 0.2rem;
  width: 100%;
  border: 1px solid #dbe7f1;
  border-radius: 6px;
  background: #f8fbfd;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  padding: 0.6rem 0.7rem;
  text-align: left;
}

.activity-day-stats button:hover,
.activity-day-stats button:focus-visible {
  border-color: #9bd4e7;
  outline: none;
}

.activity-day-stats span,
.activity-day-stats small {
  color: var(--muted);
  font-size: 0.76rem;
}

.activity-day-stats strong {
  font-size: 0.86rem;
}

.activity-day-summary {
  border-bottom: 1px solid var(--border-color, #d8dee8);
  padding: 8px 0;
}

.activity-day-summary.needs-review {
  border-left: 3px solid #b54708;
  padding-left: 8px;
}

.activity-day-warning,
.activity-warning-text {
  color: #9a3412;
  font-size: 12px;
  margin: 4px 0;
}

.activity-day-confirmation,
.activity-day-query {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.activity-day-confirmation input,
.activity-day-confirmation select,
.activity-day-query input,
.activity-day-query select {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  min-height: 36px;
  border: 1px solid #d0d9e2;
  border-radius: 3px;
  background: var(--surface, #fff);
  color: var(--ink);
  font: inherit;
  font-size: 0.8rem;
  padding: 0.4rem 0.55rem;
}

.activity-day-confirmation label,
.activity-day-query label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.activity-day-state,
.activity-day-reason {
  margin: 6px 0;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.activity-correct-action {
  margin-top: 6px;
  min-height: 30px;
  border: 1px solid #d0d9e2;
  border-radius: 3px;
  background: var(--surface, #fff);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  padding: 0.25rem 0.6rem;
}

.activity-history {
  border-top: 1px solid var(--border-color, #d8dee8);
  margin-top: 12px;
  padding-top: 12px;
}

.activity-detail-panel {
  align-self: start;
  min-width: 0;
  border: 1px solid #dbe7f1;
  border-radius: 6px;
  background: #fff;
  padding: 1rem;
}

.activity-detail-kicker {
  margin: 0 0 0.25rem;
  color: #0072bc;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.activity-detail-panel h2 {
  margin: 0 0 1rem;
  font-size: 1.08rem;
}

.activity-detail-panel dl {
  display: grid;
  gap: 0.7rem;
  margin: 0;
}

.activity-detail-panel div {
  display: grid;
  gap: 0.18rem;
}

.activity-detail-panel dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.activity-detail-panel dd {
  margin: 0;
  color: var(--ink);
  font-size: 0.88rem;
}

/* LEX-53: compact master-detail activity register. */
.activities-legaldesk--master-detail {
  align-items: start;
  min-height: 0;
}

.activities-legaldesk--master-detail .activities-inbox,
.activities-legaldesk--master-detail .activities-register {
  border: 1px solid #e1ebf3;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.04);
}

.activities-legaldesk--master-detail .activities-inbox {
  position: sticky;
  top: 88px;
}

.activities-legaldesk--master-detail .activities-register {
  min-height: 0;
  padding: 0.75rem;
}

.activities-legaldesk--master-detail .activities-register-top {
  padding: 0;
  border-radius: 0;
}

.activities-legaldesk--master-detail .activity-master-detail {
  grid-template-columns: minmax(620px, 1fr) minmax(280px, 320px);
  align-items: start;
}

.activities-legaldesk--master-detail .activity-list {
  max-height: min(58vh, 640px);
  min-height: 124px;
  background: #fff;
}

.activities-legaldesk--master-detail .activity-grid-row[hidden] {
  display: none !important;
}

.activities-legaldesk--master-detail .activity-grid-row {
  min-height: 50px;
}

.activities-legaldesk--master-detail .activity-status-form select {
  width: 100%;
  max-width: 150px;
}

.activities-legaldesk--master-detail .activity-detail-panel {
  position: sticky;
  top: 88px;
  max-height: min(58vh, 640px);
  overflow: auto;
}

.activities-legaldesk--master-detail .activities-total-bar {
  justify-content: flex-start;
  padding: 0.7rem 0.15rem 0;
}

.activities-legaldesk--master-detail .activities-total-bar strong {
  margin-left: auto;
  font-size: 0.86rem;
}

.activities-legaldesk--master-detail .activities-total-bar strong + strong {
  margin-left: 0;
}

.activity-form-wide {
  grid-column: 1 / -1;
}

.activity-modal-form footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
}

@media (max-width: 960px) {
  .activities-legaldesk {
    grid-template-columns: 1fr;
  }

  .activity-master-detail {
    grid-template-columns: 1fr;
  }

  .activities-register-top,
  .activities-total-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .activity-search {
    width: 100%;
  }

  .activity-form-grid {
    grid-template-columns: 1fr;
  }
}

.calendar-legaldesk {
  display: grid;
  grid-template-columns: clamp(340px, 21vw, 400px) minmax(0, 1fr);
  gap: 1rem;
  min-height: calc(100vh - 130px);
}

.calendar-legaldesk-sidebar {
  display: grid;
  align-content: start;
  gap: 1rem;
  min-width: 0;
}

.calendar-legaldesk[data-planner-mode="true"],
.calendar-legaldesk.is-sidebar-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.calendar-legaldesk-sidebar[hidden] {
  display: none;
}

.calendar-sidebar-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
}

.calendar-add-link button:not(.primary-action) {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 32px;
  border: 0;
  background: transparent;
  color: #0072bc;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.calendar-add-link button:not(.primary-action) span {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: #0072bc;
  font-size: 1.5rem;
  line-height: 1;
}

.calendar-source-panel summary {
  margin: 0;
  color: #0072bc;
  font-size: 0.98rem;
  font-weight: 800;
}

.calendar-source-panel {
  display: grid;
  gap: 0.75rem;
  padding: 0.5rem 0.4rem 1rem 0;
}

.calendar-source-panel details {
  display: grid;
  gap: 0.5rem;
}

.calendar-source-panel summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
  color: #3f3f46;
  cursor: pointer;
}

/* 2026-05 layout hardening and premium unification */
.matter-workspace {
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
}

.matter-layout {
  grid-template-columns: minmax(0, 1fr) minmax(240px, 280px);
}

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

.task-workspace,
.calendar-legaldesk,
.report-grid,
.case-registry,
.lead-workspace {
  border: 1px solid #e4edf7;
  border-radius: 20px;
  background: #fff;
  padding: 0.9rem;
}

.task-toolbar,
.registry-toolbar,
.calendar-legaldesk-header,
.calendar-legaldesk-tools {
  border: 1px solid #e7eef8;
  border-radius: 16px;
  background: #f9fbff;
  padding: 0.65rem 0.75rem;
}

.kanban-column,
.workspace-section,
.module-table,
.calendar-source-panel,
.calendar-legaldesk-board,
.calendar-legaldesk-list {
  border-radius: 16px;
}

.module-table--clients > a,
.workload-row,
.timeline-row {
  border-radius: 12px;
}

.module-table--clients > a {
  margin: 0.32rem 0.42rem;
  border: 1px solid #e6edf7;
  background: #fff;
}

.module-table--clients > a:hover {
  border-color: #b4d6e8;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

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

.calendar-source-panel summary::before {
  content: "^";
  color: #9ca3af;
  font-weight: 400;
}

.calendar-source-panel details:not([open]) summary::before {
  content: ">";
}

.calendar-source-panel summary small {
  color: #6b7280;
  font-size: 0.65rem;
  font-weight: 500;
}

.calendar-source-panel summary button,
.calendar-source-option button {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: #a1a1aa;
  font: inherit;
  font-weight: 600;
}

.calendar-source-option {
  display: grid;
  grid-template-columns: 18px 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.45rem;
  min-height: 32px;
  padding-left: 1.2rem;
  color: #3f3f46;
  font-size: 0.8rem;
}

.calendar-source-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.source-check {
  width: 18px;
  height: 18px;
  border: 2px solid #cbd5e1;
  border-radius: 3px;
  background: #fff;
}

.calendar-source-option input:checked + .source-check {
  background: linear-gradient(135deg, transparent 55%, currentColor 56%);
  box-shadow: inset 0 0 0 3px #fff;
}

.calendar-source-option--person .source-check {
  color: var(--calendar-owner-color, #64748b);
  border-color: var(--calendar-owner-color, #64748b);
}

.calendar-source-tree {
  display: grid;
  gap: 0.2rem;
}

.calendar-source-tree__children {
  display: grid;
  gap: 0.1rem;
  border-left: 1px solid #dbe7f3;
  margin-left: 1.7rem;
}

.calendar-source-option--context {
  padding-left: 1.2rem;
  font-weight: 700;
}

.calendar-source-option--person {
  padding-left: 0.7rem;
}

.source-check--blue {
  color: #73b8e5;
  border-color: #73b8e5;
}

.source-check--red {
  color: #a02c2c;
  border-color: #a02c2c;
}

.source-check--pink {
  color: #f5a6b8;
  border-color: #f5a6b8;
}

.source-check--gray {
  color: #a3a3a3;
  border-color: #a3a3a3;
}

.source-avatar {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--calendar-owner-color, #a3a3a3);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
}

.calendar-source-option strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.calendar-source-option strong small {
  display: block;
  overflow: hidden;
  color: #8a9aac;
  font-size: 0.66rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-legaldesk-main {
  position: relative;
  min-width: 0;
}

.calendar-legaldesk-header,
.calendar-legaldesk-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.calendar-legaldesk-header {
  margin-bottom: 1.25rem;
}

.calendar-titlebar {
  display: flex;
  align-items: center;
  gap: 0.72rem;
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: wrap;
}

.calendar-titlebar h1 {
  margin: 0 1.1rem 0 0;
  color: #2b2b2b;
  font-size: 1.45rem;
  font-weight: 700;
}

.calendar-titlebar strong {
  color: #1f1f1f;
  font-size: .9rem;
  font-weight: 600;
}

.calendar-today-link,
.calendar-period-picker__toggle,
.calendar-nav-button {
  border: 0;
  background: transparent;
  color: #0072bc;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}

.calendar-nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: #64748b;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  border-radius: 999px;
}

.calendar-nav-button:hover,
.calendar-nav-button:focus-visible {
  background: #eef9fc;
  color: #0072bc;
}

.calendar-today-link {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 0.35rem;
  font-size: 0.86rem;
  font-weight: 700;
}

.calendar-today-link:hover,
.calendar-today-link:focus-visible {
  background: #eef9fc;
}

.calendar-period-control {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.calendar-period-picker {
  position: relative;
}

.calendar-period-picker__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  color: #64748b;
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1;
  list-style: none;
}

.calendar-period-picker__toggle::-webkit-details-marker {
  display: none;
}

.calendar-period-picker__toggle:hover,
.calendar-period-picker__toggle:focus-visible {
  background: #eef9fc;
  color: #0072bc;
}

.calendar-period-picker__menu {
  display: none;
  position: absolute;
  z-index: 30;
  top: calc(100% + 0.45rem);
  left: 50%;
  width: min(320px, 88vw);
  transform: translateX(-50%);
  border: 1px solid #cfe0ed;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
  padding: 0.75rem;
}

.calendar-period-picker[open] .calendar-period-picker__menu {
  display: block;
}

.calendar-period-picker__menu::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  width: 10px;
  height: 10px;
  transform: translateX(-50%) rotate(45deg);
  border-left: 1px solid #cfe0ed;
  border-top: 1px solid #cfe0ed;
  background: #fff;
}

.calendar-period-picker__menu > span {
  display: block;
  margin-bottom: 0.45rem;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.calendar-period-picker__menu a {
  display: flex;
  align-items: center;
  min-height: 30px;
  border-radius: 6px;
  color: #1f2937;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  padding: 0 0.55rem;
}

.calendar-period-picker__menu a:hover,
.calendar-period-picker__menu a:focus-visible,
.calendar-period-picker__menu a.is-current {
  background: #e9f8fb;
  color: #00728a;
}

.calendar-period-picker__group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.25rem;
  margin-top: 0.45rem;
}

.calendar-period-picker__group--single {
  grid-template-columns: minmax(0, 1fr);
}

.calendar-period-picker__years {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.25rem;
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid #e2e8f0;
}

.calendar-period-picker__years a {
  justify-content: center;
}

.calendar-view-label {
  color: #9ca3af;
  font-size: 0.82rem;
}

.calendar-view-label strong {
  color: #3f3f46;
}

.calendar-legaldesk-tools {
  min-width: 0;
  margin-bottom: 0.9rem;
}

.calendar-search {
  position: relative;
  flex: 1 1 280px;
  min-width: min(100%, 220px);
  max-width: 320px;
}

.calendar-search input {
  width: 100%;
  min-height: 32px;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  background: #fff;
  color: #1f2937;
  padding: 0 0.75rem;
  font: inherit;
}

.calendar-type-switches,
.calendar-view-buttons {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.calendar-view-buttons--header {
  flex: 0 0 auto;
  margin-left: auto;
}

.calendar-view-buttons--header span {
  color: #9ca3af;
  font-size: 0.82rem;
}

.calendar-type-switches {
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: wrap;
  justify-content: flex-start;
  overflow: visible;
}

.calendar-type-switches button,
.calendar-view-buttons button,
.calendar-view-buttons a {
  min-height: 28px;
  border: 1px solid #d6e2ec;
  border-radius: 4px;
  background: #fff;
  color: #64748b;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.55rem;
  text-decoration: none;
}

.calendar-type-switches button {
  gap: 0.38rem;
  min-height: 30px;
  padding: 0.18rem 0.62rem;
  border-color: #d9e3ec;
  border-radius: 6px;
  background: #fff;
  color: #52657a;
  transition:
    border-color 120ms ease,
    background-color 120ms ease,
    color 120ms ease,
    box-shadow 120ms ease;
}

.calendar-type-switches button:not([data-calendar-filter="all"])::before {
  width: 15px;
  height: 15px;
  border: 1.5px solid #9aabba;
  border-radius: 50%;
  color: transparent;
  content: "";
  display: inline-grid;
  flex: 0 0 15px;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  place-items: center;
}

.calendar-type-switches button.is-active:not([data-calendar-filter="all"])::before {
  border-color: #087f9d;
  background: #087f9d;
  color: #fff;
  content: "\2713";
}

.calendar-type-switches button span {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 18px;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: #eef3f7;
  color: #52657a;
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

.calendar-type-switches button.is-active,
.calendar-view-buttons button.is-active,
.calendar-view-buttons a.is-active {
  border-color: #7cc8e6;
  background: #eef9fc;
  color: #00688f;
}

.calendar-type-switches button.is-active span {
  background: #d9f2f8;
  color: #006c87;
}

.calendar-type-switches button:hover {
  border-color: #9bc8d6;
  background: #f7fbfc;
  color: #175b70;
}

.calendar-type-switches button:focus-visible {
  outline: 2px solid #67c5da;
  outline-offset: 2px;
}

.calendar-resize-range {
  position: absolute;
  right: 0.35rem;
  bottom: 0.35rem;
  z-index: 3;
  padding: 0.18rem 0.42rem;
  border-radius: 4px;
  background: rgb(17 37 55 / 92%);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.2;
  pointer-events: none;
  white-space: nowrap;
}

.team-week-picker {
  display: inline-flex;
  align-items: center;
}

.team-week-picker label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted-text);
  font-size: 0.78rem;
}

.team-week-picker input {
  min-height: 32px;
  width: 145px;
  padding: 0.32rem 0.48rem;
  border: 1px solid #c8d8e4;
  border-radius: 4px;
  background: #fff;
  color: #17324a;
  font: inherit;
  color-scheme: light;
}

.calendar-legaldesk-board {
  position: relative;
  border: 1px solid #d1d5db;
  background: #fff;
}

.calendar-legaldesk-weekdays,
.calendar-legaldesk-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-legaldesk-weekdays.calendar-legaldesk-weekdays--period,
.calendar-legaldesk-grid.calendar-legaldesk-grid--period {
  grid-template-columns: repeat(var(--calendar-grid-columns, 7), minmax(0, 1fr));
}

.calendar-legaldesk-weekdays--period span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.calendar-legaldesk-weekdays--period span strong {
  color: #64748b;
  font-size: inherit;
}

.calendar-legaldesk-board--period .calendar-legaldesk-day {
  min-height: clamp(360px, 56vh, 620px);
}

.calendar-legaldesk-weekdays span {
  min-height: 26px;
  border-right: 1px solid #d1d5db;
  border-bottom: 1px solid #d1d5db;
  color: #9ca3af;
  font-size: 0.74rem;
  font-weight: 800;
  text-align: center;
  padding-top: 0.38rem;
}

.calendar-legaldesk-day {
  position: relative;
  min-height: 122px;
  padding: 0.45rem 0.45rem 0.35rem;
  border-right: 1px solid #d1d5db;
  border-bottom: 1px solid #d1d5db;
  background: #fff;
  cursor: default;
}

.calendar-legaldesk-day.is-muted {
  background: #f7f7f7;
}

.calendar-legaldesk-day.is-muted > strong {
  color: #a3a3a3;
}

.calendar-legaldesk-day.is-today {
  box-shadow: inset 0 3px 0 #0072bc;
}

.calendar-legaldesk-day.is-today > strong {
  color: #0072bc;
}

.calendar-legaldesk-day > strong {
  display: block;
  margin-bottom: 0.45rem;
  color: #2b2b2b;
  font-size: 0.74rem;
  font-weight: 800;
  text-align: right;
}

.calendar-legaldesk-event {
  display: grid;
  grid-template-columns: 10px auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  min-height: 20px;
  margin-bottom: 0.12rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #2b2b2b;
  font: inherit;
  font-size: 0.66rem;
  line-height: 1.1;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}

.activity-time-pair {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: .45rem;
}

.activity-time-ranges {
    min-width: 0;
    margin: 0;
    padding: .75rem;
    border: 1px solid var(--border-color, #cbd8e5);
    border-radius: 6px;
}

.activity-time-range {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(7rem, .65fr) 2rem;
    align-items: end;
    gap: .5rem;
    margin-bottom: .5rem;
}

.activity-time-range label, .activity-time-range input { min-width: 0; width: 100%; }
.activity-time-range input { box-sizing: border-box; min-height: 2.5rem; }
.activity-time-range [data-activity-remove-range] { width: 2rem; height: 2rem; min-height: 0; padding: .35rem; }
.activity-time-range [data-activity-remove-range] svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.activity-date-range { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; min-width: 0; max-width: 100%; }
.activity-date-range label { flex: 1 1 148px; }
.activity-date-range [data-activity-date-error] { flex-basis: 100%; font-size: var(--type-table); font-weight: var(--type-regular); line-height: 1.5; }
.activity-date-range [data-activity-date-error]:empty { display: none; }
.matter-finance-summary { display: flex; flex-wrap: wrap; gap: 1rem 2rem; margin: 1rem 0; }
.matter-finance-summary > div { display: grid; gap: .25rem; }
.matter-finance-summary dt { color: var(--muted); }
.matter-finance-summary dd { margin: 0; font-weight: 600; }
.matter-finance .matter-finance__activity {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(9rem, .45fr) auto;
    align-items: start;
    gap: .75rem 1rem;
}
.matter-finance .matter-finance__activity.has-values { grid-template-columns: minmax(0, 1fr) minmax(9rem, .45fr) minmax(7rem, .3fr) auto; }
.matter-finance__activity > div { min-width: 0; overflow-wrap: anywhere; }
.matter-finance__activity .modern-row__main { display: grid; grid-template-columns: minmax(0, 1fr); gap: .3rem; }
.matter-finance__activity .modern-row__main strong { font-size: .875rem; line-height: 1.5; }
.matter-finance__activity .modern-row__side { align-self: start; }

@media (max-width: 900px) {
    .matter-finance .matter-finance__activity, .matter-finance .matter-finance__activity.has-values { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .matter-finance__activity .modern-row__main { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
    .matter-finance .matter-finance__activity, .matter-finance .matter-finance__activity.has-values { grid-template-columns: minmax(0, 1fr); }
    .matter-finance__activity .modern-row__side { justify-items: start; }
}

@media (max-width: 640px) {
    .activity-time-range { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 480px) {
    .activity-time-range { grid-template-columns: minmax(0, 1fr) 2rem; }
    .activity-time-range > label { grid-column: 1 / -1; }
    .activity-time-range > label:last-of-type { grid-column: 1; }
    .activity-time-range > [data-activity-remove-range] { grid-column: 2; }
}

.rich-text-field {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
}

.rich-text-toolbar {
    display: flex;
    gap: .25rem;
    padding: .35rem;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
}

.rich-text-toolbar button {
    width: 2rem;
    height: 2rem;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--text);
}

.rich-text-toolbar button:hover,
.rich-text-toolbar button:focus-visible {
    border-color: var(--brand-strong);
    background: var(--surface);
}

.rich-text-editor {
    min-height: 9rem;
    padding: .75rem;
    color: var(--text);
}

.rich-text-editor:focus-visible {
    outline: 2px solid var(--brand-strong);
    outline-offset: -2px;
}

.rich-text-toolbar button:focus-visible {
    outline: 2px solid var(--brand-strong);
    outline-offset: 1px;
}

@media (max-width: 600px) {
    .rich-text-toolbar button {
        min-width: 44px;
        min-height: 44px;
    }
}

.calendar-legaldesk-event > .event-dot {
  grid-column: 1;
  grid-row: 1;
}

.calendar-legaldesk-event > span:not(.event-dot) {
  grid-column: 2;
  grid-row: 1;
}

.calendar-legaldesk-event.is-active {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(35, 158, 188, 0.14);
}

.calendar-legaldesk-event strong {
  grid-column: 3;
  grid-row: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.calendar-legaldesk-grid .calendar-legaldesk-event > small {
  display: none;
}

.calendar-legaldesk-event > .calendar-event-status {
  grid-column: 4;
  grid-row: 1;
}

/* Owner is a second line, never another occupant of the time column. */
.calendar-legaldesk-grid .calendar-legaldesk-event > .calendar-event-owner {
  grid-column: 2 / -1;
  grid-row: 2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .72rem;
  line-height: 1.25;
  color: var(--muted, #62798a);
}

.calendar-legaldesk-grid .calendar-legaldesk-event {
  row-gap: .12rem;
  margin-bottom: .25rem;
  line-height: 1.3;
}

.calendar-legaldesk-grid .calendar-legaldesk-event strong,
.calendar-legaldesk-grid .calendar-legaldesk-event > span:not(.event-dot):not(.calendar-event-owner) {
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}

.calendar-legaldesk-event span:not(.event-dot) {
  color: #2b2b2b;
  font-size: 0.64rem;
}

.calendar-event-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  max-width: 9rem;
  min-height: 17px;
  padding: 0 0.34rem;
  border-radius: 999px;
  color: #374151;
  background: #eef2f7;
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1400px) {
  .calendar-legaldesk-grid .calendar-event-status {
    display: none;
  }
}

.calendar-event-status--done {
  color: #166534;
  background: #dcfce7;
}

.calendar-event-status--pending-proof {
  color: #92400e;
  background: #fef3c7;
}

.calendar-event-status--progress {
  color: #1d4ed8;
  background: #dbeafe;
}

.calendar-event-status--urgent {
  color: #b91c1c;
  background: #fee2e2;
}

.calendar-legaldesk-event--status-done {
  opacity: 0.84;
}

.calendar-legaldesk-event--status-pending-proof .event-dot {
  box-shadow: 0 0 0 2px #fbbf24;
}

.event-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--calendar-owner-color, #9d2d2d);
}

.calendar-legaldesk-event--absence {
  grid-template-columns: auto minmax(0, 1fr);
  margin: 0.15rem 0 0.35rem;
  padding: 0.18rem 0.35rem;
  border-radius: 4px;
  background: #fde8e8;
}

.calendar-popover-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 0.5rem;
  border-radius: 999px;
  color: #374151;
  background: #eef2f7;
  font-size: 0.72rem;
  font-weight: 900;
}

.calendar-legaldesk-event--absence .event-dot {
  display: none;
}

.person-color-dot {
  display: inline-block;
  width: 0.58rem;
  height: 0.58rem;
  margin-right: 0.28rem;
  border-radius: 999px;
  background: var(--calendar-owner-color, #64748b);
  vertical-align: -0.04rem;
}

.calendar-legaldesk-list {
  border: 1px solid #d1d5db;
  background: #fff;
}

.calendar-legaldesk-list > header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.calendar-legaldesk-list h2 {
  margin: 0;
  font-size: 1rem;
}

.calendar-list-day {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 1rem;
  min-height: 54px;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #eef2f7;
}

.calendar-list-day > strong {
  color: #64748b;
  font-size: 0.82rem;
}

.calendar-list-day > div {
  display: grid;
  gap: 0.35rem;
}

.calendar-event-popover {
  position: absolute;
  z-index: 8;
  top: 33%;
  left: 36%;
  width: min(430px, calc(100% - 2rem));
  border: 1px solid #e5e7eb;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
  padding: 1rem 1.2rem;
}

.calendar-event-popover header {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
}

.calendar-event-popover button {
  min-width: 28px;
  min-height: 28px;
  border: 0;
  background: transparent;
  color: #94a3b8;
  font: inherit;
  cursor: pointer;
}

.calendar-event-popover h2 {
  margin: 1.2rem 0 1.5rem;
  color: #2b2b2b;
  font-size: 1rem;
}

.calendar-event-popover dl {
  display: grid;
  gap: 0.75rem;
  margin: 0;
}

.calendar-event-popover [data-calendar-popover-procedure-row][hidden] {
  display: none;
}

.calendar-event-popover dl div {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;
}

.calendar-event-popover dt {
  color: #94a3b8;
  font-size: 0.7rem;
  font-weight: 700;
}

.calendar-event-popover dd {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  min-width: 0;
}

.calendar-event-popover p {
  margin: 1.5rem -1.2rem 1rem;
  padding: 0.9rem 1.2rem;
  border-top: 1px solid #eef2f7;
  border-bottom: 1px solid #eef2f7;
  color: #a1a1aa;
}

.calendar-event-popover small {
  color: #a1a1aa;
}

.timeline-item[data-calendar-event] {
  cursor: pointer;
}

.timeline-item[data-calendar-event]:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.calendar-event-popover--matter {
  position: fixed;
  z-index: 120;
  top: 50%;
  left: 50%;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  transform: translate(-50%, -50%);
}

.calendar-popover-primary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.calendar-event-popover .calendar-popover-primary-actions .primary-action {
  min-height: 30px;
  border: 1px solid var(--brand);
  border-radius: 3px;
  background: var(--brand);
  color: #fff;
  padding: 0.25rem 0.65rem;
  font-size: 0.74rem;
  font-weight: 850;
}

.calendar-popover-primary-actions .calendar-popover-target {
  margin-bottom: 0;
}

.calendar-popover-target {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin: 0 0 0.75rem;
  border: 1px solid #d5e0ea;
  border-radius: 3px;
  background: #fff;
  color: var(--brand-dark);
  padding: 0.25rem 0.65rem;
  font-size: 0.74rem;
  font-weight: 850;
  text-decoration: none;
}

.calendar-popover-target:hover {
  border-color: var(--brand);
  background: #eef9fc;
}

.calendar-popover-actions {
  display: grid;
  gap: 0.75rem;
  margin: 0.9rem 0;
  padding: 0.8rem 0;
  border-top: 1px solid #eef2f7;
  border-bottom: 1px solid #eef2f7;
}

.calendar-popover-actions[hidden] {
  display: none;
}

.calendar-event-popover.is-private-busy > dl > div:not([data-calendar-popover-busy-visible]),
.calendar-event-popover.is-private-busy > small,
.calendar-event-popover.is-private-busy > .calendar-popover-primary-actions {
  display: none;
}

.calendar-popover-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: end;
}

.calendar-popover-form label {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.calendar-popover-form select,
.calendar-popover-form input[type="time"] {
  min-height: 32px;
  border: 1px solid #d5e0ea;
  border-radius: 5px;
  background: #fff;
  color: var(--brand-dark);
  padding: 0 0.55rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: none;
}

.calendar-popover-form button {
  min-height: 32px;
  border: 1px solid #b8e5ef;
  border-radius: 5px;
  background: #eef9fc;
  color: var(--brand-dark);
  padding: 0 0.7rem;
  font-size: 0.74rem;
  font-weight: 850;
}

.calendar-empty-state {
  padding: 1rem;
  border-top: 1px solid #e5e7eb;
}

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

  .calendar-legaldesk-sidebar {
    grid-template-columns: minmax(220px, 0.8fr) minmax(300px, 1.2fr);
  }
}

@media (max-width: 1024px) {
  .calendar-legaldesk-sidebar,
  .calendar-legaldesk-header,
  .calendar-legaldesk-tools {
    display: grid;
  }

  .calendar-titlebar {
    flex-wrap: wrap;
    gap: 0.65rem;
  }

  .calendar-titlebar h1 {
    width: 100%;
    margin-right: 0;
  }

  .calendar-search {
    flex-basis: auto;
  }

  .calendar-legaldesk-weekdays,
  .calendar-legaldesk-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .calendar-legaldesk-board {
    overflow-x: clip;
  }
}

.task-workspace {
  display: grid;
  gap: 0.55rem;
}

.task-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.task-search-group {
  position: relative;
  width: min(280px, 35vw);
}

.task-search-group input {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  color: var(--text);
  padding: 0 2rem 0 0.55rem;
  font: inherit;
}

.task-view-actions {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.task-view-actions > span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
}

.task-view-actions > button {
  position: relative;
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
}

.task-view-actions > button::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 2px solid #a7b0bb;
}

.task-view-actions > button:first-of-type::after {
  content: "";
  position: absolute;
  left: 14px;
  top: 7px;
  bottom: 7px;
  border-left: 2px solid #a7b0bb;
}

.task-view-actions > button:last-of-type::before {
  border-left: 0;
  border-right: 0;
  height: 2px;
  top: 9px;
  box-shadow: 0 6px 0 #a7b0bb, 0 12px 0 #a7b0bb;
}

.task-view-actions > button.is-active::before,
.task-view-actions > button.is-active::after {
  border-color: var(--brand);
}

.calendar-popover-delete-form {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.15rem;
}

.calendar-popover-delete-form .danger-action {
  min-height: 32px;
  padding: 0 0.7rem;
  font-size: 0.74rem;
}

.task-owner-filter {
  display: grid;
  gap: 0.1rem;
  width: clamp(190px, 16vw, 250px);
  min-width: 190px;
}

.task-owner-filter > span {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1;
}

@media (max-width: 600px) {
  .task-toolbar {
    flex-wrap: wrap;
  }

  .task-toolbar .task-search-group,
  .task-toolbar .task-view-actions {
    flex: 1 1 100%;
    min-width: 0;
  }

  .task-toolbar .task-view-actions {
    flex-wrap: wrap;
  }

  .task-toolbar .task-owner-filter {
    width: auto;
    min-width: 0;
    flex: 1 1 160px;
  }
}

.task-owner-filter .person-picker {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  flex-wrap: nowrap;
  padding: 0.12rem 0.35rem;
}

.task-owner-filter .person-picker__input {
  width: 100%;
  min-width: 0;
  flex-basis: auto;
  padding: 0.2rem;
  font-size: 0.76rem;
}

.task-owner-filter .person-picker__options {
  right: 0;
  left: auto;
  width: max-content;
  min-width: 100%;
  max-width: min(320px, calc(100vw - 2rem));
  overflow-x: hidden;
}

.task-owner-filter .person-picker__option {
  box-sizing: border-box;
  width: 100%;
  min-width: 210px;
  min-height: 32px;
  height: auto;
  white-space: normal;
  line-height: 1.25;
}

.task-mine-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  min-height: 30px;
  padding: 0 0.35rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.task-mine-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--brand);
}

.task-sort-control {
  display: grid;
  gap: 0.1rem;
  min-width: 112px;
}

.task-sort-control > span {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1;
}

.task-sort-control select {
  width: 100%;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 750;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(250px, 290px));
  align-items: start;
  gap: 0.55rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.kanban-column {
  display: flex;
  flex-direction: column;
  min-height: 68vh;
  border: 1px solid var(--line);
  background: #eff7fb;
}

.kanban-column header {
  display: flex;
  justify-content: space-between;
  padding: 0.68rem 0.75rem;
  border-bottom: 1px solid rgba(208, 220, 232, 0.8);
  color: var(--muted);
}

.kanban-column h2 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 850;
}

.kanban-move-form {
  display: none;
}

.kanban-dropzone {
  flex: 1;
  min-height: 60vh;
  padding: 0.34rem;
}

.kanban-column.is-drag-over {
  background: #eef8fb;
  box-shadow: inset 0 0 0 2px rgba(20, 158, 190, 0.22);
}

.task-card {
  display: grid;
  gap: 0.2rem;
  position: relative;
  min-height: 122px;
  margin: 0 0 0.52rem;
  padding: 0.68rem;
  border: 1px solid var(--line-soft);
  background: var(--surface);
  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.12);
  cursor: grab;
}

.task-card.is-selected {
  border-color: #9ed8ef;
  box-shadow: 0 0 0 2px rgba(34, 150, 184, 0.14), 0 2px 7px rgba(15, 23, 42, 0.12);
}

.task-card:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.task-card:active {
  cursor: grabbing;
}

.task-card.is-dragging {
  opacity: 0.55;
  outline: 2px solid var(--brand);
}

.task-card__top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto 18px 18px;
  gap: 0.35rem;
  align-items: start;
}

.task-card__top strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.task-card__top > .task-open-dot {
  grid-column: 5;
}

.task-card__top > .task-menu-button {
  grid-column: 6;
}

.task-add-child-button {
  min-width: 22px;
  min-height: 22px;
  padding: 0 3px;
  border: 1px solid #d7e3ef;
  border-radius: 5px;
  background: #f8fafc;
  color: #47627c;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.task-add-child-button:hover:not(:disabled),
.task-add-child-button:focus-visible {
  border-color: var(--brand);
  color: var(--brand);
}

.task-add-child-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.task-open-dot {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 2px solid #bde7fb;
  border-radius: 999px;
}

.task-open-dot::before {
  content: "";
  width: 0;
  height: 0;
  margin-left: 2px;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid #8ecdec;
}

.task-menu-button {
  display: inline-grid;
  place-items: start center;
  width: 18px;
  min-height: 22px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.task-menu-dot {
  position: relative;
  width: 4px;
  height: 4px;
  margin: 0.35rem auto 0;
  border-radius: 999px;
  background: #b5bdc8;
  box-shadow: 0 5px 0 #b5bdc8, 0 10px 0 #b5bdc8;
}

.task-card span,
.task-card small {
  color: var(--muted);
}

.task-card > small {
  min-height: 0;
  overflow: hidden;
  line-height: 1.4;
}

.task-review-summary {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
  line-height: 1.25;
}

.task-review-summary small {
  overflow-wrap: anywhere;
}

.task-result-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  min-width: 0;
}

.task-result-form label {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.25rem;
}

.task-result-form textarea,
.task-result-form select {
  width: 100%;
  box-sizing: border-box;
}

.task-result-history > article {
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

.task-result-history h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.task-result-files {
  padding-left: 1.25rem;
  overflow-wrap: anywhere;
}

.task-result-files small {
  display: block;
  color: var(--muted);
}

.task-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.3rem;
}

.task-owner-stack {
  display: inline-flex;
  align-items: center;
  min-width: 54px;
}

.task-owner-stack em + em {
  margin-left: -0.38rem;
}

.task-card em {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--task-owner-color, #64748b);
  color: #fff;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 800;
  box-shadow: 0 0 0 2px #fff;
}

.task-card em.task-owner-more {
  --task-owner-color: #64748b;
}

.task-owner-list {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem 0.65rem;
}

.task-owner-list__person {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
}

.task-owner-list__person i {
  width: 0.58rem;
  height: 0.58rem;
  flex: 0 0 0.58rem;
  border-radius: 999px;
  background: var(--task-owner-color, #64748b);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--task-owner-color, #64748b) 18%, transparent);
}

.task-date {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.task-date.is-overdue {
  color: #b42318;
}

.task-date.is-overdue::before {
  border-color: #d92d20;
}

.task-date::before {
  content: "";
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 0.3rem;
  border: 1.5px solid #aeb6c2;
  border-radius: 2px;
  vertical-align: -2px;
}

.task-card form:not(.kanban-move-form) {
  display: grid;
  place-items: center;
  margin: 0;
}

.task-card select,
.task-card button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f8fafc;
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
}

.task-card button {
  padding: 0 0.5rem;
  color: var(--brand-dark);
  font-weight: 800;
}

.task-menu-button {
  min-height: 22px;
  border: 0;
  background: transparent;
  padding: 0;
}

.task-card__delete {
  width: 24px;
  min-height: 24px;
  border-color: #f4c7c3;
  background: #fff5f5;
  color: #b42318;
  line-height: 1;
}

.kanban-error {
  margin: 0.5rem 0;
  padding: 0.62rem 0.75rem;
  border-left: 3px solid #dc2626;
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.84rem;
  font-weight: 700;
}

.kanban-board[aria-busy="true"] .task-card {
  cursor: wait;
}

.task-relation-icon {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: #475569;
}

.task-relation-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.task-card.task-card--compact {
  gap: 0.3rem;
  padding: 0.65rem;
  border-radius: 6px;
}

.task-card--compact .task-card__top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 24px;
  align-items: start;
  gap: 0.35rem;
}

.task-card__heading {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  min-width: 0;
}

.task-card__heading .task-relation-icon { flex: 0 0 16px; }
.task-card--compact .task-card__heading strong { font-size: 0.78rem; line-height: 1.35; }
.task-card__badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.25rem; max-width: 110px; }
.task-card--compact .task-card__top > .task-menu-button { grid-column: 3; }
.task-card--compact .task-menu-button {
  display: grid;
  place-items: center;
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border: 1px solid var(--line-soft);
  background: transparent;
}
.task-card--compact .task-menu-dot { margin: 0; width: 3px; height: 3px; box-shadow: -5px 0 0 #94a3b8, 5px 0 0 #94a3b8; background: #94a3b8; }
.task-card--compact .task-status-badge {
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  font-size: 0.64rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.task-status-badge.is-new { background: #e9f1ff; color: #1d4ed8; }
.task-status-badge.is-progress { background: #dbeafe; color: #0369a1; }
.task-status-badge.is-review { background: #fff0df; color: #a14b08; }
.task-status-badge.is-closed { background: #dff5ec; color: #137851; }
.task-card--compact .task-card__client,
.task-card--compact .task-card__matter { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.task-card--compact .task-card__people { display: flex; align-items: center; gap: 0.4rem; min-width: 0; margin: 0.3rem 0; }
.task-card--compact .task-owner-stack { min-width: 0; flex-shrink: 0; }
.task-card--compact em { width: 24px; height: 24px; background: color-mix(in srgb, var(--task-owner-color) 14%, var(--surface, #fff)); color: var(--task-owner-color); font-size: 0.62rem; }
.task-card__owner-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-recorded-work { display: block; width: fit-content; max-width: 100%; margin: 0.2rem 0; color: var(--brand-dark); font-size: 0.72rem; line-height: 1.35; text-decoration: none; overflow-wrap: anywhere; }
.task-recorded-work:hover { text-decoration: underline; }
.task-child-row__content { min-width: 0; padding: 0.25rem 0; }
.task-child-row__content .task-child-row__open { width: 100%; min-height: 20px !important; }
.task-child-row__content .task-recorded-work { margin: 0; font-size: 0.63rem; }
.activity-task-scope { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem; padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.activity-task-scope > div { display: grid; gap: 0.25rem; min-width: 0; overflow-wrap: anywhere; }
.activity-task-scope span { color: var(--muted); font-size: 0.82rem; }
.task-card--compact .task-date { font-size: 0.65rem; white-space: nowrap; font-weight: 500; }
.task-card--compact .task-assignment--compact { padding: 0.3rem 0.4rem; font-size: 0.7rem; }

.task-children {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

.task-card .task-children__summary {
  display: grid;
  width: 100%;
  gap: 0.24rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  min-height: 0;
}

.task-card .task-children__label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  font-weight: 400;
}
.task-children__chevron {
  margin-left: auto;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
}
.task-children__chevron::before {
  content: "";
  width: 5px;
  height: 5px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-1px) rotate(45deg);
}
.task-children__summary[aria-expanded="true"] .task-children__chevron::before { transform: translateY(2px) rotate(225deg); }

.task-children__status-bar {
  display: flex;
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 2px;
  background: #e2e8f0;
}

.task-children__status-bar i {
  flex: var(--task-child-count) 1 0;
  min-width: 3px;
}

.task-children .is-new { --child-status-color: #cbd5e1; }
.task-children .is-progress { --child-status-color: #4095ed; }
.task-children .is-review { --child-status-color: #ed9a28; }
.task-children .is-closed { --child-status-color: #52b964; }
.task-children__status-bar i { background: var(--child-status-color); }
.task-children__legend { display: flex; gap: 1rem; margin-top: 0.25rem; }
.task-children__legend > span { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 400; }
.task-children__legend i { width: 7px; height: 7px; border-radius: 50%; background: var(--child-status-color); }

.task-children__rows {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line-soft);
}

.task-child-row {
  display: grid;
  position: relative;
  grid-template-columns: 18px minmax(0, 1fr) 24px 72px 24px;
  gap: 0.4rem;
  align-items: center;
  min-height: 40px;
  border-bottom: 1px solid var(--line-soft);
  padding-left: calc(var(--task-child-depth, 0) * 0.7rem);
}
.task-card .task-child-row__date { color: var(--muted); font-size: 0.62rem; white-space: nowrap; text-align: right; }
.task-child-row__owner { display: flex; justify-content: center; }
.task-card .task-child-status {
  position: relative;
  width: 18px;
  height: 24px;
  display: grid;
  place-items: center;
}
.task-child-status__dot { display: grid; place-items: center; width: 14px; height: 14px; border: 2px solid var(--child-status-color); border-radius: 50%; font-size: 10px; }
.task-child-status.is-closed .task-child-status__dot { background: var(--child-status-color); color: #fff; }
.task-card .task-child-status select { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; opacity: 0; cursor: pointer; }
.task-child-status:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

.task-child-row__open {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  min-height: 28px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--text) !important;
  text-align: left;
  font-weight: 500 !important;
  font-size: 0.7rem !important;
}
.task-child-row__title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text) !important; }
.task-card .task-child-row__blocker { color: #b42318; background: #fff0ef; padding: 2px 4px; border-radius: 3px; font-size: 0.6rem; }
.task-child-row__assignment { grid-column: 1 / -1; padding-bottom: 0.4rem; }

.task-child-row .task-context-menu form {
  display: block !important;
}

.task-card .task-children__show-all,
.task-card .task-children__add {
  justify-self: start;
  min-height: 26px;
  padding: 0 0.25rem;
  border: 0;
  background: transparent;
  color: var(--brand-dark);
}
.task-card .task-children__add { margin-top: 0.35rem; min-height: 30px; font-size: 0.72rem; font-weight: 500; }

.task-context-menu {
  position: absolute;
  right: 0.55rem;
  top: 2.25rem;
  z-index: 8;
  display: grid;
  gap: 0.12rem;
  width: min(280px, calc(100% - 1rem));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.16);
  padding: 0.55rem;
}

.task-context-menu[hidden] {
  display: none;
}

.task-context-menu a,
.task-context-menu button {
  width: 100%;
  min-height: 32px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--brand-dark);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  text-align: left;
  text-decoration: none;
  padding: 0.35rem 0.5rem;
}

.task-context-menu a:hover,
.task-context-menu button:hover,
.task-context-menu a:focus-visible,
.task-context-menu button:focus-visible {
  background: #eef5fb;
}

.task-context-menu form {
  width: 100%;
  margin: 0;
}

.task-assignment {
  display: grid;
  gap: 0.38rem;
  min-width: 0;
  padding: 0.5rem;
  border-left: 3px solid #27856f;
  border-radius: 6px;
  background: #f1faf7;
}

html[data-theme="dark"] .task-assignment {
  background: #122a2c;
  border-left-color: #43b59b;
  color: var(--text);
}

html[data-theme="dark"] .task-assignment .task-assignment__prompt,
html[data-theme="dark"] .task-assignment__states .is-accepted {
  color: #a2e9d6;
}

html[data-theme="dark"] .task-assignment__states .is-pending {
  color: #d7ca9f;
}

html[data-theme="dark"] .task-assignment .task-assignment__rejected,
html[data-theme="dark"] .task-assignment__states .is-rejected {
  color: #ffb4ab;
}

html[data-theme="dark"] .task-assignment__reject > summary {
  background: #321f26;
  border-color: #915258;
  color: #ffb4ab;
}

html[data-theme="dark"] .task-assignment__reject > form {
  background: var(--surface);
  color: var(--text);
}

.task-assignment__prompt,
.task-assignment__rejected {
  color: #176855;
  font-size: 0.78rem;
}

.task-assignment__rejected,
.task-assignment__states .is-rejected {
  color: #a43c32;
}

.task-assignment__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: flex-start;
}

.task-assignment__actions form {
  margin: 0;
}

.task-assignment__actions button,
.task-assignment__reject > summary {
  min-height: 32px;
  padding: 0.38rem 0.7rem;
  border-radius: 5px;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.task-assignment__reject {
  position: relative;
}

.task-assignment__reject[open] {
  flex-basis: 100%;
  min-width: 0;
}

.task-assignment__reject > summary {
  display: inline-flex;
  align-items: center;
  border: 1px solid #d9a8a2;
  background: #fff;
  color: #9d3028;
  list-style: none;
}

.task-assignment__reject > summary::-webkit-details-marker {
  display: none;
}

.task-assignment__reject > form {
  position: static;
  display: grid;
  gap: 0.45rem;
  width: 100%;
  box-sizing: border-box;
  margin-top: 0.35rem;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.task-assignment__reject label,
.task-assignment__reject label span,
.task-assignment__reject textarea {
  display: block;
  width: 100%;
}

.task-assignment__reject textarea {
  resize: vertical;
}

.task-assignment__states {
  display: grid;
  gap: 0.15rem;
}

.task-assignment__states small {
  overflow-wrap: anywhere;
}

.task-assignment__states .is-accepted {
  color: #176855;
}

.task-assignment__states .is-pending {
  color: #805b00;
}

.task-assignment--compact {
  padding: 0.4rem;
}

.workflow-item.workflow-item--assignment,
.dashboard--mockup-card .workflow-item.workflow-item--assignment {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: start;
}

.workflow-item--assignment > .task-assignment {
  grid-column: 1 / -1;
  width: 100%;
  box-sizing: border-box;
}

.workflow-item--assignment > a {
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.workflow-item--assignment.is-rejected {
  border-left-color: #c44b40;
}

.task-notifications {
  position: relative;
}

.task-notifications > summary {
  position: relative;
  list-style: none;
  cursor: pointer;
}

.task-notifications > summary::-webkit-details-marker {
  display: none;
}

.task-notifications__count {
  position: absolute;
  top: -4px;
  right: -5px;
  display: grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #c43d33;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
}

.task-notifications__panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 0.6rem);
  right: 0;
  display: grid;
  gap: 0.2rem;
  width: min(360px, calc(100vw - 2rem));
  max-height: min(520px, calc(100vh - 6rem));
  overflow-y: auto;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.2);
}

.task-notifications__panel > header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0.4rem 0.5rem;
}

.task-notifications__panel > p {
  margin: 0;
  padding: 0.7rem 0.4rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.task-notifications__item {
  display: grid;
  gap: 0.16rem;
  padding: 0.55rem;
  border-radius: 5px;
  color: inherit;
  text-decoration: none;
}

.task-notifications__item:hover,
.task-notifications__item:focus-visible {
  background: #eef5fb;
}

.task-notifications__item span {
  color: var(--muted);
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}

.task-context-menu form,
.task-context-menu label {
  display: grid;
  gap: 0.32rem;
  margin: 0;
}

.task-context-menu label span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.task-context-menu select {
  width: 100%;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 0.76rem;
}

.task-context-menu .danger-action {
  background: #ef4444;
  color: #fff;
}

.task-context-menu .danger-action:hover,
.task-context-menu .danger-action:focus-visible {
  background: #b91c1c;
  color: #fff;
}

.split-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 0.75rem;
}

.case-tabs,
.admin-tabs {
  position: sticky;
  top: 57px;
  z-index: 5;
  display: flex;
  gap: 0.28rem;
  overflow-x: auto;
  padding: 0.34rem 0;
  background: var(--bg);
}

.admin-tabs--menu-backed {
  display: none;
}

.case-tabs a,
.admin-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  min-height: 29px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.28rem 0.5rem;
  background: var(--surface);
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 850;
  white-space: nowrap;
}

.case-tabs a:hover,
.case-tabs a:focus,
.case-tabs a.is-active,
.admin-tabs a:hover,
.admin-tabs a:focus,
.admin-tabs a.is-active {
  border-color: var(--brand);
  background: #eef9fc;
  color: var(--brand-dark);
}

.case-tabs strong,
.admin-tabs strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  padding: 0 0.26rem;
  background: #e0f2fe;
  color: var(--brand-dark);
  font-size: 0.62rem;
  line-height: 1;
}

.case-command {
  display: grid;
  grid-template-columns: 300px repeat(2, minmax(260px, 1fr));
  gap: 0.75rem;
  align-items: start;
}

.matter-workspace {
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
}

.matter-sidecard {
  position: sticky;
  top: 108px;
}

.matter-tab-panels {
  min-width: 0;
}

.matter-tab-panel {
  display: none;
}

.matter-tab-panel.is-active {
  display: block;
}

.admin-tab-panels {
  display: grid;
  gap: 0.75rem;
}

.admin-tab-panel {
  display: none;
}

.admin-tab-panel.is-active {
  display: block;
}

.admin-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.1rem 0 0.75rem;
  padding: 0.35rem;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--surface);
}

.admin-subtabs a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 0.36rem 0.62rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-decoration: none;
}

.admin-subtabs a:hover,
.admin-subtabs a:focus,
.admin-subtabs a.is-active {
  border-color: var(--brand);
  background: #eef9fc;
  color: var(--brand-dark);
}

.admin-subtab-panels {
  min-width: 0;
}

.admin-subtab-panel {
  display: none;
}

.admin-subtab-panel.is-active {
  display: grid;
  gap: 0.75rem;
}

.admin-subtab-panel > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0;
  border: 0;
}

.admin-subtab-panel > header h3 {
  margin: 0;
  font-size: 1rem;
}

.admin-subtab-panel > header p {
  margin: 0.18rem 0 0;
  color: var(--muted);
}

.matter-ai-cost-profile {
  margin-top: 1rem;
  border: 1px solid rgba(13, 148, 136, 0.22);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.78), rgba(240, 249, 255, 0.72));
  padding: 1rem;
}

.matter-ai-cost-profile > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.matter-ai-cost-profile h4,
.matter-ai-cost-profile h5 {
  margin: 0;
  color: var(--text);
}

.matter-ai-cost-profile p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  max-width: 68ch;
}

.matter-ai-cost-profile__actions {
  display: flex;
  align-items: end;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.matter-ai-cost-profile__actions label {
  display: grid;
  gap: 0.25rem;
  min-width: 140px;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
}

.matter-ai-cost-profile__actions input {
  min-height: 38px;
  border: 1px solid rgba(14, 116, 144, 0.22);
  border-radius: 12px;
  padding: 0.45rem 0.7rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
}

.matter-ai-cost-profile__actions button {
  min-height: 38px;
  border: 0;
  border-radius: 12px;
  padding: 0.5rem 0.9rem;
  color: #ffffff;
  background: #0e9aaa;
  box-shadow: 0 8px 18px rgba(14, 154, 170, 0.22);
  font-weight: 800;
  cursor: pointer;
}

.matter-ai-cost-profile__empty {
  border: 1px dashed rgba(14, 116, 144, 0.28);
  border-radius: 12px;
  padding: 0.9rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
}

.matter-ai-cost-profile__summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 0 0 0.9rem;
}

.matter-ai-cost-profile__summary div {
  border: 1px solid rgba(14, 116, 144, 0.16);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  background: rgba(255, 255, 255, 0.78);
}

.matter-ai-cost-profile__summary dt {
  margin: 0 0 0.2rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.matter-ai-cost-profile__summary dd {
  margin: 0;
  color: var(--text);
  font-weight: 850;
}

.matter-ai-cost-profile__tables {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.matter-ai-cost-profile__tables h5 {
  margin-bottom: 0.45rem;
}

.matter-ai-cost-profile__table {
  border: 1px solid rgba(14, 116, 144, 0.16);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.82);
}

.matter-ai-cost-profile__table header,
.matter-ai-cost-profile__table section {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.9fr 0.8fr;
  gap: 0.5rem;
  align-items: center;
  padding: 0.55rem 0.7rem;
}

.matter-ai-cost-profile__table header {
  background: rgba(14, 154, 170, 0.09);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.matter-ai-cost-profile__table section + section {
  border-top: 1px solid rgba(14, 116, 144, 0.12);
}

.matter-ai-cost-profile__table section {
  color: var(--text);
  font-size: 0.86rem;
}

@media (max-width: 980px) {
  .matter-ai-cost-profile > header,
  .matter-ai-cost-profile__tables {
    grid-template-columns: 1fr;
    display: grid;
  }

  .matter-ai-cost-profile__summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .matter-ai-cost-profile__summary,
  .matter-ai-cost-profile__table header,
  .matter-ai-cost-profile__table section {
    grid-template-columns: 1fr;
  }

  .matter-ai-cost-profile__actions {
    justify-content: stretch;
  }

  .matter-ai-cost-profile__actions label,
  .matter-ai-cost-profile__actions button {
    width: 100%;
  }
}

html[data-theme="dark"] .matter-ai-cost-profile {
  border-color: rgba(45, 212, 191, 0.28);
  background: linear-gradient(135deg, rgba(20, 83, 45, 0.24), rgba(8, 47, 73, 0.28));
}

html[data-theme="dark"] .matter-ai-cost-profile__actions input,
html[data-theme="dark"] .matter-ai-cost-profile__empty,
html[data-theme="dark"] .matter-ai-cost-profile__summary div,
html[data-theme="dark"] .matter-ai-cost-profile__table {
  border-color: rgba(125, 211, 252, 0.18);
  background: rgba(15, 23, 42, 0.66);
}

html[data-theme="dark"] .matter-ai-cost-profile__table header {
  background: rgba(45, 212, 191, 0.12);
}

.client-detail-page {
  display: grid;
  gap: 0.75rem;
}

.user-settings-page {
  display: grid;
  gap: 0;
  min-height: calc(100vh - 52px);
  background: #f4f4f4;
}

.user-settings-title {
  background: #f4f4f4;
}

.user-settings-title h1 {
  margin: 0;
  font-size: 1.25rem;
}

.user-settings-shell {
  min-height: calc(100vh - 150px);
}

.user-settings-nav {
  background: #fff;
}

.user-settings-panel {
  align-content: start;
  background: #fff;
  padding: 1rem 1rem 5rem;
}

.user-settings-heading {
  display: grid;
  gap: 0.35rem;
  max-width: 940px;
  margin-bottom: 0.65rem;
}

.user-settings-heading p {
  margin: 0;
  color: #9aa1aa;
  font-weight: 850;
}

.user-settings-heading span {
  color: var(--muted);
}

.settings-table {
  display: grid;
  max-width: 860px;
  border-top: 1px solid var(--line-soft);
}

.settings-table header,
.settings-table label {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 130px 130px;
  gap: 1rem;
  align-items: center;
  min-height: 38px;
  border-bottom: 1px solid var(--line-soft);
}

.settings-table header {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 850;
}

.settings-table label {
  margin: 0;
  color: var(--text);
}

.settings-table input,
.scope-list input,
.provider-row input,
.settings-checkbox-line input {
  width: 20px;
  height: 20px;
  accent-color: #0877b8;
}

.settings-note {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  max-width: 980px;
  margin-top: 1.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line-soft);
}

.settings-note strong {
  font-size: 0.88rem;
}

.settings-note span {
  color: var(--muted);
}

.settings-note button,
.provider-button,
.settings-register-toolbar button,
.settings-register-table button,
.user-settings-actions button,
.user-settings-actions a {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  color: var(--brand-dark);
  padding: 0 0.75rem;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.settings-note--quiet {
  align-items: start;
  display: grid;
}

.integration-account,
.settings-form-card,
.settings-register {
  display: grid;
  gap: 1rem;
  max-width: 980px;
}

.integration-account--compact {
  max-width: 760px;
}

.integration-callout {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(220px, 1fr) auto;
  gap: 1rem;
  align-items: center;
  max-width: 820px;
  padding: 0.75rem;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.integration-callout strong {
  font-size: 0.82rem;
  color: var(--muted);
}

.integration-callout span {
  font-weight: 750;
}

.provider-button {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 44px;
  padding-inline: 1rem;
  color: var(--text);
  box-shadow: var(--shadow);
}

.provider-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.provider-button span {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: #fff;
  border-radius: 3px;
  background: var(--brand);
  font-weight: 900;
}

.provider-button--google span {
  background: #fff;
  color: #4285f4;
  font-size: 1.2rem;
}

.provider-button--microsoft span {
  background: linear-gradient(90deg, #f25022 0 50%, #7fba00 50% 100%);
}

.provider-row {
  display: grid;
  grid-template-columns: 24px 12px minmax(220px, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  max-width: 720px;
}

.provider-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.provider-dot--rose {
  background: #f4a6b5;
}

.provider-row em {
  color: #a3aab3;
  font-style: normal;
  font-weight: 700;
}

.settings-link {
  color: var(--brand-dark);
  font-weight: 700;
}

.scope-list {
  display: grid;
  gap: 0.4rem;
}

.scope-list label {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 750;
}

.settings-warning {
  margin: 0;
  color: #d97706;
  font-weight: 700;
}

.settings-metadata-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 0;
  border: 1px solid var(--line);
}

.settings-metadata-grid div {
  display: grid;
  gap: 0.35rem;
  min-height: 76px;
  padding: 0.75rem;
  border-right: 1px solid var(--line-soft);
}

.settings-metadata-grid div:last-child {
  border-right: 0;
}

.settings-metadata-grid strong {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.settings-metadata-grid span {
  font-weight: 750;
}

.settings-form-card {
  padding-top: 0.4rem;
}

.pisp-connection-result {
  border: 1px solid var(--line);
  background: #f8fafc;
}

.pisp-connection-result > header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--line);
}

.pisp-connection-result > header strong {
  color: var(--brand-dark);
}

.pisp-connection-result > header span {
  color: var(--muted);
  font-size: 0.82rem;
}

.pisp-connection-result__table-wrapper {
  overflow-x: auto;
}

.pisp-connection-result table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
}

.pisp-connection-result th,
.pisp-connection-result td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  white-space: nowrap;
}

.pisp-connection-result thead th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.pisp-connection-result tbody tr:last-child th,
.pisp-connection-result tbody tr:last-child td {
  border-bottom: 0;
}

.pisp-connection-result__status--success {
  color: #087443;
  font-weight: 750;
}

.pisp-connection-result__status--warning {
  color: #9b5d00;
  font-weight: 750;
}

.pisp-import-scope {
  margin: 1.5rem 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
}

.pisp-import-scope h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.pisp-import-scope p, .pisp-import-scope small { color: var(--muted); line-height: 1.5; }
.pisp-import-scope form { display: grid; gap: 0.85rem; }
.pisp-import-scope form > button { justify-self: start; }
.pisp-import-scope .settings-checkbox-line input { width: 1.1rem; height: 1.1rem; flex: 0 0 auto; }
.pisp-import-scope .legaldesk-field-grid { grid-template-columns: minmax(0, 30rem); }
.pisp-import-scope__counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.75rem; margin: 1rem 0; }
.pisp-import-scope__counts > div { padding: 0.75rem; border: 1px solid var(--line-soft); border-radius: 0.4rem; }
.pisp-import-scope__counts dt { color: var(--muted); font-size: 0.8rem; }
.pisp-import-scope__counts dd { margin: 0.25rem 0 0; font-size: 1.15rem; font-weight: 750; }

.settings-checkbox-line {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 750;
}

.settings-register-toolbar {
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--line);
}

.settings-register-table {
  display: grid;
  border-top: 1px solid var(--line-soft);
}

.settings-register-table header,
.settings-register-table div {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(140px, 0.65fr) minmax(260px, 1.1fr) auto;
  gap: 1rem;
  align-items: center;
  min-height: 48px;
  border-bottom: 1px solid var(--line-soft);
}

.settings-register-table--prints header,
.settings-register-table--prints div {
  grid-template-columns: minmax(260px, 1fr) minmax(160px, 0.65fr) minmax(120px, 0.45fr) auto;
}

.settings-register-table header {
  background: #eef6fb;
  color: #9aa1aa;
  font-size: 0.78rem;
  font-weight: 850;
}

.settings-register-table span,
.settings-register-table strong {
  padding-left: 0.75rem;
}

.user-settings-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin: 2rem -1rem -5rem;
  padding: 0.8rem 1rem;
  border-top: 1px solid var(--line);
  background: #fff;
}

.user-settings-actions .primary-action {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.client-legaldesk-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 0;
  align-items: start;
  min-height: calc(100vh - 170px);
  padding-bottom: 74px;
}

.client-legaldesk-main {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}

.client-legaldesk-form {
  display: grid;
  gap: 0;
  min-width: 0;
}

.client-form-title {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  min-height: 58px;
  padding: 0 1rem;
}

.client-form-title a,
.client-back-link {
  color: var(--brand-dark);
  font-size: 0.86rem;
  font-weight: 700;
}

.client-form-title h2 {
  margin: 0;
  font-size: 1.15rem;
}

.client-form-title button {
  justify-self: end;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--brand-dark);
  font-weight: 800;
}

.client-form-section {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-width: 0;
  background: var(--surface);
}

.client-form-section--single {
  grid-template-columns: minmax(0, 1fr);
}

.client-form-section + .client-form-section {
  border-top: 1px solid var(--line-soft);
}

.client-form-section > aside {
  display: grid;
  align-content: start;
  gap: 0.08rem;
  padding: 0.9rem 0;
  border-right: 1px solid var(--line-soft);
}

.client-form-section--single > aside {
  display: none;
}

.client-form-section > aside h3 {
  margin: 0;
  padding: 0 1rem 0.45rem;
  font-size: 0.92rem;
}

.client-form-section > aside a,
.client-form-section > aside span {
  display: block;
  padding: 0.42rem 1rem;
  border-left: 2px solid transparent;
  color: var(--ink);
  font-size: 0.86rem;
}

.client-form-section > aside span {
  color: var(--muted);
  line-height: 1.45;
}

.client-form-section > aside a.is-active,
.client-form-section > aside a:hover,
.client-form-section > aside a:focus {
  border-left-color: var(--brand);
  background: #eef7fc;
  color: var(--brand-dark);
}

.client-form-panel {
  display: grid;
  gap: 0.85rem;
  min-width: 0;
  padding: 1rem;
}

.client-form-panel--tinted {
  background: #f0f8fc;
}

.client-form-panel > p {
  margin: 0;
  color: #9aa8b8;
  font-weight: 850;
}

.legaldesk-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 1rem 1.25rem;
}

.legaldesk-field-grid--three {
  grid-template-columns: repeat(3, minmax(190px, 1fr));
}

.legaldesk-field-grid label {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  color: var(--ink);
  font-weight: 850;
}

.legaldesk-field-grid label > span:first-child {
  font-size: 0.82rem;
}

.legaldesk-field-grid input,
.legaldesk-field-grid textarea {
  width: 100%;
  border: 1px solid #e2edf5;
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.legaldesk-field-grid input {
  min-height: 34px;
  padding: 0 0.55rem;
}

.legaldesk-field-grid textarea {
  min-height: 54px;
  padding: 0.45rem 0.55rem;
  resize: vertical;
}

.legaldesk-field-grid input:disabled {
  background: #f8fafc;
  color: var(--muted);
}

.client-checkbox-line {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 34px;
  font-weight: 700;
}

.client-checkbox-line input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--brand);
}

.client-note-private-field {
  display: grid;
  align-content: end;
  gap: 0.42rem;
}

.client-note-private-field > span {
  color: var(--muted-text);
  font-size: 0.78rem;
  font-weight: 750;
}

.client-note-private-field .client-checkbox-line {
  min-height: 42px;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
}

.client-related-section {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.client-related-section header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: start;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line-soft);
}

.client-related-section header p {
  margin: 0;
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.client-related-section h2 {
  margin: 0.16rem 0 0;
  font-size: 1rem;
}

.client-related-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) minmax(150px, 0.8fr) minmax(180px, 1fr) minmax(120px, 0.7fr) minmax(110px, 0.55fr) auto;
  gap: 0.75rem;
  align-items: center;
  min-height: 52px;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
}

.client-related-row:last-child {
  border-bottom: 0;
}

.client-related-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.client-related-row span {
  min-width: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.client-related-row--link:hover,
.client-related-row--link:focus {
  background: #f8fbfd;
}

.client-relation-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 0;
  border-bottom: 1px solid var(--line-soft);
}

.client-relation-summary span {
  padding: 0.75rem 1rem;
  border-right: 1px solid var(--line-soft);
  color: var(--muted);
}

.client-relation-summary span:last-child {
  border-right: 0;
}

.client-relation-summary strong {
  color: var(--ink);
}

.client-save-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  grid-column: 2;
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.95);
  backdrop-filter: blur(8px);
}

.client-save-bar a,
.client-save-bar button,
.matter-save-bar a,
.matter-save-bar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: auto;
  align-self: center;
  height: 32px;
  min-height: 32px;
  max-width: max-content;
  border: 1px solid #d5e0ea;
  border-radius: 3px;
  background: #fff;
  color: var(--brand-dark);
  padding: 0.3rem 0.75rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.matter-save-bar a:not(.primary-action) {
  min-width: auto;
  border-color: transparent;
  background: transparent;
}

.client-save-bar button,
.matter-save-bar button {
  cursor: pointer;
}

.client-save-bar .primary-action,
.matter-save-bar .primary-action {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.matter-legaldesk-page {
  display: grid;
  gap: 0;
  padding: 0.9rem 1rem 0;
}

.legaldesk-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 30px;
  color: #a0a8b3;
  font-size: 0.8rem;
}

.legaldesk-breadcrumb--page {
  align-self: start;
}

.legaldesk-breadcrumb a {
  color: var(--brand-dark);
}

.legaldesk-breadcrumb span + span::before,
.legaldesk-breadcrumb a + span::before {
  content: ">";
  margin-right: 0.55rem;
  color: #b9c0c7;
}

.matter-form-title {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  min-height: 78px;
}

.matter-form-title h1 {
  margin: 0;
  font-size: 1.24rem;
  font-weight: 850;
}

.matter-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.matter-form-actions a,
.matter-form-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid #d5e0ea;
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  padding: 0.3rem 0.75rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  text-decoration: none;
}

.matter-form-actions button:first-child {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.matter-form-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: calc(100vh - 170px);
  background: var(--surface);
}

.matter-section-menu {
  display: grid;
  align-content: start;
  gap: 0.04rem;
  padding: 0.85rem 0;
  border-right: 1px solid var(--line-soft);
  background: #fff;
}

.matter-section-menu strong {
  padding: 0.45rem 1rem 0.35rem;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 850;
}

.matter-section-menu a,
.matter-section-menu span {
  display: block;
  min-height: 32px;
  padding: 0.42rem 1rem;
  border-left: 2px solid transparent;
  color: var(--ink);
  font-size: 0.86rem;
}

.matter-section-menu span {
  color: var(--muted);
}

.matter-section-menu a:hover,
.matter-section-menu a:focus,
.matter-section-menu a.is-active {
  border-left-color: var(--brand);
  background: #eef7fc;
  color: var(--brand-dark);
}

.matter-form-main {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
  padding-bottom: 76px;
}

.legaldesk-edit-form {
  display: grid;
  gap: 0.85rem;
  min-width: 0;
  padding: 1rem;
}

.legaldesk-edit-form h2 {
  margin: 0 0 0.35rem;
  color: #9aa8b8;
  font-size: 0.94rem;
  font-weight: 850;
}

.legaldesk-field-grid select {
  width: 100%;
  min-height: 34px;
  border: 1px solid #e2edf5;
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  padding: 0 0.55rem;
  font: inherit;
}

.matter-save-bar {
  position: sticky;
  bottom: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.8rem;
  min-height: 58px;
  margin: 1rem -1rem -1rem;
  padding: 0.8rem 1rem;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.matter-form-main {
  align-content: start;
}

.legaldesk-related-panel {
  display: grid;
  gap: 0;
  align-self: start;
  margin: 0 1rem 0.75rem;
  border-top: 1px solid var(--line-soft);
  background: #fff;
}

.legaldesk-related-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 58px;
  padding: 0 0.15rem;
  border-bottom: 1px solid var(--line-soft);
}

.legaldesk-related-panel header p {
  margin: 0;
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.legaldesk-related-panel h2 {
  margin: 0.12rem 0 0;
  font-size: 1rem;
}

.legaldesk-related-panel header a,
.legaldesk-related-panel header button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border: 1px solid #d5e0ea;
  border-radius: 3px;
  background: #fff;
  color: var(--brand-dark);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 850;
  padding: 0.25rem 0.65rem;
  text-decoration: none;
}

.legaldesk-list-row {
  display: grid;
  gap: 0.8rem;
  align-items: center;
  min-height: 48px;
  padding: 0.55rem 0.15rem;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
  font-size: 0.84rem;
}

.legaldesk-list-row strong,
.legaldesk-list-row span,
.legaldesk-list-row a {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legaldesk-list-row span {
  color: var(--muted);
}

.legaldesk-list-row a {
  justify-self: end;
  color: var(--brand-dark);
  font-weight: 850;
}

.legaldesk-list-row--team {
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 0.7fr) minmax(220px, 1fr) minmax(130px, 0.7fr);
  min-height: 46px;
  align-items: center;
  padding: 0.55rem 0.15rem;
}

.legaldesk-list-row--tasks {
  grid-template-columns: minmax(260px, 1.1fr) minmax(260px, 1.2fr) minmax(140px, 0.6fr) minmax(120px, 0.5fr);
  cursor: pointer;
}

.legaldesk-list-row--activities {
  grid-template-columns: minmax(320px, 1.4fr) minmax(150px, 0.7fr) minmax(130px, 0.55fr) minmax(120px, 0.55fr) minmax(90px, 0.4fr);
}

.legaldesk-list-row--documents {
  grid-template-columns: minmax(240px, 1fr) minmax(260px, 1fr) minmax(130px, 0.55fr) minmax(90px, 0.4fr) minmax(70px, 0.3fr);
}

.legaldesk-list-row--deadlines,
.legaldesk-list-row--correspondence,
.legaldesk-list-row--costs {
  grid-template-columns: minmax(260px, 1.2fr) minmax(260px, 1.2fr) minmax(140px, 0.7fr) minmax(130px, 0.6fr);
}

.matter-section-panel {
  min-height: auto;
}

.matter-table {
  display: grid;
  min-width: 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--line-soft);
}

.matter-table-row {
  display: grid;
  align-items: center;
  min-width: 720px;
  min-height: 46px;
  padding: 0 0.15rem;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
  font-size: 0.84rem;
}

.matter-table-row > * {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matter-table-row span {
  color: var(--muted);
}

.matter-table-head {
  min-height: 38px;
  background: #eef7fb;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.matter-table--team .matter-table-row {
  grid-template-columns: minmax(180px, 1.1fr) minmax(120px, 0.6fr) minmax(250px, 1.3fr) minmax(120px, 0.6fr) minmax(110px, 0.5fr);
}

.matter-table--finance .matter-table-row,
.matter-table--financial-docs .matter-table-row {
  grid-template-columns: minmax(260px, 1.3fr) minmax(150px, 0.7fr) minmax(110px, 0.5fr) minmax(130px, 0.6fr) minmax(120px, 0.6fr);
}

.matter-table--access .matter-table-row {
  grid-template-columns: minmax(180px, 1fr) minmax(120px, 0.6fr) minmax(260px, 1.35fr) minmax(120px, 0.6fr) minmax(240px, 1.2fr);
}

.matter-readonly-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 0;
  border-bottom: 1px solid var(--line-soft);
}

.matter-readonly-item {
  min-height: 70px;
  padding: 0.75rem;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.matter-readonly-item span {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.matter-readonly-item strong {
  display: block;
  color: var(--ink);
  font-size: 0.9rem;
}

.matter-note-list {
  display: grid;
  gap: 0;
}

.matter-note-item {
  padding: 0.8rem 0.15rem;
  border-bottom: 1px solid var(--line-soft);
}

.matter-note-item header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  min-height: 0;
  padding: 0;
  border: 0;
}

.matter-note-item header span {
  color: var(--muted);
  font-size: 0.78rem;
}

.matter-note-item p {
  margin: 0.35rem 0;
  color: var(--ink);
}

.matter-note-item footer {
  color: var(--muted);
  font-size: 0.78rem;
}

.client-record-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
}

.client-section-menu {
  position: sticky;
  top: 66px;
  display: grid;
  gap: 0.1rem;
  padding: 0.85rem 0;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.client-section-menu strong {
  padding: 0.45rem 1rem 0.35rem;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 850;
}

.client-section-menu a {
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 0 1rem;
  border-left: 2px solid transparent;
  color: var(--ink);
  font-size: 0.84rem;
}

.client-section-menu a:hover,
.client-section-menu a:focus,
.client-section-menu a.is-active {
  border-left-color: var(--brand);
  background: #eef7fc;
  color: var(--brand-dark);
}

.client-record-main {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}

.client-data-card {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem;
}

.client-data-card header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--line-soft);
}

.client-data-card header p,
.client-matters-panel header p,
.client-contacts-panel header p,
.client-correspondence-panel header p,
.client-intake-panel header p {
  margin: 0;
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.client-data-card h2 {
  margin: 0.12rem 0 0;
  font-size: 1rem;
}

.client-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 0;
  margin: 0;
}

.client-field-grid div {
  display: grid;
  grid-template-columns: minmax(125px, 0.34fr) minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  min-height: 44px;
  padding: 0.42rem 0.65rem;
  border-bottom: 1px solid var(--line-soft);
}

.client-field-grid .span-2 {
  grid-column: 1 / -1;
}

.client-field-grid dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.client-field-grid dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.client-registry-action {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding-left: 0.65rem;
}

.client-status-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  margin: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.client-status-strip div {
  min-height: 58px;
  padding: 0.55rem 0.75rem;
  border-right: 1px solid var(--line-soft);
}

.client-status-strip div:last-child {
  border-right: 0;
}

.client-status-strip dt {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
  text-transform: uppercase;
}

.client-status-strip dd {
  margin: 0.18rem 0 0;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1;
}

.client-hero-grid {
  display: grid;
  grid-template-columns: minmax(340px, 1.2fr) repeat(4, minmax(145px, 0.55fr));
  gap: 0.75rem;
  align-items: stretch;
}

.client-hero-grid--compact {
  grid-template-columns: minmax(420px, 0.78fr) minmax(520px, 1.22fr);
}

.client-summary-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 0;
  margin: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.client-summary-strip div {
  display: grid;
  align-content: center;
  gap: 0.15rem;
  min-height: 74px;
  padding: 0.65rem 0.8rem;
  border-right: 1px solid var(--line-soft);
}

.client-summary-strip div:last-child {
  border-right: 0;
}

.client-summary-strip dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.client-summary-strip dd {
  margin: 0;
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
}

.client-work-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1.25fr) minmax(360px, 0.75fr);
  gap: 0.75rem;
  align-items: start;
}

.client-tabs {
  display: flex;
  gap: 0.28rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.client-tabs--subtle {
  box-shadow: none;
}

.client-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  min-height: 34px;
  padding: 0 0.7rem;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.client-tabs a:hover,
.client-tabs a:focus,
.client-tabs a.is-active {
  border-bottom-color: var(--brand);
  background: #f8fbfd;
  color: var(--brand-dark);
}

.client-tabs strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1;
}

.client-tab-panels {
  grid-template-columns: minmax(0, 1fr);
}

.client-tab-panel {
  display: none;
}

.client-tab-panel.is-active {
  display: block;
}

.client-profile-card,
.client-metric-card,
.client-matters-panel,
.client-contacts-panel,
.client-correspondence-panel,
.client-intake-panel {
  padding: 0.72rem;
}

.client-profile-card > p,
.client-metric-card > p {
  margin: 0;
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.client-profile-card h2 {
  margin: 0.22rem 0 0.65rem;
}

.client-profile-card dl {
  display: grid;
  gap: 0;
  margin: 0;
}

.client-profile-card dl div {
  display: grid;
  grid-template-columns: minmax(120px, 0.45fr) minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line-soft);
}

.client-profile-card dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.client-profile-card dd {
  margin: 0;
  min-width: 0;
}

.client-metric-card {
  display: grid;
  align-content: center;
  gap: 0.12rem;
  min-height: 84px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.client-metric-card strong {
  color: var(--ink);
  font-size: 1.24rem;
  line-height: 1;
}

.client-metric-card span {
  color: var(--muted);
  font-size: 0.76rem;
}

.client-matters-panel,
.client-correspondence-panel,
.client-intake-panel {
  display: grid;
  gap: 0.45rem;
}

.client-matters-panel header,
.client-contacts-panel header,
.client-correspondence-panel header,
.client-intake-panel header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: start;
}

.client-correspondence-panel,
.client-intake-panel {
  grid-column: 1 / -1;
}

.client-edit-form,
.client-note-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

.client-edit-form button,
.client-note-form button {
  grid-column: 1 / -1;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.report-grid > .workspace-section--wide,
.report-grid > .report-section--status {
  grid-column: 1 / -1;
}

.report-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.report-status-card {
  color: var(--text);
}

.workload-table {
  display: grid;
  padding: 0.75rem;
}

.workload-table header,
.workload-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) repeat(6, minmax(70px, 0.45fr));
  gap: 0.55rem;
  align-items: center;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line-soft);
}

.workload-table header {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.workload-row {
  color: var(--text);
}

.workload-row span {
  font-weight: 800;
}

.workload-row small {
  color: var(--muted);
  font-weight: 500;
}

.workload-row--high {
  border-left: 4px solid #dc2626;
  padding-left: 0.45rem;
}

.workload-row--medium {
  border-left: 4px solid #f59e0b;
  padding-left: 0.45rem;
}

.workload-row--low {
  border-left: 4px solid #22c55e;
  padding-left: 0.45rem;
}

.admin-settings {
  display: grid;
  gap: 0.75rem;
}

.global-settings-shell,
.global-settings-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.global-settings-header p,
.global-settings-section > header p {
  margin: 0.2rem 0 0;
  color: var(--muted);
}

.global-settings-section > header {
  align-items: center;
}

.settings-grid .settings-checkbox {
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  align-self: end;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.55rem;
  background: #f8fafc;
  color: var(--text);
}

.settings-grid .settings-checkbox input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.global-settings-actions {
  border-top: 1px solid var(--line-soft);
}

.admin-settings-tools header p {
  margin: 0.18rem 0 0;
  color: var(--muted);
}

.admin-danger-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 0.9rem;
}

.admin-danger-card {
  display: grid;
  gap: 0.85rem;
  min-width: 0;
  border: 1px solid var(--line-soft);
  background: #fff;
  padding: 1rem;
}

.admin-danger-card--danger {
  border-color: rgba(220, 38, 38, 0.28);
  background: #fffafa;
}

.admin-danger-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0;
  border: 0;
}

.admin-danger-card header p,
.admin-danger-card h4 {
  margin: 0;
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-danger-card h3 {
  margin: 0.15rem 0 0;
  font-size: 1.15rem;
}

.admin-danger-card > p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.admin-reset-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.7fr);
  gap: 0.75rem;
}

.admin-reset-list {
  border: 1px solid rgba(220, 38, 38, 0.2);
  background: rgba(254, 242, 242, 0.62);
}

.admin-reset-list--safe {
  border-color: var(--line-soft);
  background: var(--surface-soft);
}

.admin-reset-list h4 {
  padding: 0.75rem;
  border-bottom: 1px solid var(--line-soft);
}

.admin-reset-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.62rem 0.75rem;
  border-bottom: 1px solid var(--line-soft);
}

.admin-reset-list div:last-child {
  border-bottom: 0;
}

.admin-reset-list span {
  color: var(--text);
  font-weight: 800;
}

.admin-reset-list strong {
  color: var(--brand-dark);
}

.admin-confirm-form {
  display: grid;
  grid-template-columns: minmax(160px, 0.45fr) minmax(220px, 1fr) auto;
  align-items: end;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line-soft);
}

.confirmation-code {
  display: grid;
  gap: 0.25rem;
  padding: 0.75rem;
  border: 1px solid rgba(220, 38, 38, 0.24);
  background: #fff1f2;
}

.confirmation-code span {
  color: #b91c1c;
  font-size: 0.72rem;
  font-weight: 900;
}

.confirmation-code strong {
  color: #7f1d1d;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
}

.admin-confirm-form label {
  display: grid;
  gap: 0.35rem;
}

.admin-confirm-form label span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.admin-confirm-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.62rem 0.7rem;
  font: inherit;
}

.danger-action {
  border: 1px solid rgba(220, 38, 38, 0.28);
  border-radius: 5px;
  background: #ef4444;
  color: #fff;
  padding: 0.68rem 0.9rem;
  font-weight: 900;
  cursor: pointer;
}

.demo-load-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  border: 1px solid var(--line-soft);
}

.demo-load-summary div {
  padding: 0.8rem;
  border-right: 1px solid var(--line-soft);
}

.demo-load-summary div:last-child {
  border-right: 0;
}

.demo-load-summary dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.demo-load-summary dd {
  margin: 0.25rem 0 0;
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 900;
}

.audit-strip {
  margin-top: 0.75rem;
}

.audit-strip header p {
  margin: 0.18rem 0 0;
  color: var(--muted);
}

.audit-filters {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--line-soft);
}

.audit-list {
  display: grid;
  gap: 0;
}

.audit-row {
  border-top: 0;
  position: relative;
}

.audit-row[hidden] {
  display: none;
}

.audit-module-pill,
.audit-severity {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  font-size: 0.68rem;
  line-height: 1;
  font-weight: 800;
}

.audit-module-pill {
  margin-left: 0.45rem;
  padding: 0.2rem 0.45rem;
  color: var(--brand-dark);
  background: rgba(34, 150, 184, 0.12);
  font-style: normal;
}

.audit-severity {
  padding: 0.24rem 0.5rem;
  color: var(--muted);
  background: rgba(100, 116, 139, 0.12);
}

.audit-severity--kontrola {
  color: #b45309;
  background: rgba(245, 158, 11, 0.14);
}

.audit-severity--wysokie {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
}

.audit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
}

.audit-grid .timeline-row {
  min-width: 0;
  border-right: 1px solid var(--line-soft);
}

.audit-grid .timeline-row:nth-child(4n) {
  border-right: 0;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 0.75rem;
  padding: 0.85rem;
}

.settings-grid label,
.permissions-grid label {
  display: grid;
  gap: 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.settings-grid input,
.settings-grid select,
.settings-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.55rem;
  color: var(--text);
  background: #f8fafc;
  font: inherit;
}

.settings-grid fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
}

.settings-grid legend {
  padding: 0 0.35rem;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 900;
}

.ai-model-catalog {
  margin: 0.25rem 0.85rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(14, 165, 190, 0.06), rgba(255, 255, 255, 0.86));
  padding: 1rem;
}

.google-document-ai-panel {
  display: grid;
  gap: 0.85rem;
  margin: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 1rem;
}

.agent-provider-accounts {
  display: grid;
  gap: 0.85rem;
  margin: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.agent-provider-accounts > header,
.agent-provider-account > header,
.agent-provider-login__surface > header,
.agent-provider-login__surface > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.agent-provider-accounts > header h3,
.agent-provider-accounts > header p,
.agent-provider-account p,
.agent-provider-login h3,
.agent-provider-login p {
  margin: 0;
}

.agent-provider-accounts > header p,
.agent-provider-account p,
.agent-provider-accounts__status,
.agent-provider-login p {
  color: var(--muted);
  font-size: 0.8rem;
}

.agent-provider-accounts__status:empty {
  display: none;
}

.agent-provider-accounts__list {
  display: grid;
  gap: 0;
  border-block: 1px solid var(--line);
}

.agent-analysis-defaults__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.agent-analysis-defaults fieldset {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 0.75rem;
  margin: 0;
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.agent-analysis-defaults__context {
  grid-column: 1 / -1;
}

.agent-analysis-defaults legend {
  padding: 0 0.3rem;
  font-weight: 800;
}

.agent-analysis-defaults label {
  display: grid;
  min-width: 0;
  gap: 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.agent-analysis-defaults select,
.agent-analysis-defaults input[type="number"] {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  box-sizing: border-box;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.agent-analysis-defaults .settings-checkbox {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 0.5rem;
}

.agent-analysis-defaults .settings-checkbox input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.agent-analysis-defaults .settings-actions {
  justify-content: flex-end;
  padding-top: 0.75rem;
}

@media (max-width: 880px) {
  .agent-analysis-defaults__grid,
  .agent-analysis-defaults fieldset {
    grid-template-columns: 1fr;
  }
}

.agent-provider-account {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(0, 2.7fr) minmax(150px, 0.7fr);
  align-items: center;
  gap: 1rem;
  min-width: 0;
  padding: 0.85rem 0;
}

.agent-provider-account + .agent-provider-account {
  border-top: 1px solid var(--line-soft);
}

.agent-provider-account > header {
  justify-content: flex-start;
}

.agent-provider-account dl {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0;
}

.agent-provider-account dl div {
  min-width: 0;
}

.agent-provider-account dt,
.agent-provider-login__device-code span,
.agent-provider-login label span,
.agent-provider-login [data-provider-login-eyebrow] {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.agent-provider-account dd {
  margin: 0.18rem 0 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
}

.agent-provider-account > p {
  grid-column: 2;
}

.agent-provider-account > button {
  grid-column: 3;
  grid-row: 1 / span 2;
  justify-self: end;
}

.agent-provider-login {
  width: min(620px, calc(100vw - 2rem));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.3);
}

.agent-provider-login::backdrop {
  background: rgba(15, 23, 42, 0.5);
}

.agent-provider-login__surface {
  display: grid;
  gap: 1rem;
  padding: 1.15rem;
}

.agent-provider-login__surface > footer {
  justify-content: flex-end;
}

.agent-provider-login__device-code {
  display: grid;
  gap: 0.3rem;
  border-block: 1px solid var(--line);
  padding: 0.85rem 0;
}

.agent-provider-login__device-code strong {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 1.35rem;
  letter-spacing: 0;
}

.agent-provider-login__device-code > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.agent-provider-login__device-code button {
  flex: 0 0 auto;
}

.agent-provider-login label {
  display: grid;
  gap: 0.35rem;
}

.agent-provider-login input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0.65rem;
}

@media (max-width: 980px) {
  .agent-provider-account {
    grid-template-columns: 1fr auto;
  }

  .agent-provider-account dl,
  .agent-provider-account > p {
    grid-column: 1 / -1;
  }

  .agent-provider-account > button {
    grid-column: 2;
    grid-row: 1;
  }

  .agent-provider-account dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.google-document-ai-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.google-document-ai-panel > header > div {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.google-document-ai-panel h3,
.google-document-ai-panel h4 {
  margin: 0;
}

.google-document-ai-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin: 0;
}

.google-document-ai-summary div {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #f8fafc;
  padding: 0.7rem;
}

.google-document-ai-summary dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.google-document-ai-summary dd {
  margin: 0.2rem 0 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-weight: 800;
}

.google-document-ai-error {
  margin: 0;
  border: 1px solid rgba(220, 38, 38, 0.22);
  border-radius: 6px;
  background: rgba(254, 226, 226, 0.66);
  color: #991b1b;
  padding: 0.7rem;
  font-weight: 800;
}

.google-document-ai-env {
  display: grid;
  gap: 0.45rem;
}

.google-document-ai-env pre {
  margin: 0;
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #0f172a;
  color: #e2e8f0;
  padding: 0.75rem;
  font-size: 0.8rem;
}

.ai-model-catalog > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.ai-model-catalog h3 {
  margin: 0 0 0.75rem;
  font-size: 0.98rem;
}

.ai-model-catalog > header h3 {
  margin: 0;
}

.ai-model-catalog__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.75rem;
}

.ai-model-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  padding: 0.75rem;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.ai-model-card.is-muted {
  opacity: 0.58;
}

.ai-model-card .settings-actions {
  grid-column: 1 / -1;
}

.ai-model-card label {
  display: grid;
  gap: 0.25rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.ai-model-card input,
.ai-model-card select,
.ai-model-card textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  color: var(--text);
  font: inherit;
  padding: 0.45rem 0.5rem;
}

.ai-model-card p {
  color: var(--muted);
  font-size: 0.78rem;
}

.ai-model-card__flags span {
  border-radius: 999px;
  background: rgba(14, 165, 190, 0.11);
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.25rem 0.5rem;
}

.ai-model-card__flags {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ai-model-card__flags label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: 999px;
  background: rgba(14, 165, 190, 0.09);
  color: var(--accent-strong);
  padding: 0.3rem 0.55rem;
}

.ai-model-card__flags input {
  width: auto;
}

.ai-model-card__description {
  grid-column: 1 / -1;
}

.settings-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem;
}

.settings-actions button,
.document-generation-model-form button {
  min-height: 34px;
}

.document-generation-model-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
  gap: 0.75rem;
}

.document-generation-model-form label {
  display: grid;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.document-generation-model-form select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  padding: 0.45rem 0.55rem;
  font: inherit;
}

.ai-model-catalog > header p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.settings-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 0.55rem;
}

.settings-checklist label {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 0.5rem;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.55rem;
  background: #f8fafc;
}

.settings-checklist input {
  width: auto;
  margin-top: 0.15rem;
}

.settings-checklist small {
  grid-column: 2;
}

.matter-analysis-mode-settings {
  display: grid;
  gap: 0.75rem;
}

.matter-analysis-mode-card {
  display: grid;
  gap: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 0.75rem;
}

.matter-analysis-mode-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.matter-analysis-mode-card h4 {
  margin: 0;
  color: var(--text);
  font-size: 0.92rem;
}

.matter-analysis-mode-card p {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.matter-analysis-mode-card__toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

.matter-analysis-mode-card__toggles label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid rgba(14, 165, 190, 0.26);
  border-radius: 999px;
  background: rgba(14, 165, 190, 0.09);
  color: var(--accent-strong);
  font-size: 0.74rem;
  font-weight: 850;
  padding: 0.32rem 0.58rem;
}

.matter-analysis-mode-card__toggles input {
  width: auto;
}

.settings-grid--compact {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.6rem;
}

html[data-theme="dark"] .matter-analysis-mode-card {
  border-color: rgba(125, 211, 252, 0.22);
  background: rgba(15, 23, 42, 0.82);
}

html[data-theme="dark"] .matter-analysis-mode-card__toggles label {
  border-color: rgba(125, 211, 252, 0.28);
  background: rgba(14, 165, 190, 0.16);
}

.span-3 {
  grid-column: span 3;
}

.permissions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 0.7rem;
  padding: 0.85rem;
}

.permissions-grid label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text);
  font-size: 0.86rem;
}

.admin-access-grid {
  display: grid;
  grid-template-columns: 0.8fr 1fr 1.2fr;
  gap: 0.85rem;
  padding: 0.85rem;
}

.admin-access-summary {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.3fr);
  gap: 0.85rem;
  padding: 0.85rem 0.85rem 0;
}

.admin-access-summary section {
  display: grid;
  align-content: start;
  gap: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.75rem;
  background: #f8fafc;
}

.admin-access-summary h3 {
  margin: 0;
  font-size: 0.92rem;
}

.admin-users-panel {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem;
  background: #fff;
}

.billing-admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 0.85rem;
  padding: 0.85rem;
}

.billing-admin-card {
  display: grid;
  align-content: start;
  gap: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.75rem;
  background: #f8fafc;
}

.billing-admin-card--wide {
  grid-column: 1 / -1;
}

.billing-admin-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0;
  border-bottom: 0;
}

.billing-admin-card h3 {
  margin: 0;
  font-size: 0.92rem;
}

.billing-admin-card header span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.billing-config-table {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: auto;
  background: var(--surface);
}

.billing-config-table__head,
.billing-config-row {
  display: grid;
  gap: 0.45rem;
  align-items: center;
  min-width: 760px;
  padding: 0.55rem;
}

.billing-config-table--rates .billing-config-table__head,
.billing-config-table--rates .billing-config-row {
  grid-template-columns: minmax(150px, 1.2fr) minmax(110px, 0.75fr) minmax(170px, 1fr) minmax(82px, 0.45fr) minmax(120px, 0.75fr) minmax(150px, 1fr) minmax(110px, 0.7fr);
}

.billing-config-table--custom-fields .billing-config-table__head,
.billing-config-table--custom-fields .billing-config-row {
  grid-template-columns: minmax(150px, 1fr) minmax(180px, 1.25fr) minmax(100px, 0.55fr) minmax(110px, 0.6fr) minmax(90px, 0.45fr) minmax(180px, 1.15fr) minmax(110px, 0.6fr);
}

.billing-config-table--categories .billing-config-table__head,
.billing-config-table--categories .billing-config-row,
.billing-config-table--forms .billing-config-table__head,
.billing-config-table--forms .billing-config-row,
.billing-config-table--tables .billing-config-table__head,
.billing-config-table--tables .billing-config-row {
  min-width: 0;
  grid-template-columns: minmax(140px, 1fr) minmax(110px, 0.55fr) minmax(120px, 0.65fr);
}

.billing-config-table__head {
  color: var(--muted);
  background: #eef6fb;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.billing-config-row {
  border-top: 1px solid var(--line-soft);
}

.billing-config-row input,
.billing-config-row select,
.billing-config-row textarea {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.42rem;
  color: var(--text);
  background: var(--surface);
  font: inherit;
  font-size: 0.8rem;
}

.billing-config-row textarea {
  resize: vertical;
}

.billing-config-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
}

.billing-config-check input {
  width: auto;
}

.client-custom-checkbox {
  align-content: start;
}

.control-settings-grid {
  display: grid;
  gap: 0.85rem;
  padding: 0.85rem;
}

.control-settings-group {
  display: grid;
  gap: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.8rem;
  background: #f8fafc;
}

.control-settings-group h3 {
  margin: 0;
  font-size: 0.92rem;
}

.control-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.65rem;
  align-items: start;
}

.control-toggle input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin-top: 0.15rem;
}

.control-toggle span {
  display: grid;
  gap: 0.18rem;
  min-width: 0;
}

.control-toggle strong {
  color: var(--text);
}

.control-toggle small {
  color: var(--muted);
}

.admin-users-table {
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  overflow: auto;
  background: var(--surface);
  box-shadow: none;
}

.admin-users-table__head,
.admin-user-row {
  display: grid;
  grid-template-columns: minmax(230px, 1.2fr) minmax(105px, 0.4fr) minmax(130px, 0.5fr) minmax(100px, 0.35fr) minmax(145px, 0.5fr) minmax(120px, 0.4fr);
  gap: 0.75rem;
  align-items: center;
  min-width: 900px;
  padding: 0.72rem 0.85rem;
}

.admin-users-table__head {
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-user-row {
  appearance: none;
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line-soft);
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.admin-user-row:hover,
.admin-user-row:focus-visible {
  position: relative;
  z-index: 1;
  background: #f4fbfe;
  box-shadow: inset 3px 0 0 var(--brand);
  outline: 0;
}

.admin-user-row__identity {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.admin-user-schedule-state { display: grid; gap: .35rem; color: var(--muted); font-size: .78rem; }
.admin-user-schedule-state button { justify-self: start; padding: .25rem .45rem; border: 1px solid var(--line); background: #fff; color: var(--brand-dark); font: inherit; cursor: pointer; }

.admin-user-row__identity strong,
.admin-user-row__identity small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-row__identity small {
  color: var(--muted);
}

.admin-user-role-pill {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.admin-user-role-pill {
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  background: #e0f2fe;
  color: #0c4a6e;
  font-style: normal;
  font-weight: 900;
}

.admin-users-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.admin-user-color-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  justify-self: start;
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  background: #f8fafc;
  color: #475569;
  font-size: 0.74rem;
  font-weight: 900;
}

.admin-user-color-pill i {
  width: 0.85rem;
  height: 0.85rem;
  flex: 0 0 auto;
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 999px;
}

.admin-user-account-state {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
  justify-self: start;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.76rem;
  font-weight: 900;
}

.admin-user-account-state small {
  font-size: 0.68rem;
  opacity: 0.78;
}

.admin-user-account-state.is-open {
  background: #dcfce7;
  color: #166534;
}

.admin-user-account-state.is-locked {
  background: #fee2e2;
  color: #991b1b;
}

.admin-user-account-state.is-warning {
  background: #fef3c7;
  color: #92400e;
}

.admin-user-modal {
  width: min(760px, calc(100vw - 2rem));
}

.admin-user-modal__card {
  gap: 1rem;
}

.admin-user-modal__card header {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.75rem;
}

.admin-user-modal__card header p {
  margin: 0 0 0.15rem;
}

.admin-user-modal__card header h2 {
  margin: 0;
}

.admin-user-modal__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.admin-user-modal__grid label {
  display: grid;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.admin-user-modal__grid input,
.admin-user-modal__grid select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.6rem 0.68rem;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.admin-user-password-field {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.admin-user-password-control {
  position: relative;
  min-width: 0;
}

.admin-user-password-control input {
  padding-right: 3rem;
}

.admin-user-password-control__toggle {
  position: absolute;
  top: 50%;
  right: 0.25rem;
  display: inline-grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  transform: translateY(-50%);
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.admin-user-password-control__toggle:hover {
  background: #f1f5f9;
  color: var(--text);
}

.admin-user-password-control__toggle:focus-visible {
  outline: 2px solid var(--brand, #0f766e);
  outline-offset: 1px;
}

.admin-user-password-control__toggle svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.admin-user-lock-toggle {
  align-self: end;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.55rem 0.65rem;
  background: #f8fafc;
}

.admin-user-lock-toggle input {
  width: 1rem;
  height: 1rem;
}

.admin-user-modal__card footer {
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
}

@media (max-width: 820px) {
  .admin-users-table__head {
    display: none;
  }

  .admin-user-row,
  .admin-user-modal__grid {
    grid-template-columns: 1fr;
  }
}

.auth-page {
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(180deg, #eff6fb 0%, #f8fafc 100%);
  color: var(--text);
  font-family: var(--font-sans);
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 1rem;
}

.auth-card {
  display: grid;
  gap: 1.1rem;
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.2rem;
  background: var(--surface);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}

.auth-card__brand {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

.auth-card__brand p,
.auth-card__brand h1 {
  margin: 0;
}

.auth-card__brand p {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  color: var(--brand-dark);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-env-label {
  display: inline-flex;
  align-items: center;
  min-height: 1.25rem;
  border: 1px solid color-mix(in srgb, var(--app-environment-accent, #b91c1c) 55%, #fff);
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  background: color-mix(in srgb, var(--app-environment-accent, #b91c1c) 12%, #fff);
  color: var(--app-environment-accent, #b91c1c);
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.auth-card__brand h1 {
  font-size: 1.35rem;
}

.auth-form {
  display: grid;
  gap: 0.85rem;
}

.auth-form label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.auth-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.72rem 0.8rem;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.auth-error:not(:empty) {
  border: 1px solid #fecaca;
  border-radius: 7px;
  padding: 0.65rem 0.75rem;
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.82rem;
  font-weight: 800;
}

.admin-roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
  padding: 0.85rem;
}

.admin-role-card {
  display: grid;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.85rem;
  background: #f8fafc;
}

.admin-role-card strong {
  color: var(--text);
  font-size: 0.95rem;
}

.admin-role-card code {
  width: fit-content;
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  background: #e0f2fe;
  color: #075985;
  font-size: 0.75rem;
  font-weight: 800;
}

.admin-role-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.permission-matrix {
  padding: 0.85rem;
  max-height: calc(100vh - 180px);
  overflow: auto;
}

.permission-matrix__table {
  min-width: calc(320px + (var(--permission-role-count, 7) * 132px));
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
}

.permission-matrix__row {
  display: grid;
  grid-template-columns: minmax(320px, 1.35fr) repeat(var(--permission-role-count, 7), minmax(120px, 0.5fr));
  align-items: center;
  min-height: 3rem;
  border-top: 1px solid var(--line-soft);
}

.permission-matrix__head {
  position: sticky;
  top: 0;
  z-index: 4;
  min-height: 2.6rem;
  border-top: 0;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.permission-matrix__row > span,
.permission-matrix__permission,
.permission-matrix__check {
  padding: 0.62rem 0.75rem;
}

.permission-matrix--task-assignment .permission-matrix__head > span:not(:first-child) {
  text-align: center;
}

.permission-matrix__group {
  padding: 0.55rem 0.75rem;
  border-top: 1px solid var(--line);
  background: #eef9fc;
  color: #075985;
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.permission-matrix__permission {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.permission-matrix__permission strong {
  color: var(--text);
}

.permission-matrix__permission small {
  color: var(--muted);
  line-height: 1.35;
}

.permission-matrix__check {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 2.75rem;
}

.permission-matrix__check input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
}

.admin-access-grid--technical {
  grid-template-columns: repeat(2, minmax(260px, 1fr));
}

.access-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 0.55rem;
  align-items: start;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
}

.access-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.access-row strong {
  color: var(--text);
}

.access-row span {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-width: 0;
}

.access-row em,
.access-row b {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.16rem 0.45rem;
  background: var(--surface);
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
  line-height: 1.35;
}

.access-row b {
  border-color: #93c5fd;
  color: #1d4ed8;
  background: #eff6ff;
}

.admin-access-grid section {
  display: grid;
  align-content: start;
  gap: 0.55rem;
}

.admin-access-grid h3 {
  margin: 0;
  font-size: 0.92rem;
}

.admin-access-grid label {
  display: grid;
  gap: 0.25rem;
  color: var(--text);
  font-size: 0.84rem;
}

.admin-access-grid input[type="checkbox"] {
  margin-right: 0.35rem;
}

.template-draft-preview {
  display: grid;
  gap: 0.55rem;
  padding: 0.8rem;
  border-top: 1px solid var(--line);
}

.template-draft-preview h3,
.template-draft-preview p {
  margin: 0;
}

.template-draft-preview details {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.template-draft-preview summary {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 0.55rem;
  align-items: center;
  cursor: pointer;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--line-soft);
}

.template-draft-preview summary span,
.template-draft-preview summary em {
  justify-self: end;
  color: var(--muted);
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 800;
}

.template-variable-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 0.45rem;
  padding: 0.7rem;
}

.template-variable-grid div {
  display: grid;
  gap: 0.18rem;
  padding: 0.45rem;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: #f8fafc;
}

.template-variable-grid .is-missing {
  border-color: #fecaca;
  background: #fff7f7;
}

.template-draft-preview pre {
  margin: 0 0.7rem 0.7rem;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.65rem;
  background: #0f172a;
  color: #e5e7eb;
  font-size: 0.78rem;
}

.prompt-json-editor {
  border-top: 0;
}

.prompt-json-editor label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.prompt-json-editor textarea {
  width: 100%;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #0f172a;
  color: #e5e7eb;
  padding: 0.65rem;
  font: 0.78rem Consolas, monospace;
}

.prompt-editor-modal {
  max-width: 860px;
}

.template-draft-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 0.7rem 0.7rem;
}

.template-draft-actions button {
  border: 1px solid var(--brand);
  border-radius: 4px;
  background: var(--brand);
  color: white;
  font-weight: 900;
  padding: 0.45rem 0.75rem;
}

.admin-access-grid select,
.admin-access-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.45rem;
  color: var(--text);
  background: #f8fafc;
  font: inherit;
}

.workspace-section {
  scroll-margin-top: 112px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.workspace-section--wide {
  grid-column: span 2;
}

.workspace-section header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--line);
}

.workspace-section h2 {
  margin: 0;
  font-size: 1rem;
}

.workspace-section header :is(a, button):not(:where(.settings-ui *)) {
  border: 0;
  background: transparent;
  color: var(--brand-dark);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
}

.timeline-row {
  display: grid;
  gap: 0.15rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--line-soft);
}

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

.timeline-row span,
.timeline-row small,
.empty-state {
  color: var(--muted);
}

.client-contact-row small,
.module-table--clients small {
  overflow-wrap: anywhere;
}

.empty-state {
  margin: 0;
  padding: 0.9rem;
}

.modal {
  width: min(640px, calc(100vw - 2rem));
  border: 0;
  padding: 0;
  background: transparent;
}

.modal[open] {
  display: block;
}

.modal--wide {
  width: min(980px, calc(100vw - 2rem));
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.32);
}

.modal-card {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
}

.modal-card--wide {
  width: min(980px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
}

.modal-card header,
.modal-card footer {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.modal-card header button {
  width: 32px;
}

.lead-modal-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 0.9rem;
  align-items: start;
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.72rem;
}

.modal-grid label {
  display: grid;
  gap: 0.24rem;
  min-width: 0;
}

.modal-grid label span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.modal-grid input,
.modal-grid select,
.modal-grid textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 0.45rem 0.55rem;
}

.modal-grid textarea {
  min-height: 82px;
  resize: vertical;
}

.modal-grid select[multiple] {
  min-height: 112px;
  padding-block: 0.35rem;
}

.modal-grid .span-2 {
  grid-column: 1 / -1;
}

.task-editor-dialog {
  width: min(960px, calc(100vw - 2rem));
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 2rem);
}

.task-editor-modal {
  box-sizing: border-box;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.task-editor-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 1rem;
}

.task-editor-section {
  display: grid;
  gap: 0.72rem;
  min-width: 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line-soft);
}

.task-editor-section:first-child {
  padding-top: 0;
  border-top: 0;
}

.task-editor-section--wide {
  grid-column: 1 / -1;
}

.task-editor-section h3 {
  margin: 0;
  color: var(--text);
}

.task-editor-modal .modal-grid label.task-editor-checkbox {
  display: inline-flex;
  grid-template-columns: none;
  grid-auto-flow: column;
  justify-content: start;
  align-items: center;
  align-self: end;
  gap: 0.45rem;
  min-height: 36px;
}

.task-editor-modal .task-editor-checkbox input[type="checkbox"] {
  width: 1rem;
  min-width: 1rem;
  min-height: 1rem;
  height: 1rem;
  margin: 0;
  padding: 0;
}

.task-editor-modal .task-editor-checkbox span {
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
}

.task-editor-date-stack {
  display: grid;
  gap: 0.72rem;
}

.modal-grid.task-editor-date-stack {
  grid-template-columns: minmax(0, 1fr);
}

.task-required-mark {
  color: #dc2626;
  font-weight: 900;
}

.task-editor-validation {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.7rem;
  border-left: 3px solid #dc2626;
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.84rem;
  font-weight: 700;
}

.billing-navigation { display: flex; flex-wrap: wrap; gap: 4px 20px; border-bottom: 1px solid var(--border-color, #d7e1eb); margin-bottom: 20px; }
.task-add-options { position: relative; z-index: 8; }
.task-add-options > div { position: absolute; right: 0; top: 100%; min-width: 240px; max-width: min(440px, 80vw); padding: 8px; border: 1px solid var(--border-color, #d7e1eb); background: var(--surface, #fff); display: grid; gap: 4px; box-shadow: 0 8px 24px #0002; }
.task-add-options > div a, .task-add-options > div button { text-align: left; white-space: normal; overflow-wrap: anywhere; padding: 8px; }
.task-set-template-list { margin-bottom: 28px; }
.task-set-template-list table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.task-set-template-list th, .task-set-template-list td { padding: 10px 8px; border-bottom: 1px solid var(--border-color, #d7e1eb); text-align: left; }
.task-set-designer, .task-set-instance { max-width: 1120px; margin: 24px 0; }
.task-set-designer-step, .task-set-instance-step { padding: 16px 0; border-bottom: 1px solid var(--border-color, #d7e1eb); }
.task-set-designer-step summary { padding: 8px 0; font-weight: 700; cursor: pointer; }
.task-set-designer-field { display: grid; grid-template-columns: minmax(0, 1fr) 170px 120px; align-items: end; gap: 16px; padding: 8px 0; }
.task-set-field { display: grid; gap: 6px; min-width: 0; }
.task-set-field input, .task-set-field textarea, .task-set-field select { width: 100%; min-width: 0; }
.task-set-footer { display: flex; justify-content: flex-end; align-items: center; gap: 16px; margin-top: 20px; }
.task-set-error { padding: 12px; color: #b91c1c; border-left: 3px solid #dc2626; }
@media (max-width: 760px) { .task-set-designer-field { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .task-set-designer-field > .task-set-field { grid-column: 1 / -1; } }
.billing-navigation a { padding: 12px 2px; text-decoration: none; border-bottom: 3px solid transparent; }
.billing-navigation a.is-active { border-bottom-color: var(--accent, #0891b2); font-weight: 700; }
.billing-overview-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 20px 0 28px; }
.billing-overview-metrics div { border-left: 3px solid #0891b2; padding: 4px 12px; }
.billing-overview-metrics dt { font-size: 13px; }
.billing-overview-metrics dd { font-size: 26px; font-weight: 700; margin: 6px 0 0; }
.billing-overview-metrics div:nth-child(2) { border-color: #d97706; }
.billing-overview-metrics div:nth-child(3) { border-color: #16a34a; }
.billing-overview-metrics div:nth-child(4) { border-color: #dc2626; }
.billing-overview-actions { display: flex; gap: 24px; flex-wrap: wrap; margin: 24px 0; }
.billing-value-note { color: var(--text-muted, #64748b); font-size: 13px; }
@media (max-width: 700px) { .billing-overview-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.task-estimate-dialog {
  width: min(620px, calc(100vw - 2rem));
}

.task-estimate-forms,
.task-estimate-forms form {
  display: grid;
  gap: 0.7rem;
}

.task-estimate-forms form + form {
  border-top: 1px solid var(--line-soft);
  padding-top: 0.85rem;
}

.task-estimate-forms label {
  display: grid;
  gap: 0.3rem;
}

.task-estimate-field input {
  box-sizing: border-box;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--surface, #fff);
  color: inherit;
  font: inherit;
}

.task-estimate-forms footer {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 700px) {
  .task-editor-dialog,
  .task-editor-modal {
    width: calc(100vw - 2rem) !important;
    max-width: calc(100vw - 2rem) !important;
    max-height: calc(100vh - 2rem) !important;
  }

  .task-editor-modal .modal-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .task-editor-sections {
    grid-template-columns: minmax(0, 1fr);
  }

  .task-editor-modal .modal-grid .span-2 {
    grid-column: auto;
  }

  .task-editor-modal .modal-grid label.task-editor-checkbox {
    align-self: start;
  }
}

.lead-modal-section {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: #fff;
  padding: 1rem;
}

.lead-modal-section--wide {
  grid-column: auto;
}

.lead-modal-section header {
  align-items: flex-start;
  border-bottom: 1px solid var(--line-soft);
  margin: -0.1rem 0 0.75rem;
  padding-bottom: 0.55rem;
}

.lead-modal-section h3 {
  margin: 0;
  font-size: 1rem;
}

.lead-modal-section .lead-client-match {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.compact-definition-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem 1rem;
  margin: 0;
}

.compact-definition-list div {
  min-width: 0;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 0.45rem;
}

.compact-definition-list dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.compact-definition-list dd {
  margin: 0.12rem 0 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.lead-score-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.65rem 0;
}

.lead-score-strip span {
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0.3rem 0.65rem;
}

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

.form-grid--single {
  grid-template-columns: 1fr;
}

.form-grid label {
  display: grid;
  gap: 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.55rem;
  color: var(--text);
  background: #f8fafc;
  font: inherit;
}

.client-registry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  border: 1px solid rgba(14, 165, 196, 0.16);
  border-radius: 6px;
  padding: 0.65rem;
  background: #f8fbfd;
}

.client-registry-actions button {
  min-height: 34px;
  padding: 0.45rem 0.75rem;
}

.client-registry-actions span {
  flex: 1 1 260px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.45;
}

.client-registry-actions span[data-client-registry-state="success"] {
  color: #0f766e;
}

.client-registry-actions span[data-client-registry-state="warning"] {
  color: #92400e;
}

.client-registry-actions span[data-client-registry-state="error"] {
  color: #b91c1c;
}

.quick-contact-panel {
  display: grid;
  gap: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.75rem;
  background: #f8fafc;
}

.quick-contact-panel[hidden] {
  display: none;
}

.link-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.link-button:hover,
.link-button:focus-visible {
  color: var(--accent-dark);
  text-decoration: underline;
}

.quick-contact-panel > span {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
}

.quick-contact-panel small {
  color: var(--muted);
  font-weight: 700;
}

.matter-client-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.35rem;
  align-items: end;
  gap: 0.45rem;
}

.matter-client-picker label {
  min-width: 0;
}

.matter-client-picker__add {
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f8fafc;
  color: var(--brand-dark);
  font-size: 1.15rem;
  font-weight: 900;
}

.matter-client-picker__add:hover,
.matter-client-picker__add:focus {
  border-color: var(--brand);
  background: #eef9fc;
}

.matter-create-modal {
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

.matter-create-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.72rem;
  align-items: end;
}

.matter-create-grid label {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.matter-create-grid input,
.matter-create-grid select,
.matter-create-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.58rem 0.65rem;
  background: #f8fafc;
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
}

.matter-create-grid textarea {
  resize: vertical;
  line-height: 1.45;
}

.matter-number-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem;
  align-items: center;
}

.matter-number-control__toggle {
  display: inline-grid;
  width: 2.35rem;
  height: 2.35rem;
  min-height: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.matter-number-control__toggle svg {
  width: 1rem;
  height: 1rem;
}

.matter-number-control__toggle:hover,
.matter-number-control__toggle:focus-visible {
  border-color: rgba(9, 148, 179, 0.42);
  background: #f8fbfd;
}

.matter-number-control__toggle[aria-pressed="true"] {
  border-color: rgba(9, 148, 179, 0.58);
  color: #075a6c;
  background: rgba(9, 148, 179, 0.1);
}

.matter-create-grid input.is-manual {
  background: #ffffff;
}

.matter-create-grid .span-2 {
  grid-column: span 2;
}

.matter-create-grid .span-3 {
  grid-column: 1 / -1;
}

.matter-create-section {
  align-self: stretch;
  border-top: 1px solid var(--line-soft);
  padding-top: 0.8rem;
}

.matter-create-section:first-child {
  border-top: 0;
  padding-top: 0;
}

.matter-create-section h3 {
  margin: 0;
  color: var(--text);
}

.matter-inline-client {
  display: grid;
  gap: 0.75rem;
  border: 1px solid rgba(9, 148, 179, 0.22);
  border-radius: 6px;
  padding: 0.8rem;
  background: #f8fbfd;
  box-sizing: border-box;
  width: 100%;
  max-height: calc(100vh - 2rem);
  overflow: auto;
}

.matter-inline-client[hidden] {
  display: none;
}

#matterInlineClientModal {
  width: min(720px, calc(100vw - 2rem));
}

.matter-inline-client header,
.matter-inline-client__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.matter-inline-client header p {
  margin: 0;
}

.matter-inline-client header strong {
  color: var(--text);
  font-size: 0.9rem;
}

.matter-inline-client__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.matter-inline-client__grid label {
  display: grid;
  gap: 0.24rem;
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.matter-inline-client__grid input,
.matter-inline-client__grid select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.58rem 0.65rem;
  background: #f8fafc;
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
}

.matter-inline-client__grid input:focus,
.matter-inline-client__grid select:focus,
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  outline: 2px solid rgba(14, 165, 196, 0.18);
  border-color: rgba(14, 165, 196, 0.55);
  background: #fff;
}

.matter-inline-client__grid .span-2 {
  grid-column: 1 / -1;
}

.matter-inline-client__footer {
  flex-wrap: wrap;
}

.matter-inline-client__footer span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.matter-inline-client__footer span.is-error {
  color: #b91c1c;
}

@media (max-width: 760px) {
  .matter-create-grid {
    grid-template-columns: 1fr;
  }

  .matter-create-grid .span-2,
  .matter-create-grid .span-3 {
    grid-column: 1 / -1;
  }

  .matter-create-grid > div:not(.matter-create-section) {
    display: none;
  }

  .matter-inline-client__grid {
    grid-template-columns: 1fr;
  }
}

.stack-form {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.stack-form--inline {
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  align-items: end;
}

.automation-rule-form {
  grid-template-columns: repeat(6, minmax(130px, 1fr)) auto auto;
  align-items: end;
}

.automation-rule-form label:nth-child(2) {
  grid-column: span 2;
}

.stack-form label {
  display: grid;
  gap: 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.stack-form input,
.stack-form select,
.stack-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.5rem;
  color: var(--text);
  background: #f8fafc;
  font: inherit;
}

.span-2 {
  grid-column: span 2;
}

@media (max-width: 1100px) {
  .panel-grid,
  .role-playbook,
  .work-grid,
  .kanban-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .module-shell--wide,
  .module-shell--register,
  .wizard-collision-grid,
  .calendar-workspace,
  .calendar-summary-strip,
  .split-workspace,
  .report-grid,
  .client-hero-grid,
  .client-work-grid,
  .client-hero-grid--compact,
  .client-summary-strip,
  .client-record-shell,
  .client-legaldesk-shell,
  .client-form-title,
  .client-form-section,
  .legaldesk-field-grid,
  .legaldesk-field-grid--three,
  .client-related-row,
  .client-relation-summary,
  .client-field-grid,
  .client-status-strip,
  .admin-summary-strip,
  .document-command-strip,
  .document-bottom-grid,
  .document-detail-grid,
  .settings-grid,
  .document-generation-model-form,
  .admin-access-summary,
  .admin-access-grid,
  .admin-danger-grid,
  .admin-reset-layout,
  .admin-confirm-form,
  .case-command {
    grid-template-columns: 1fr;
  }

  .matter-form-title,
  .matter-form-shell {
    grid-template-columns: 1fr;
  }

  .matter-section-menu {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .matter-readonly-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }


  .access-row {
    grid-template-columns: 1fr;
  }

  .review-panel__main {
    grid-template-columns: 1fr;
  }

  .limited-trust-review {
    grid-template-columns: 1fr;
  }

  .review-decision-form__checks {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wizard-steps {
    grid-template-columns: 1fr;
  }

  .lead-modal-grid,
  .compact-definition-list {
    grid-template-columns: 1fr;
  }

  .workload-table {
    overflow-x: auto;
  }

  .workspace-section--wide {
    grid-column: 1 / -1;
  }

  .client-correspondence-panel,
  .client-intake-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .client-section-menu {
    position: static;
    display: flex;
    flex-wrap: wrap;
    padding: 0.45rem;
  }

  .client-section-menu strong {
    width: 100%;
    padding: 0.35rem 0.5rem 0.2rem;
  }

  .client-section-menu a {
    min-height: 30px;
    padding: 0 0.65rem;
    border-left: 0;
    border-bottom: 2px solid transparent;
  }

  .client-section-menu a:hover,
  .client-section-menu a:focus,
  .client-section-menu a.is-active {
    border-bottom-color: var(--brand);
  }

  .client-form-section > aside {
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .client-save-bar {
    grid-column: 1;
  }

  .audit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .demo-load-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .audit-grid .timeline-row:nth-child(2n) {
    border-right: 0;
  }

  .span-3 {
    grid-column: auto;
  }
}

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

  .app-shell {
    --menu-width: 0px;
    --menu-overlay-width: min(284px, calc(100vw - 20px));
    grid-template-columns: minmax(0, 1fr);
  }

  .app-menu {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--menu-overlay-width);
    min-height: 100dvh;
    max-width: calc(100vw - 12px);
    transform: translateX(calc(-100% - 10px));
    transition: transform 0.22s ease;
    box-shadow: 0 24px 42px rgba(15, 23, 42, 0.24);
    z-index: 60;
  }

  .app-shell.is-menu-expanded .app-menu,
  .app-shell.is-menu-hovered .app-menu {
    transform: translateX(0);
  }

  .app-shell::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.32);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 50;
  }

  .app-shell.is-menu-expanded::after {
    opacity: 1;
    pointer-events: auto;
  }

  .app-main {
    grid-column: 1;
    min-width: 0;
  }

  .panel-grid,
  .role-playbook,
  .work-grid,
  .module-shell,
  .kanban-board,
  .form-grid,
  .client-record-shell,
  .client-legaldesk-shell,
  .client-form-section,
  .client-field-grid,
  .legaldesk-field-grid,
  .legaldesk-field-grid--three,
  .client-related-row,
  .client-relation-summary,
  .client-status-strip,
  .demo-load-summary,
  .permissions-grid {
    grid-template-columns: 1fr;
  }

  .dashboard,
  .module-page {
    min-width: 0;
    padding: 0.65rem;
    gap: 0.65rem;
  }

  .page-actions,
  .module-actions,
  .module-filter-row,
  .module-tabs,
  .module-stat-pills {
    max-width: 100%;
    overflow-x: auto;
  }

  .client-data-card header,
  .client-registry-action {
    align-items: stretch;
    flex-direction: column;
  }

  .client-field-grid div {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .page-header,
  .topbar {
    align-items: stretch;
    flex-direction: column;
    min-width: 0;
  }

  .page-header {
    padding: 0.85rem;
  }

  .topbar {
    gap: 0.55rem;
    padding: 0.55rem;
  }

  .topbar input {
    width: 100%;
    min-width: 0;
  }

  .topbar-actions {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.4rem;
    width: 100%;
    margin-left: 0;
  }

  .work-timer {
    max-width: 100%;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .role-notifications {
    max-width: 100%;
    flex-wrap: wrap;
    overflow: visible;
  }

  .context-switcher {
    width: 100%;
    flex-wrap: wrap;
  }

  .context-switcher select {
    min-width: 0;
    flex: 1 1 150px;
  }

  .module-table {
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
  }

  .matter-readonly-grid {
    grid-template-columns: 1fr;
  }

  .matter-save-bar {
    position: static;
  }

  .span-2 {
    grid-column: auto;
  }

  .lead-client-match article {
    grid-template-columns: 1fr;
  }

  .lead-client-match article a {
    justify-self: start;
  }
}

/* ===== Layout v2 premium workspace ===== */
:root {
  --brand: #0891b2;
  --brand-strong: #0e7490;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
}

body,
input,
button,
select,
textarea {
  font-family: var(--font-sans);
}

.app-shell--v2 {
  --menu-width: 88px;
  --menu-overlay-width: 240px;
  background:
    radial-gradient(1200px 420px at 55% -160px, rgba(8, 145, 178, 0.13), transparent 58%),
    var(--bg);
}

@media (min-width: 1025px) {
  .app-shell--v2 {
    --menu-width: 88px;
    --menu-overlay-width: 240px;
    grid-template-columns: var(--menu-width) minmax(0, 1fr);
  }

  .app-shell--v2.app-shell.is-menu-hovered {
    --menu-width: 88px;
  }

  .app-shell--v2.app-shell.is-menu-expanded {
    --menu-width: var(--menu-overlay-width);
  }

  .app-shell--v2 .app-menu {
    width: var(--menu-width);
  }

  .app-shell--v2.app-shell.is-menu-expanded .app-menu,
  .app-shell--v2.app-shell.is-menu-hovered .app-menu {
    width: var(--menu-overlay-width);
  }

  .app-shell--v2 .app-main {
    grid-column: 2 / -1 !important;
  }
}

.app-shell--v2 .app-menu {
  border-right: 1px solid #e6edf5;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
}

.app-shell--v2 .menu-stack {
  gap: 0.65rem;
  padding: 0.9rem 0.45rem 1rem;
}

.app-shell--v2 .menu-group {
  display: grid;
  gap: 0.3rem;
}

.app-shell--v2 .app-menu p {
  display: none;
  margin: 0.2rem 0.4rem;
  color: #94a3b8;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}

.app-shell.is-menu-expanded .app-menu p,
.app-shell.is-menu-hovered .app-menu p {
  display: block;
}

.app-shell--v2 .menu-item {
  border: 0;
  border-radius: 14px;
  min-height: 42px;
  padding: 0 0.7rem;
  transition: all 0.18s ease;
}

.app-shell--v2 .menu-item:hover,
.app-shell--v2 .menu-item.is-active {
  color: #083344;
  background: linear-gradient(90deg, rgba(8, 145, 178, 0.18), rgba(8, 145, 178, 0.06));
}

.app-shell--v2 .menu-item svg {
  stroke-width: 1.55;
}

.app-shell--v2 .menu-settings {
  border-radius: 16px;
}

.app-shell--v2 .menu-settings-summary {
  margin-inline: 0;
}

.app-shell--v2 .menu-settings[open] {
  background: linear-gradient(180deg, rgba(248, 252, 254, 0.96), rgba(241, 248, 251, 0.78));
  box-shadow: inset 0 0 0 1px rgba(203, 213, 225, 0.7);
}

.app-shell--v2 .menu-settings[open] > .menu-settings-summary {
  border-radius: 14px 14px 10px 10px;
}

.app-shell--v2 .menu-settings-body {
  margin: 0 0.36rem 0.42rem;
  padding: 0.22rem 0.16rem 0.42rem;
  border-top: 1px solid rgba(203, 213, 225, 0.6);
}

.app-shell--v2 .menu-subgroup {
  position: relative;
  gap: 0.08rem;
  padding: 0.34rem 0 0.22rem;
}

.app-shell--v2 .menu-subgroup + .menu-subgroup {
  border-top: 1px solid rgba(226, 232, 240, 0.8);
}

.app-shell--v2 .menu-subgroup p {
  display: block;
  margin: 0 0 0.18rem;
  padding: 0 0.5rem;
  color: #7c8da3;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.075em;
}

.app-shell--v2 .menu-subitem {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 31px;
  border-radius: 9px;
  padding: 0.36rem 0.54rem;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 760;
  transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.app-shell--v2 .menu-subitem::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  margin-right: 0.48rem;
  border-radius: 999px;
  background: #cbd5e1;
  opacity: 0.78;
}

.app-shell--v2 .menu-subitem:hover,
.app-shell--v2 .menu-subitem:focus-visible {
  background: rgba(226, 245, 250, 0.72);
  color: #075985;
  outline: none;
}

.app-shell--v2 .menu-subitem.is-active {
  background: #dff4f8;
  color: #07566a;
  box-shadow: inset 0 0 0 1px rgba(103, 202, 220, 0.35);
}

.app-shell--v2 .menu-subitem.is-active::before {
  background: #0891b2;
  opacity: 1;
}

@media (max-width: 1024px) {
  .app-shell--v2 {
    --menu-width: 0px;
    --menu-overlay-width: min(284px, calc(100vw - 20px));
    grid-template-columns: minmax(0, 1fr);
  }
}

.topbar--v2 {
  position: sticky;
  top: 0;
  z-index: 35;
  min-height: 72px;
  padding: 0.85rem 1.35rem;
  border-bottom: 1px solid #e6edf5;
  background: rgba(245, 247, 250, 0.88);
  backdrop-filter: blur(9px);
}

.app-environment--highlighted .topbar--v2 {
  border-bottom-color: color-mix(in srgb, var(--app-environment-accent) 80%, #000);
  background: var(--app-environment-accent);
  box-shadow: 0 3px 12px color-mix(in srgb, var(--app-environment-accent) 32%, transparent);
  backdrop-filter: none;
}

html[data-theme="dark"] .app-environment--highlighted .topbar--v2 {
  border-bottom-color: color-mix(in srgb, var(--app-environment-accent) 80%, #000);
  background: var(--app-environment-accent);
  backdrop-filter: none;
}

.topbar-start {
  display: flex;
  align-items: center;
}

@media (min-width: 1025px) {
  .topbar-start {
    display: none;
  }
}

.topbar-icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid #dbe4ee;
  border-radius: 12px;
  background: #fff;
  color: #334155;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.topbar-icon-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
}

.topbar-search-wrap {
  display: grid;
  gap: 0.32rem;
  flex: 1;
  max-width: 720px;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  border: 1px solid #d6e2ef;
  border-radius: 16px;
  padding: 0 0.75rem;
  background: #fff;
}

.topbar-search input {
  width: 100%;
  border: 0;
  background: transparent;
  font-size: 0.92rem;
}

.topbar-search input:focus {
  outline: none;
}

.topbar-search svg {
  width: 16px;
  height: 16px;
  stroke: #94a3b8;
  fill: none;
}

.topbar-search-hints {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.topbar-search-hints a {
  border-radius: 999px;
  background: rgba(8, 145, 178, 0.08);
  color: #0f766e;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
}

.global-search-dialog {
  width: min(920px, calc(100vw - 32px));
  height: min(820px, calc(100dvh - 40px));
  max-width: none;
  max-height: min(820px, calc(100dvh - 40px));
  margin: 20px auto;
  padding: 0;
  border: 1px solid #d6e2ef;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
  overflow: hidden;
}

.global-search-dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(2px);
}

.global-search-dialog__surface {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-height: 0;
}

.global-search-dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.45rem 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.global-search-dialog__eyebrow {
  display: block;
  margin-bottom: 0.2rem;
  color: #087f96;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.global-search-dialog__header h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.25;
}

.global-search-dialog__close {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border: 1px solid #d6e2ef;
  border-radius: 6px;
  background: #fff;
  color: #475569;
  cursor: pointer;
}

.global-search-dialog__close:hover,
.global-search-dialog__close:focus-visible {
  border-color: #0891b2;
  color: #087f96;
  outline: none;
}

.global-search-dialog__close svg,
.global-search-dialog__input svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
}

.global-search-dialog__input {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  margin: 1rem 1.45rem 0;
  min-height: 48px;
  padding: 0 0.85rem;
  border: 1px solid #b8cadc;
  border-radius: 6px;
  color: #64748b;
  background: #fff;
}

.global-search-dialog__input:focus-within {
  border-color: #0891b2;
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.12);
}

.global-search-dialog__input input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #0f172a;
  font-size: 1rem;
}

.global-search-dialog__input [data-global-search-progress] {
  width: 16px;
  height: 16px;
  border: 2px solid #cbd5e1;
  border-top-color: #0891b2;
  border-radius: 50%;
  animation: global-search-spin 0.7s linear infinite;
}

.global-search-dialog__summary {
  min-height: 40px;
  padding: 0.7rem 1.45rem;
  color: #64748b;
  font-size: 0.82rem;
}

.global-search-results {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 0.75rem;
  scroll-padding-block: 2.75rem 0.75rem;
  scrollbar-gutter: stable;
  border-top: 1px solid #e2e8f0;
}

.global-search-group + .global-search-group {
  border-top: 1px solid #cbd5e1;
}

.global-search-group__header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.62rem 1.45rem;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
}

.global-search-group__header h3 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 800;
}

.global-search-group__header span {
  min-width: 24px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: #fff;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 700;
}

.global-search-group__items {
  display: grid;
}

.global-search-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.8rem;
  min-height: 62px;
  padding: 0.72rem 1.45rem;
  border-bottom: 1px solid #edf2f7;
  color: inherit;
  text-decoration: none;
}

.global-search-result:hover,
.global-search-result:focus-visible,
.global-search-result.is-active {
  background: #ecfeff;
  outline: none;
}

.global-search-result__body {
  min-width: 0;
  display: grid;
  gap: 0.16rem;
}

.global-search-result__title,
.global-search-result__subtitle,
.global-search-result__meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-search-result__title {
  color: #0f172a;
  font-size: 0.86rem;
  font-weight: 750;
}

.global-search-result__subtitle {
  color: #475569;
  font-size: 0.78rem;
}

.global-search-result__meta {
  color: #94a3b8;
  font-size: 0.72rem;
}

.global-search-result__badge {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0.2rem 0.45rem;
  border: 1px solid #bae6fd;
  border-radius: 999px;
  background: #f0f9ff;
  color: #0369a1;
  font-size: 0.68rem;
  font-weight: 700;
}

.global-search-result__arrow {
  color: #0891b2;
  font-size: 1.25rem;
  line-height: 1;
}

@keyframes global-search-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 700px) {
  .global-search-dialog {
    width: 100vw;
    max-height: 100dvh;
    height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .global-search-dialog__surface {
    height: 100dvh;
  }

  .global-search-dialog__header,
  .global-search-result {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .global-search-dialog__input {
    margin-left: 1rem;
    margin-right: 1rem;
  }

  .global-search-dialog__summary,
  .global-search-group__header {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .global-search-result {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .global-search-result__badge {
    display: none;
  }
}

.topbar-actions--v2 {
  gap: 0.48rem;
}

.ai-assistant-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(120deg, #0891b2, #0ea5e9);
  color: #fff;
  min-height: 38px;
  padding: 0 0.68rem;
  font-weight: 700;
}

.ai-assistant-btn svg {
  width: 15px;
  height: 15px;
  stroke: #fff;
  fill: none;
}

.role-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  min-height: 32px;
  padding: 0 0.62rem;
  font-size: 0.74rem;
  font-weight: 800;
}

.role-chip.is-partner,
.role-chip.is-senior { background: #eef2ff; color: #4338ca; }
.role-chip.is-student { background: #f1f5f9; color: #334155; }
.role-chip.is-aplikant { background: #ecfeff; color: #0e7490; }
.role-chip.is-admin { background: #fef3c7; color: #92400e; }
.role-chip.is-assistant { background: #dcfce7; color: #166534; }
.role-chip.is-secretariat { background: #cffafe; color: #155e75; }
.role-chip.is-lawyer { background: #e0f2fe; color: #0c4a6e; }

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid #dbe4ee;
  border-radius: 999px;
  background: #fff;
  min-height: 38px;
  padding: 0 0.48rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.profile-chip::-webkit-details-marker {
  display: none;
}

.profile-chip__avatar {
  width: 27px;
  height: 27px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: #0ea5e9;
  color: #fff;
  font-size: 0.75rem;
}

.profile-menu {
  position: relative;
}

.profile-menu__panel {
  position: absolute;
  z-index: 1200;
  top: calc(100% + 0.55rem);
  right: 0;
  width: min(300px, calc(100vw - 2rem));
  display: grid;
  gap: 0.7rem;
  border: 1px solid rgba(203, 213, 225, 0.92);
  border-radius: 0.9rem;
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
}

.profile-menu:not([open]) .profile-menu__panel {
  display: none;
}

.profile-menu__identity,
.profile-menu__row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.profile-menu__identity {
  min-width: 0;
}

.profile-menu__identity div {
  display: grid;
  min-width: 0;
}

.profile-menu__identity strong,
.profile-menu__identity small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-menu__identity small,
.profile-menu__row > span:first-child {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.profile-menu__row {
  justify-content: space-between;
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  padding-top: 0.7rem;
}

.topbar-mobile-search {
  display: none;
}

.profile-menu__impersonation {
  display: grid;
  gap: 0.3rem;
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  padding-top: 0.7rem;
}

.profile-menu__impersonation > span {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.profile-menu__impersonation select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 2rem 0 0.65rem;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
}

.profile-menu__panel a {
  display: flex;
  align-items: center;
  min-height: 2.25rem;
  border-radius: 0.65rem;
  padding: 0 0.65rem;
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.profile-menu__panel a:hover,
.profile-menu__panel a:focus-visible {
  background: rgba(14, 165, 233, 0.1);
}

.profile-menu__logout {
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  padding-top: 0.7rem;
}

.profile-menu__logout button {
  display: flex;
  width: 100%;
  min-height: 36px;
  align-items: center;
  gap: 0.55rem;
  border: 0;
  border-radius: 0.65rem;
  padding: 0 0.65rem;
  background: transparent;
  color: #b42318;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.profile-menu__logout button:hover,
.profile-menu__logout button:focus-visible {
  background: #fff1f0;
}

.profile-menu__logout svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
}

.dashboard--premium,
.module-page,
.matter-workspace {
  padding: 1.25rem 1.35rem 1.6rem;
  gap: 1rem;
}

.page-header--premium {
  border: 1px solid #e5edf6;
  border-radius: 20px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.05);
}

.page-header--premium h1 { font-size: 2rem; }
.page-header--premium p { color: #0891b2; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 0.8rem;
}

.kpi-card {
  border-radius: 20px;
  border: 1px solid #e5edf6;
  background: #fff;
  padding: 1rem;
  display: grid;
  gap: 0.25rem;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
  transition: transform 0.2s ease;
}

.kpi-card:hover { transform: translateY(-2px); }
.kpi-card strong { font-size: 2rem; line-height: 1; }
.kpi-card span { font-weight: 700; }
.kpi-card small { color: #64748b; }
.kpi-card em { color: #0369a1; font-style: normal; font-weight: 700; margin-top: 0.2rem; }

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  color: #fff;
  font-size: 1.05rem;
}

.kpi-card--blue .kpi-icon { background: linear-gradient(120deg, #2563eb, #38bdf8); }
.kpi-card--green .kpi-icon { background: linear-gradient(120deg, #16a34a, #4ade80); }
.kpi-card--violet .kpi-icon { background: linear-gradient(120deg, #7c3aed, #a78bfa); }
.kpi-card--orange .kpi-icon { background: linear-gradient(120deg, #ea580c, #fb923c); }

.dashboard-grid {
  display: grid;
  gap: 0.8rem;
}

.dashboard-grid--main {
  grid-template-columns: 1.35fr 1fr 1fr;
}

.dashboard-grid--secondary {
  grid-template-columns: 1fr 1fr;
}

.workspace-card {
  border: 1px solid #e4edf7;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
  padding: 0.95rem;
  display: grid;
  gap: 0.75rem;
}

.workspace-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.workspace-card > header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.workflow-feed {
  display: grid;
  gap: 0.55rem;
}

.workflow-item {
  display: grid;
  grid-template-columns: 4px 26px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid #edf2f7;
  border-radius: 14px;
  background: #fff;
  padding: 0.5rem;
}

.workflow-item--focused {
  border-color: #78c8da;
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.14);
  background: linear-gradient(160deg, #ffffff, #f3fbff);
}

.workflow-reset-link {
  margin-left: auto;
  border: 1px solid #c9dbea;
  border-radius: 10px;
  padding: 0.26rem 0.56rem;
  color: #0e7490;
  font-size: 0.82rem;
  font-weight: 700;
}

.workflow-item__bar {
  border-radius: 999px;
  min-height: 100%;
  background: #cbd5e1;
}

.workflow-item__bar.is-danger { background: var(--danger); }
.workflow-item__bar.is-warning { background: var(--warning); }
.workflow-item__bar.is-success { background: var(--success); }
.workflow-item__bar.is-info { background: var(--info); }

.workflow-item__icon {
  width: 26px;
  height: 26px;
  border-radius: 10px;
  background: #f1f5f9;
  display: inline-grid;
  place-items: center;
}

.workflow-item__content {
  display: grid;
}

.workflow-item__content small,
.modern-row__main small,
.modern-row__meta small,
.timeline-item__body small {
  color: #64748b;
}

.workflow-item__owner {
  color: #64748b;
  font-size: 0.78rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  min-height: 24px;
  padding: 0 0.5rem;
  font-size: 0.7rem;
  font-weight: 800;
}

.status-pill.is-danger { background: #fee2e2; color: #b91c1c; }
.status-pill.is-warning { background: #fef3c7; color: #92400e; }
.status-pill.is-success { background: #dcfce7; color: #166534; }
.status-pill.is-info { background: #dbeafe; color: #1d4ed8; }

.timeline-agenda {
  display: grid;
  gap: 0.5rem;
}

.timeline-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.6rem;
  border: 1px solid #e9f0f7;
  border-left: 4px solid #cbd5e1;
  border-radius: 14px;
  padding: 0.55rem;
}

.timeline-item.is-danger { border-left-color: var(--danger); }
.timeline-item.is-warning { border-left-color: var(--warning); }
.timeline-item.is-success { border-left-color: var(--success); }
.timeline-item.is-info { border-left-color: var(--info); }

.timeline-item__date {
  min-width: 76px;
  border-radius: 10px;
  background: #f8fafc;
  padding: 0.35rem;
  display: grid;
  align-content: center;
  text-align: center;
}

.timeline-item__body {
  display: grid;
}

.timeline-item__body em {
  font-style: normal;
  color: #0f766e;
  font-weight: 700;
}

.approval-center {
  display: grid;
  gap: 0.55rem;
}

.approval-card {
  border: 1px solid #e7eef6;
  border-radius: 14px;
  padding: 0.65rem;
  display: grid;
  gap: 0.42rem;
}

.approval-actions {
  display: flex;
  gap: 0.4rem;
}

.approval-actions a {
  border: 1px solid #d4e0ec;
  border-radius: 10px;
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.approval-actions .is-primary {
  background: #0891b2;
  color: #fff;
  border-color: #0891b2;
}

.workspace-card--insights ul {
  margin: 0;
  padding-left: 1rem;
  color: #0f172a;
}

.insight-actions {
  display: flex;
  gap: 0.45rem;
}

.insight-actions a {
  border: 1px solid #d7e2ee;
  border-radius: 12px;
  padding: 0.45rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.quick-actions-grid a,
.quick-actions-grid button {
  border: 1px solid #dbe5f0;
  border-radius: 16px;
  min-height: 52px;
  background: linear-gradient(160deg, #f8fcff, #f3f7fb);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0f172a;
  font-weight: 700;
}

.registry-modern {
  display: grid;
  gap: 0.85rem;
}

.registry-modern__toolbar,
.registry-modern__controls {
  border: 1px solid #e4edf7;
  border-radius: 20px;
  background: #fff;
  padding: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.registry-modern__title h2 { margin: 0; font-size: 1.35rem; }
.registry-modern__title p { margin: 0.2rem 0 0; color: #64748b; }

.registry-modern__chips {
  display: flex;
  gap: 0.38rem;
  flex-wrap: wrap;
}

.registry-modern__chips button {
  min-height: 34px;
  border: 1px solid #d9e4ef;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  font-weight: 700;
  padding: 0 0.62rem;
}

.registry-modern__chips button.is-active,
.registry-modern__chips button:hover {
  background: rgba(8, 145, 178, 0.12);
  border-color: #8fd0de;
  color: #0e7490;
}

.registry-modern__search {
  min-width: 320px;
  flex: 1;
}

.registry-modern__controls .registry-search--compact {
  min-width: 220px;
}

.modern-list {
  display: grid;
  gap: 0.55rem;
}

.modern-row {
  border: 1px solid #e5edf7;
  border-radius: 16px;
  padding: 0.78rem 0.85rem;
  background: #fff;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.modern-row:hover {
  border-color: #b7d7e8;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}

.modern-row--button {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.modern-row__main,
.modern-row__meta,
.modern-row__side {
  display: grid;
  gap: 0.18rem;
}

.modern-row__main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.62rem;
}

.modern-row__main strong {
  font-size: 1rem;
}

.modern-row__side {
  justify-items: end;
  gap: 0.3rem;
}

.modern-row__icon {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: inline-grid;
  place-items: center;
  font-size: 0.95rem;
  font-weight: 700;
  border: 1px solid #d9e6f1;
}

.modern-row__icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

.modern-row__icon--case {
  background: linear-gradient(140deg, rgba(37, 99, 235, 0.16), rgba(14, 165, 233, 0.08));
  color: #1d4ed8;
}

.modern-row__icon--doc {
  background: linear-gradient(140deg, rgba(249, 115, 22, 0.16), rgba(251, 191, 36, 0.08));
  color: #c2410c;
}

.modern-row__owner {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
}

.modern-row__owner small {
  white-space: nowrap;
}

.modern-row--case {
  min-height: 92px;
  padding: 0.95rem 1rem;
}

.modern-row--case .modern-row__main strong {
  font-size: 1.12rem;
  line-height: 1.2;
}

.modern-row--case .modern-row__main small {
  font-size: 0.92rem;
}

.modern-row--case .modern-row__meta span {
  font-size: 1rem;
  line-height: 1.25;
}

.modern-row--case .modern-row__meta small {
  font-size: 0.9rem;
}

.modern-row--case .status-pill {
  min-height: 28px;
  font-size: 0.82rem;
  padding: 0 0.62rem;
}

.modern-row--case .avatar-chip {
  width: 32px;
  height: 32px;
  font-size: 0.78rem;
}



.modern-list--cases .modern-row--case {
  min-height: 76px;
  padding: 0.72rem 0.82rem;
  border-radius: 12px;
  box-shadow: none;
}

.modern-list--cases .modern-row--case .modern-row__main strong {
  font-size: 1rem;
}

.modern-list--cases .modern-row--case .modern-row__meta {
  gap: 0.1rem;
}

.modern-list--cases .case-next-step {
  font-size: 0.95rem;
  line-height: 1.2;
}

.modern-list--cases .case-deadline {
  font-size: 0.82rem;
  color: #64748b;
}

.modern-list--cases .case-meta-line {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.modern-list--cases .case-meta-line span + span::before {
  content: "•";
  margin-right: 0.35rem;
  color: #94a3b8;
}

.modern-list--cases .modern-row__owner small {
  font-size: 0.86rem;
}

.modern-row--doc {
  min-height: 88px;
  padding: 0.9rem 1rem;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1.15fr) auto;
  align-items: start;
}

.modern-row--doc .modern-row__main strong {
  font-size: 1.1rem;
  line-height: 1.2;
}

.modern-row--doc .modern-row__main small {
  font-size: 0.9rem;
}

.modern-row--doc .modern-row__meta span {
  font-size: 1rem;
  line-height: 1.25;
}

.modern-row--doc .modern-row__meta small {
  font-size: 0.88rem;
}

.doc-file-meta {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.doc-file-meta span + span::before {
  content: "•";
  margin-right: 0.4rem;
  color: #94a3b8;
}

.doc-meta-line {
  display: block;
}

.doc-meta-line strong {
  color: #475569;
  font-weight: 700;
}

.modern-row--doc .status-pill {
  min-height: 28px;
  font-size: 0.8rem;
  padding: 0 0.62rem;
}

.modern-row--doc .doc-format {
  font-size: 0.76rem;
  padding: 0.18rem 0.5rem;
}

.modern-row--team-member {
  min-height: 84px;
  padding: 0.86rem 0.95rem;
}

.modern-row--team-member .modern-row__main strong {
  font-size: 1.08rem;
}

.modern-row--team-member .modern-row__main small {
  font-size: 0.9rem;
}

.modern-row--team-member .modern-row__meta span {
  font-size: 0.98rem;
}

.modern-row--team-member .modern-row__meta small {
  font-size: 0.88rem;
}


.modern-row--compact {
  min-height: 0;
  border-radius: 12px;
  padding: 0.5rem 0.65rem;
  gap: 0.55rem;
  box-shadow: none;
}

.modern-row--compact .modern-row__main strong {
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.2;
}

.modern-row--compact .modern-row__main small {
  font-size: 0.82rem;
  color: #6b7280;
}

.modern-row--compact .status-pill {
  min-height: 22px;
  padding: 0 0.48rem;
  font-size: 0.72rem;
}

.matter-context-number-dialog {
  width: min(34rem, calc(100vw - 2rem));
}

.matter-context-number-dialog > p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.matter-context-number-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 1rem;
}

.modern-row--matter-activity {
  grid-template-columns: minmax(0, 1fr) 12rem 17rem;
  align-items: start;
}

.modern-row--matter-activity .modern-row__main {
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
}

.modern-row--matter-activity .modern-row__main strong,
.modern-row--matter-activity .modern-row__main small,
.modern-row--matter-activity .modern-row__meta span,
.modern-row--matter-activity .modern-row__meta small,
.modern-row--matter-activity .modern-row__side small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.modern-row--matter-activity .modern-row__meta {
  border-left: 1px solid #e5edf7;
  padding-left: 0.7rem;
}

.modern-row--matter-activity .modern-row__side {
  min-width: 0;
  text-align: right;
}

.modern-row--matter-activity .matter-activity-status-form,
.modern-row--matter-activity .matter-activity-status-form select {
  width: 100%;
  min-width: 0;
}

.modern-row--matter-activity .matter-activity-status-form select {
  min-height: 2.25rem;
  border-color: #cbd9e6;
  border-radius: 6px;
  background-color: #fff;
  color: var(--text);
  font-weight: 650;
  cursor: pointer;
}

.avatar-chip--team {
  background: linear-gradient(145deg, #dbeafe, #e0f2fe);
  color: #1d4ed8;
}


.doc-format {
  padding: 0.12rem 0.4rem;
  border-radius: 8px;
  border: 1px solid #d7e2ee;
  color: #64748b;
  font-weight: 700;
  font-size: 0.7rem;
}

.avatar-chip {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  display: inline-grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 800;
}

.matter-workspace {
  display: grid;
  gap: 0.8rem;
}

.matter-hero {
  border: 1px solid #e3ecf7;
  border-radius: 20px;
  background: #fff;
  padding: 1rem;
}

.matter-hero h1 {
  margin: 0;
  font-size: 1.8rem;
}

.matter-hero p {
  margin: 0.25rem 0;
  color: #64748b;
}

.matter-hero .matter-hero__client {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}

.matter-hero .matter-hero__client:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.matter-hero__badges {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.matter-relation-badge {
  background: var(--relation-bg, #dcfce7);
  color: var(--relation-fg, #166534);
  border: 1px solid var(--relation-border, #86efac);
}

.matter-relation-badge:hover {
  filter: saturate(1.05);
}

.matter-relation-badge--more {
  --relation-bg: #f8fafc;
  --relation-fg: #334155;
  --relation-border: #cbd5e1;
}

.matter-analysis-related-scope {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.35rem;
}

.matter-analysis-related-scope--modal {
  max-height: 36vh;
  overflow: auto;
  padding: 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.72);
}

.matter-analysis-related-scope hr {
  width: 100%;
  border: 0;
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  margin: 0.25rem 0;
}

.matter-analysis-related-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.72);
}

.matter-analysis-related-option input {
  width: 1rem;
  height: 1rem;
}

.matter-analysis-related-option.is-current {
  border-color: #7dd3fc;
  background: rgba(224, 242, 254, 0.82);
}

.matter-analysis-related-option span {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.matter-analysis-related-option small {
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matter-analysis-related-option em {
  justify-self: end;
  font-style: normal;
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
}

.matter-analysis-related-empty {
  margin: 0.5rem 0 0;
  color: #64748b;
  font-size: 0.82rem;
}

.matter-relations-panel header {
  align-items: flex-start;
}

.modern-list--relations .modern-row--relation {
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.8fr) auto;
}

.modern-row--relation .modern-row__main {
  grid-template-columns: auto minmax(0, 1fr);
}

.modern-row--relation .modern-row__main small {
  grid-column: 2;
}

.modern-row--relation .matter-relation-badge {
  align-self: start;
  justify-self: start;
}

.relation-dictionary-card {
  margin-bottom: 1rem;
}

.dictionary-admin-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.dictionary-admin-nav {
  display: grid;
  align-content: start;
  gap: 0.4rem;
  border: 1px solid #dbe6f3;
  border-radius: 12px;
  padding: 0.5rem;
  background: #f8fbff;
}

.dictionary-admin-nav button {
  display: grid;
  gap: 0.15rem;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 0.55rem 0.65rem;
  text-align: left;
  color: #1f2a44;
  cursor: pointer;
}

.dictionary-admin-nav button.is-active {
  border-color: #9bd7ea;
  background: #e8f8fc;
  color: #075985;
}

.dictionary-admin-nav small {
  color: #64748b;
}

.dictionary-admin-panels {
  min-width: 0;
}

.billing-config-table--relations .billing-config-table__head,
.billing-config-table--relations .billing-config-row {
  grid-template-columns: minmax(110px, 0.8fr) minmax(130px, 1fr) minmax(180px, 1.2fr) 62px 62px 62px minmax(120px, 0.8fr) 120px 90px 72px;
}

.billing-config-table--relations input[type="color"] {
  min-height: 38px;
  padding: 0.1rem;
}

.matter-registry-admin {
  margin-top: 1rem;
}

.registry-lazy-placeholder {
  margin: 0;
  padding: 0.85rem;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.court-directory-admin {
  margin-top: 1rem;
}

.court-directory-shell {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(420px, 1.6fr);
  gap: 1rem;
  align-items: start;
}

.court-directory-master,
.court-directory-card {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.85rem;
  background: #fff;
}

.court-directory-master header,
.court-directory-card header,
.court-directory-actions,
.court-directory-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.court-directory-master h4,
.court-directory-card h4 {
  margin: 0;
}

.court-directory-master header span,
.court-directory-card header span,
.court-directory-pager span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.court-directory-card header span.is-error {
  color: #b91c1c;
}

.court-directory-search {
  display: grid;
  gap: 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.court-directory-search input,
.court-directory-form-grid input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.5rem;
  background: #f8fafc;
  color: var(--text);
  font: inherit;
}

.admin-user-modal__grid input[type="color"] {
  min-height: 42px;
  padding: 0.25rem;
}

.court-directory-list {
  display: grid;
  gap: 0.4rem;
  min-height: 360px;
  align-content: start;
}

.court-directory-list--departments {
  min-height: 220px;
}

.court-directory-row {
  display: grid;
  gap: 0.16rem;
  width: 100%;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.55rem 0.65rem;
  background: #f8fafc;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.court-directory-row:hover,
.court-directory-row:focus-visible,
.court-directory-row.is-active {
  border-color: var(--brand);
  background: #eef9fc;
}

.court-directory-row strong,
.court-directory-row span,
.court-directory-row small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.court-directory-row strong {
  font-size: 0.86rem;
}

.court-directory-row span,
.court-directory-row small {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
}

.court-directory-detail {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.court-directory-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.court-directory-form-grid label:not(.control-toggle) {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.court-directory-department-form {
  border-top: 1px solid var(--line-soft);
  padding-top: 0.75rem;
}

@media (max-width: 1100px) {
  .court-directory-shell {
    grid-template-columns: 1fr;
  }
}

.billing-config-table--registry-contexts .billing-config-table__head,
.billing-config-table--registry-contexts .billing-config-row {
  min-width: 840px;
  grid-template-columns: minmax(110px, 0.7fr) minmax(180px, 1fr) minmax(90px, 0.4fr) minmax(140px, 0.6fr) minmax(110px, 0.5fr) 84px;
}

.billing-config-table--registry-types .billing-config-table__head,
.billing-config-table--registry-types .billing-config-row {
  min-width: 980px;
  grid-template-columns: minmax(110px, 0.65fr) minmax(170px, 1fr) minmax(190px, 1fr) minmax(120px, 0.65fr) minmax(150px, 0.8fr) minmax(120px, 0.55fr) 84px;
}

.matter-number-format-help {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0.75rem 0 0.9rem;
  padding: 0.7rem;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #f8fbfd;
}

.matter-number-format-help div {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.matter-number-format-help strong {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
}

.matter-number-format-help span {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

@media (max-width: 980px) {
  .matter-number-format-help {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .matter-number-format-help {
    grid-template-columns: 1fr;
  }
}

.billing-config-table--registry-counters .billing-config-table__head,
.billing-config-table--registry-counters .billing-config-row {
  min-width: 680px;
  grid-template-columns: minmax(150px, 1fr) minmax(130px, 0.8fr) minmax(90px, 0.45fr) minmax(110px, 0.55fr) 84px;
}

.billing-config-table--registry-courts .billing-config-table__head,
.billing-config-table--registry-courts .billing-config-row {
  min-width: 780px;
  grid-template-columns: minmax(120px, 0.75fr) minmax(130px, 0.8fr) minmax(240px, 1.35fr) minmax(110px, 0.65fr) minmax(120px, 0.55fr) 84px;
}

.billing-config-table--registry-departments .billing-config-table__head,
.billing-config-table--registry-departments .billing-config-row {
  min-width: 980px;
  grid-template-columns: minmax(130px, 0.8fr) minmax(220px, 1.2fr) minmax(240px, 1.35fr) minmax(80px, 0.45fr) minmax(120px, 0.55fr) minmax(90px, 0.45fr) 84px;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.activity-form-grid label.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.checkbox-field input[type="checkbox"] {
  flex: 0 0 auto;
  width: 1rem;
  min-height: auto;
}

.checkbox-field.is-disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

@media (max-width: 920px) {
  .dictionary-admin-layout {
    grid-template-columns: 1fr;
  }
}

.matter-tabs {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  border-radius: 16px;
  padding: 0.35rem;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid #e1eaf5;
}

.matter-tabs a,
.matter-tabs button {
  border: 0;
  border-radius: 12px;
  padding: 0.45rem 0.65rem;
  color: #475569;
  background: transparent;
  font-weight: 700;
  font: inherit;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.matter-tabs a.is-active,
.matter-tabs button.is-active {
  background: linear-gradient(120deg, rgba(8, 145, 178, 0.2), rgba(8, 145, 178, 0.08));
  color: #0e7490;
}

.matter-tabs .tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 0.3rem;
  border-radius: 999px;
  border: 1px solid #d9e6f2;
  background: #f8fafc;
  color: #475569;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
}

.matter-tabs a.is-active .tab-count,
.matter-tabs button.is-active .tab-count {
  border-color: #8fd0de;
  background: #e8f8fc;
  color: #0e7490;
}

.matter-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 0.8rem;
  align-items: start;
}

.matter-content {
  display: grid;
  gap: 0.8rem;
}

.matter-sticky-actions {
  position: sticky;
  top: 92px;
  border: 1px solid #e4edf7;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(9px);
  padding: 0.75rem;
  display: grid;
  gap: 0.45rem;
}

.matter-sticky-actions h3 {
  margin: 0 0 0.2rem;
}

.matter-sticky-actions a,
.matter-sticky-actions button {
  min-height: 40px;
  border: 1px solid #d8e4ef;
  border-radius: 12px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #0f172a;
}

.matter-sticky-actions a:hover,
.matter-sticky-actions button:hover {
  border-color: #7cc9da;
  color: #0f766e;
}

@media (max-width: 1250px) {
  .kpi-grid,
  .dashboard-grid--main,
  .dashboard-grid--secondary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .matter-layout {
    grid-template-columns: 1fr;
  }

  .matter-sticky-actions {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .dashboard--premium,
  .module-page,
  .matter-workspace {
    padding: 0.72rem;
  }

  .kpi-grid,
  .dashboard-grid--main,
  .dashboard-grid--secondary,
  .quick-actions-grid,
  .matter-sticky-actions,
  .modern-row {
    grid-template-columns: 1fr;
  }

  .topbar--v2 {
    padding: 0.55rem;
  }

  .topbar-search-wrap {
    max-width: 100%;
  }

  .registry-modern__search {
    min-width: 0;
    width: 100%;
  }

  .registry-modern__controls .registry-search--compact {
    width: 100%;
    min-width: 0;
    flex: 1 1 100%;
  }

  .registry-modern__chips {
    width: 100%;
  }

  .registry-tabs {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .billing-rates {
    overflow-x: auto;
  }

  .billing-rate-row {
    grid-template-columns: 1fr 74px 58px 1fr auto;
    min-width: 420px;
  }

  .invoice-queue {
    overflow-x: auto;
  }

  .invoice-queue > header,
  .invoice-row {
    min-width: 0;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 0.45rem;
  }

  .invoice-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .invoice-row form,
  .invoice-row > a {
    width: fit-content;
  }

  .module-table {
    overflow-x: auto;
  }

  .module-table--clients header,
  .module-table--clients > a,
  .module-table--costs header,
  .module-table--costs > a,
  .module-table--correspondence header,
  .module-table--correspondence .module-table-row {
    min-width: 760px;
  }

  .activities-register {
    overflow-x: auto;
  }

  .activity-grid,
  .activity-grid-header,
  .activity-grid-row {
    min-width: 980px;
  }

  .calendar-legaldesk-board,
  .calendar-type-switches {
    overflow-x: clip;
  }

  .calendar-legaldesk-weekdays,
  .calendar-legaldesk-grid {
    min-width: 0;
  }

  .modern-row--case {
    min-height: 0;
    padding: 0.78rem 0.85rem;
  }

  .modern-row--case .modern-row__main strong {
    font-size: 1.02rem;
  }

  .modern-row--case .modern-row__meta span {
    font-size: 0.92rem;
  }

  .modern-row--doc {
    min-height: 0;
    padding: 0.78rem 0.85rem;
    grid-template-columns: minmax(0, 1fr);
  }

  .modern-row--doc .modern-row__main strong {
    font-size: 1.02rem;
  }

  .modern-row--doc .modern-row__meta span {
    font-size: 0.92rem;
  }

  .modern-row--team-member {
    min-height: 0;
    padding: 0.75rem 0.82rem;
  }

  .modern-row--team-member .modern-row__main strong {
    font-size: 1rem;
  }

  .modern-row--matter-activity {
    grid-template-columns: minmax(0, 1fr);
  }

  .modern-row--matter-activity .modern-row__meta {
    border-left: 0;
    border-top: 1px solid #e5edf7;
    padding: 0.5rem 0 0;
  }

  .modern-row--matter-activity .modern-row__side {
    justify-items: start;
    text-align: left;
  }
}

/* hotfix: case details layout stability */
.matter-layout {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
}

.matter-content {
  flex: 1 1 auto;
  min-width: 0;
}

.matter-sticky-actions {
  width: 280px;
  flex: 0 0 280px;
}

.matter-tabs {
  display: flex;
  align-items: center;
}

@media (max-width: 1250px) {
  .matter-layout {
    display: grid;
    grid-template-columns: 1fr;
  }

  .matter-sticky-actions {
    width: 100%;
    flex: 1 1 auto;
  }
}

/* final override: case details must stay single-column shell */
.matter-workspace {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  width: 100% !important;
}

.matter-layout {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 0.8rem !important;
  align-items: start !important;
}

.matter-content {
  min-width: 0 !important;
}

.matter-actions-trigger {
  margin-left: auto;
  min-height: 34px;
  border: 1px solid #89cadb;
  border-radius: 999px;
  background: linear-gradient(120deg, #0891b2, #0ea5b7);
  color: #fff;
  font: inherit;
  font-weight: 800;
  padding: 0 0.8rem;
  cursor: pointer;
}

.matter-actions-drawer {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
}

.matter-actions-drawer__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(15, 23, 42, 0.24);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.matter-actions-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(360px, 92vw);
  height: 100%;
  border-left: 1px solid #d8e4ef;
  background: #fff;
  box-shadow: -18px 0 48px rgba(15, 23, 42, 0.22);
  padding: 1rem;
  transform: translateX(104%);
  transition: transform 0.24s ease;
  display: grid;
  align-content: start;
  gap: 0.75rem;
}

.matter-actions-drawer.is-open {
  pointer-events: auto;
}

.matter-actions-drawer.is-open .matter-actions-drawer__backdrop {
  opacity: 1;
}

.matter-actions-drawer.is-open .matter-actions-drawer__panel {
  transform: translateX(0);
}

.matter-actions-drawer__panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.matter-actions-drawer__panel h3 {
  margin: 0;
  font-size: 1.1rem;
}

.matter-actions-drawer__close {
  width: 30px;
  min-height: 30px;
  border: 1px solid #d8e4ef;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.matter-actions-drawer__buttons {
  display: grid;
  gap: 0.45rem;
}

.matter-actions-drawer__buttons a,
.matter-actions-drawer__buttons button {
  min-height: 42px;
  border: 1px solid #d8e4ef;
  border-radius: 12px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 750;
  color: #0f172a;
}

.matter-actions-drawer__buttons a:hover,
.matter-actions-drawer__buttons button:hover {
  border-color: #7cc9da;
  color: #0f766e;
}



/* ===== Unified compact lists across modules (May 2026) ===== */
.module-table {
  border-radius: 14px;
  overflow: hidden;
}

.module-table header,
.module-table > a,
.module-table-row {
  padding: 0.5rem 0.7rem;
  min-height: 44px;
}

.module-table header {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  background: #f5f9fd;
}

.module-table > a,
.module-table-row {
  font-size: 0.9rem;
}

.module-table small {
  font-size: 0.78rem;
  line-height: 1.3;
}

.module-table--clients a,
.module-table--correspondence .module-table-row,
.module-table--costs a,
.module-table--activities a {
  background: #fff;
}

.module-table--clients a:hover,
.module-table--correspondence .module-table-row:hover,
.module-table--costs a:hover,
.module-table--activities a:hover {
  background: #f8fbff;
}

.module-table--clients a em,
.module-table--correspondence .module-table-row strong,
.module-table--costs a strong {
  font-size: 0.95rem;
  line-height: 1.2;
}

.module-table--correspondence .module-table-row {
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}

.module-table--correspondence .status-pill,
.module-table--costs .status-pill,
.module-table--clients .status-pill {
  min-height: 24px;
  padding: 0 0.5rem;
  font-size: 0.72rem;
}

.invoice-queue {
  margin: 0.65rem;
  border-radius: 12px;
  border-color: #dce6f0;
}

.invoice-queue > header,
.invoice-row {
  padding: 0.5rem 0.65rem;
  min-height: 40px;
}

.invoice-row button,
.invoice-row > a,
.invoice-actions a,
.row-actions--compact button {
  min-height: 28px;
  padding: 0.28rem 0.5rem;
  border-radius: 8px;
  font-size: 0.76rem;
}

.activity-grid-header {
  min-height: 38px;
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  background: #f5f9fd;
}

.activity-grid-row {
  min-height: 40px;
  font-size: 0.84rem;
}

.activity-grid-header span,
.activity-grid-row > span,
.activity-grid-row > a {
  padding: 0.4rem 0.54rem;
}

.activity-description {
  gap: 0.04rem;
}

.activity-description strong {
  font-size: 0.86rem;
  font-weight: 760;
}

.activity-description small {
  font-size: 0.74rem;
}

.activity-inbox-card {
  min-height: 90px;
  margin-bottom: 0.5rem;
  padding: 0.58rem 0.6rem 0.54rem 0.82rem;
}

.activity-inbox-card strong {
  font-size: 0.84rem;
}

.activity-inbox-card p,
.activity-inbox-card footer {
  font-size: 0.72rem;
}

.activities-total-bar {
  padding-top: 0.7rem;
}

.activities-total-bar strong {
  font-size: 0.92rem;
}

.kanban-board {
  gap: 0.4rem;
  grid-template-columns: repeat(4, minmax(210px, 250px));
}

.kanban-column {
  min-height: 60vh;
  border-radius: 10px;
  border-color: #dce7f2;
}

.kanban-column header {
  padding: 0.44rem 0.56rem;
}

.kanban-column h2 {
  font-size: 0.74rem;
  font-weight: 780;
}

.kanban-column header span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  min-height: 20px;
  padding: 0 0.34rem;
  border-radius: 999px;
  border: 1px solid #c9deec;
  background: #f4f9fd;
  color: #3f566d;
  font-size: 0.68rem;
  font-weight: 760;
  line-height: 1;
}

.kanban-dropzone {
  min-height: 56vh;
  padding: 0.3rem;
}

.task-card {
  min-height: 84px;
  margin: 0 0 0.36rem;
  padding: 0.44rem;
  border-radius: 9px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.07);
}

.task-card span,
.task-card small,
.task-date {
  font-size: 0.74rem;
}

.task-card__top {
  gap: 0.28rem;
}

.task-card__top strong {
  font-size: 0.84rem;
  font-weight: 760;
  line-height: 1.2;
}

.task-card footer {
  margin-top: 0.08rem;
}

.task-card em {
  width: 18px;
  height: 18px;
  font-size: 0.56rem;
}

.task-open-dot {
  width: 14px;
  height: 14px;
  border-width: 1.5px;
}

.task-open-dot::before {
  border-top-width: 3px;
  border-bottom-width: 3px;
  border-left-width: 4px;
}

.task-menu-dot {
  width: 3px;
  height: 3px;
  box-shadow: 0 4px 0 #b5bdc8, 0 8px 0 #b5bdc8;
}

.report-status-card {
  border-radius: 12px;
}

.workload-table {
  padding: 0.55rem;
}

.workload-table header,
.workload-row {
  padding: 0.42rem 0;
  gap: 0.45rem;
}

.workload-table header {
  font-size: 0.68rem;
}

.workload-row {
  font-size: 0.88rem;
}

/* ===== Billing + Correspondence compact harmonization (Block B, May 2026) ===== */
.module-table--correspondence {
  border-radius: 14px;
}

.module-table--correspondence header,
.module-table--costs header {
  min-height: 38px;
  font-size: 0.66rem;
  letter-spacing: 0.06em;
}

.module-table--correspondence .module-table-row,
.module-table--costs > a {
  min-height: 40px;
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
  font-size: 0.84rem;
}

.module-table--correspondence .module-table-row strong,
.module-table--costs > a strong {
  font-size: 0.86rem;
  line-height: 1.2;
}

.module-table--correspondence .module-table-row > span,
.module-table--costs > a > span {
  line-height: 1.28;
}

.module-table--correspondence .module-table-row small,
.module-table--costs > a small {
  font-size: 0.74rem;
}

.module-table--correspondence .status-pill,
.module-table--costs .status-pill,
.module-table--costs select,
.module-table--correspondence .row-actions--compact button {
  min-height: 24px;
  font-size: 0.72rem;
}

.module-table--costs .inline-form select {
  min-height: 28px;
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
}

.correspondence-process-note {
  padding: 0.58rem 0.72rem;
}

.correspondence-process-note span {
  padding: 0.2rem 0.5rem;
  font-size: 0.72rem;
}

.correspondence-detail-modal {
  gap: 0.75rem;
}

.correspondence-detail-modal header {
  align-items: flex-start;
  padding-bottom: 0.68rem;
  border-bottom: 1px solid var(--line-soft);
}

.correspondence-detail-modal header h2 {
  font-size: 1.08rem;
  margin: 0.08rem 0 0.3rem;
}

.correspondence-detail-modal header span {
  font-size: 0.76rem;
}

.correspondence-modal-actions {
  gap: 0.34rem;
  margin-bottom: 0.58rem;
}

.correspondence-modal-actions a,
.confirmation-upload label span,
.button-row .inline-form button {
  min-height: 28px;
  padding: 0.26rem 0.46rem;
  border-radius: 6px;
  font-size: 0.72rem;
}

.invoice-queue {
  margin: 0.55rem;
  border-radius: 10px;
}

.invoice-queue > header,
.invoice-row {
  padding: 0.42rem 0.56rem;
  min-height: 38px;
}

.invoice-queue h2 {
  font-size: 0.86rem;
}

.invoice-queue > header span,
.invoice-row small {
  font-size: 0.72rem;
}

.invoice-row {
  font-size: 0.82rem;
}

.invoice-row strong,
.invoice-row em {
  font-size: 0.84rem;
}

.invoice-row button,
.invoice-row > a,
.invoice-actions a {
  min-height: 28px;
  padding: 0.26rem 0.48rem;
  font-size: 0.72rem;
  border-radius: 8px;
}

.detail-pane {
  padding: 0.72rem;
}

.detail-pane h2 {
  font-size: 1rem;
  margin-bottom: 0.58rem;
}

.compact-summary {
  margin-bottom: 0.65rem;
}

.compact-summary div {
  padding: 0.4rem 0.5rem;
}

.compact-summary dt {
  font-size: 0.7rem;
}

.compact-summary dd {
  font-size: 0.84rem;
}

.billing-rates {
  margin-bottom: 0.65rem;
  padding: 0.52rem;
}

.billing-rates h3 {
  font-size: 0.8rem;
}

.billing-rate-row {
  grid-template-columns: minmax(64px, 1fr) 58px 50px minmax(82px, 1fr) auto;
  gap: 0.24rem;
}

.billing-rate-row strong {
  font-size: 0.72rem;
}

.billing-rate-row input,
.billing-rate-row select,
.billing-rate-row button {
  min-height: 28px;
  padding: 0.24rem 0.4rem;
  font-size: 0.72rem;
}
/* ===== Clients + Reports + Dashboard compact harmonization (Block C, May 2026) ===== */
.module-table--clients header {
  min-height: 38px;
  font-size: 0.66rem;
}

.module-table--clients > a {
  min-height: 44px;
  padding-top: 0.48rem;
  padding-bottom: 0.48rem;
  font-size: 0.84rem;
}

.module-table--clients > a strong {
  font-size: 0.88rem;
  line-height: 1.2;
}

.module-table--clients > a small {
  font-size: 0.72rem;
}

.module-table--clients > a em {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  min-width: 56px;
  border: 1px solid #b7dcea;
  border-radius: 999px;
  padding: 0 0.48rem;
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 760;
  font-style: normal;
  background: #fff;
}

.report-grid {
  gap: 0.72rem;
}

.metric-grid {
  gap: 0.52rem;
}

.metric-card {
  min-height: 84px;
  padding: 0.58rem 0.66rem;
  border-radius: 10px;
}

.metric-card strong {
  font-size: 1.14rem;
}

.metric-card span {
  font-size: 0.8rem;
}

.metric-card small {
  font-size: 0.72rem;
}

.workload-table {
  padding: 0.48rem;
}

.workload-table header,
.workload-row {
  min-height: 38px;
  padding: 0.34rem 0;
}

.workload-table header {
  font-size: 0.66rem;
}

.workload-row {
  font-size: 0.82rem;
}

.workload-row strong {
  font-size: 0.86rem;
}

.workload-row small {
  font-size: 0.72rem;
}

.timeline-row {
  min-height: 40px;
  padding: 0.4rem 0.56rem;
}

.timeline-row strong {
  font-size: 0.84rem;
}

.timeline-row span,
.timeline-row small {
  font-size: 0.74rem;
}

.report-status-card {
  border-radius: 10px;
}

.workflow-item {
  min-height: 40px;
  padding: 0.42rem 0.5rem;
}

.workflow-item__icon {
  min-width: 44px;
  font-size: 0.64rem;
  letter-spacing: 0.04em;
}

.workflow-item__content strong {
  font-size: 0.84rem;
}

.workflow-item__content small,
.workflow-item__owner {
  font-size: 0.72rem;
}

.timeline-item {
  min-height: 44px;
  padding: 0.42rem 0.52rem;
}

.timeline-item__date strong {
  font-size: 0.82rem;
}

.timeline-item__date small,
.timeline-item__body small,
.timeline-item__body em {
  font-size: 0.72rem;
}

.approval-card {
  padding: 0.56rem;
}

.approval-card strong {
  font-size: 0.86rem;
}

.approval-card small {
  font-size: 0.72rem;
}

.approval-actions a {
  min-height: 28px;
  padding: 0.26rem 0.48rem;
  font-size: 0.72rem;
}

.quick-actions-grid a,
.quick-actions-grid button {
  min-height: 42px;
  font-size: 0.84rem;
}
/* ===== Cases + Documents + Case details compact harmonization (Block D, May 2026) ===== */
.modern-list {
  gap: 0.4rem;
}

.modern-row {
  border-radius: 12px;
  padding: 0.58rem 0.68rem;
  gap: 0.56rem;
}

.modern-row:hover {
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.05);
}

.modern-row__main {
  gap: 0.46rem;
}

.modern-row__main strong {
  font-size: 0.9rem;
  line-height: 1.2;
}

.modern-row__main small,
.modern-row__meta span,
.modern-row__meta small,
.modern-row__owner small {
  font-size: 0.74rem;
}

.modern-row__icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
}

.modern-row--case {
  min-height: 74px;
  padding: 0.6rem 0.72rem;
}

.modern-row--case .modern-row__main strong {
  font-size: 0.94rem;
}

.modern-row--case .case-next-step {
  font-size: 0.84rem;
}

.modern-row--case .case-deadline {
  font-size: 0.72rem;
}

.modern-row--case .status-pill {
  min-height: 24px;
  font-size: 0.72rem;
  padding: 0 0.52rem;
}

.modern-row--case .avatar-chip {
  width: 22px;
  height: 22px;
  font-size: 0.62rem;
}

.modern-row--doc {
  min-height: 72px;
  padding: 0.58rem 0.72rem;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr) auto;
}

.modern-row--doc .modern-row__main strong {
  font-size: 0.92rem;
}

.modern-row--doc .modern-row__main small,
.modern-row--doc .modern-row__meta span,
.modern-row--doc .modern-row__meta small {
  font-size: 0.74rem;
}

.modern-row--doc .status-pill {
  min-height: 24px;
  font-size: 0.72rem;
}

.doc-format {
  font-size: 0.68rem;
  padding: 0.14rem 0.42rem;
}

.matter-tabs {
  min-height: 44px;
  gap: 0.22rem;
}

.matter-tabs a,
.matter-tabs button {
  min-height: 30px;
  padding: 0.34rem 0.56rem;
  font-size: 0.8rem;
}

.tab-count {
  min-width: 20px;
  min-height: 18px;
  padding: 0 0.28rem;
  font-size: 0.66rem;
}

.matter-content .workspace-card {
  padding: 0.64rem;
}

.matter-content .workspace-card > header h2 {
  font-size: 0.98rem;
}

.matter-overview-editor > header {
  align-items: flex-start;
  gap: 0.75rem;
}

.matter-overview-editor > header p {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.matter-edit-grid {
  display: grid;
  grid-template-columns:
    minmax(160px, 1fr)
    minmax(130px, 0.8fr)
    minmax(180px, 1.15fr)
    minmax(240px, 1.6fr)
    minmax(190px, 1.15fr);
  gap: 0.72rem;
}

.matter-edit-field--client,
.matter-edit-field--clients {
  grid-column: span 3;
}

.agent-analysis {
  width: 95%;
  margin: 16px auto 24px;
}

.agent-analysis__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
}

.agent-analysis__header span,
.agent-analysis__conversation > header span,
.agent-analysis__field > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.agent-analysis__header h1 {
  margin: 4px 0;
  font-size: 1.75rem;
  letter-spacing: 0;
}

.agent-analysis__header p {
  margin: 0;
  color: var(--muted);
}

.agent-analysis__back {
  color: var(--brand-dark);
  font-weight: 700;
  text-decoration: none;
}

.agent-analysis__workspace {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  align-items: stretch;
  gap: 12px;
}

.agent-analysis-preparation[open] {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0;
  padding: 20px;
  place-items: center;
  border: 0;
  background: rgba(17, 32, 43, 0.42);
}

.agent-analysis-preparation > section {
  position: relative;
  width: min(900px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 22px;
  border: 1px solid #d8e3ea;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 55px rgba(17, 32, 43, 0.2);
}

.agent-analysis-preparation > section > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.agent-analysis-preparation .agent-analysis-preparation__close {
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  min-height: 32px;
  padding: 0;
  place-items: center;
  border: 1px solid #d8e3ea;
  border-radius: 4px;
  color: #52697c;
  background: #fff;
  font-size: 1.25rem;
  line-height: 1;
}

.agent-analysis-preparation.is-failed > section {
  border-color: #eab5b5;
}

.agent-analysis-preparation header span,
.agent-analysis-preparation dt {
  color: #61778b;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.agent-analysis-preparation h2 {
  margin: 3px 0 16px;
  font-size: 1.2rem;
}

.agent-analysis-preparation dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 18px 0;
  border-block: 1px solid #e0e8ed;
}

.agent-analysis-preparation dl div {
  min-width: 0;
  padding: 12px 8px;
}

.agent-analysis-preparation dd {
  margin: 4px 0 0;
  font-weight: 700;
}

.agent-analysis-preparation__progress {
  display: grid;
  gap: 8px;
  margin: -2px 0 16px;
}

.agent-analysis-preparation__progress > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #52697c;
  font-size: 0.82rem;
}

.agent-analysis-preparation__progress strong {
  color: #10233c;
}

.agent-analysis-preparation__progress.is-failed strong,
.agent-analysis-preparation__progress.is-failed span {
  color: #a42222;
}

.agent-analysis-preparation__progress.is-ready strong,
.agent-analysis-preparation__progress.is-ready span {
  color: #147c50;
}

.agent-analysis-preparation__progress-bar {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #e8f0f5;
}

.agent-analysis-preparation__progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0a91a6, #14905e);
  transition: width 0.25s ease;
}

.agent-analysis-preparation__states {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 16px;
  border: 1px solid #dce6ec;
  border-radius: 6px;
  background: #f8fbfc;
}

.agent-analysis-preparation__states > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 10px 12px;
}

.agent-analysis-preparation__states > div + div {
  border-left: 1px solid #dce6ec;
}

.agent-analysis-preparation__states span {
  color: #52697c;
  font-size: 0.76rem;
}

.agent-analysis-preparation__states strong {
  color: #10233c;
  font-size: 1rem;
}

.agent-analysis-preparation__active {
  margin: 0 0 16px;
}

.agent-analysis-preparation__active h3 {
  margin: 0 0 8px;
  color: #10233c;
  font-size: 0.84rem;
}

.agent-analysis-preparation__items {
  overflow: hidden;
  margin: 0;
  border: 1px solid #dce6ec;
  border-radius: 6px;
  background: #fff;
}

.agent-analysis-preparation__items-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 0.72fr) 86px;
  gap: 18px;
  padding: 0 12px 6px;
  color: #61778b;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.agent-analysis-preparation__items-header span:last-child {
  text-align: right;
}

.agent-analysis-preparation__item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 0.72fr) 86px;
  align-items: center;
  gap: 18px;
  min-width: 0;
  padding: 11px 12px;
  background: #fff;
}

.agent-analysis-preparation__item + .agent-analysis-preparation__item {
  border-top: 1px solid #e2e9ee;
}

.agent-analysis-preparation__item-description,
.agent-analysis-preparation__item-progress-cell > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.agent-analysis-preparation__item-description {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.agent-analysis-preparation__item-description strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #10233c;
  font-size: 0.8rem;
  line-height: 1.35;
}

.agent-analysis-preparation__item-status {
  justify-self: end;
  padding: 3px 7px;
  border-radius: 999px;
  color: #17647a;
  background: #dff5fa;
  font-size: 0.68rem;
  white-space: nowrap;
}

.agent-analysis-preparation__item.is-done .agent-analysis-preparation__item-status,
.agent-analysis-preparation__item.is-ready .agent-analysis-preparation__item-status {
  color: #12633f;
  background: #dcf7e8;
}

.agent-analysis-preparation__item.is-failed .agent-analysis-preparation__item-status {
  color: #982727;
  background: #fde4e4;
}

.agent-analysis-preparation__item.is-retrying .agent-analysis-preparation__item-status {
  color: #8a5b0a;
  background: #fff2cf;
}

.agent-analysis-preparation__item-description p,
.agent-analysis-preparation__item-description small {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: #52697c;
  font-size: 0.72rem;
  line-height: 1.35;
}

.agent-analysis-preparation__item-progress-cell small {
  color: #52697c;
  font-size: 0.72rem;
}

.agent-analysis-preparation__item-progress {
  overflow: hidden;
  height: 6px;
  margin-top: 6px;
  border-radius: 999px;
  background: #e5edf2;
}

.agent-analysis-preparation__item-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #0a91a6;
  transition: width 0.25s ease;
}

.agent-analysis-preparation__item-progress.is-indeterminate span {
  width: 32% !important;
  animation: agent-analysis-preparation-progress 1.4s ease-in-out infinite;
}

@keyframes agent-analysis-preparation-progress {
  from { transform: translateX(-110%); }
  to { transform: translateX(320%); }
}

@media (prefers-reduced-motion: reduce) {
  .agent-analysis-preparation__item-progress.is-indeterminate span {
    animation: none;
    transform: translateX(110%);
  }
}

.agent-analysis-preparation__item.is-done .agent-analysis-preparation__item-progress span,
.agent-analysis-preparation__item.is-ready .agent-analysis-preparation__item-progress span {
  background: #14905e;
}

.agent-analysis-preparation__note {
  color: #52697c;
  font-size: 0.82rem;
  line-height: 1.55;
}

.agent-analysis-preparation__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

.agent-analysis-preparation__actions form {
  margin: 0;
}

.agent-analysis-preparation__actions a {
  color: #087e99;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}

.agent-analysis-preparation button {
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: #087e99;
  font-weight: 700;
}

.agent-analysis-preparation button:disabled {
  cursor: default;
  opacity: 0.62;
}

@media (max-width: 720px) {
  .agent-analysis-preparation__states {
    grid-template-columns: 1fr;
  }

  .agent-analysis-preparation__states > div + div {
    border-top: 1px solid #dce6ec;
    border-left: 0;
  }

  .agent-analysis-preparation__items-header {
    display: none;
  }

  .agent-analysis-preparation__item {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 12px;
  }

  .agent-analysis-preparation__item-description {
    grid-column: 1;
  }

  .agent-analysis-preparation__item-progress-cell {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .agent-analysis-preparation__item-status {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
  }
}

.agent-analysis__workspace > [data-agent-analysis-related-inputs] {
  display: none;
}

.agent-analysis__sessions {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.agent-analysis__sessions > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.agent-analysis__sessions h2 {
  margin: 2px 0 0;
  font-size: 1rem;
}

.agent-analysis__sessions > header span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.agent-analysis__sessions > header button,
.agent-analysis__session > div button {
  display: inline-grid;
  width: 30px;
  min-width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.agent-analysis__sessions-body {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.agent-analysis__sessions-body > p {
  margin: 8px 4px;
  color: var(--muted);
  font-size: 0.76rem;
}

.agent-analysis__new-session {
  display: block;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.agent-analysis__sessions-more {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--brand-dark);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.agent-analysis__sessions-more:disabled {
  color: var(--muted);
  cursor: wait;
}

.agent-analysis__sessions nav {
  display: grid;
  gap: 6px;
}

.agent-analysis__session {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-left: 3px solid transparent;
  border-radius: 4px;
  background: var(--surface-soft);
}

.agent-analysis__session.is-active {
  border-left-color: var(--brand);
  background: var(--brand-soft);
}

.agent-analysis__session > a {
  min-width: 0;
  padding: 9px 6px 9px 9px;
  color: var(--text);
  text-decoration: none;
}

.agent-analysis__session > a strong,
.agent-analysis__session > a span {
  display: block;
  min-width: 0;
}

.agent-analysis__session > a strong {
  overflow: hidden;
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-analysis__session > a span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.64rem;
}

.agent-analysis__session > a em {
  float: right;
  font-style: normal;
}

.agent-analysis__session > a em.is-running {
  color: var(--brand-dark);
}

.agent-analysis__session > a em.is-error {
  color: #b42318;
}

.agent-analysis__session > div {
  display: none;
  gap: 3px;
  padding-right: 5px;
}

.agent-analysis__session:hover > div,
.agent-analysis__session:focus-within > div {
  display: flex;
}

.agent-analysis__session > div button {
  width: 24px;
  min-width: 24px;
  height: 24px;
  font-size: 0.74rem;
}

.agent-analysis__workspace.is-sessions-collapsed {
  grid-template-columns: 48px minmax(0, 1fr);
}

.agent-analysis__workspace.is-sessions-collapsed .agent-analysis__sessions > header {
  justify-content: center;
  padding-inline: 8px;
}

.agent-analysis__workspace.is-sessions-collapsed .agent-analysis__sessions > header > div,
.agent-analysis__workspace.is-sessions-collapsed .agent-analysis__sessions-body {
  display: none;
}

.agent-analysis__conversation {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.agent-analysis__conversation > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.agent-analysis__conversation > header strong {
  display: block;
  margin-top: 3px;
}

.agent-analysis__field {
  display: grid;
  gap: 7px;
}

.agent-analysis__field input,
.agent-analysis__field select,
.agent-analysis__composer textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.agent-analysis__field input,
.agent-analysis__field select {
  min-height: 42px;
  padding: 8px 10px;
}

.agent-analysis__toggle {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.agent-analysis__toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.agent-analysis__commands {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.agent-analysis__conversation {
  display: grid;
  grid-template-rows: auto minmax(340px, 1fr) auto;
  height: calc(95dvh - 112px);
  min-height: min(680px, calc(100dvh - 136px));
  overflow: hidden;
}

.agent-analysis__conversation > header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.agent-analysis__conversation-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.agent-analysis__conversation-tools button,
.agent-analysis__detach {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 9px;
  background: var(--surface);
  color: var(--brand-dark);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.agent-analysis__conversation-tools button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.agent-analysis__conversation-tools button.agent-analysis__status {
  border-radius: 999px;
  padding: 5px 9px;
  text-transform: none !important;
}

.agent-analysis__conversation-tools button.agent-analysis__status:disabled {
  opacity: 1;
  cursor: default;
}

.agent-analysis__status.is-success {
  background: #dff7ea;
  color: #166534;
}

.agent-analysis__status.is-running {
  background: #e8f3fb;
  color: #155e75;
}

.agent-analysis__status.is-error,
.agent-analysis__alert.is-error {
  background: #feecec;
  color: #991b1b;
}

.agent-analysis__alert {
  margin: 0 0 16px;
  border-radius: 6px;
  padding: 12px 14px;
}

.agent-analysis__messages {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  padding: 22px 20px;
  scroll-behavior: smooth;
}

.agent-analysis__empty {
  margin: auto;
  color: var(--muted);
}

.agent-analysis__message {
  width: min(82%, 880px);
  min-width: 0;
}

.agent-analysis__message.is-user {
  align-self: flex-end;
  border-radius: 8px;
  padding: 12px 14px;
  background: #eaf8fb;
}

.agent-analysis__message.is-agent {
  align-self: flex-start;
  width: 100%;
}

.agent-analysis__message.is-agent .agent-analysis__message-content {
  width: 100%;
  max-width: none;
}

.agent-analysis__message > details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
  list-style: none;
}

.agent-analysis__message > details > summary::-webkit-details-marker {
  display: none;
}

.agent-analysis__message > details > summary::before {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  content: "";
  transform: rotate(45deg);
}

.agent-analysis__message > details:not([open]) > summary::before {
  transform: rotate(-45deg);
}

.agent-analysis__message > details > summary > span {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.agent-analysis__message > details > summary > span:first-of-type {
  margin-right: auto;
}

.agent-analysis__message > details > summary small,
.agent-analysis__message > details > summary em,
.agent-analysis__message > details > summary time {
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 700;
}

.agent-analysis__message > details > summary em {
  color: #166534;
}

.agent-analysis__message > details:not([open]) > summary {
  margin-bottom: 0;
}

.agent-analysis__message-preview {
  display: none;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-analysis__message > details:not([open]) > summary .agent-analysis__message-preview {
  display: block;
}

.agent-analysis__message-body {
  min-width: 0;
}

.agent-analysis__message-content {
  color: var(--text);
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.agent-analysis__message-content p,
.agent-analysis__message-content h4 {
  margin: 0 0 0.75rem;
}

.agent-analysis__message-content .matter-analysis-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.agent-analysis__message-content .matter-analysis-table {
  width: 100%;
  table-layout: auto;
}

.agent-analysis__message-content .matter-analysis-table th,
.agent-analysis__message-content .matter-analysis-table td {
  overflow-wrap: normal;
  word-break: normal;
}

.agent-analysis__prompt-drop {
  position: relative;
  display: grid;
  border: 1px solid transparent;
  border-radius: 6px;
}

.agent-analysis__prompt-drop textarea {
  width: 100%;
  padding-right: 78px;
}

.agent-analysis__prompt-drop.is-drop-target {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent);
}

.agent-analysis__prompt-drop.is-drop-target::after {
  position: absolute;
  inset: 8px;
  z-index: 2;
  display: grid;
  place-items: center;
  border: 2px dashed var(--brand);
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--brand-dark);
  content: "Upuść pliki tutaj";
  font-size: 0.82rem;
  font-weight: 800;
  pointer-events: none;
}

.agent-analysis__composer .agent-analysis__attach-button {
  position: absolute;
  right: 10px;
  top: 10px;
  width: auto;
  min-width: 0;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  background: var(--surface);
  color: var(--brand-dark);
  font-size: 0.74rem;
}

.agent-analysis__attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 7px 2px 0;
}

.agent-analysis__attachment-list:empty,
.agent-analysis__attachment-feedback:empty {
  display: none;
}

.agent-analysis__attachment-feedback {
  padding: 2px 3px 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.agent-analysis__attachment-feedback.is-error {
  color: #b42318;
}

.agent-analysis__attachment {
  display: inline-grid;
  grid-template-columns: minmax(0, auto) auto auto;
  align-items: center;
  max-width: 100%;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 6px 5px 8px;
  background: var(--surface-soft);
  font-size: 0.74rem;
}

.agent-analysis__attachment strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-analysis__attachment small {
  color: var(--muted);
}

.agent-analysis__composer .agent-analysis__attachment button {
  width: 24px;
  min-width: 24px;
  min-height: 24px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
}

.agent-analysis__message-content button.agent-analysis__inline-citation {
  display: inline;
  width: auto;
  min-width: 0;
  min-height: 0;
  margin: 0 0.05rem;
  border: 0;
  border-bottom: 1px dotted currentColor;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  color: var(--brand-dark);
  font: inherit;
  font-size: 0.9em;
  font-weight: 800;
  line-height: inherit;
  vertical-align: baseline;
  cursor: pointer;
  appearance: none;
}

.agent-analysis__message-content button.agent-analysis__inline-citation:hover,
.agent-analysis__message-content button.agent-analysis__inline-citation:focus-visible {
  background: transparent;
  color: var(--brand);
  outline: 2px solid color-mix(in srgb, var(--brand) 30%, transparent);
  outline-offset: 2px;
}

.agent-analysis__pending {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
  color: var(--muted);
}

.agent-analysis__pending-body {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.agent-analysis__pending p {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin: 0;
}

.agent-analysis__pending strong {
  color: var(--text);
  font-size: 0.86rem;
}

.agent-analysis__pending time {
  color: var(--muted);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.agent-analysis__pending > span {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 2px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: agent-analysis-spin 0.8s linear infinite;
}

.agent-analysis__progress-log {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.agent-analysis__progress-log li {
  display: grid;
  grid-template-columns: 10px 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 0.78rem;
  line-height: 1.35;
}

.agent-analysis__progress-log li::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  content: "";
}

.agent-analysis__progress-log li[data-progress-state="completed"]::before {
  background: var(--success);
}

.agent-analysis__progress-log li[data-progress-state="failed"]::before {
  background: var(--danger);
}

.agent-analysis__progress-log strong {
  color: var(--text);
  font-size: inherit;
}

.agent-analysis__progress-log span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.agent-analysis__progress-log em {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  color: var(--muted);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.agent-analysis__progress-log li[data-progress-state="running"] em {
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
  color: var(--brand);
}

.agent-analysis__progress-log li[data-progress-state="completed"] em {
  border-color: color-mix(in srgb, var(--success) 35%, var(--line));
  color: var(--success);
}

.agent-analysis__progress-log li[data-progress-state="failed"] em {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
  color: var(--danger);
}

@media (max-width: 560px) {
  .agent-analysis__progress-log li {
    grid-template-columns: 10px 54px minmax(0, 1fr);
  }

  .agent-analysis__progress-log em {
    grid-column: 3;
    justify-self: start;
  }
}

@keyframes agent-analysis-spin {
  to { transform: rotate(360deg); }
}

.agent-analysis__legal-verifications {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.agent-analysis__legal-verifications > header {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--brand-dark);
  font-size: 0.86rem;
}

.agent-analysis__legal-verifications > header span {
  min-width: 22px;
  border-radius: 999px;
  padding: 2px 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.agent-analysis__legal-verifications > div {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.agent-analysis__legal-verification {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid #b7791f;
  border-radius: 6px;
  padding: 9px 11px;
  background: #fffbeb;
}

.agent-analysis__legal-verification.is-available {
  border-left-color: #16805b;
  background: #f0fdf4;
}

.agent-analysis__legal-verification.is-available.is-usage-review {
  border-left-color: #b7791f;
  background: #fffbeb;
}

.agent-analysis__legal-verification.is-unavailable {
  border-left-color: #b42318;
  background: #fff5f5;
}

.agent-analysis__legal-verification.is-mention {
  border-left-color: var(--muted);
  background: var(--surface-soft);
}

.agent-analysis__legal-verification.is-mention > em {
  color: var(--muted);
}

.agent-analysis__legal-verification > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.agent-analysis__legal-verification > div span,
.agent-analysis__legal-verification dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.agent-analysis__legal-verification > em {
  color: #92400e;
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 800;
}

.agent-analysis__legal-verification.is-available > em {
  color: #166534;
}

.agent-analysis__legal-verification.is-available.is-usage-review > em {
  color: #92400e;
}

.agent-analysis__legal-verification.is-unavailable > em {
  color: #b42318;
}

.agent-analysis__legal-verification dl {
  display: grid;
  grid-column: 1 / -1;
  gap: 5px;
  margin: 0;
}

.agent-analysis__legal-verification dl > div {
  display: grid;
  grid-template-columns: minmax(120px, 150px) minmax(0, 1fr);
  gap: 12px;
}

.agent-analysis__legal-verification dd {
  margin: 0;
  line-height: 1.4;
}

.agent-analysis__legal-verification-details {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.agent-analysis__legal-verification-details > summary {
  color: var(--brand-dark);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 800;
}

.agent-analysis__legal-verification-details > div {
  display: grid;
  gap: 7px;
  margin-top: 9px;
}

.agent-analysis__legal-verification-details strong {
  font-size: 0.78rem;
}

.agent-analysis__legal-verification-details blockquote {
  margin: 0;
  padding: 8px 10px;
  border-left: 2px solid var(--brand);
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  line-height: 1.5;
  white-space: pre-wrap;
}

.agent-analysis__legal-validity {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.agent-analysis__citations {
  margin-top: 12px;
}

.agent-analysis__citations > summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--brand-dark);
  cursor: pointer;
  font-size: 0.86rem;
  list-style: none;
}

.agent-analysis__citations > summary::-webkit-details-marker {
  display: none;
}

.agent-analysis__citations > summary::before {
  content: "▸";
}

.agent-analysis__citations[open] > summary::before {
  content: "▾";
}

.agent-analysis__citations > summary span {
  min-width: 22px;
  border-radius: 999px;
  padding: 2px 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.agent-analysis__citation-list {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.agent-analysis__citation {
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  background: #f8fafc;
  overflow-wrap: anywhere;
}

.agent-analysis__citation.is-legalbase {
  border-left-color: #16805b;
}

.agent-analysis__citation.is-casefile {
  border-left-color: var(--brand);
}

.agent-analysis__citation.is-attention {
  border-left-color: var(--danger);
}

.agent-analysis__citation > summary {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}

.agent-analysis__citation > summary::-webkit-details-marker {
  display: none;
}

.agent-analysis__citation > summary::before {
  flex: 0 0 auto;
  color: var(--muted);
  content: "▸";
}

.agent-analysis__citation-number {
  flex: 0 0 auto;
  color: var(--brand-dark);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.agent-analysis__citation[open] > summary::before {
  content: "▾";
}

.agent-analysis__citation > summary strong {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.agent-analysis__citation > summary span {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}

.agent-analysis__citation-kind,
.agent-analysis__citation > summary small {
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 600;
  white-space: nowrap;
}

.agent-analysis__citation-content {
  margin-top: 8px;
  padding-left: 18px;
}

.agent-analysis__legal-context {
  display: grid;
  gap: 6px;
  margin: 9px 0 0;
}

.agent-analysis__legal-context > div {
  display: grid;
  grid-template-columns: minmax(120px, 150px) minmax(0, 1fr);
  gap: 12px;
}

.agent-analysis__legal-context dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.agent-analysis__legal-context dd {
  margin: 0;
  line-height: 1.45;
}

.agent-analysis__citations blockquote {
  margin: 8px 0 0;
  padding-left: 9px;
  border-left: 2px solid var(--brand);
  color: var(--text);
  line-height: 1.45;
  white-space: pre-wrap;
}

.agent-analysis__citation-technical {
  margin-top: 8px;
}

.agent-analysis__citation-technical > summary {
  color: var(--brand-dark);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
}

.agent-analysis__citation-technical code {
  display: block;
  max-width: 100%;
  margin-top: 8px;
  overflow-wrap: anywhere;
  color: var(--brand-dark);
  font-size: 0.72rem;
}

.agent-analysis__citation-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start !important;
  gap: 8px !important;
  margin-top: 9px;
}

.agent-analysis__citation-actions button,
.agent-analysis__citation-actions a {
  min-height: 34px;
  border: 1px solid var(--brand-dark);
  border-radius: 6px;
  padding: 7px 10px;
  background: var(--surface);
  color: var(--brand-dark);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.agent-analysis__citation-verification {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.agent-analysis__citation-verification.is-verified {
  border-color: #86d4ae;
  background: #e9f8ef;
  color: #166534;
}

.agent-analysis__artifacts {
  display: grid;
  width: 100%;
  gap: 8px;
  margin-top: 16px;
}

.agent-analysis__artifacts h2 {
  margin: 0;
  font-size: 0.86rem;
  letter-spacing: 0;
}

.agent-analysis__artifacts article {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.agent-analysis__artifacts article:hover,
.agent-analysis__artifacts article:focus-visible {
  border-color: var(--brand);
  background: var(--surface-soft);
  outline: none;
}

.agent-analysis__artifacts article > div {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.agent-analysis__artifacts article > div strong {
  overflow-wrap: anywhere;
}

.agent-analysis__artifacts article > div span,
.agent-analysis__artifacts p {
  color: var(--muted);
  font-size: 0.78rem;
}

.agent-analysis__artifacts p {
  margin: 0;
}

.agent-analysis__artifacts article > button {
  grid-column: 2;
  grid-row: 1 / span 2;
  border: 0;
  border-radius: 6px;
  padding: 8px 12px;
  background: var(--brand-dark);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.agent-analysis__artifact-dialog {
  width: min(520px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
}

.agent-analysis__artifact-dialog::backdrop {
  background: rgb(15 23 42 / 45%);
}

.agent-analysis__artifact-dialog .modal-card {
  display: grid;
  gap: 16px;
  margin: 0;
}

.agent-analysis__artifact-dialog label {
  display: grid;
  gap: 6px;
}

.agent-analysis__artifact-dialog select {
  width: 100%;
}

.agent-analysis__artifact-dialog-status {
  min-height: 1.4em;
  margin: 0;
  color: var(--muted);
}

.agent-analysis__message-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.agent-analysis__message-actions label {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
}

.agent-analysis__message-actions button,
.agent-analysis__synthesis-bar button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  background: var(--surface);
  color: var(--brand-dark);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.agent-analysis__composer {
  display: grid;
  gap: 7px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.agent-analysis__synthesis-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.agent-analysis__synthesis-bar span {
  margin-right: auto;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.agent-analysis__synthesis-bar select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 30px 6px 10px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
}

.agent-analysis__synthesis-bar select option {
  font-family: var(--font-sans);
  font-size: 0.78rem;
}

.agent-analysis__composer > label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.agent-analysis__composer textarea {
  min-height: 92px;
  max-height: 240px;
  padding: 12px;
  resize: vertical;
}

.agent-analysis__composer footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 0.82rem;
}

.agent-analysis__source-preview {
  width: min(1180px, calc(100vw - 32px));
  height: min(900px, calc(100vh - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.3);
}

.agent-analysis__source-preview[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.agent-analysis__source-preview::backdrop {
  background: rgba(15, 23, 42, 0.55);
}

.agent-analysis__source-preview > header,
.agent-analysis__source-preview > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
}

.agent-analysis__source-preview > header {
  border-bottom: 1px solid var(--line);
}

.agent-analysis__source-preview > footer {
  border-top: 1px solid var(--line);
}

.agent-analysis__source-preview > header span,
.agent-analysis__source-preview > header strong {
  display: block;
}

.agent-analysis__source-preview > header span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.agent-analysis__source-preview iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.agent-analysis__source-preview button,
.agent-analysis__source-preview a {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 11px;
  background: var(--surface);
  color: var(--brand-dark);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.agent-analysis__source-preview > header button {
  width: 36px;
  min-width: 36px;
  padding: 0;
  font-size: 1.35rem;
}

.agent-analysis__composer-meta {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.agent-analysis__turn-options {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.agent-analysis__turn-options details {
  position: relative;
}

.agent-analysis__provider-choice {
  display: grid;
  flex: 0 1 258px;
  grid-template-columns: 17px minmax(0, 1fr);
  align-items: flex-start;
  gap: 7px;
  min-width: 190px;
}

.agent-analysis__provider-toggle {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 32px;
  cursor: pointer;
}

.agent-analysis__provider-toggle input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--brand);
}

.agent-analysis__provider-control {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.agent-analysis__citation-verification.is-attention,
.agent-analysis__source-warning {
  color: #b42318;
  background: #fff3f2;
  border-color: #f2b8b5;
  white-space: normal;
}

.agent-analysis__source-warning {
  border-left: 3px solid #b42318;
  padding: 8px 12px;
}

.agent-analysis__provider-control > details {
  max-width: 100%;
  min-width: 0;
  width: 100%;
}

.agent-analysis__provider-control > details > summary {
  box-sizing: border-box;
  width: 100%;
  overflow: hidden;
}

.agent-analysis__provider-control.is-disabled .agent-analysis__provider-limit {
  filter: grayscale(1);
  opacity: 0.45;
}

.agent-analysis__provider-limit {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 0 2px;
}

.agent-analysis__provider-limit > span {
  height: 3px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--line);
}

.agent-analysis__provider-limit i {
  display: block;
  width: 0;
  height: 100%;
  background: #16836f;
  transition: width 180ms ease;
}

.agent-analysis__provider-limit.is-low i {
  background: #b54708;
}

.agent-analysis__provider-limit.is-critical i {
  background: #b42318;
}

.agent-analysis__provider-limit small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.65rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-analysis__patience,
.agent-analysis__cooperation {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.agent-analysis__patience select,
.agent-analysis__cooperation select {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 27px 4px 8px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 500;
}

.agent-analysis__cooperation.is-disabled {
  opacity: 0.45;
}

.agent-analysis__turn-options summary {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  max-width: 230px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 26px 5px 9px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.76rem;
  cursor: pointer;
  list-style: none;
}

.agent-analysis__turn-options summary::-webkit-details-marker {
  display: none;
}

.agent-analysis__turn-options summary::after {
  position: absolute;
  right: 11px;
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  content: "";
  transform: translateY(-2px) rotate(45deg);
}

.agent-analysis__turn-options details[open] summary::after {
  transform: translateY(2px) rotate(225deg);
}

.agent-analysis__turn-options details.is-disabled summary {
  cursor: not-allowed;
  filter: grayscale(1);
  opacity: 0.45;
}

.agent-analysis__turn-options summary strong {
  flex: 0 0 auto;
  font-size: 0.76rem;
}

.agent-analysis__turn-options summary span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-analysis__turn-options-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 20;
  display: grid;
  gap: 9px;
  width: min(310px, calc(100vw - 48px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: var(--surface);
  box-shadow: 0 16px 36px rgba(17, 24, 39, 0.18);
  color: var(--text);
}

.agent-analysis__turn-options-menu .agent-analysis__field {
  gap: 5px;
}

.agent-analysis__turn-options-menu .agent-analysis__field > span {
  font-size: 0.68rem;
}

.agent-analysis__turn-options-menu .agent-analysis__field input,
.agent-analysis__turn-options-menu .agent-analysis__field select {
  min-height: 34px;
  padding: 5px 8px;
  font-size: 0.78rem;
}

.agent-analysis__turn-options-menu .agent-analysis__toggle {
  min-height: 30px;
  gap: 7px;
  font-size: 0.76rem;
}

.agent-analysis__turn-options-menu .agent-analysis__toggle input {
  width: 16px;
  height: 16px;
}

.agent-analysis__composer button {
  min-width: 100px;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: var(--brand-dark);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.agent-analysis__composer button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.agent-analysis__composer .agent-analysis__cancel {
  border: 1px solid #b42318;
  background: var(--surface);
  color: #b42318;
}

.agent-analysis__usage-panel {
  border-top: 1px solid var(--line);
  padding-top: 7px;
}

.agent-analysis__usage-panel > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: 100%;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.76rem;
  list-style: none;
}

.agent-analysis__usage-panel > summary::-webkit-details-marker {
  display: none;
}

.agent-analysis__usage-panel > summary::before {
  content: "▸";
}

.agent-analysis__usage-panel[open] > summary::before {
  content: "▾";
}

.agent-analysis__usage-panel > summary span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-analysis__usage-panel > summary .agent-analysis__access-mode {
  flex-shrink: 0;
}

.agent-analysis__usage {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 8px 0 0;
  background: var(--line);
}

.agent-analysis__usage div {
  min-width: 0;
  padding: 10px;
  background: var(--surface);
}

.agent-analysis__usage dt {
  color: var(--muted);
  font-size: 0.75rem;
}

.agent-analysis__usage dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.agent-analysis__validation {
  color: #991b1b;
  font-size: 0.82rem;
}

.agent-analysis .is-hidden {
  display: none !important;
}

html[data-theme="dark"] .agent-analysis__message.is-user {
  background: #17343c;
}

html[data-theme="dark"] .agent-analysis__citation {
  background: #182126;
}

html[data-theme="dark"] .agent-analysis__legal-verification {
  background: #302715;
}

html[data-theme="dark"] .agent-analysis__legal-verification > em {
  color: var(--text);
}

html[data-theme="dark"] .agent-analysis__legal-verification.is-available {
  background: #173a2a;
}

html[data-theme="dark"] .agent-analysis__legal-verification.is-available.is-usage-review {
  background: #302715;
}

html[data-theme="dark"] .agent-analysis__legal-verification.is-unavailable {
  background: #3b1d1d;
}

html[data-theme="dark"] .agent-analysis__legal-verification.is-mention {
  background: var(--surface-soft);
}

.analysis-template-catalog {
  display: grid;
  align-content: start;
  gap: 18px;
  width: min(1440px, 100%);
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
  box-sizing: border-box;
}

.analysis-template-catalog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 40px;
}

.analysis-template-catalog__header h1,
.analysis-template-catalog__list h2,
.analysis-template-catalog__list p {
  margin: 0;
}

.analysis-template-catalog__list article > div > span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.analysis-template-catalog__list {
  display: grid;
  gap: 8px;
}

.analysis-template-catalog__empty {
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 20px;
  background: color-mix(in srgb, var(--surface) 82%, var(--bg));
  color: var(--muted);
  text-align: center;
}

.analysis-template-catalog__list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.4fr) auto;
  gap: 20px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px;
  background: var(--surface);
}

.analysis-template-catalog__list dl {
  display: grid;
  gap: 4px;
  margin: 0;
}

.analysis-template-catalog__list dl div {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px;
}

.analysis-template-catalog__list dt,
.analysis-template-catalog__list dd {
  margin: 0;
  font-size: 0.78rem;
}

.analysis-template-catalog__list dt {
  color: var(--muted);
}

.analysis-template-catalog__list footer,
.analysis-template-catalog__list footer form {
  display: flex;
  gap: 7px;
}

.analysis-template-catalog__list footer {
  flex-direction: column;
}

.analysis-template-catalog__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.analysis-template-catalog__tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 0.7rem;
}

.analysis-template-editor {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  overflow: hidden;
}

.analysis-template-editor::backdrop {
  background: rgb(15 23 42 / 45%);
}

.analysis-template-editor .modal-card {
  gap: 18px;
  max-height: calc(100dvh - 32px);
  margin: 0;
  padding: 20px;
  overflow: auto;
  box-sizing: border-box;
}

.analysis-template-editor .modal-card > header {
  align-items: flex-start;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 14px;
}

.analysis-template-editor .modal-card > header span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: uppercase;
}

.analysis-template-editor .modal-card > header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.analysis-template-editor .modal-card > header .icon-action {
  flex: 0 0 34px;
  width: 34px;
  min-height: 34px;
  padding: 0;
  cursor: pointer;
}

.analysis-template-editor__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.analysis-template-editor__grid > label,
.analysis-template-editor__field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
}

.analysis-template-editor__grid input,
.analysis-template-editor__grid select,
.analysis-template-editor__grid textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 9px 11px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  line-height: 1.4;
  box-sizing: border-box;
}

.analysis-template-editor__grid input,
.analysis-template-editor__grid select {
  min-height: 40px;
}

.analysis-template-editor__grid textarea {
  resize: vertical;
}

.analysis-template-editor__grid input:focus,
.analysis-template-editor__grid select:focus,
.analysis-template-editor__grid textarea:focus {
  border-color: var(--brand);
  outline: 3px solid color-mix(in srgb, var(--brand) 16%, transparent);
  outline-offset: 0;
}

.analysis-template-editor__native-file {
  position: absolute;
  width: 1px !important;
  height: 1px !important;
  margin: -1px;
  padding: 0 !important;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0 !important;
}

.analysis-template-editor__file-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 5px;
  background: var(--surface);
  cursor: pointer;
  box-sizing: border-box;
}

.analysis-template-editor__file-picker strong {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 10px;
  background: #f8fafc;
  color: var(--brand-dark);
  font-size: 0.74rem;
  font-weight: 750;
}

.analysis-template-editor__file-picker > span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analysis-template-editor__native-file:focus + small,
.analysis-template-editor__field:focus-within .analysis-template-editor__file-picker {
  border-color: var(--brand);
  outline: 3px solid color-mix(in srgb, var(--brand) 16%, transparent);
}

.analysis-template-editor__grid small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
}

.analysis-template-editor__grid .is-wide {
  grid-column: 1 / -1;
}

.analysis-template-editor .modal-card > footer {
  align-items: center;
  border-top: 1px solid var(--line-soft);
  padding-top: 14px;
}

.analysis-template-editor .modal-card > footer button {
  min-height: 38px;
  padding: 7px 13px;
  cursor: pointer;
}

html[data-theme="dark"] .analysis-template-editor__file-picker strong {
  border-color: #35516a;
  background: #183047;
  color: #d7eef8;
}

@media (max-width: 900px) {
  .analysis-template-catalog__list article,
  .analysis-template-editor__grid {
    grid-template-columns: 1fr;
  }

  .analysis-template-editor__grid .is-wide {
    grid-column: auto;
  }
}

html[data-theme="dark"] .agent-analysis__citation-verification.is-verified {
  border-color: #2f7655;
  background: #173a2a;
  color: #a7e7c1;
}

.agent-analysis-detached {
  min-height: 100dvh;
  overflow: hidden;
  background: var(--page);
}

.agent-analysis-detached__header {
  display: flex;
  height: 40px;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid var(--line);
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.72rem;
}

.agent-analysis-detached__header span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-analysis-detached__header a {
  margin-left: auto;
  color: var(--brand-dark);
  font-weight: 700;
  text-decoration: none;
}

.agent-analysis-detached__content {
  height: calc(100dvh - 40px);
}

.agent-analysis-detached .agent-analysis {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 6px;
}

.agent-analysis-detached .agent-analysis__header {
  display: none;
}

.agent-analysis-detached .agent-analysis__workspace,
.agent-analysis-detached .agent-analysis__conversation {
  height: 100%;
  min-height: 0;
}

.agent-analysis-detached .agent-analysis__workspace {
  display: block;
}

.agent-analysis-detached .agent-analysis__conversation {
  border-radius: 4px;
}

@media (max-width: 900px) {
  .agent-analysis {
    width: 95%;
    margin-top: 16px;
  }

  .agent-analysis__header {
    align-items: flex-start;
    flex-direction: column;
  }

  .agent-analysis__conversation {
    height: min(78vh, 760px);
    min-height: 600px;
  }

  .agent-analysis__workspace,
  .agent-analysis__workspace.is-sessions-collapsed {
    grid-template-columns: 1fr;
  }

  .agent-analysis__workspace.is-sessions-collapsed .agent-analysis__sessions {
    display: none;
  }

  .agent-analysis__turn-options {
    flex-wrap: wrap;
  }
}

@media (max-width: 560px) {
  .agent-analysis__message,
  .agent-analysis__message.is-agent {
    width: 100%;
  }

  .agent-analysis__composer footer,
  .agent-analysis__synthesis-bar,
  .agent-analysis__message-actions,
  .agent-analysis__artifacts article > div {
    align-items: flex-start;
    flex-direction: column;
  }

  .agent-analysis__composer button {
    width: 100%;
  }

  .agent-analysis__commands {
    width: 100%;
  }

  .agent-analysis__conversation > header,
  .agent-analysis__conversation-tools {
    align-items: flex-start;
    flex-direction: column;
  }

  .agent-analysis__conversation-tools {
    width: 100%;
  }

  .agent-analysis__conversation-tools button,
  .agent-analysis__detach {
    width: 100%;
  }

  .agent-analysis__message > details > summary {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .agent-analysis__message > details > summary > span:last-child {
    margin-left: 17px;
  }

  .agent-analysis__legal-context > div {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .agent-analysis__legal-verification {
    grid-template-columns: 1fr;
  }

  .agent-analysis__legal-verification > em {
    justify-self: start;
  }

  .agent-analysis__legal-verification dl > div {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .agent-analysis__citation > summary {
    flex-wrap: wrap;
  }

  .agent-analysis__composer-meta {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
  }

  .agent-analysis__turn-options {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr;
  }

  .agent-analysis__provider-choice {
    width: 100%;
    min-width: 0;
  }

  .agent-analysis__provider-control {
    width: 100%;
  }

  .agent-analysis__turn-options summary {
    max-width: none;
  }

  .agent-analysis__patience,
  .agent-analysis__cooperation {
    width: 100%;
  }

  .agent-analysis__patience select,
  .agent-analysis__cooperation select {
    flex: 1 1 auto;
  }

  .agent-analysis__artifacts article {
    grid-template-columns: 1fr;
  }

  .agent-analysis__artifacts article > button {
    grid-column: 1;
    grid-row: auto;
    text-align: center;
  }

  .agent-analysis__usage {
    grid-template-columns: 1fr 1fr;
  }
}

.matter-edit-field--linked-clients {
  grid-column: 1 / -1;
  display: grid;
  gap: 0.3rem;
  min-width: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.matter-linked-clients {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.matter-linked-client {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  padding: 0.38rem 0.55rem;
  background: #f0f9ff;
  color: #0c4a6e;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: none;
}

.matter-linked-client small {
  color: #0369a1;
  font-size: 0.68rem;
  font-weight: 700;
}

.matter-edit-field--analysis,
.matter-edit-actions {
  grid-column: 1 / -1;
}

.matter-edit-grid label {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.matter-edit-grid input,
.matter-edit-grid select,
.matter-edit-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.58rem 0.65rem;
  background: #f8fafc;
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  text-transform: none;
}

.matter-edit-grid textarea {
  resize: vertical;
  line-height: 1.45;
}

.matter-edit-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.matter-edit-actions small {
  color: var(--muted);
}

.matter-edit-actions button {
  border: 1px solid var(--brand);
  border-radius: 6px;
  padding: 0.58rem 0.95rem;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(14, 165, 198, 0.18);
}

.matter-edit-actions button:hover,
.matter-edit-actions button:focus-visible {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  outline: none;
}

.matter-content .timeline-item {
  min-height: 40px;
  padding: 0.38rem 0.5rem;
}

.matter-content .modern-row--compact {
  min-height: 34px;
  padding: 0.36rem 0.5rem;
  border-radius: 9px;
}

.matter-content .modern-row--compact .modern-row__main strong {
  font-size: 0.84rem;
}

.matter-content .modern-row--compact .modern-row__main small {
  font-size: 0.72rem;
}
/* ===== Dashboard + Calendar refinement (Block E, May 2026) ===== */
.page-header--premium h1 {
  font-size: 2rem;
}

.page-header--premium span {
  font-size: 0.95rem;
}

.kpi-grid {
  gap: 0.56rem;
}

.kpi-card {
  min-height: 120px;
  border-radius: 14px;
  padding: 0.64rem 0.74rem;
}

.kpi-card strong {
  font-size: 1.7rem;
}

.kpi-card span {
  font-size: 0.92rem;
}

.kpi-card small,
.kpi-card em {
  font-size: 0.76rem;
}

.kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.dashboard-grid {
  gap: 0.56rem;
}

.workspace-card {
  border-radius: 14px;
  padding: 0.62rem;
}

.workspace-card header h2 {
  font-size: 1rem;
}

.workflow-feed,
.timeline-agenda,
.approval-center,
.quick-actions-grid {
  gap: 0.36rem;
}

.workflow-item {
  min-height: 38px;
  padding: 0.36rem 0.48rem;
}

.workflow-item__icon {
  min-width: 42px;
  font-size: 0.62rem;
}

.workflow-item__content strong {
  font-size: 0.82rem;
}

.workflow-item__content small,
.workflow-item__owner {
  font-size: 0.71rem;
}

.timeline-item {
  min-height: 40px;
  padding: 0.36rem 0.48rem;
  border-left-width: 3px;
}

.timeline-item__date strong {
  font-size: 0.8rem;
}

.timeline-item__date small,
.timeline-item__body small,
.timeline-item__body em {
  font-size: 0.71rem;
}

.timeline-item__body strong {
  font-size: 0.82rem;
}

.approval-card {
  padding: 0.52rem;
  border-radius: 10px;
}

.approval-card strong {
  font-size: 0.84rem;
}

.approval-card small {
  font-size: 0.71rem;
}

.approval-actions a {
  min-height: 28px;
  padding: 0.24rem 0.44rem;
  font-size: 0.71rem;
}

.quick-actions-grid a,
.quick-actions-grid button {
  min-height: 40px;
  border-radius: 11px;
  font-size: 0.82rem;
}

.calendar-legaldesk {
  gap: 0.7rem;
}

.calendar-legaldesk-sidebar,
.calendar-legaldesk-main {
  border-radius: 14px;
}

.calendar-source-panel,
.calendar-legaldesk-board,
.calendar-legaldesk-list {
  border-radius: 12px;
}

.calendar-legaldesk-tools {
  gap: 0.45rem;
}

.calendar-type-switches button,
.calendar-view-buttons button,
.calendar-view-buttons a {
  min-height: 30px;
  font-size: 0.72rem;
  padding: 0.26rem 0.5rem;
}

.calendar-legaldesk-weekdays span {
  min-height: 34px;
  font-size: 0.66rem;
}

.calendar-legaldesk-day {
  min-height: 110px;
  padding: 0.36rem;
}

.calendar-legaldesk-day > strong {
  font-size: 0.74rem;
}

.calendar-legaldesk-event {
  min-height: 24px;
  padding: 0.2rem 0.3rem;
  border-radius: 8px;
}

.calendar-legaldesk-event strong {
  font-size: 0.68rem;
}

.calendar-legaldesk-event span:not(.event-dot) {
  font-size: 0.64rem;
}

.calendar-list-day {
  padding: 0.42rem 0.52rem;
}

.calendar-list-day > strong {
  font-size: 0.78rem;
}

.calendar-event-popover {
  border-radius: 12px;
  padding: 0.62rem;
}

.calendar-event-popover h2 {
  font-size: 0.92rem;
}

.calendar-event-popover dt,
.calendar-event-popover dd,
.calendar-event-popover p,
.calendar-event-popover small {
  font-size: 0.72rem;
}
/* ===== Leads + Team + WorkQueue compact harmonization (Block F, May 2026) ===== */
.work-grid {
  gap: 0.56rem;
}

.work-panel {
  border-radius: 12px;
}

.work-panel header {
  padding: 0.52rem 0.62rem;
}

.work-panel h2 {
  font-size: 0.96rem;
}

.work-row {
  min-height: 38px;
  padding: 0.42rem 0.56rem;
  gap: 0.08rem;
}

.work-row strong {
  font-size: 0.84rem;
  line-height: 1.2;
}

.work-row span,
.work-row small,
.work-row em {
  font-size: 0.72rem;
}

.lead-workspace {
  gap: 0.6rem;
}

.lead-modal-grid {
  gap: 0.7rem;
}

.lead-modal-section {
  padding: 0.72rem;
  border-radius: 10px;
}

.compact-definition-list {
  gap: 0.55rem 0.75rem;
}

.compact-definition-list dt {
  font-size: 0.7rem;
}

.compact-definition-list dd {
  font-size: 0.8rem;
}

.lead-score-strip span,
.evidence-panel span {
  font-size: 0.72rem;
}

.lead-client-match article {
  padding: 0.46rem 0.52rem;
}

.lead-client-match strong {
  font-size: 0.84rem;
}

.lead-client-match span,
.lead-client-match small {
  font-size: 0.72rem;
}

.module-table--team header,
.module-table--team a {
  min-height: 40px;
  padding-top: 0.42rem;
  padding-bottom: 0.42rem;
  font-size: 0.82rem;
}

.module-table--team header {
  font-size: 0.66rem;
}

.module-table--team a strong {
  font-size: 0.86rem;
}

.module-table--team a small,
.module-table--team a span {
  font-size: 0.72rem;
}

.team-control-pane {
  padding: 0.7rem;
}

.team-side-section {
  margin-bottom: 0.58rem;
  padding: 0.5rem;
  border-radius: 10px;
}

.team-side-section header h3 {
  font-size: 0.84rem;
}

.compact-register {
  gap: 0.42rem;
}

.compact-register div {
  padding: 0.42rem 0.5rem;
}

.compact-register dt {
  font-size: 0.78rem;
}

.compact-register dd {
  font-size: 0.72rem;
}

.absence-wizard {
  gap: 0.75rem;
}

.wizard-steps {
  gap: 0.3rem;
}

.wizard-steps button {
  min-height: 30px;
  font-size: 0.74rem;
  padding: 0.24rem 0.44rem;
}

.wizard-panel {
  padding: 0.62rem;
}

.wizard-note {
  font-size: 0.74rem;
}

.wizard-collision-list div,
.wizard-collision-list em {
  padding: 0.36rem 0.42rem;
}

.wizard-collision-list strong {
  font-size: 0.8rem;
}

.wizard-collision-list span,
.wizard-collision-list small {
  font-size: 0.72rem;
}
/* ===== Admin + Integrations compact harmonization (Block G, May 2026) ===== */
.module-table--admin header {
  min-height: 38px;
  font-size: 0.66rem;
  letter-spacing: 0.06em;
}

.module-table--admin > a,
.module-table--admin .module-table-row {
  min-height: 42px;
  padding-top: 0.42rem;
  padding-bottom: 0.42rem;
  font-size: 0.82rem;
}

.module-table--admin > a strong,
.module-table--admin .module-table-row strong {
  font-size: 0.86rem;
  line-height: 1.2;
}

.module-table--admin > a span,
.module-table--admin .module-table-row > span,
.module-table--admin > a small,
.module-table--admin .module-table-row small {
  font-size: 0.72rem;
}

.admin-tabs {
  min-height: 44px;
  gap: 0.22rem;
}

.admin-tabs a {
  min-height: 30px;
  padding: 0.34rem 0.56rem;
  font-size: 0.8rem;
}

.admin-tabs strong {
  min-width: 20px;
  min-height: 18px;
  padding: 0 0.28rem;
  font-size: 0.66rem;
}

.admin-summary-strip {
  gap: 0.42rem;
}

.admin-summary-strip div {
  padding: 0.5rem 0.56rem;
  border-radius: 10px;
}

.admin-summary-strip dt {
  font-size: 0.68rem;
}

.admin-summary-strip dd {
  font-size: 1.02rem;
}

.settings-grid {
  gap: 0.55rem;
}

.settings-grid label {
  gap: 0.24rem;
}

.settings-grid input,
.settings-grid select,
.settings-grid textarea {
  min-height: 34px;
  font-size: 0.8rem;
  padding: 0.34rem 0.48rem;
}

.admin-danger-grid {
  gap: 0.52rem;
}

.admin-danger-card {
  border-radius: 12px;
  padding: 0.62rem;
}

.admin-danger-card h3 {
  font-size: 1rem;
}

.admin-danger-card > p,
.admin-reset-list span,
.admin-confirm-form label span,
.demo-load-summary dt {
  font-size: 0.74rem;
}

.admin-reset-list div,
.demo-load-summary div {
  padding: 0.38rem 0.46rem;
}

.admin-reset-list strong,
.demo-load-summary dd {
  font-size: 0.84rem;
}

.audit-strip {
  gap: 0.55rem;
}

.audit-filters {
  gap: 0.4rem;
}

.audit-filters label span {
  font-size: 0.72rem;
}

.audit-row {
  min-height: 40px;
  padding: 0.4rem 0.5rem;
}

.audit-row strong {
  font-size: 0.84rem;
}

.audit-row span,
.audit-row small {
  font-size: 0.72rem;
}

.audit-module-pill,
.audit-severity {
  min-height: 22px;
  font-size: 0.68rem;
  padding: 0.16rem 0.42rem;
}

.module-filters button {
  min-height: 30px;
  font-size: 0.74rem;
  padding: 0.24rem 0.5rem;
}
/* ===== Cross-module interaction quality pass (Block H, May 2026) ===== */
.module-table > a,
.module-table-row,
.modern-row,
.workflow-item,
.timeline-item,
.work-row,
.invoice-row,
.activity-grid-row,
.workload-row,
.audit-row {
  transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.module-table > a:focus-visible,
.module-table-row:focus-visible,
.modern-row:focus-visible,
.workflow-item:focus-visible,
.timeline-item:focus-visible,
.work-row:focus-visible,
.invoice-row:focus-within,
.activity-grid-row:focus-within,
.workload-row:focus-visible,
.audit-row:focus-within {
  outline: 2px solid rgba(8, 145, 178, 0.45);
  outline-offset: 2px;
  border-color: #86c9db;
}

.module-table > a:hover,
.module-table-row:hover,
.work-row:hover,
.invoice-row:hover,
.activity-grid-row:hover,
.workload-row:hover,
.audit-row:hover {
  background: #f9fcff;
}

.status-pill,
.status-chip {
  letter-spacing: 0.01em;
}

.status-pill {
  border-width: 1px;
}

.row-actions--compact button,
.row-actions--compact a,
.invoice-row button,
.invoice-row > a,
.quick-actions-grid a,
.quick-actions-grid button,
.approval-actions a,
.work-panel header a,
.workspace-card header a {
  transition: border-color 0.14s ease, background-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.row-actions--compact button:hover,
.row-actions--compact a:hover,
.invoice-row button:hover,
.invoice-row > a:hover,
.quick-actions-grid a:hover,
.quick-actions-grid button:hover,
.approval-actions a:hover,
.work-panel header a:hover,
.workspace-card header a:hover {
  border-color: #7ec8da;
  box-shadow: 0 2px 6px rgba(14, 116, 144, 0.12);
}

.registry-search,
.activity-search,
.task-search-group input,
.calendar-search input,
.module-shell input[type="search"] {
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.registry-search:focus,
.activity-search:focus,
.task-search-group input:focus,
.calendar-search input:focus,
.module-shell input[type="search"]:focus {
  border-color: #74bfd4;
  box-shadow: 0 0 0 2px rgba(8, 145, 178, 0.14);
  outline: none;
}

.registry-tabs button,
.activity-filter-strip button,
.calendar-type-switches button,
.calendar-view-buttons button,
.calendar-view-buttons a,
.module-filters button,
.admin-tabs a,
.case-tabs a,
.matter-tabs a {
  transition: border-color 0.14s ease, background-color 0.14s ease, color 0.14s ease;
}

.registry-tabs button:focus-visible,
.activity-filter-strip button:focus-visible,
.calendar-type-switches button:focus-visible,
.calendar-view-buttons button:focus-visible,
.calendar-view-buttons a:focus-visible,
.module-filters button:focus-visible,
.admin-tabs a:focus-visible,
.case-tabs a:focus-visible,
.matter-tabs a:focus-visible {
  outline: 2px solid rgba(8, 145, 178, 0.32);
  outline-offset: 1px;
}

.module-table > a strong,
.module-table-row strong,
.modern-row__main strong,
.workflow-item__content strong,
.timeline-item__body strong,
.work-row strong,
.workload-row strong,
.audit-row strong {
  color: #0f2440;
}

.module-table > a small,
.module-table-row small,
.modern-row__main small,
.modern-row__meta small,
.workflow-item__content small,
.workflow-item__owner,
.timeline-item__body small,
.timeline-item__body em,
.work-row small,
.work-row span,
.audit-row small,
.audit-row span {
  color: #5d6f83;
}
/* ===== Desktop scale tuning (Block I, May 2026) ===== */
@media (min-width: 1280px) and (max-width: 1599px) {
  :root {
    --font-size-base: 13px;
  }

  .topbar {
    min-height: 64px;
    padding: 0.44rem 0.7rem;
  }

  .topbar-search {
    max-width: 560px;
  }

  .workspace-header {
    padding-top: 0.72rem;
    padding-bottom: 0.52rem;
  }

  .workspace-header h1 {
    font-size: 2rem;
  }

  .workspace-card,
  .module-table,
  .work-panel,
  .detail-pane,
  .calendar-legaldesk-sidebar,
  .calendar-legaldesk-main {
    border-radius: 12px;
  }

  .module-table header,
  .module-table > a,
  .module-table-row,
  .modern-row,
  .workflow-item,
  .timeline-item,
  .work-row,
  .invoice-row,
  .activity-grid-row,
  .workload-row,
  .audit-row {
    min-height: 38px;
  }

  .kpi-card {
    min-height: 108px;
  }

  .kpi-card strong {
    font-size: 1.56rem;
  }

  .calendar-legaldesk-day {
    min-height: 100px;
  }
}
/* ===== Cases/Documents/Correspondence polish (Block H, May 2026) ===== */
.modern-list--cases .modern-row--case {
  min-height: 68px;
  border-radius: 10px;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) auto;
}

.modern-list--cases .modern-row--case .modern-row__main strong {
  font-size: 0.85rem;
}

.modern-list--cases .modern-row--case .modern-row__meta {
  gap: 0.08rem;
  border-left: 1px solid var(--line-soft);
  padding-left: 0.6rem;
}

.modern-list--cases .modern-row__owner small {
  font-size: 0.7rem;
  white-space: nowrap;
}

.modern-list--documents .modern-row--doc {
  min-height: 62px;
  border-radius: 10px;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.05fr) auto;
}

.modern-list--documents .modern-row--doc .modern-row__main strong {
  font-size: 0.88rem;
}

.modern-list--documents .modern-row--doc .modern-row__main small,
.modern-list--documents .modern-row--doc .modern-row__meta span,
.modern-list--documents .modern-row--doc .modern-row__meta small {
  font-size: 0.71rem;
}

.modern-list--documents .modern-row--doc .modern-row__meta {
  border-left: 1px solid var(--line-soft);
  padding-left: 0.58rem;
}

.modern-list--documents .doc-meta-line {
  display: block;
  line-height: 1.22;
  font-size: 0.71rem;
}

.modern-list--documents .doc-meta-line strong {
  font-size: 0.69rem;
  color: var(--muted);
  font-weight: 600;
}

.modern-list--documents .doc-format {
  font-size: 0.64rem;
}

.correspondence-detail-modal {
  overflow-x: hidden;
}

.correspondence-detail-modal .lead-modal-grid {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1fr) minmax(0, 1.05fr);
}

.correspondence-detail-modal .lead-modal-section {
  min-width: 0;
}

.correspondence-detail-modal .correspondence-modal-actions,
.correspondence-detail-modal .button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.correspondence-detail-modal .button-row .inline-form {
  min-width: 0;
}

.legal-drafts-panel {
  display: grid;
  gap: 1rem;
}

.legal-draft-row {
  grid-template-columns: minmax(0, 1.4fr) minmax(180px, 0.7fr) auto;
  align-items: center;
  cursor: pointer;
}

.legal-draft-row:focus-visible,
.template-library-row:focus-visible {
  outline: 3px solid rgba(8, 145, 178, 0.24);
  outline-offset: 2px;
}

.legal-draft-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.legal-draft-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid #7dd3fc;
  border-radius: 10px;
  background: #eefbff;
  color: #075985;
  padding: 0.75rem 0.9rem;
}

.legal-draft-dialog {
  width: 90vw;
  max-width: calc(100vw - 2rem);
}

.legal-draft-modal {
  overflow-x: hidden;
  width: 100%;
  max-width: none;
  max-height: calc(100vh - 2rem);
  padding: 1rem;
}

.legal-draft-modal .modal-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.legal-draft-modal label,
.legal-draft-modal textarea,
.legal-draft-modal select,
.legal-draft-modal input {
  min-width: 0;
}

.legal-draft-modal .form-warning {
  margin: 0;
  color: #9a3412;
  font-size: 0.9rem;
  font-weight: 700;
}

.legal-draft-preview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(340px, 0.95fr);
  align-items: start;
  gap: 1rem;
  min-height: min(74vh, 820px);
}

.legal-draft-preview-shell {
  display: grid;
  gap: 0.5rem;
  grid-row: span 3;
  min-width: 0;
}

.legal-draft-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.legal-draft-preview-grid iframe {
  width: 100%;
  min-height: min(72vh, 780px);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.legal-draft-editor {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}

.legal-draft-editor label {
  display: grid;
  gap: 0.35rem;
  margin: 0;
}

.legal-draft-editor input,
.legal-draft-editor select,
.legal-draft-editor textarea {
  width: 100%;
}

.legal-draft-editor textarea {
  min-height: 220px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.84rem;
  line-height: 1.45;
  resize: vertical;
}

.legal-draft-editor details {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  background: #fff;
}

.legal-draft-editor summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--ink);
}

.legal-draft-html-editor .html-template-surface {
  min-height: clamp(260px, 42vh, 620px);
}

.templates-library,
.templates-library__panel,
.template-category,
.template-edit-modal {
  display: grid;
  gap: 1rem;
}

.templates-library__panel > header,
.template-category h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.template-category h3 span {
  border-radius: 999px;
  background: var(--soft-blue);
  color: var(--brand-dark);
  padding: 0.1rem 0.45rem;
  font-size: 0.78rem;
}

.template-library-row {
  grid-template-columns: minmax(0, 1.4fr) minmax(160px, 0.45fr) auto;
  cursor: pointer;
}

.template-library-row .modern-row__side {
  gap: 0.45rem;
}

.template-action-button {
  min-height: 2rem;
  padding: 0.4rem 0.7rem;
}

.template-edit-modal footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.html-template-editor {
  display: grid;
  gap: 0;
  min-width: 0;
}

.html-template-editor > header {
  display: grid;
  gap: 0.45rem;
  border: 0;
  background: transparent;
  padding: 0;
}

.html-template-editor > header > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.html-template-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-start;
  align-items: center;
  border: 1px solid #d8e3ef;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #f8fbff;
  padding: 0.5rem 0.55rem;
}

.html-template-toolbar__group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex: 0 0 auto;
  min-width: 0;
  align-items: center;
}

.modal-card .html-template-toolbar button,
.html-template-toolbar button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid #cfe0ef;
  border-radius: 6px;
  background: #fff;
  color: #1f2a44;
  width: auto;
  max-width: none;
  min-width: 1.95rem;
  min-height: 1.75rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 800;
  font-family: inherit;
  line-height: 1.1;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.modal-card .html-template-toolbar button:hover,
.modal-card .html-template-toolbar button:focus-visible,
.modal-card .html-template-toolbar button.is-active,
.html-template-toolbar button:hover,
.html-template-toolbar button:focus-visible,
.html-template-toolbar button.is-active {
  border-color: #0891b2;
  background: #e8f8fc;
  color: #075985;
  box-shadow: 0 0 0 1px rgba(8, 145, 178, 0.12);
}

.modal-card .html-template-toolbar button:disabled,
.html-template-toolbar button:disabled {
  border-color: #d8e3ef;
  background: #f8fafc;
  color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
}

.html-template-surface {
  min-height: clamp(260px, 34vh, 520px);
  overflow: auto;
  border: 1px solid #d8e3ef;
  border-top-color: #d8e3ef;
  border-radius: 0 0 10px 10px;
  background: #fff;
  color: #111827;
  padding: clamp(1rem, 1.7vw, 1.65rem);
  line-height: 1.6;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.03);
  white-space: normal;
  word-break: break-word;
}

.html-template-surface:focus {
  border-color: #0891b2;
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.14);
}

.html-template-surface:empty::before {
  content: attr(data-placeholder);
  color: #7890aa;
  font-weight: 700;
  pointer-events: none;
}

.html-template-surface h1,
.html-template-surface h2,
.html-template-surface h3 {
  margin: 0.8rem 0 0.45rem;
  color: #111827;
}

.html-template-surface p {
  margin: 0 0 0.7rem;
}

textarea.html-template-source {
  width: 100%;
  min-height: clamp(260px, 34vh, 520px);
  overflow: auto;
  border: 1px solid #d8e3ef;
  border-radius: 0 0 10px 10px;
  background: #fff;
  color: #111827;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  padding: clamp(1rem, 1.7vw, 1.65rem);
  resize: vertical;
  outline: none;
}

textarea.html-template-source:focus {
  border-color: #0891b2;
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.14);
}

.html-template-editor.is-html-mode .html-template-surface {
  display: none;
}

.html-template-editor.is-html-mode textarea.html-template-source {
  display: block;
}

.template-archive {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
}

.template-archive-form {
  margin: 0 1.25rem 1.25rem;
}

@media (max-width: 1360px) {
  .modal--wide,
  .modal-card--wide {
    width: min(92vw, 980px);
  }

  .legal-draft-dialog {
    width: 94vw;
  }

  .legal-draft-modal {
    width: 100%;
  }

  .correspondence-detail-modal .lead-modal-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .correspondence-detail-modal .lead-modal-section--wide {
    grid-column: 1 / -1;
  }

  .legal-draft-preview-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .legal-draft-preview-shell {
    grid-row: auto;
  }
}

@media (max-width: 1024px) {
  .modern-list--cases .modern-row--case,
  .modern-list--documents .modern-row--doc {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .modern-list--cases .modern-row--case .modern-row__meta,
  .modern-list--documents .modern-row--doc .modern-row__meta {
    border-left: 0;
    padding-left: 0;
  }
}
/* ===== Matter tabs compact register (Block I, May 2026) ===== */
.matter-content .modern-list {
  gap: 0.28rem;
}

.matter-content .modern-row,
.matter-content .workflow-item,
.matter-content .timeline-item {
  min-height: 34px;
  border-radius: 8px;
  padding: 0.32rem 0.46rem;
}

.matter-content .modern-row__main strong,
.matter-content .workflow-item__content strong,
.matter-content .timeline-item__body strong {
  font-size: 0.82rem;
  line-height: 1.2;
}

.matter-content .modern-row__main small,
.matter-content .modern-row__meta span,
.matter-content .modern-row__meta small,
.matter-content .workflow-item__content small,
.matter-content .workflow-item__owner,
.matter-content .timeline-item__date small,
.matter-content .timeline-item__body small {
  font-size: 0.7rem;
}

.matter-content .workflow-item__icon,
.matter-content .timeline-item__date {
  min-width: 44px;
}

.matter-content .status-pill {
  min-height: 20px;
  font-size: 0.68rem;
  padding: 0 0.45rem;
}

.matter-tabs .tab-count {
  margin-left: 0.2rem;
}
/* ===== Documents row quick actions (Block J, May 2026) ===== */
.modern-list--documents .modern-row__side {
  align-items: flex-end;
  gap: 0.2rem;
}

.doc-row-action {
  min-height: 20px;
  min-width: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbfe;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.35rem;
}

.doc-row-action:hover,
.doc-row-action:focus-visible {
  border-color: rgba(8, 145, 178, 0.35);
  color: var(--brand-dark);
  background: #eef8fc;
}
/* ===== Correspondence register compact pass (Block K, May 2026) ===== */
.module-table--correspondence header {
  min-height: 34px;
  font-size: 0.62rem;
  letter-spacing: 0.07em;
}

.module-table--correspondence .module-table-row {
  min-height: 36px;
  padding-top: 0.34rem;
  padding-bottom: 0.34rem;
  border-bottom: 1px solid #edf2f7;
}

.module-table--correspondence .module-table-row > span,
.module-table--correspondence .module-table-row strong,
.module-table--correspondence .module-table-row small {
  font-size: 0.72rem;
  line-height: 1.22;
}

.module-table--correspondence .module-table-row strong {
  font-size: 0.8rem;
}

.module-table--correspondence .status-pill {
  min-height: 20px;
  font-size: 0.67rem;
}

.module-table--correspondence .row-actions--compact button {
  min-height: 22px;
  font-size: 0.68rem;
  padding: 0 0.42rem;
}

.correspondence-process-note {
  gap: 0.22rem;
}

.correspondence-process-note strong {
  font-size: 0.76rem;
}

.correspondence-process-note span {
  min-height: 22px;
  font-size: 0.68rem;
}
/* ===== Clients + Reports + Calendar consistency pass (Block L, May 2026) ===== */
.module-table--clients header {
  min-height: 34px;
  font-size: 0.62rem;
  letter-spacing: 0.07em;
}

.module-table--clients > a {
  min-height: 38px;
  padding-top: 0.36rem;
  padding-bottom: 0.36rem;
  border-bottom: 1px solid #edf2f7;
}

.module-table--clients > a strong {
  font-size: 0.82rem;
}

.module-table--clients > a span,
.module-table--clients > a small,
.module-table--clients > a em {
  font-size: 0.71rem;
  line-height: 1.2;
}

.action-link-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 0 0.42rem;
  border-radius: 999px;
  border: 1px solid rgba(8, 145, 178, 0.3);
  color: var(--brand-dark);
  background: #edf8fc;
  font-style: normal;
  font-weight: 600;
}

.report-grid .workspace-section {
  padding: 0.56rem;
  border-radius: 12px;
}

.report-grid .workspace-section > header h2 {
  font-size: 0.94rem;
}

.report-grid .workspace-section > header a {
  min-height: 24px;
  font-size: 0.72rem;
}

.metric-grid {
  gap: 0.4rem;
}

.metric-card {
  min-height: 88px;
  padding: 0.54rem;
  border-radius: 10px;
}

.metric-card strong {
  font-size: 1.16rem;
}

.metric-card span {
  font-size: 0.79rem;
}

.metric-card small {
  font-size: 0.7rem;
}

.workload-table header {
  min-height: 32px;
  font-size: 0.62rem;
}

.workload-row {
  min-height: 36px;
  padding-top: 0.34rem;
  padding-bottom: 0.34rem;
}

.workload-row strong {
  font-size: 0.8rem;
}

.workload-row span,
.workload-row small {
  font-size: 0.71rem;
}

.calendar-legaldesk-sidebar {
  border-radius: 12px;
  padding: 0.5rem;
}

.calendar-source-option,
.calendar-list-day {
  min-height: 34px;
  border-radius: 8px;
}

.calendar-legaldesk-event strong {
  font-size: 0.78rem;
}

.calendar-legaldesk-event span {
  font-size: 0.69rem;
}

.calendar-legaldesk-event {
  min-height: 28px;
  padding: 0.24rem 0.34rem;
  border-radius: 8px;
}

.calendar-legaldesk-tools {
  padding: 0.36rem;
  border-radius: 10px;
}

.calendar-type-switches button,
.calendar-view-buttons button,
.calendar-view-buttons a {
  min-height: 24px;
  font-size: 0.69rem;
}
/* ===== Billing + Activities compact pass (Block M, May 2026) ===== */
.module-table--costs header {
  min-height: 34px;
  font-size: 0.62rem;
  letter-spacing: 0.07em;
}

.module-table--costs > a {
  min-height: 36px;
  padding-top: 0.32rem;
  padding-bottom: 0.32rem;
}

.module-table--costs > a strong {
  font-size: 0.8rem;
}

.module-table--costs > a span,
.module-table--costs > a small {
  font-size: 0.71rem;
}

.module-table--costs .inline-form select {
  min-height: 24px;
  font-size: 0.69rem;
}

.module-shell--billing {
  grid-template-columns: minmax(0, 1fr);
}

.module-shell--billing .module-table--costs {
  width: 100%;
}

.module-table--costs > .module-table-row {
  color: var(--text);
  text-decoration: none;
}

.module-table--costs header,
.module-table--costs > .module-table-row {
  grid-template-columns: 92px minmax(120px, 0.8fr) minmax(130px, 0.85fr) minmax(240px, 2fr) 100px 90px minmax(190px, 0.9fr);
}

.module-table--costs > .module-table-row > span:last-child {
  overflow: visible;
}

.module-table--costs .inline-form select {
  min-width: 180px;
  font-size: 0.76rem;
}

.detail-pane {
  border-radius: 12px;
  padding: 0.6rem;
}

.detail-pane h2 {
  font-size: 0.96rem;
  margin-bottom: 0.38rem;
}

.detail-pane .compact-summary dd {
  font-size: 0.84rem;
}

.billing-rate-row {
  min-height: 30px;
  gap: 0.32rem;
}

.billing-rate-row strong {
  font-size: 0.74rem;
}

.billing-rate-row input,
.billing-rate-row select,
.billing-rate-row button {
  min-height: 24px;
  font-size: 0.69rem;
}

.invoice-row {
  min-height: 34px;
  padding-top: 0.32rem;
  padding-bottom: 0.32rem;
}

.invoice-row strong,
.invoice-row em {
  font-size: 0.78rem;
}

.invoice-row span,
.invoice-row small {
  font-size: 0.69rem;
}

.activity-grid-header {
  min-height: 32px;
  font-size: 0.62rem;
  letter-spacing: 0.07em;
}

.activity-grid-row {
  min-height: 34px;
  padding-top: 0.28rem;
  padding-bottom: 0.28rem;
}

.activity-grid-row > span,
.activity-grid-row > a {
  font-size: 0.72rem;
}

.activity-description strong {
  font-size: 0.8rem;
}

.activity-description small {
  font-size: 0.69rem;
}

.activities-inbox h2 {
  font-size: 0.9rem;
}

.activity-inbox-card {
  min-height: 56px;
  border-radius: 10px;
  padding: 0.42rem 0.5rem;
}

.activity-inbox-card strong {
  font-size: 0.79rem;
}

.activity-inbox-card p,
.activity-inbox-card footer span {
  font-size: 0.68rem;
}.detail-pane-note {
  margin: 0.38rem 0 0.52rem;
  font-size: 0.71rem;
  line-height: 1.32;
  color: var(--muted);
}
/* ===== Cases/Documents/Correspondence final alignment (Block N, May 2026) ===== */
.modern-list--cases .modern-row--case .modern-row__side {
  align-items: flex-end;
  gap: 0.3rem;
  min-width: 170px;
}

.modern-list--cases .modern-row--case .status-pill {
  font-weight: 700;
}

.modern-list--cases .modern-row--case .modern-row__owner {
  gap: 0.24rem;
}

.modern-list--cases .modern-row--case:hover {
  border-color: rgba(8, 145, 178, 0.25);
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.modern-list--documents .modern-row--doc:hover {
  border-color: rgba(8, 145, 178, 0.22);
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.modern-list--documents .modern-row__side {
  align-items: flex-end;
  gap: 0.26rem;
}

.doc-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.doc-row-action {
  min-height: 20px;
  min-width: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbfe;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1;
  padding: 0 0.35rem;
}

button.doc-row-action {
  cursor: pointer;
}

button.doc-row-action:hover,
button.doc-row-action:focus-visible {
  border-color: rgba(8, 145, 178, 0.35);
  color: var(--brand-dark);
  background: #eef8fc;
}

.module-table--correspondence .module-table-row {
  grid-template-columns: 0.7fr 0.9fr 0.95fr 1.7fr 0.8fr 0.5fr;
}

.module-table--correspondence .module-table-row > span:nth-child(4) {
  font-size: 0.75rem;
}

.module-table--correspondence .module-table-row > span:nth-child(4) small {
  color: #718096;
}

.module-table--correspondence .module-table-row > span:nth-child(3) small a,
.module-table--correspondence .module-table-row > span:nth-child(4) small a {
  color: var(--brand-dark);
  font-weight: 600;
}

.module-table--correspondence .module-table-row:hover {
  background: #fcfeff;
  border-color: rgba(8, 145, 178, 0.22);
}
/* ===== Tasks kanban compact pass (Block O, May 2026) ===== */
.task-workspace {
  gap: 0.5rem;
}

.task-toolbar {
  padding: 0.42rem 0.5rem;
  border-radius: 10px;
}

.task-search-group input {
  min-height: 28px;
  font-size: 0.74rem;
}

.task-view-actions {
  gap: 0.2rem;
  font-size: 0.7rem;
}

.task-view-actions > button {
  min-width: 24px;
  min-height: 24px;
}

@media (max-width: 1200px) {
  .matter-edit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .matter-edit-field--client {
    grid-column: span 2;
  }

  .matter-edit-field--clients {
    grid-column: span 2;
  }
}

.kanban-board {
  gap: 0.34rem;
  grid-template-columns: repeat(4, minmax(198px, 1fr));
}

.kanban-column {
  min-height: 58vh;
  border-radius: 9px;
}

.kanban-column header {
  min-height: 30px;
  padding: 0.34rem 0.44rem;
}

.kanban-column h2 {
  font-size: 0.72rem;
  letter-spacing: 0.03em;
}

.kanban-column header span {
  min-width: 24px;
  min-height: 18px;
  font-size: 0.64rem;
}

.kanban-dropzone {
  min-height: 54vh;
  padding: 0.24rem;
}

.task-card {
  min-height: 74px;
  margin-bottom: 0.28rem;
  padding: 0.34rem 0.38rem;
  border-radius: 8px;
}

.task-card__top strong {
  font-size: 0.78rem;
}

.task-card span,
.task-card small,
.task-date {
  font-size: 0.68rem;
  line-height: 1.2;
}

.task-card em {
  width: 16px;
  height: 16px;
  font-size: 0.52rem;
}
/* ===== Dashboard + Reports + Calendar final polish (Block P, May 2026) ===== */
.page-header--premium {
  padding: 0.72rem 0.82rem;
  border-radius: 14px;
}

.page-header--premium p {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}

.page-header--premium h1 {
  font-size: 2.05rem;
  margin: 0.15rem 0 0.25rem;
}

.page-header--premium span {
  font-size: 0.84rem;
}

.kpi-card {
  min-height: 110px;
  border-radius: 12px;
  padding: 0.58rem 0.68rem;
}

.kpi-card strong {
  font-size: 1.48rem;
}

.kpi-card span {
  font-size: 0.83rem;
}

.kpi-card small,
.kpi-card em {
  font-size: 0.7rem;
}

.kpi-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 0.68rem;
}

.workflow-item {
  min-height: 34px;
  padding: 0.32rem 0.44rem;
  border-radius: 8px;
}

.workflow-item__icon {
  min-width: 38px;
  font-size: 0.58rem;
}

.workflow-item__content strong {
  font-size: 0.78rem;
}

.workflow-item__content small,
.workflow-item__owner {
  font-size: 0.69rem;
}

.timeline-agenda .timeline-item {
  min-height: 34px;
  border-radius: 8px;
  padding: 0.3rem 0.42rem;
}

.timeline-item__date strong {
  font-size: 0.76rem;
}

.timeline-item__date small,
.timeline-item__body small,
.timeline-item__body em {
  font-size: 0.67rem;
}

.timeline-item__body strong {
  font-size: 0.78rem;
}

.approval-card {
  padding: 0.44rem;
  border-radius: 8px;
}

.approval-card strong {
  font-size: 0.79rem;
}

.approval-card small {
  font-size: 0.69rem;
}

.approval-actions a {
  min-height: 24px;
  padding: 0.2rem 0.42rem;
  font-size: 0.68rem;
}

.quick-actions-grid a,
.quick-actions-grid button {
  min-height: 34px;
  font-size: 0.74rem;
}

.report-status-grid--compact {
  gap: 0.28rem;
}

.report-status-card--compact {
  min-height: 34px;
  padding: 0.34rem 0.44rem;
  border-radius: 9px;
}

.report-status-card--compact strong {
  font-size: 0.78rem;
}

.report-status-card--compact span,
.report-status-card--compact small {
  font-size: 0.68rem;
}

.report-stream-row {
  min-height: 34px;
  padding: 0.32rem 0.42rem;
  border-radius: 8px;
}

.report-stream-row strong {
  font-size: 0.78rem;
}

.report-stream-row span,
.report-stream-row small {
  font-size: 0.68rem;
}

.calendar-type-switches button,
.calendar-view-buttons button,
.calendar-view-buttons a,
.calendar-nav-button,
.calendar-period-picker__toggle {
  min-height: 26px;
  font-size: 0.84rem;
  font-weight: 800;
}

.calendar-nav-button {
  font-size: 0.92rem;
  color: #64748b;
}

.calendar-today-link {
  min-height: 30px;
  font-size: 0.84rem;
}

.calendar-search input {
  min-height: 28px;
  font-size: 0.72rem;
}

.calendar-source-panel details > summary {
  min-height: 26px;
  font-size: 0.73rem;
}

.calendar-source-option strong {
  font-size: 0.72rem;
}

.calendar-source-option button {
  min-height: 20px;
  font-size: 0.66rem;
}
/* ===== Billing queue + Activities registry alignment (Block Q, May 2026) ===== */
.invoice-queue {
  margin: 0.45rem;
  border-radius: 9px;
  border: 1px solid #dce7f2;
  background: #fff;
}

.invoice-queue > header {
  min-height: 34px;
  padding: 0.34rem 0.48rem;
  border-bottom: 1px solid #e8f0f6;
}

.invoice-queue h2 {
  font-size: 0.8rem;
}

.invoice-queue > header span,
.invoice-actions strong {
  font-size: 0.68rem;
}

.invoice-row {
  border-bottom: 1px solid #edf2f7;
}

.invoice-row:last-child {
  border-bottom: 0;
}

.invoice-row .status-pill {
  min-height: 20px;
  font-size: 0.66rem;
  font-style: normal;
}

.invoice-row button,
.invoice-row > a {
  min-height: 24px;
  font-size: 0.67rem;
  border-radius: 7px;
}

.activities-inbox,
.activities-register {
  border-radius: 12px;
}

.activity-filter-strip {
  min-height: 34px;
  padding: 0.24rem;
  border-radius: 9px;
  border: 1px solid #dce7f2;
  background: #fff;
}

.activity-filter-strip button {
  min-height: 24px;
  font-size: 0.68rem;
}

.activity-register-tools button {
  min-height: 22px;
  font-size: 0.66rem;
}

.activity-group-hint {
  min-height: 30px;
  border-radius: 8px;
  font-size: 0.69rem;
}

.activities-register-top {
  border-radius: 10px;
  padding: 0.36rem 0.46rem;
}
.modern-list--tasks {
  margin-top: 0.34rem;
  padding: 0.26rem;
  border: 1px solid #dce7f2;
  border-radius: 10px;
  background: #fff;
}

.modern-list--tasks .modern-row--compact {
  min-height: 32px;
  position: relative;
  overflow: visible;
}

.modern-list--tasks .modern-row__main {
  grid-template-columns: minmax(0, 1fr);
}

.modern-list--tasks .modern-row__main a {
  color: inherit;
  text-decoration: none;
}

.modern-list--tasks .modern-row__main a:hover {
  color: var(--brand);
}

.modern-list--tasks .modern-row__side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.34rem;
}

.modern-list--tasks .task-menu-button {
  width: 30px;
  min-height: 28px;
  border-radius: 8px;
  border: 1px solid #d7e3ef;
  background: #f8fafc;
}

.modern-list--tasks .task-add-child-button {
  min-width: 30px;
  min-height: 28px;
}

.modern-list--tasks .task-context-menu--list {
  top: 2.15rem;
  right: 0.45rem;
  text-align: left;
}
/* ===== Mobile cards for costs/correspondence (Block R, May 2026) ===== */
@media (max-width: 900px) {
  .module-table--correspondence,
  .module-table--costs {
    overflow: hidden;
  }

  .module-table--correspondence > header,
  .module-table--costs > header {
    display: none;
  }

  .module-table--correspondence .module-table-row,
  .module-table--costs > a {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.18rem;
    align-items: start;
    min-height: auto;
    padding: 0.48rem;
    border-radius: 10px;
    margin: 0.3rem;
    border: 1px solid #e3ebf3;
    background: #fff;
  }

  .module-table--correspondence .module-table-row > span,
  .module-table--correspondence .module-table-row > strong,
  .module-table--costs > a > span,
  .module-table--costs > a > strong {
    min-width: 0;
    white-space: normal;
  }

  .module-table--correspondence .row-actions,
  .module-table--costs .inline-form {
    justify-content: flex-start;
  }

  .module-table--costs .inline-form select,
  .module-table--correspondence .row-actions--compact button {
    min-height: 24px;
    font-size: 0.68rem;
  }

  .invoice-queue {
    margin: 0.34rem;
  }

  .invoice-row {
    grid-template-columns: 1fr;
    gap: 0.22rem;
    align-items: start;
  }

  .detail-pane {
    margin-top: 0.34rem;
  }
}
@media (max-width: 1100px) {
  .modern-list--tasks {
    margin-top: 0.22rem;
    padding: 0.2rem;
  }

  .modern-list--tasks .modern-row--compact {
    min-height: 30px;
    padding: 0.28rem 0.36rem;
  }

  .modern-list--tasks .modern-row__main strong {
    font-size: 0.76rem;
  }

  .modern-list--tasks .modern-row__main small,
  .modern-list--tasks .modern-row__meta span,
  .modern-list--tasks .modern-row__meta small {
    font-size: 0.66rem;
  }
}

/* Final pass: case task focus and denser registry rows */
.task-focus-banner {
  margin: 0;
  font-size: 0.72rem;
  color: var(--soft);
}

.modern-list--tasks .modern-row--task-focus {
  border-color: rgba(34, 150, 184, 0.45);
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.08), rgba(255, 255, 255, 0.98));
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.18);
}

.modern-list--cases .modern-row--case,
.modern-list--documents .modern-row--doc {
  min-height: 58px;
  padding-block: 0.58rem;
}

.modern-list--cases .modern-row--case .modern-row__main strong,
.modern-list--documents .modern-row--doc .modern-row__main strong {
  font-size: 0.84rem;
  line-height: 1.2;
}

.modern-list--cases .modern-row--case .modern-row__meta,
.modern-list--documents .modern-row--doc .modern-row__meta {
  gap: 0.1rem;
}

.modern-list--cases .modern-row--case .modern-row__meta span,
.modern-list--cases .modern-row--case .modern-row__meta small,
.modern-list--documents .modern-row--doc .modern-row__meta span,
.modern-list--documents .modern-row--doc .modern-row__meta small,
.modern-list--cases .modern-row--case .modern-row__main small,
.modern-list--documents .modern-row--doc .modern-row__main small {
  font-size: 0.72rem;
  line-height: 1.2;
}

/* Correspondence modal overflow hardening */
.modal-card--wide.correspondence-detail-modal {
  width: min(96vw, 1120px);
  max-width: 1120px;
  overflow-x: clip;
}

.correspondence-detail-modal .lead-modal-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  align-items: start;
}

.correspondence-detail-modal .lead-modal-section,
.correspondence-detail-modal .lead-modal-section * {
  min-width: 0;
}

.correspondence-detail-modal .correspondence-modal-actions a,
.correspondence-detail-modal .button-row .inline-form button,
.correspondence-detail-modal .button-row .inline-form span {
  white-space: nowrap;
}

@media (max-width: 1280px) {
  .modal-card--wide.correspondence-detail-modal {
    width: min(96vw, 980px);
  }

  .correspondence-detail-modal .lead-modal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .correspondence-detail-modal .lead-modal-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Registry tables compact pass: correspondence/clients/team/costs */
.module-table--registry,
.module-table--team,
.module-table--costs {
  border-radius: 12px;
  overflow: hidden;
}

.module-table--registry > header,
.module-table--team > header,
.module-table--costs > header {
  min-height: 34px;
  padding-block: 0.42rem;
  font-size: 0.64rem;
  letter-spacing: 0.06em;
}

.module-table--registry .module-table-row,
.module-table--team .module-table-row,
.module-table--costs .module-table-row {
  min-height: 38px;
  padding-block: 0.4rem;
  align-items: center;
}

.module-table--registry .module-table-row > span,
.module-table--registry .module-table-row > strong,
.module-table--registry .module-table-row small,
.module-table--team .module-table-row > span,
.module-table--team .module-table-row > strong,
.module-table--team .module-table-row small,
.module-table--costs .module-table-row > span,
.module-table--costs .module-table-row > strong,
.module-table--costs .module-table-row small {
  font-size: 0.73rem;
  line-height: 1.22;
}

.module-table--registry .module-table-row strong,
.module-table--team .module-table-row strong,
.module-table--costs .module-table-row strong {
  font-size: 0.82rem;
  font-weight: 700;
}

.module-table--registry .status-pill,
.module-table--team .status-pill,
.module-table--costs .status-pill {
  min-height: 20px;
  font-size: 0.67rem;
  padding-inline: 0.45rem;
}

.module-table--registry .row-actions--compact button,
.module-table--team .row-actions--compact button,
.module-table--costs .row-actions--compact button {
  min-height: 23px;
  font-size: 0.68rem;
  padding-inline: 0.46rem;
}

.module-table--registry .module-table-row:hover,
.module-table--team .module-table-row:hover,
.module-table--costs .module-table-row:hover {
  background: #fbfdff;
}

/* Correspondence modal action layout stabilization */
.correspondence-detail-dialog {
  width: min(1180px, calc(100vw - 3rem));
  max-width: calc(100vw - 3rem);
  overflow: visible;
}

.correspondence-detail-dialog .modal-card--wide.correspondence-detail-modal {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  max-height: calc(100vh - 3rem);
  overflow-x: hidden;
  overflow-y: auto;
}

.correspondence-detail-dialog .lead-modal-grid {
  grid-template-columns: minmax(260px, 0.85fr) minmax(300px, 1fr) minmax(280px, 0.95fr);
  gap: 0.75rem;
}

.correspondence-detail-modal .correspondence-modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  gap: 0.4rem;
}

.correspondence-detail-modal .correspondence-modal-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0.38rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f8fbfe;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}

.correspondence-detail-modal .button-row {
  margin-top: 0.45rem;
  align-items: stretch;
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 0.4rem;
}

.correspondence-detail-modal .button-row .inline-form {
  min-width: 0;
}

.correspondence-detail-modal .button-row .inline-form button,
.correspondence-detail-modal .button-row .inline-form label {
  width: 100%;
  justify-content: center;
  min-height: 30px;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1180px) {
  .correspondence-detail-dialog {
    width: min(980px, calc(100vw - 2rem));
    max-width: calc(100vw - 2rem);
  }

  .correspondence-detail-dialog .lead-modal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .correspondence-detail-dialog .lead-modal-section--wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .correspondence-detail-dialog {
    width: calc(100vw - 1rem);
    max-width: calc(100vw - 1rem);
  }

  .correspondence-detail-dialog .modal-card--wide.correspondence-detail-modal {
    max-height: calc(100vh - 1rem);
  }

  .correspondence-detail-dialog .lead-modal-grid,
  .correspondence-detail-modal .correspondence-modal-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .correspondence-detail-modal .button-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Team and costs selector alignment (real markup targets) */
.module-table--team .team-row {
  min-height: 38px;
  padding-block: 0.4rem;
  align-items: center;
}

.module-table--team .team-row strong {
  font-size: 0.82rem;
}

.module-table--team .team-row small,
.module-table--team .team-row span {
  font-size: 0.73rem;
  line-height: 1.22;
}

.module-table--costs > a {
  min-height: 38px;
  padding-block: 0.4rem;
}

.module-table--costs > a > strong {
  font-size: 0.82rem;
}

.module-table--costs > a > span,
.module-table--costs > a small {
  font-size: 0.73rem;
  line-height: 1.22;
}

/* Section counters in case detail cards */
.section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.45rem;
  height: 1.2rem;
  margin-left: 0.34rem;
  padding: 0 0.34rem;
  border-radius: 999px;
  border: 1px solid #cfe3ef;
  background: #f2f9fd;
  color: var(--brand-dark);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}

/* Final compacting: invoice queue + team side registries */
.invoice-queue {
  border-radius: 12px;
}

.invoice-queue > header {
  min-height: 36px;
  padding: 0.5rem 0.62rem;
}

.invoice-queue h2 {
  font-size: 0.9rem;
  letter-spacing: 0.01em;
}

.invoice-row {
  min-height: 44px;
  padding: 0.42rem 0.62rem;
  gap: 0.48rem;
}

.invoice-row strong,
.invoice-row em {
  font-size: 0.8rem;
  line-height: 1.22;
}

.invoice-row span,
.invoice-row small {
  font-size: 0.71rem;
  line-height: 1.2;
}

.invoice-row .status-pill {
  min-height: 20px;
  font-size: 0.66rem;
}

.invoice-row button,
.invoice-row > a {
  min-height: 24px;
  font-size: 0.68rem;
  padding-inline: 0.5rem;
}

.team-side-section {
  border-radius: 10px;
}

.team-side-section header h3 {
  font-size: 0.82rem;
}

.compact-register {
  gap: 0.2rem;
}

.compact-register div {
  padding: 0.34rem 0.4rem;
  border-radius: 8px;
}

.compact-register dt {
  font-size: 0.76rem;
  line-height: 1.2;
}

.compact-register dd {
  font-size: 0.7rem;
  line-height: 1.18;
}

/* Desktop FHD compact pass for registry pages */
@media (min-width: 1200px) {
  .module-page {
    gap: 0.62rem;
  }

  .module-page .page-header {
    min-height: 82px;
    padding: 0.58rem 0.72rem;
    border-radius: 12px;
  }

  .module-page .page-header h1 {
    font-size: 2.02rem;
    line-height: 1.06;
  }

  .registry-modern {
    gap: 0.46rem;
  }

  .registry-modern__toolbar {
    min-height: 72px;
    padding: 0.5rem 0.62rem;
  }

  .registry-modern__controls,
  .registry-toolbar {
    min-height: 52px;
    padding: 0.4rem 0.54rem;
    border-radius: 10px;
  }

  .registry-modern__chips button,
  .registry-tabs button {
    min-height: 28px;
    font-size: 0.73rem;
    padding-inline: 0.54rem;
  }

  .registry-search {
    min-height: 32px;
    font-size: 0.76rem;
  }
}

/* Excel-like list heads for cases/documents */
.modern-list-head {
  display: grid;
  align-items: center;
  min-height: 28px;
  padding: 0 0.64rem;
  margin: 0.08rem 0 0.14rem;
  border: 1px solid #e7edf5;
  border-radius: 8px;
  background: #f8fbff;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.modern-list-head--cases,
.modern-list-head--documents {
  grid-template-columns: 1.35fr 1fr 0.78fr;
}

.modern-list-head span:last-child {
  justify-self: end;
}

@media (max-width: 1024px) {
  .modern-list-head {
    display: none;
  }
}

.case-listing {
  --case-listing-blue: #0b93b8;
  --case-listing-blue-soft: #e3f8fe;
  --case-listing-line: #d8e5f0;
  --case-listing-soft: #f7fafd;
  --case-listing-muted: #63758b;
  --case-listing-green: #22b981;
  --case-listing-green-soft: #ddfbf0;
  --case-listing-amber: #b56a00;
  --case-listing-amber-soft: #fff3d7;
  --case-listing-red: #dc2626;
  --case-listing-red-soft: #fee2e2;
  --case-listing-title-size: 0.86rem;
  --case-listing-strong-size: 0.78rem;
  --case-listing-body-size: 0.68rem;
  --case-listing-chip-size: 0.66rem;
  gap: 0.78rem;
}

.case-listing-icons {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.case-listing svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.case-listing-card,
.case-listing-table {
  border: 1px solid var(--case-listing-line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(16, 42, 67, 0.06);
}

.case-listing-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
}

.case-listing-controls {
  display: flex;
  align-items: center;
  gap: 0.68rem;
  flex-wrap: wrap;
  padding: 0.78rem 1rem;
}

.case-listing-search {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: min(360px, 100%);
  min-height: 42px;
  border: 1px solid var(--case-listing-line);
  border-radius: 12px;
  background: #f8fbfe;
  color: #7c8ea4;
  padding: 0 0.82rem;
}

.case-listing-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 650;
}

.case-listing-search input::placeholder {
  color: #7c8ea4;
}

.case-listing .registry-modern__chips {
  flex: 1 1 auto;
  align-items: center;
}

.case-listing .registry-modern__chips button {
  min-height: 30px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 850;
}

.case-listing-owner-filter {
  min-width: 220px;
  min-height: 42px;
  border: 1px solid var(--case-listing-line);
  border-radius: 12px;
  background: #fff;
  color: #31425a;
  padding: 0 0.8rem;
  font: inherit;
  font-weight: 800;
}

.case-listing-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.72rem 1rem;
  border: 1px solid var(--case-listing-line);
  border-radius: 12px;
  background: #fff;
  color: var(--case-listing-muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.case-listing-pagination p {
  margin: 0;
}

.case-listing-pagination > div {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.case-listing-page-link {
  display: inline-grid;
  min-width: 32px;
  min-height: 32px;
  place-items: center;
  padding: 0 0.62rem;
  border: 1px solid var(--case-listing-line);
  border-radius: 8px;
  background: #fff;
  color: #31425a;
  text-decoration: none;
}

.case-listing-page-link:hover,
.case-listing-page-link:focus,
.case-listing-page-link.is-active {
  border-color: var(--case-listing-blue);
  background: #eaf4ff;
  color: var(--case-listing-blue);
}

.case-listing-page-link.is-disabled {
  pointer-events: none;
  opacity: 0.45;
}

.case-listing-table {
  overflow: hidden;
}

.case-listing-head,
.case-listing-row {
  display: grid;
  grid-template-columns:
    minmax(360px, 1.8fr)
    minmax(190px, 0.76fr)
    minmax(160px, 0.58fr)
    minmax(112px, 0.42fr);
  gap: 1rem;
  align-items: center;
}

.case-listing-head {
  min-height: 38px;
  padding: 0 1.15rem 0 1.75rem;
  background: var(--case-listing-soft);
  color: var(--case-listing-muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.case-listing-head span:last-child {
  justify-self: end;
}

.case-listing-row {
  position: relative;
  min-height: 68px;
  padding: 0.58rem 1.05rem 0.58rem 1.65rem;
  border-top: 1px solid #e7eff7;
  color: var(--text);
  text-decoration: none;
  background: #fff;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.case-listing-row:hover,
.case-listing-row:focus {
  background: #fbfeff;
  border-color: #cfe5ef;
}

.case-listing-strip {
  position: absolute;
  left: 0;
  top: 0.58rem;
  bottom: 0.58rem;
  width: 5px;
  border-radius: 0 4px 4px 0;
  background: var(--case-listing-green);
}

.case-listing-row.is-priority-high .case-listing-strip {
  background: var(--case-listing-red);
}

.case-listing-main,
.case-listing-owner {
  display: flex;
  align-items: center;
  gap: 0.68rem;
  min-width: 0;
}

.case-listing-folder {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid #d6e8ff;
  border-radius: 10px;
  background: #eaf4ff;
  color: #2d6cdf;
  flex: 0 0 auto;
}

.case-listing-folder svg {
  width: 18px;
  height: 18px;
}

.case-listing-main-text,
.case-listing-owner div {
  min-width: 0;
}

.case-listing-title,
.case-listing-owner strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-listing-title {
  font-size: var(--case-listing-title-size);
  letter-spacing: 0;
}

.case-listing-subline {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  margin-top: 0.28rem;
  color: var(--case-listing-muted);
  font-size: var(--case-listing-body-size);
  white-space: nowrap;
  overflow: hidden;
}

.case-listing-reference,
.case-listing-tag {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 180px;
  overflow: hidden;
  border: 1px solid var(--case-listing-line);
  border-radius: 999px;
  background: #f2f7fc;
  color: #4e6278;
  font-weight: 800;
  line-height: 1;
  font-size: var(--case-listing-chip-size);
  padding: 0.2rem 0.46rem;
  text-overflow: ellipsis;
}

.case-listing-reference {
  border-color: #cfe2ff;
  background: #eef6ff;
  color: #2451a6;
}

.case-listing-client {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.case-listing-client svg {
  width: 15px;
  height: 15px;
}

.case-listing .case-listing-client--missing {
  color: var(--case-listing-client-missing, #b91c1c);
  font-weight: 700;
}

html[data-theme="dark"] .case-listing .case-listing-client--missing {
  color: var(--case-listing-client-missing-dark, #fca5a5);
}

@media (forced-colors: active) {
  .case-listing .case-listing-client--missing { color: MarkText; }
}

.case-listing-avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid #cfe2ff;
  border-radius: 999px;
  background: #e9f2ff;
  color: #1e4dd8;
  font-size: 0.62rem;
  font-weight: 950;
  flex: 0 0 auto;
}

.case-listing-owner strong {
  font-size: var(--case-listing-strong-size);
}

.case-listing-owner small {
  display: block;
  margin-top: 0.12rem;
  color: var(--case-listing-muted);
  font-size: var(--case-listing-body-size);
  font-weight: 700;
}

.case-listing-metrics {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.38rem 0.72rem;
  min-width: 0;
  color: #31425a;
  font-size: var(--case-listing-body-size);
  font-weight: 850;
}

.case-listing-metrics span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.case-listing-metrics svg {
  width: 16px;
  height: 16px;
  color: var(--case-listing-muted);
}

.case-listing-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  min-width: 0;
}

.case-listing-priority {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border: 1px solid #a7efd2;
  border-radius: 999px;
  background: var(--case-listing-green-soft);
  color: var(--case-listing-green);
  font-size: var(--case-listing-chip-size);
  font-weight: 950;
  line-height: 1;
  padding: 0 0.58rem;
  white-space: nowrap;
}

.case-listing-priority--high {
  border-color: #fecaca;
  background: var(--case-listing-red-soft);
  color: var(--case-listing-red);
}

.case-listing-more {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  color: #7c8ea4;
}

.case-listing-row:hover .case-listing-more,
.case-listing-row:focus .case-listing-more {
  background: #f2f7fc;
  color: #31425a;
}

.case-listing-table .empty-state {
  margin: 0;
  border-top: 1px solid #e7eff7;
  border-radius: 0;
}

@media (max-width: 1280px) {
  .case-listing-head,
  .case-listing-row {
    grid-template-columns:
      minmax(320px, 1.65fr)
      minmax(210px, 1fr)
      minmax(170px, 0.72fr)
      minmax(100px, 0.38fr);
    gap: 0.75rem;
  }
}

@media (max-width: 1120px) {
  .case-listing-head {
    display: none;
  }

  .case-listing-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.58rem;
    min-height: 0;
    padding: 0.9rem 1rem 0.9rem 1.45rem;
  }

  .case-listing-owner,
  .case-listing-metrics,
  .case-listing-side {
    padding-left: 48px;
  }

  .case-listing-side {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .case-listing-toolbar,
  .case-listing-controls {
    align-items: stretch;
    border-radius: 14px;
  }

  .case-listing-toolbar {
    display: grid;
  }

  .case-listing-search,
  .case-listing-owner-filter {
    width: 100%;
    min-width: 0;
  }

  .case-listing-pagination {
    align-items: flex-start;
    flex-direction: column;
  }

  .case-listing-pagination > div {
    max-width: 100%;
    flex-wrap: wrap;
  }

  .case-listing .registry-modern__chips {
    flex: 1 1 100%;
  }

  .case-listing-subline {
    flex-wrap: wrap;
    white-space: normal;
  }
}

html[data-theme="dark"] .case-listing-card,
html[data-theme="dark"] .case-listing-table,
html[data-theme="dark"] .case-listing-row,
html[data-theme="dark"] .case-listing-pagination,
html[data-theme="dark"] .case-listing-page-link {
  background: #0e1a24;
  border-color: rgba(148, 163, 184, 0.24);
  color: #eef6ff;
}

html[data-theme="dark"] .case-listing-head {
  background: #132231;
  color: #9fb0c3;
}

html[data-theme="dark"] .case-listing-row {
  border-top-color: rgba(148, 163, 184, 0.2);
}

html[data-theme="dark"] .case-listing-row:hover,
html[data-theme="dark"] .case-listing-row:focus {
  background: #132231;
}

html[data-theme="dark"] .case-listing-title,
html[data-theme="dark"] .case-listing-owner strong {
  color: #f8fbff;
}

html[data-theme="dark"] .case-listing-search,
html[data-theme="dark"] .case-listing-owner-filter,
html[data-theme="dark"] .case-listing-tag,
html[data-theme="dark"] .case-listing-more:hover {
  background: #0b1721;
  border-color: rgba(148, 163, 184, 0.28);
  color: #e6f2ff;
}

html[data-theme="dark"] .case-listing-search input {
  color: #e6f2ff;
}

html[data-theme="dark"] .case-listing-subline,
html[data-theme="dark"] .case-listing-owner small,
html[data-theme="dark"] .case-listing-metrics,
html[data-theme="dark"] .case-listing-client {
  color: #9fb0c3;
}

html[data-theme="dark"] .case-listing-reference {
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(96, 165, 250, 0.32);
  color: #bfdbfe;
}

/* Case details: enforce stable 3-column rhythm like Cases list */
.matter-content .modern-row--doc,
.matter-content .modern-row--team-member,
.matter-content .modern-row--compact {
  grid-template-columns: minmax(0, 1.28fr) minmax(0, 1fr) auto;
  column-gap: 0.72rem;
  align-items: center;
}

.matter-content .modern-list--matter-activities .modern-row--matter-activity {
  grid-template-columns: minmax(0, 1fr) 12rem 17rem;
  align-items: start;
}

.matter-content .modern-row--doc .modern-row__meta,
.matter-content .modern-row--team-member .modern-row__meta,
.matter-content .modern-row--compact .modern-row__meta {
  border-left: 1px solid #e6edf6;
  padding-left: 0.66rem;
  margin-left: 0.06rem;
}

.matter-content .modern-row--doc .modern-row__side,
.matter-content .modern-row--team-member .modern-row__side,
.matter-content .modern-row--compact .modern-row__side {
  justify-self: end;
  align-items: flex-end;
  text-align: right;
}

.matter-content .modern-row--team-member .modern-row__main {
  display: flex;
  align-items: center;
  gap: 0.52rem;
}

.matter-content .modern-row--team-member .modern-row__main > div small,
.matter-content .modern-row--doc .modern-row__main small,
.matter-content .modern-row--compact .modern-row__main small {
  display: block;
  margin-top: 0.06rem;
}

@media (max-width: 1024px) {
  .matter-content .modern-row--doc,
  .matter-content .modern-row--team-member,
  .matter-content .modern-row--compact {
    grid-template-columns: 1fr;
    row-gap: 0.24rem;
  }

  .matter-content .modern-list--matter-activities .modern-row--matter-activity {
    grid-template-columns: minmax(0, 1fr);
  }

  .matter-content .modern-row--doc .modern-row__meta,
  .matter-content .modern-row--team-member .modern-row__meta,
  .matter-content .modern-row--compact .modern-row__meta {
    border-left: 0;
    padding-left: 0;
    margin-left: 0;
  }

  .matter-content .modern-row--doc .modern-row__side,
  .matter-content .modern-row--team-member .modern-row__side,
  .matter-content .modern-row--compact .modern-row__side {
    justify-self: start;
    align-items: flex-start;
    text-align: left;
  }
}





.topbar-search-hints a:hover,
.topbar-search-hints a:focus {
  background: rgba(8, 145, 178, 0.16);
  color: #0b5e73;
}


.dashboard--mockup-card .page-header--premium {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dashboard-grid--mockup {
  grid-template-columns: 1.2fr 0.9fr 0.85fr;
  align-items: start;
}

.dashboard-side-stack {
  display: grid;
  gap: 0.8rem;
}

.workspace-card--calendar .mini-agenda {
  display: grid;
  gap: 0.55rem;
}

.workspace-card--calendar .mini-agenda a {
  display: grid;
  gap: 0.16rem;
  border: 1px solid #e9f0f7;
  border-radius: 12px;
  padding: 0.55rem 0.65rem;
}

.workspace-card--calendar .mini-agenda a small {
  color: #64748b;
}

.dashboard-grid--mockup-secondary {
  grid-template-columns: 1fr 1fr 1fr;
}

.workspace-card--documents .documents-feed {
  display: grid;
  gap: 0.45rem;
}

.documents-feed__row {
  display: grid;
  gap: 0.1rem;
  border: 1px solid #e7eef6;
  border-radius: 12px;
  padding: 0.55rem 0.65rem;
}

.documents-feed__row small {
  color: #64748b;
}

@media (max-width: 1400px) {
  .dashboard-grid--mockup {
    grid-template-columns: 1fr;
  }

  .dashboard-grid--mockup-secondary {
    grid-template-columns: 1fr;
  }
}

/* Dashboard mockup polish overrides */
.dashboard--mockup-card .kpi-card {
  background: linear-gradient(180deg, #ffffff 0%, #f9fcff 100%);
}

.dashboard--mockup-card .kpi-icon {
  font-weight: 800;
  letter-spacing: 0.04em;
}

.dashboard--mockup-card .status-pill.is-danger {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}

.dashboard--mockup-card .status-pill.is-warning {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.dashboard--mockup-card .status-pill.is-success {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}

.dashboard--mockup-card .status-pill.is-info {
  background: #e0f2fe;
  color: #0c4a6e;
  border-color: #bae6fd;
}

.dashboard--mockup-card .documents-feed__row--empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.24rem;
  background: #f8fbff;
  line-height: 1.35;
}

.dashboard--mockup-card .documents-feed__row--empty strong,
.dashboard--mockup-card .documents-feed__row--empty small {
  display: block;
  width: 100%;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

.dashboard--mockup-card .documents-feed__row--empty strong {
  font-size: 0.9rem;
}

.dashboard--mockup-card .documents-feed__row--empty small {
  font-size: 0.78rem;
}

/* Case details alignment fix: team + documents rows */
.matter-team-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.matter-team-toolbar .registry-search {
  min-width: min(320px, 100%);
}

.matter-team-toolbar button {
  min-height: 36px;
  border: 1px solid rgba(14, 165, 196, 0.28);
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 900;
  padding: 0 0.82rem;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(14, 165, 196, 0.16);
}

.matter-team-toolbar button.secondary-action {
  background: #fff;
  color: var(--brand-dark);
  box-shadow: none;
}

.matter-team-toolbar button:hover,
.matter-team-toolbar button:focus-visible {
  filter: brightness(0.98);
  transform: translateY(-1px);
  outline: none;
}

.matter-team-row-button {
  width: 100%;
  border: 1px solid var(--line-soft);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.matter-team-row-button:hover,
.matter-team-row-button:focus-visible {
  border-color: rgba(14, 165, 196, 0.35);
  background: #f0fbff;
  outline: none;
}

html[data-theme="dark"] .matter-team-row-button:hover,
html[data-theme="dark"] .matter-team-row-button:focus-visible {
  background: rgba(14, 165, 196, 0.14);
}

html[data-theme="dark"] .matter-team-toolbar button.secondary-action,
html[data-theme="dark"] .contacts-workspace .segmented-control button,
html[data-theme="dark"] .contacts-workspace .modern-row__side button {
  background: rgba(15, 23, 42, 0.82);
  color: var(--text);
}

html[data-theme="dark"] .matter-modal-summary--compact,
html[data-theme="dark"] .matter-modal-summary-note,
html[data-theme="dark"] .matter-new-contact-fields,
html[data-theme="dark"] .contacts-workspace .segmented-control button.is-active,
html[data-theme="dark"] .contacts-workspace .segmented-control button:hover,
html[data-theme="dark"] .contacts-workspace .segmented-control button:focus-visible,
html[data-theme="dark"] .contacts-workspace .modern-row__side button:hover,
html[data-theme="dark"] .contacts-workspace .modern-row__side button:focus-visible {
  background: rgba(14, 165, 196, 0.14);
}

.matter-modal-danger-form {
  display: flex;
  justify-content: flex-start;
  padding-top: 0.2rem;
  border-top: 1px solid var(--line-soft);
}

.matter-modal-summary {
  display: grid;
  gap: 0.55rem;
  margin: 0;
}

.matter-modal-summary div {
  display: grid;
  gap: 0.12rem;
}

.matter-modal-summary dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.matter-modal-summary dd {
  margin: 0;
  font-weight: 700;
}

.matter-modal-summary--compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 0.7rem;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #f8fbff;
}

.matter-modal-summary-note {
  margin: 0;
  padding: 0.7rem;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #f8fbff;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.matter-new-contact-fields {
  margin: 0;
  padding: 0.75rem;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #f8fbff;
}

.matter-new-contact-fields legend {
  padding: 0 0.35rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.matter-contact-picker {
  display: grid;
  gap: 0.45rem;
}

.matter-contact-picker input[type="search"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.68rem 0.8rem;
  background: var(--surface);
  color: var(--ink);
}

.matter-contact-picker small {
  min-height: 1rem;
  color: var(--muted);
  font-size: 0.78rem;
}

@media (max-width: 760px) {
  .matter-modal-summary--compact {
    grid-template-columns: 1fr;
  }
}

.matter-content .modern-list--documents .modern-row--document {
  grid-template-columns: minmax(0, 1.28fr) minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 0.72rem;
}

.matter-content .modern-list--team .modern-row--team-member {
  grid-template-columns: minmax(0, 1.35fr) minmax(220px, 0.95fr) minmax(118px, 118px);
  align-items: center;
  column-gap: 0.72rem;
}

.matter-content .modern-list--documents .modern-row__meta,
.matter-content .modern-list--team .modern-row__meta {
  border-left: 0;
  padding-left: 0;
  margin-left: 0;
  display: grid;
  gap: 0.1rem;
}

.matter-content .modern-list--documents .modern-row__side,
.matter-content .modern-list--team .modern-row__side {
  justify-self: end;
  align-self: center;
  text-align: right;
}

.matter-content .modern-list--documents .modern-row--document .modern-row__main,
.matter-content .modern-list--team .modern-row--team-member .modern-row__main {
  min-width: 0;
}

.matter-content .modern-list--team .modern-row--team-member .modern-row__main {
  display: flex;
  align-items: center;
  gap: 0.56rem;
}

@media (max-width: 1024px) {
  .matter-content .modern-list--documents .modern-row--document,
  .matter-content .modern-list--team .modern-row--team-member {
    grid-template-columns: 1fr;
    row-gap: 0.24rem;
    align-items: start;
  }

  .matter-content .modern-list--documents .modern-row__side,
  .matter-content .modern-list--team .modern-row__side {
    justify-self: start;
    text-align: left;
  }
}

/* Dashboard card: strict mock layout */
.dashboard--mockup-card .page-header p {
  color: #0f8fb2;
}

.dashboard--mockup-card .kpi-card {
  grid-template-areas:
    "icon"
    "label"
    "value"
    "meta"
    "cta";
  gap: 0.22rem;
}

.dashboard--mockup-card .kpi-card .kpi-icon {
  grid-area: icon;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 1.2rem;
}

.dashboard--mockup-card .kpi-card span { grid-area: label; }
.dashboard--mockup-card .kpi-card strong { grid-area: value; font-size: 2.65rem; font-weight: 800; }
.dashboard--mockup-card .kpi-card small { grid-area: meta; }
.dashboard--mockup-card .kpi-card em { grid-area: cta; }

.dashboard-grid--mockup {
  grid-template-columns: 1.15fr 1fr 0.95fr;
}

.dashboard--mockup-card .workflow-item {
  grid-template-columns: 24px minmax(0, 1fr) auto;
  border-radius: 12px;
}

.dashboard--mockup-card .workflow-item__icon {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 0.68rem;
  font-weight: 800;
  color: #0f172a;
  background: #eef4fb;
}

.dashboard--mockup-card .workflow-item__icon.is-danger { background: #fee2e2; color: #b91c1c; }
.dashboard--mockup-card .workflow-item__icon.is-warning { background: #fef3c7; color: #92400e; }
.dashboard--mockup-card .workflow-item__icon.is-success { background: #dcfce7; color: #166534; }
.dashboard--mockup-card .workflow-item__icon.is-info { background: #e0f2fe; color: #0c4a6e; }

.dashboard--mockup-card .timeline-item {
  grid-template-columns: 92px minmax(0, 1fr) auto;
}

.dashboard--mockup-card .timeline-item__owner {
  align-self: center;
  justify-self: end;
  color: #0f766e;
  font-size: 0.92rem;
  font-style: normal;
  font-weight: 700;
}

.dashboard--mockup-card .approval-card {
  display: grid;
  gap: 0.25rem;
}

.dashboard--mockup-card .approval-actions {
  margin-top: 0.15rem;
}

.dashboard-grid--mockup-tail {
  grid-template-columns: 1fr 1fr;
}

.quick-actions-icons {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
}

.quick-actions-icons a {
  display: grid;
  justify-items: center;
  gap: 0.4rem;
  border: 1px solid #e5edf6;
  border-radius: 14px;
  background: #fff;
  padding: 0.75rem 0.4rem;
}

.quick-actions-icons a span {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #f1f7fd;
  color: #0c5e74;
  font-size: 1.05rem;
}

.quick-actions-icons a em {
  font-style: normal;
  color: #1e293b;
  font-size: 0.86rem;
  font-weight: 700;
  text-align: center;
}

@media (max-width: 1400px) {
  .dashboard-grid--mockup-tail,
  .quick-actions-icons {
    grid-template-columns: 1fr;
  }

  .quick-actions-icons a {
    grid-template-columns: 44px minmax(0, 1fr);
    justify-items: start;
    align-items: center;
  }

  .quick-actions-icons a em {
    text-align: left;
  }
}

/* Dashboard icon sheet crops */
.dashboard--mockup-card .kpi-card .kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: transparent !important;
  color: transparent;
  overflow: hidden;
}

.dashboard--mockup-card .workflow-item {
  grid-template-columns: 32px minmax(0, 1fr) auto;
}

.dashboard--mockup-card .workflow-item__icon {
  width: 32px;
  height: 32px;
  border: 0 !important;
  border-radius: 10px;
  background: transparent !important;
  color: transparent;
  overflow: hidden;
}

.dashboard--mockup-card .workflow-item__icon.is-danger,
.dashboard--mockup-card .workflow-item__icon.is-warning,
.dashboard--mockup-card .workflow-item__icon.is-success,
.dashboard--mockup-card .workflow-item__icon.is-info {
  background: transparent !important;
  color: transparent !important;
}

.dashboard--mockup-card .quick-actions-icons a > .mock-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: transparent !important;
  overflow: hidden;
}

.mock-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

.mock-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mock-icon__dark {
  display: none !important;
}

.dashboard--mockup-card .documents-feed__row {
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
}

.dashboard--mockup-card .documents-feed__icon {
  width: 32px;
  height: 32px;
}

@media (prefers-color-scheme: dark) {
  .mock-icon__light {
    display: none !important;
  }

  .mock-icon__dark {
    display: block !important;
  }
}

/* Theme-aware icon assets and dark mode shell */
.mock-icon__light {
  display: block;
}

.mock-icon__dark {
  display: none;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08121a;
  --surface: #0d1b27;
  --surface-soft: #0b1721;
  --panel: #0e1a24;
  --panel-strong: #111f2b;
  --line: rgba(148, 163, 184, 0.22);
  --line-soft: rgba(148, 163, 184, 0.14);
  --ink: #f8fbff;
  --text-main: #eef6ff;
  --text: #eef6ff;
  --muted: #9fb0c3;
  --soft: #7f93aa;
  --brand: #0ea5c8;
  --brand-dark: #38bdf8;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] body,
html[data-theme="dark"] .app-main {
  background: radial-gradient(circle at 35% 0%, rgba(14, 165, 200, 0.14), transparent 32%), #08121a;
  color: var(--text);
}

html[data-theme="dark"] .app-shell,
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .app-menu,
html[data-theme="dark"] .profile-menu__panel,
html[data-theme="dark"] .page-header,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .card,
html[data-theme="dark"] .kpi-card,
html[data-theme="dark"] .dashboard-card,
html[data-theme="dark"] .premium-card,
html[data-theme="dark"] .case-hero,
html[data-theme="dark"] .tab-strip,
html[data-theme="dark"] dialog,
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .workflow-panel,
html[data-theme="dark"] .documents-feed,
html[data-theme="dark"] .quick-actions-icons,
html[data-theme="dark"] .timeline-panel,
html[data-theme="dark"] .approval-center,
html[data-theme="dark"] .ai-insights-card {
  background-color: var(--panel);
  border-color: var(--line);
  color: var(--text);
}

html[data-theme="dark"] .app-menu,
html[data-theme="dark"] .topbar {
  background: rgba(8, 18, 26, 0.88);
  backdrop-filter: blur(18px);
}

html[data-theme="dark"] .app-title,
html[data-theme="dark"] .menu-item,
html[data-theme="dark"] .menu-toggle,
html[data-theme="dark"] .topbar-search input,
html[data-theme="dark"] .context-switcher select,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .profile-chip,
html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .work-timer,
html[data-theme="dark"] .topbar-icon-button {
  background-color: #0b1721;
  border-color: var(--line);
  color: var(--text);
}

html[data-theme="dark"] .profile-menu__row,
html[data-theme="dark"] .profile-menu__impersonation,
html[data-theme="dark"] .profile-menu__logout {
  border-color: var(--line);
}

html[data-theme="dark"] .profile-menu__logout button:hover,
html[data-theme="dark"] .profile-menu__logout button:focus-visible {
  background: rgba(239, 68, 68, 0.14);
}

html[data-theme="dark"] .profile-menu__panel a:hover,
html[data-theme="dark"] .profile-menu__panel a:focus-visible {
  background: rgba(14, 116, 144, 0.18);
}

html[data-theme="dark"] .menu-item.is-active,
html[data-theme="dark"] .menu-item:hover,
html[data-theme="dark"] .menu-toggle:hover,
html[data-theme="dark"] .theme-toggle:hover {
  background: linear-gradient(135deg, rgba(14, 165, 200, 0.22), rgba(14, 165, 200, 0.08));
  color: #7dd3fc;
}

html[data-theme="dark"] .app-shell--v2 .menu-settings[open] {
  background: linear-gradient(180deg, rgba(15, 31, 43, 0.94), rgba(12, 25, 35, 0.86));
  box-shadow: inset 0 0 0 1px rgba(51, 65, 85, 0.78);
}

html[data-theme="dark"] .app-shell--v2 .menu-settings-body,
html[data-theme="dark"] .app-shell--v2 .menu-subgroup + .menu-subgroup {
  border-color: rgba(51, 65, 85, 0.78);
}

html[data-theme="dark"] .app-shell--v2 .menu-subgroup p {
  color: #8ea1b8;
}

html[data-theme="dark"] .app-shell--v2 .menu-subitem {
  color: #a8b6c7;
}

html[data-theme="dark"] .app-shell--v2 .menu-subitem::before {
  background: #475569;
}

html[data-theme="dark"] .app-shell--v2 .menu-subitem:hover,
html[data-theme="dark"] .app-shell--v2 .menu-subitem:focus-visible {
  background: rgba(14, 116, 144, 0.18);
  color: #7dd3fc;
}

html[data-theme="dark"] .app-shell--v2 .menu-subitem.is-active {
  background: rgba(14, 165, 200, 0.2);
  color: #a5f3fc;
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.24);
}

html[data-theme="dark"] .topbar-search,
html[data-theme="dark"] .topbar-search-hints a,
html[data-theme="dark"] .status-pill,
html[data-theme="dark"] .filter-chip,
html[data-theme="dark"] .tab-link,
html[data-theme="dark"] .tab-button,
html[data-theme="dark"] .data-table,
html[data-theme="dark"] .data-list__row,
html[data-theme="dark"] .workflow-item,
html[data-theme="dark"] .timeline-item,
html[data-theme="dark"] .approval-card,
html[data-theme="dark"] .documents-feed__row,
html[data-theme="dark"] .quick-actions-icons a {
  background-color: #0b1721;
  border-color: var(--line);
  color: var(--text);
}

html[data-theme="dark"] .muted,
html[data-theme="dark"] small,
html[data-theme="dark"] .page-header p,
html[data-theme="dark"] .workflow-item p,
html[data-theme="dark"] .timeline-item p,
html[data-theme="dark"] .documents-feed__row p,
html[data-theme="dark"] .menu-group p {
  color: var(--muted);
}

html[data-theme="dark"] .mock-icon__light {
  display: none;
}

html[data-theme="dark"] .mock-icon__dark {
  display: block;
}

.theme-toggle {
  min-height: 2.35rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--brand-dark);
  font-weight: 700;
  cursor: pointer;
}

.profile-menu__theme-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 2.7rem;
  padding: 0 0.65rem;
  text-align: left;
}

.theme-toggle__switch {
  position: relative;
  width: 2.35rem;
  height: 1.28rem;
  border-radius: 999px;
  background: #cbd5e1;
  box-shadow: inset 0 0 0 1px rgba(100, 116, 139, 0.26);
  transition: background-color 0.18s ease;
}

.theme-toggle__switch::after {
  content: "";
  position: absolute;
  top: 0.18rem;
  left: 0.18rem;
  width: 0.92rem;
  height: 0.92rem;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.25);
  transition: transform 0.18s ease;
}

.theme-toggle[data-theme-state="dark"] .theme-toggle__switch {
  background: #0ea5e9;
}

.theme-toggle[data-theme-state="dark"] .theme-toggle__switch::after {
  transform: translateX(1.05rem);
}

.profile-menu__theme-toggle strong {
  color: var(--accent-strong);
  font-size: 0.8rem;
}

/* Explicit app theme wins over browser/OS color preference. */
html:not([data-theme="dark"]) .mock-icon__light {
  display: block !important;
}

html:not([data-theme="dark"]) .mock-icon__dark {
  display: none !important;
}

html[data-theme="dark"] .mock-icon__light {
  display: none !important;
}

html[data-theme="dark"] .mock-icon__dark {
  display: block !important;
}

/* Dashboard dark theme polish */
html[data-theme="dark"] .dashboard--mockup-card .page-header,
html[data-theme="dark"] .dashboard--mockup-card .kpi-card,
html[data-theme="dark"] .dashboard--mockup-card .panel,
html[data-theme="dark"] .dashboard--mockup-card .approval-card,
html[data-theme="dark"] .dashboard--mockup-card .timeline-item,
html[data-theme="dark"] .dashboard--mockup-card .workflow-item,
html[data-theme="dark"] .dashboard--mockup-card .documents-feed__row,
html[data-theme="dark"] .dashboard--mockup-card .quick-actions-icons a {
  background: #0e1a24 !important;
  border-color: rgba(148, 163, 184, 0.24) !important;
  color: #eef6ff !important;
}

html[data-theme="dark"] .dashboard--mockup-card .kpi-card strong,
html[data-theme="dark"] .dashboard--mockup-card h1,
html[data-theme="dark"] .dashboard--mockup-card h2,
html[data-theme="dark"] .dashboard--mockup-card h3,
html[data-theme="dark"] .dashboard--mockup-card .workflow-item strong,
html[data-theme="dark"] .dashboard--mockup-card .timeline-item strong,
html[data-theme="dark"] .dashboard--mockup-card .approval-card strong,
html[data-theme="dark"] .dashboard--mockup-card .documents-feed__row strong {
  color: #f8fbff !important;
}

html[data-theme="dark"] .dashboard--mockup-card p,
html[data-theme="dark"] .dashboard--mockup-card small,
html[data-theme="dark"] .dashboard--mockup-card span,
html[data-theme="dark"] .dashboard--mockup-card .workflow-item p,
html[data-theme="dark"] .dashboard--mockup-card .timeline-item p,
html[data-theme="dark"] .dashboard--mockup-card .documents-feed__row p {
  color: #9fb0c3 !important;
}

html[data-theme="dark"] .dashboard--mockup-card a,
html[data-theme="dark"] .dashboard--mockup-card em {
  color: #38bdf8 !important;
}

html[data-theme="dark"] .dashboard--mockup-card .workspace-card,
html[data-theme="dark"] .dashboard--mockup-card .workspace-card .approval-center,
html[data-theme="dark"] .dashboard--mockup-card .workspace-card .timeline-agenda,
html[data-theme="dark"] .dashboard--mockup-card .workspace-card .workflow-feed,
html[data-theme="dark"] .dashboard--mockup-card .workspace-card .mini-agenda,
html[data-theme="dark"] .dashboard--mockup-card .workspace-card .documents-feed {
  background: #0e1a24 !important;
  border-color: rgba(148, 163, 184, 0.24) !important;
  color: #eef6ff !important;
}

html[data-theme="dark"] .dashboard--mockup-card .workspace-card header,
html[data-theme="dark"] .dashboard--mockup-card .workspace-card h2,
html[data-theme="dark"] .dashboard--mockup-card .workspace-card h3 {
  color: #f8fbff !important;
}

/* Dark theme for registry/detail surfaces */
html[data-theme="dark"] .registry-modern,
html[data-theme="dark"] .registry-modern__hero,
html[data-theme="dark"] .registry-modern__controls,
html[data-theme="dark"] .registry-modern__table-head,
html[data-theme="dark"] .registry-modern__card,
html[data-theme="dark"] .module-shell,
html[data-theme="dark"] .module-card,
html[data-theme="dark"] .modern-row,
html[data-theme="dark"] .compact-row,
html[data-theme="dark"] .detail-card,
html[data-theme="dark"] .case-detail-card,
html[data-theme="dark"] .document-detail-card,
html[data-theme="dark"] .data-table-wrap,
html[data-theme="dark"] .table-card,
html[data-theme="dark"] .doc-row,
html[data-theme="dark"] .document-row,
html[data-theme="dark"] .matter-row,
html[data-theme="dark"] .task-row {
  background: #0e1a24 !important;
  border-color: rgba(148, 163, 184, 0.24) !important;
  color: #eef6ff !important;
}

html[data-theme="dark"] .registry-modern__hero p,
html[data-theme="dark"] .registry-modern__card p,
html[data-theme="dark"] .modern-row small,
html[data-theme="dark"] .compact-row small,
html[data-theme="dark"] .doc-row small,
html[data-theme="dark"] .document-row small,
html[data-theme="dark"] .matter-row small,
html[data-theme="dark"] .task-row small {
  color: #9fb0c3 !important;
}

html[data-theme="dark"] .registry-modern__hero h1,
html[data-theme="dark"] .registry-modern__hero h2,
html[data-theme="dark"] .registry-modern__card h2,
html[data-theme="dark"] .modern-row strong,
html[data-theme="dark"] .compact-row strong,
html[data-theme="dark"] .doc-row strong,
html[data-theme="dark"] .document-row strong,
html[data-theme="dark"] .matter-row strong,
html[data-theme="dark"] .task-row strong {
  color: #f8fbff !important;
}

/* Dark theme finishing pass for real registry markup. */
html[data-theme="dark"] .page-header--registry,
html[data-theme="dark"] .registry-modern__toolbar,
html[data-theme="dark"] .modern-list,
html[data-theme="dark"] .modern-list-head,
html[data-theme="dark"] .document-tab-panels,
html[data-theme="dark"] .document-profile-card,
html[data-theme="dark"] .document-preview-card,
html[data-theme="dark"] .document-context-card,
html[data-theme="dark"] .document-review-card,
html[data-theme="dark"] .matter-table,
html[data-theme="dark"] .matter-table-head,
html[data-theme="dark"] .matter-table-row,
html[data-theme="dark"] .module-table,
html[data-theme="dark"] .module-table header,
html[data-theme="dark"] .module-table-row,
html[data-theme="dark"] .workspace-section {
  background: #0e1a24 !important;
  border-color: rgba(148, 163, 184, 0.24) !important;
  color: #eef6ff !important;
}

html[data-theme="dark"] .modern-list-head,
html[data-theme="dark"] .matter-table-head,
html[data-theme="dark"] .module-table header,
html[data-theme="dark"] .document-register-table > header {
  background: #132231 !important;
  color: #9fb0c3 !important;
}

html[data-theme="dark"] .registry-modern__title h2,
html[data-theme="dark"] .page-header--registry h1,
html[data-theme="dark"] .workspace-section h2,
html[data-theme="dark"] .document-profile-card h2,
html[data-theme="dark"] .document-preview-card h2,
html[data-theme="dark"] .document-context-card h2,
html[data-theme="dark"] .module-table-row strong,
html[data-theme="dark"] .matter-table-row strong {
  color: #f8fbff !important;
}

html[data-theme="dark"] .registry-modern__title p,
html[data-theme="dark"] .legaldesk-breadcrumb,
html[data-theme="dark"] .legaldesk-breadcrumb span,
html[data-theme="dark"] .module-table small,
html[data-theme="dark"] .matter-table-row span,
html[data-theme="dark"] .document-profile-card dt,
html[data-theme="dark"] .document-profile-card dd {
  color: #9fb0c3 !important;
}

html[data-theme="dark"] .document-tool-button,
html[data-theme="dark"] .doc-row-action,
html[data-theme="dark"] .row-actions button,
html[data-theme="dark"] .inline-form select,
html[data-theme="dark"] .matter-tabs,
html[data-theme="dark"] .matter-tabs a {
  background: #0b1721 !important;
  border-color: rgba(148, 163, 184, 0.28) !important;
  color: #e6f2ff !important;
}

html[data-theme="dark"] .matter-tabs a.is-active,
html[data-theme="dark"] .matter-tabs a:hover,
html[data-theme="dark"] .registry-modern__chips button.is-active,
html[data-theme="dark"] .registry-modern__chips button:hover {
  background: linear-gradient(135deg, rgba(14, 165, 200, 0.28), rgba(14, 165, 200, 0.11)) !important;
  border-color: rgba(34, 211, 238, 0.48) !important;
  color: #7dd3fc !important;
}

html[data-theme="dark"] .work-timer output,
html[data-theme="dark"] .work-timer button {
  background: #0b1721 !important;
  border-color: rgba(148, 163, 184, 0.28) !important;
  color: #e6f2ff !important;
}

html[data-theme="dark"] .work-timer button[data-work-timer-toggle],
html[data-theme="dark"] .primary-action:not(:where(.settings-ui *)),
html[data-theme="dark"] .button-primary {
  background: linear-gradient(135deg, #0891b2, #06a7d0) !important;
  border-color: transparent !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .document-preview-card iframe {
  background: #111827;
  border-color: rgba(148, 163, 184, 0.24);
}

/* Dark theme: matter details must not inherit light card fills. */
html[data-theme="dark"] .matter-workspace,
html[data-theme="dark"] .matter-hero,
html[data-theme="dark"] .matter-layout,
html[data-theme="dark"] .matter-content,
html[data-theme="dark"] .matter-content .workspace-card,
html[data-theme="dark"] .matter-content .modern-list,
html[data-theme="dark"] .matter-content .timeline-agenda,
html[data-theme="dark"] .matter-content .modern-row,
html[data-theme="dark"] .matter-content .timeline-item,
html[data-theme="dark"] .matter-actions-drawer,
html[data-theme="dark"] .matter-actions-drawer__panel {
  background: #0e1a24 !important;
  border-color: rgba(148, 163, 184, 0.24) !important;
  color: #eef6ff !important;
}

html[data-theme="dark"] .matter-hero h1,
html[data-theme="dark"] .matter-content h2,
html[data-theme="dark"] .matter-content h3,
html[data-theme="dark"] .matter-content .modern-row__main strong,
html[data-theme="dark"] .matter-content .timeline-item__body strong {
  color: #f8fbff !important;
}

html[data-theme="dark"] .matter-hero p,
html[data-theme="dark"] .matter-content .modern-row__main small,
html[data-theme="dark"] .matter-content .modern-row__meta,
html[data-theme="dark"] .matter-content .modern-row__meta span,
html[data-theme="dark"] .matter-content .modern-row__meta small,
html[data-theme="dark"] .matter-content .timeline-item__body small,
html[data-theme="dark"] .matter-content .timeline-item__body em,
html[data-theme="dark"] .task-focus-banner {
  color: #9fb0c3 !important;
}

html[data-theme="dark"] .matter-content .timeline-item__date {
  background: #132231 !important;
  border: 1px solid rgba(148, 163, 184, 0.24) !important;
  color: #e6f2ff !important;
}

html[data-theme="dark"] .matter-content .timeline-item__date strong,
html[data-theme="dark"] .matter-content .timeline-item__date small {
  color: #e6f2ff !important;
}

html[data-theme="dark"] .matter-content .modern-row:hover,
html[data-theme="dark"] .matter-content .modern-row:focus-visible,
html[data-theme="dark"] .matter-content .timeline-item:hover {
  background: #132231 !important;
  border-color: rgba(34, 211, 238, 0.34) !important;
}

html[data-theme="dark"] .section-count,
html[data-theme="dark"] .tab-count {
  background: rgba(14, 165, 200, 0.18) !important;
  border-color: rgba(34, 211, 238, 0.34) !important;
  color: #7dd3fc !important;
}

html[data-theme="dark"] .status-pill.is-danger {
  background: rgba(239, 68, 68, 0.16) !important;
  border-color: rgba(248, 113, 113, 0.42) !important;
  color: #fecaca !important;
}

html[data-theme="dark"] .status-pill.is-warning {
  background: rgba(245, 158, 11, 0.16) !important;
  border-color: rgba(251, 191, 36, 0.42) !important;
  color: #fde68a !important;
}

html[data-theme="dark"] .status-pill.is-success {
  background: rgba(34, 197, 94, 0.14) !important;
  border-color: rgba(74, 222, 128, 0.38) !important;
  color: #bbf7d0 !important;
}

html[data-theme="dark"] .status-pill.is-info {
  background: rgba(59, 130, 246, 0.16) !important;
  border-color: rgba(96, 165, 250, 0.42) !important;
  color: #bfdbfe !important;
}

/* Dark theme: keep date/time chips and dense dashboard lists consistent. */
html[data-theme="dark"] .dashboard--mockup-card .timeline-item__date,
html[data-theme="dark"] .dashboard--mockup-card .mini-agenda time,
html[data-theme="dark"] .dashboard--mockup-card .calendar-day,
html[data-theme="dark"] .dashboard--mockup-card .calendar-strip span {
  background: #132231 !important;
  border: 1px solid rgba(148, 163, 184, 0.24) !important;
  color: #e6f2ff !important;
}

html[data-theme="dark"] .dashboard--mockup-card .timeline-item__date strong,
html[data-theme="dark"] .dashboard--mockup-card .timeline-item__date small,
html[data-theme="dark"] .dashboard--mockup-card .mini-agenda time strong,
html[data-theme="dark"] .dashboard--mockup-card .mini-agenda time small {
  color: #e6f2ff !important;
}

html[data-theme="dark"] .dashboard--mockup-card .workflow-item__icon.is-danger,
html[data-theme="dark"] .dashboard--mockup-card .workflow-item__icon.is-warning,
html[data-theme="dark"] .dashboard--mockup-card .workflow-item__icon.is-success,
html[data-theme="dark"] .dashboard--mockup-card .workflow-item__icon.is-info {
  background: #07131c !important;
  border-color: rgba(34, 211, 238, 0.28) !important;
  color: #38bdf8 !important;
}

html[data-theme="dark"] .matter-content .modern-row--doc,
html[data-theme="dark"] .matter-content .modern-row--team-member,
html[data-theme="dark"] .matter-content .modern-row--compact {
  background: #0b1721 !important;
  border-color: rgba(148, 163, 184, 0.24) !important;
}

/* Dark theme: the closed action drawer must not paint over the workspace. */
html[data-theme="dark"] .matter-actions-drawer {
  background: transparent !important;
  border-color: transparent !important;
  color: inherit !important;
}

html[data-theme="dark"] .matter-actions-drawer.is-open .matter-actions-drawer__backdrop {
  background: rgba(2, 8, 14, 0.62) !important;
}

html[data-theme="dark"] .matter-actions-drawer__panel {
  background: #0e1a24 !important;
  border-color: rgba(148, 163, 184, 0.24) !important;
  color: #eef6ff !important;
}

/* Dashboard document type icons stay brand-colored in both themes. */
html[data-theme="dark"] .dashboard--mockup-card .documents-feed__icon {
  width: 34px;
  height: 34px;
  padding: 0.22rem;
  border-radius: 10px;
  background: rgba(226, 232, 240, 0.06) !important;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

html[data-theme="dark"] .dashboard--mockup-card .documents-feed__icon .mock-icon__light {
  display: block !important;
}

html[data-theme="dark"] .dashboard--mockup-card .documents-feed__icon .mock-icon__dark {
  display: none !important;
}

/* Reports dark theme: keep KPI cards and operational tables on the dark surface. */
html[data-theme="dark"] .report-grid {
  background: #0e1a24 !important;
  border-color: rgba(148, 163, 184, 0.24) !important;
  color: #eef6ff !important;
}

html[data-theme="dark"] .report-grid .metric-card,
html[data-theme="dark"] .report-grid .report-status-card,
html[data-theme="dark"] .report-grid .report-stream-row,
html[data-theme="dark"] .report-grid .workload-table,
html[data-theme="dark"] .report-grid .workload-row {
  background: #0b1721 !important;
  border-color: rgba(148, 163, 184, 0.22) !important;
  color: #eef6ff !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .report-grid .metric-card--high,
html[data-theme="dark"] .report-grid .workload-row--high {
  border-top-color: #f87171 !important;
  border-left-color: rgba(248, 113, 113, 0.55) !important;
}

html[data-theme="dark"] .report-grid .metric-card--medium,
html[data-theme="dark"] .report-grid .workload-row--medium {
  border-top-color: #fbbf24 !important;
  border-left-color: rgba(251, 191, 36, 0.55) !important;
}

html[data-theme="dark"] .report-grid .metric-card--low,
html[data-theme="dark"] .report-grid .workload-row--low {
  border-top-color: #4ade80 !important;
  border-left-color: rgba(74, 222, 128, 0.55) !important;
}

html[data-theme="dark"] .report-grid .metric-card strong,
html[data-theme="dark"] .report-grid .report-status-card strong,
html[data-theme="dark"] .report-grid .report-stream-row strong,
html[data-theme="dark"] .report-grid .workload-row strong,
html[data-theme="dark"] .report-grid .workload-row span {
  color: #f8fbff !important;
}

html[data-theme="dark"] .report-grid .metric-card span,
html[data-theme="dark"] .report-grid .metric-card small,
html[data-theme="dark"] .report-grid .report-status-card span,
html[data-theme="dark"] .report-grid .report-status-card small,
html[data-theme="dark"] .report-grid .report-stream-row span,
html[data-theme="dark"] .report-grid .report-stream-row small,
html[data-theme="dark"] .report-grid .workload-row small,
html[data-theme="dark"] .report-grid .workload-table header {
  color: #9fb0c3 !important;
}

html[data-theme="dark"] .report-grid .workspace-section > header {
  border-color: rgba(148, 163, 184, 0.22) !important;
}

html[data-theme="dark"] .report-grid .workspace-section > header a {
  color: #38bdf8 !important;
}

/* Stage 6 management reports */
.stage6-report {
  display: grid;
  gap: 1rem;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.stage6-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 0.65rem;
  align-items: end;
  min-width: 0;
  padding: 0.8rem 0;
  border-block: 1px solid var(--line);
}

.stage6-filters > label,
.matter-progress-form label {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.stage6-filters > label > input:not([type="radio"]),
.stage6-filters > label > select,
.matter-progress-form textarea {
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.45rem 0.6rem;
  background: var(--surface, #fff);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
}

.stage6-filters > label > input:not([type="radio"]),
.stage6-filters > label > select,
.stage6-filters > label > .searchable-select {
  height: 38px;
  min-height: 38px;
}

.stage6-period {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.stage6-period label {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.stage6-period input {
  position: absolute;
  opacity: 0;
}

.stage6-period span {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.7rem;
  color: var(--muted);
  background: var(--panel);
  font-size: 0.78rem;
  font-weight: 700;
}

.stage6-period input:checked + span {
  color: #fff;
  background: var(--brand-dark);
}

.stage6-filter-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.stage6-filter-actions a {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.stage6-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.2rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.stage6-summary span {
  color: var(--muted);
  font-size: 0.78rem;
}

.stage6-summary strong {
  margin-right: 0.25rem;
  color: var(--text);
  font-size: 1rem;
}

.stage6-band {
  display: grid;
  gap: 0.7rem;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  padding-block: 0.15rem 0.85rem;
  border-bottom: 1px solid var(--line);
}

.stage6-band > header {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.stage6-band > header > div {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  min-width: 0;
}

.stage6-band h2,
.stage6-band h3 {
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
  letter-spacing: 0;
}

.stage6-band h3 {
  margin-bottom: 0.45rem;
  font-size: 0.82rem;
}

.stage6-band > header span,
.stage6-band > header a {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.stage6-band > header a,
.stage6-table a,
.stage6-line {
  color: var(--brand-dark);
}

.stage6-table-scroll {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.stage6-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 0.76rem;
}

.stage6-table--history {
  min-width: 640px;
}

.stage6-table--manager {
  min-width: 920px;
}

.stage6-table th,
.stage6-table td {
  padding: 0.55rem 0.45rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: normal;
  word-break: normal;
}

.stage6-table th {
  color: var(--muted);
  font-size: 0.66rem;
  text-transform: uppercase;
}

.stage6-table td {
  color: var(--text);
}

.stage6-table small {
  color: var(--muted);
}

.stage6-alert-list {
  display: grid;
  gap: 0.35rem;
}

.stage6-alert {
  display: grid;
  grid-template-columns: 130px minmax(180px, 1fr) minmax(150px, 0.8fr) minmax(240px, 1.3fr) 90px;
  gap: 0.6rem;
  align-items: start;
  min-width: 0;
  padding: 0.52rem 0.6rem;
  border-left: 3px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

.stage6-alert--high { border-left-color: #dc2626; }
.stage6-alert--medium { border-left-color: #d97706; }
.stage6-alert span,
.stage6-alert small,
.stage6-alert time {
  color: var(--muted);
  font-size: 0.7rem;
}

.stage6-alert em {
  color: var(--text);
  font-size: 0.74rem;
  font-style: normal;
}

.stage6-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  min-width: 0;
}

.stage6-line {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.stage6-line span,
.stage6-line small,
.stage6-empty {
  color: var(--muted);
  font-size: 0.72rem;
}

.stage6-empty {
  margin: 0;
  padding: 0.65rem 0;
}

.stage6-pager {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.stage6-pager a {
  color: var(--brand-dark);
}

.stage6-pager a.is-disabled {
  pointer-events: none;
  color: var(--muted);
  opacity: 0.55;
}

.matter-progress-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: end;
  margin-bottom: 0.8rem;
}

html[data-theme="dark"] .stage6-period span {
  background: #0b1721;
}

html[data-theme="dark"] .stage6-period input:checked + span {
  background: #036985;
}

html[data-theme="dark"] .stage6-band,
html[data-theme="dark"] .stage6-summary,
html[data-theme="dark"] .stage6-filters,
html[data-theme="dark"] .stage6-table th,
html[data-theme="dark"] .stage6-table td,
html[data-theme="dark"] .stage6-line {
  border-color: rgba(148, 163, 184, 0.22);
}

@media (max-width: 980px) {
  .stage6-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stage6-alert {
    grid-template-columns: 110px minmax(160px, 1fr) minmax(180px, 1.4fr) 80px;
  }

  .stage6-alert small {
    display: none;
  }
}

@media (max-width: 600px) {
  .stage6-filters,
  .stage6-split {
    grid-template-columns: minmax(0, 1fr);
  }

  .stage6-alert {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .stage6-alert strong,
  .stage6-alert em {
    grid-column: 1 / -1;
  }

  .stage6-alert small {
    display: block;
    grid-column: 1;
  }

  .matter-progress-form {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Matter FileService workspace */
.matter-files-shell {
  display: grid;
  gap: 1rem;
}

.matter-files-toolbar,
.matter-files-upload {
  align-items: end;
  background: color-mix(in srgb, var(--surface, #fff) 92%, var(--accent, #2563eb) 8%);
  border: 1px solid var(--border, #d8dee8);
  border-radius: 18px;
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.matter-files-toolbar {
  grid-template-columns: minmax(0, 1fr) auto;
}

.matter-files-toolbar h3 {
  margin: .15rem 0;
}

.matter-files-inline-form,
.matter-files-upload {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
}

.matter-files-inline-form input,
.matter-files-inline-form select,
.matter-files-upload input,
.matter-files-upload select {
  min-height: 2.5rem;
}

.matter-files-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(220px, .42fr) minmax(0, 1fr);
}

.matter-files-folders {
  display: grid;
  gap: .75rem;
}

.matter-folder-card {
  border: 1px solid var(--border, #d8dee8);
  border-radius: 18px;
  display: grid;
  gap: .55rem;
  padding: .9rem;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.matter-folder-card.is-drop-target {
  border-color: var(--accent, #2563eb);
  box-shadow: 0 18px 38px rgba(37, 99, 235, .18);
  transform: translateY(-1px);
}

.matter-folder-card strong,
.matter-folder-card small {
  display: block;
}

.matter-folder-card__status {
  color: var(--muted, #64748b);
  margin: 0;
}

.matter-folder-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.matter-folder-card__actions form {
  margin: 0;
}

@media (max-width: 900px) {
  .matter-files-toolbar,
  .matter-files-grid {
    grid-template-columns: 1fr;
  }
}

/* Matter FileService workspace polish */
.matter-files-toolbar,
.matter-files-upload {
  background: linear-gradient(135deg, #f8fbff 0%, #edf7fb 100%);
  border-color: #d8e7f0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.75);
}

.matter-files-toolbar p {
  color: #0f8fa8;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  margin: 0;
  text-transform: uppercase;
}

.matter-files-toolbar small,
.matter-files-upload span,
.matter-files-list .modern-row__meta small {
  color: #64748b;
}

.matter-files-inline-form input,
.matter-files-inline-form select,
.matter-files-upload input,
.matter-files-upload select {
  background: #fff;
  border: 1px solid #cad9e8;
  border-radius: 12px;
  color: #172033;
  padding: .6rem .75rem;
}

.matter-files-upload {
  align-items: center;
  grid-template-columns: minmax(180px, .32fr) minmax(260px, 1fr) auto;
}

.matter-files-upload label {
  display: grid;
  gap: .35rem;
}

.matter-folder-card {
  background: #fff;
  box-shadow: 0 16px 34px rgba(15, 35, 64, .07);
  min-height: 170px;
}

.matter-folder-card__top {
  align-items: center;
  display: flex;
  gap: .75rem;
}

.matter-folder-icon {
  align-items: center;
  background: #eaf8fb;
  border-radius: 14px;
  color: #0f8fa8;
  display: inline-flex;
  height: 2.45rem;
  justify-content: center;
  width: 2.45rem;
}

.matter-folder-icon svg {
  height: 1.25rem;
  width: 1.25rem;
}

.matter-folder-card__actions button {
  background: #fff;
  border: 1px solid #cbdbea;
  border-radius: 11px;
  color: #172033;
  cursor: pointer;
  font-weight: 700;
  padding: .48rem .7rem;
}

.matter-folder-card__actions form:first-child button {
  background: #0898b3;
  border-color: #0898b3;
  color: #fff;
}

.matter-files-list {
  gap: .6rem;
}

.matter-files-list .modern-row {
  background: #fff;
  border-color: #dbe8f3;
  grid-template-columns: minmax(340px, 1.2fr) minmax(220px, .8fr) auto;
}

.matter-files-list .modern-row__main {
  align-items: center;
  display: flex;
  gap: .75rem;
  min-width: 0;
}

.matter-files-list .modern-row__main > div,
.matter-files-list .modern-row__meta {
  min-width: 0;
}

.matter-files-list .modern-row strong,
.matter-files-list .modern-row small,
.matter-files-list .modern-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-theme="dark"] .matter-files-toolbar,
html[data-theme="dark"] .matter-files-upload,
html[data-theme="dark"] .matter-folder-card,
html[data-theme="dark"] .matter-files-list .modern-row {
  background: #121b2b;
  border-color: rgba(148, 163, 184, .24);
}

html[data-theme="dark"] .matter-files-inline-form input,
html[data-theme="dark"] .matter-files-inline-form select,
html[data-theme="dark"] .matter-files-upload input,
html[data-theme="dark"] .matter-files-upload select,
html[data-theme="dark"] .matter-folder-card__actions button {
  background: #0d1524;
  border-color: rgba(148, 163, 184, .28);
  color: #eef6ff;
}

@media (max-width: 900px) {
  .matter-files-upload,
  .matter-files-list .modern-row {
    grid-template-columns: 1fr;
  }
}

/* Matter file manager */
.matter-files-shell--manager {
  gap: 1rem;
}

.matter-files-toolbar--manager {
  align-items: center;
  background: linear-gradient(135deg, rgba(9, 148, 179, 0.1), rgba(236, 249, 252, 0.92));
}

.matter-file-manager {
  display: grid;
  grid-template-columns: minmax(240px, 310px) minmax(0, 1fr);
  gap: 1rem;
  min-height: 520px;
}

.matter-file-tree,
.matter-file-browser,
.matter-folder-panel {
  border: 1px solid var(--border-soft);
  border-radius: 1.4rem;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 18px 48px rgba(28, 45, 78, 0.08);
}

.matter-file-tree {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.matter-file-tree header {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 1rem 1.05rem;
  border-bottom: 1px solid var(--border-soft);
}

.matter-file-tree__items {
  display: grid;
  gap: 0.15rem;
  padding: 0.45rem;
  overflow: auto;
}

.matter-tree-row {
  display: grid;
  grid-template-columns: 0.9rem 1.6rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  border: 0;
  border-radius: 0.95rem;
  padding: 0.72rem 0.7rem 0.72rem calc(0.75rem + (var(--depth, 0) * 1.05rem));
  color: var(--text-main);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.matter-tree-row.is-tree-hidden {
  display: none;
}

.matter-tree-row:hover,
.matter-tree-row.is-active,
.matter-tree-row.is-drop-target {
  background: rgba(9, 148, 179, 0.12);
}

.matter-tree-row.is-active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.matter-tree-row.is-archive,
.matter-tree-row.is-system {
  margin-top: 0.35rem;
  color: var(--text-muted);
  background: rgba(107, 123, 145, 0.09);
  opacity: 0.72;
}

.matter-tree-row__toggle {
  display: inline-grid;
  place-items: center;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
  transform: rotate(90deg);
  transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.matter-tree-row.has-children .matter-tree-row__toggle {
  background: rgba(9, 148, 179, 0.08);
  color: var(--accent-strong);
}

.matter-tree-row.has-children .matter-tree-row__toggle:hover {
  background: rgba(9, 148, 179, 0.16);
}

.matter-tree-row.is-collapsed .matter-tree-row__toggle {
  transform: rotate(0deg);
}

.matter-tree-row__icon svg,
.matter-folder-chip svg {
  width: 1.1rem;
  height: 1.1rem;
}

.matter-tree-row__label {
  display: grid;
  min-width: 0;
}

.matter-tree-row__label strong,
.matter-tree-row__label small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matter-tree-row__badges {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  justify-self: end;
}

.matter-tree-row__ai,
.matter-tree-row__status {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  border-radius: 999px;
  padding: 0.16rem 0.43rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.1;
  border: 1px solid transparent;
}

.matter-tree-row__status {
  background: rgba(11, 169, 196, 0.12);
  color: var(--accent-strong);
}

.matter-tree-row__ai.is-success {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.matter-tree-row__ai.is-info {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #93c5fd;
}

.matter-tree-row__ai.is-warning {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}

.matter-tree-row__ai.is-danger {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

.matter-tree-row__ai.is-pending i,
.status-pill.is-pending i {
  width: 0.68em;
  height: 0.68em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  animation: llmBadgeSpin 0.8s linear infinite;
}

@keyframes llmBadgeSpin {
  to {
    transform: rotate(360deg);
  }
}

.matter-file-browser {
  display: grid;
  gap: 0.9rem;
  padding: 0.9rem;
  align-content: start;
}

.matter-files-upload--current {
  margin: 0;
  grid-template-columns: minmax(0, 1fr) auto;
}

.matter-folder-panel {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
}

.matter-folder-panel[hidden] {
  display: none;
}

.matter-folder-panel.is-archive {
  background: linear-gradient(135deg, rgba(107, 123, 145, 0.09), rgba(255, 255, 255, 0.76));
}

.matter-folder-panel__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: start;
  gap: 1rem;
}

.matter-folder-panel__header p,
.matter-files-toolbar--manager p {
  margin: 0;
  color: var(--accent-strong);
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.matter-folder-panel__header h3 {
  margin: 0.15rem 0;
}

.matter-folder-panel__status,
.matter-folder-panel__actions,
.matter-file-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.matter-folder-panel__status form {
  display: inline-flex;
  margin: 0;
}

.matter-zip-import-status {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.matter-zip-import-status__item {
  max-width: min(100%, 42rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matter-zip-import-status__item--queued,
.matter-zip-import-status__item--running {
  background: #dbeafe;
  color: #1d4ed8;
}

.matter-zip-import-status__item--failed {
  background: #fee2e2;
  color: #b91c1c;
}

.matter-folder-panel__actions button,
.matter-file-actions button,
.matter-folder-chip {
  border: 1px solid var(--border-soft);
  border-radius: 0.8rem;
  padding: 0.52rem 0.72rem;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.78);
  font-weight: 700;
  cursor: pointer;
}

.matter-folder-panel__actions button:disabled,
.matter-file-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.matter-file-actions .danger-action {
  color: #a93838;
  border-color: rgba(169, 56, 56, 0.28);
}

.matter-folder-children {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.matter-folder-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(9, 148, 179, 0.1);
}

.matter-files-list--manager .modern-row {
  grid-template-columns: minmax(0, 1.25fr) minmax(160px, 0.55fr) auto;
}

html[data-theme="dark"] .matter-files-toolbar--manager,
html[data-theme="dark"] .matter-file-tree,
html[data-theme="dark"] .matter-file-browser,
html[data-theme="dark"] .matter-folder-panel {
  background: rgba(19, 27, 42, 0.84);
}

html[data-theme="dark"] .matter-tree-row:hover,
html[data-theme="dark"] .matter-tree-row.is-active,
html[data-theme="dark"] .matter-tree-row.is-drop-target {
  background: rgba(69, 191, 214, 0.15);
}

@media (max-width: 980px) {
  .matter-file-manager,
  .matter-folder-panel__header,
  .matter-files-list--manager .modern-row {
    grid-template-columns: 1fr;
  }

  .matter-folder-panel__status,
  .matter-folder-panel__actions,
  .matter-file-actions {
    justify-content: flex-start;
  }
}

.matter-folder-panel__actions[hidden],
.matter-file-actions[hidden],
.matter-files-upload--current[hidden] {
  display: none !important;
}

.matter-context-menu {
  position: fixed;
  z-index: 1200;
  min-width: 210px;
  padding: 0.35rem;
  border: 1px solid rgba(120, 145, 170, 0.34);
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 70px rgba(16, 31, 55, 0.22);
}

.matter-context-menu button {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 0.65rem;
  padding: 0.62rem 0.75rem;
  background: transparent;
  color: var(--text-main);
  text-align: left;
  font-weight: 700;
  cursor: pointer;
}

.matter-context-menu button:hover:not(:disabled) {
  background: rgba(9, 148, 179, 0.12);
}

.matter-context-menu button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.matter-context-menu__separator {
  height: 1px;
  margin: 0.35rem 0.25rem;
  background: rgba(120, 145, 170, 0.28);
}

.matter-context-menu__separator[hidden] {
  display: none !important;
}

.matter-context-menu .danger-action {
  color: #a93838;
}
.matter-file-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto minmax(150px, auto) auto;
  gap: 0.85rem;
  align-items: center;
  min-height: 58px;
  border: 1px solid rgba(119, 151, 180, 0.24);
  border-radius: 0.9rem;
  padding: 0.55rem 0.7rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(248, 252, 255, 0.9)), var(--surface);
  box-shadow: 0 10px 28px rgba(32, 56, 88, 0.05);
  cursor: default;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.matter-file-row:hover {
  border-color: rgba(9, 148, 179, 0.35);
  box-shadow: 0 16px 34px rgba(32, 56, 88, 0.1);
  transform: translateY(-1px);
}

.matter-file-row.is-selected {
  border-color: rgba(9, 148, 179, 0.72);
  background: linear-gradient(135deg, rgba(218, 246, 252, 0.95), rgba(241, 252, 255, 0.92)), var(--surface);
  box-shadow: 0 0 0 2px rgba(9, 148, 179, 0.16), 0 16px 34px rgba(32, 56, 88, 0.1);
}

.matter-file-row:focus-visible {
  outline: 3px solid rgba(9, 148, 179, 0.3);
  outline-offset: 2px;
}

.matter-file-row__icon {
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  border: 1px solid rgba(249, 115, 22, 0.22);
  border-radius: 0.7rem;
  background: #fff7ed;
  color: #ea580c;
}

.matter-file-row__icon svg {
  width: 1.05rem;
  height: 1.05rem;
}

.matter-file-row__body {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.matter-file-row__body strong,
.matter-file-row__body small,
.matter-file-row__body span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matter-file-row__body strong {
  color: var(--text-main);
  font-size: 0.92rem;
  font-weight: 900;
}

.matter-file-row__body small {
  color: var(--text-muted);
  font-size: 0.76rem;
}

.matter-file-row__body span,
.matter-file-row__facts small {
  color: var(--text-soft);
  font-size: 0.72rem;
}

.matter-file-row__ai-states {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.12rem;
}

.matter-file-row__body .matter-file-row__ai-states {
  overflow: visible;
  white-space: normal;
}

.matter-file-row__ai-states .status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.68rem;
  line-height: 1;
  padding: 0.16rem 0.42rem;
}

.matter-file-row__facts {
  display: grid;
  gap: 0.08rem;
  justify-items: end;
  min-width: 0;
}

.matter-file-row__open {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid rgba(9, 148, 179, 0.28);
  border-radius: 0.45rem;
  background: rgba(232, 249, 253, 0.9);
  color: #087d99;
  cursor: pointer;
}

.matter-file-row__open svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.matter-file-row__open:hover,
.matter-file-row__open:focus-visible {
  border-color: rgba(9, 148, 179, 0.62);
  background: #d8f3f9;
  outline: none;
}

.matter-file-row__facts span {
  color: var(--text-main);
  font-weight: 850;
}

.matter-file-row__type span {
  display: inline-flex;
  align-items: center;
  min-height: 1.55rem;
  border: 1px solid rgba(22, 163, 74, 0.22);
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  background: #dcfce7;
  color: #166534;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.matter-file-upload-popover {
  position: fixed;
  inset: 0;
  z-index: 1150;
  display: grid;
  place-items: start center;
  padding-top: min(18vh, 9rem);
  background: rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(3px);
}

.matter-file-upload-popover[hidden] {
  display: none;
}

.matter-file-upload-popover form {
  width: min(520px, calc(100vw - 2rem));
  border: 1px solid rgba(9, 148, 179, 0.28);
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 28px 90px rgba(16, 31, 55, 0.24);
  padding: 1rem;
}

.matter-file-upload-popover header,
.matter-file-upload-popover footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.matter-file-upload-popover header p {
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.matter-file-upload-popover header button,
.matter-file-upload-popover footer button {
  border: 1px solid var(--border-soft);
  border-radius: 0.8rem;
  padding: 0.55rem 0.85rem;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text-main);
  font-weight: 800;
}

.matter-file-upload-drop {
  display: grid;
  place-items: center;
  min-height: 160px;
  margin: 1rem 0;
  border: 2px dashed rgba(9, 148, 179, 0.4);
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(9, 148, 179, 0.08), rgba(255, 255, 255, 0.9));
  color: var(--text-muted);
  text-align: center;
  cursor: pointer;
}

.matter-file-upload-drop.is-drop-target {
  border-color: var(--accent);
  background: rgba(9, 148, 179, 0.16);
}

.matter-file-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.matter-file-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.matter-file-picker__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 2.3rem;
  border-radius: 999px;
  padding: 0.58rem 1rem;
  border: 1px solid rgba(9, 148, 179, 0.28);
  background: #0891b2;
  color: #fff;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(9, 148, 179, 0.22);
}

.matter-file-picker__button--secondary {
  background: #ffffff;
  color: #0f766e;
  box-shadow: none;
}

.matter-file-picker__summary {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.matter-upload-progress {
  display: grid;
  gap: 0.45rem;
  width: 100%;
  margin: 0.75rem 0;
  border: 1px solid rgba(9, 148, 179, 0.24);
  border-radius: 0.85rem;
  padding: 0.65rem 0.75rem;
  background: rgba(240, 253, 250, 0.9);
}

.matter-upload-progress[hidden] {
  display: none;
}

.matter-upload-progress div {
  display: grid;
  grid-template-columns: minmax(8.5rem, 8.5rem) 4.25rem auto;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.matter-upload-progress [data-upload-progress-label] {
  min-width: 8.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matter-upload-progress [data-upload-progress-detail] {
  min-width: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  overflow-wrap: anywhere;
  white-space: normal;
}

.matter-upload-progress [data-upload-progress-value] {
  color: var(--accent-strong);
  text-align: right;
}

.matter-upload-progress [data-upload-cancel] {
  border: 1px solid rgba(9, 148, 179, 0.28);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  background: #ffffff;
  color: #0f766e;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.matter-upload-progress progress {
  width: 100%;
  height: 0.65rem;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.24);
}

.matter-upload-progress progress::-webkit-progress-bar {
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.24);
}

.matter-upload-progress progress::-webkit-progress-value {
  border-radius: 999px;
  background: #0891b2;
}

.matter-upload-progress progress::-moz-progress-bar {
  border-radius: 999px;
  background: #0891b2;
}

form.is-uploading {
  cursor: progress;
}

form.is-uploading [data-upload-picker] {
  display: none;
}

.matter-file-upload-popover {
  padding: min(8vh, 5rem) 1rem 1rem;
  background: rgba(30, 43, 55, 0.34);
}

.matter-file-upload-popover .matter-file-upload-card {
  width: min(760px, calc(100vw - 2rem));
  border-color: rgba(167, 220, 231, 0.9);
  border-radius: 1.5rem;
  padding: 1.5rem;
  box-shadow: 0 24px 70px rgba(15, 34, 45, 0.24);
}

.matter-file-upload-header {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start !important;
  margin-bottom: 1.1rem;
}

.matter-file-upload-header p {
  margin: 0 0 0.25rem;
  color: #1f2937;
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.matter-file-upload-header h2 {
  margin: 0;
  color: #17202b;
  font-size: 1.25rem;
  line-height: 1.25;
  font-weight: 900;
}

.matter-file-upload-header small {
  display: block;
  margin-top: 0.45rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.4;
  font-weight: 700;
}

.matter-file-upload-close {
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid #d7edf3 !important;
  border-radius: 999px !important;
  padding: 0 !important;
  background: #f0f9fc !important;
  color: #17202b !important;
  font-size: 1.1rem;
  line-height: 1;
  font-weight: 950;
  box-shadow: 0 8px 18px rgba(15, 34, 45, 0.08);
  cursor: pointer;
}

.matter-file-upload-close:hover {
  border-color: #9bd9e5 !important;
  background: #dff6fb !important;
}

.matter-file-upload-drop {
  min-height: 178px;
  margin: 0;
  padding: 1.75rem 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  border-color: rgba(104, 207, 228, 0.92);
  border-radius: 1.125rem;
  background: linear-gradient(135deg, rgba(234, 250, 253, 0.82), rgba(255, 255, 255, 0.92));
  color: #314052;
  cursor: default;
}

.matter-file-upload-drop.is-drop-target {
  border-color: #0788a9;
  background: #e2f8fd;
}

.matter-file-upload-drop__main {
  margin: 0 0 1.25rem;
  color: #314052;
  font-size: 0.94rem;
  line-height: 1.45;
  font-weight: 650;
}

.matter-file-upload-drop__main strong {
  color: #0b85a4;
}

.matter-file-picker {
  width: 100%;
  margin-top: 0;
}

.matter-file-picker__button {
  min-height: 2.65rem;
  padding: 0 1.15rem;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.matter-file-picker__button:active {
  transform: translateY(1px);
}

.matter-file-picker__button--primary {
  background: #0ea5c6;
  color: #fff;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.55), 0 8px 18px rgba(14, 165, 198, 0.26);
}

.matter-file-picker__button--primary:hover {
  background: #0788a9;
}

.matter-file-picker__button--secondary {
  color: #087b96;
  background: #fff;
  border-color: #a9e1ec;
  box-shadow: inset 0 0 0 3px rgba(14, 165, 198, 0.12);
}

.matter-file-picker__button--secondary:hover {
  background: #effcff;
}

.matter-file-picker__summary {
  min-height: 2.65rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #344054;
  font-size: 0.9rem;
  font-weight: 850;
  white-space: nowrap;
}

.matter-file-picker__summary-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: #b8c7cf;
  flex: 0 0 auto;
}

.matter-file-picker__summary.is-selected .matter-file-picker__summary-dot {
  background: #17875b;
}

.matter-file-selection-summary {
  width: 100%;
  margin-top: 0.9rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid #d2edf4;
  border-radius: 0.9rem;
  background: #f7fcfd;
  text-align: left;
}

.matter-file-selection-summary[hidden] {
  display: none;
}

.matter-file-selection-summary__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
  color: #253041;
  font-size: 0.82rem;
  font-weight: 900;
}

.matter-file-selection-summary__header small {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 750;
  white-space: nowrap;
}

.matter-file-selection-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.matter-file-selection-preview li {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #e3eef2;
  border-radius: 0.65rem;
  padding: 0.5rem 0.65rem;
  background: #fff;
  color: #263445;
  font-size: 0.8rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matter-file-selection-preview li.more {
  color: var(--text-muted);
}

.matter-file-upload-card.upload-state-uploading [data-upload-picker],
.matter-file-upload-card.upload-state-issues [data-upload-picker],
.matter-file-upload-card.upload-state-done [data-upload-picker] {
  display: none;
}

.matter-file-upload-card.upload-state-uploading button[type="submit"],
.matter-file-upload-card.upload-state-issues button[type="submit"],
.matter-file-upload-card.upload-state-done button[type="submit"] {
  display: none;
}

.matter-file-upload-card.upload-state-empty button[type="submit"] {
  opacity: 0.55;
}

.matter-file-upload-card.upload-state-empty [data-upload-cancel],
.matter-file-upload-card.upload-state-selected [data-upload-cancel],
.matter-file-upload-card.upload-state-issues [data-upload-cancel],
.matter-file-upload-card.upload-state-done [data-upload-cancel] {
  display: none;
}

.matter-file-upload-card.upload-state-uploading [data-upload-dismiss] {
  display: none;
}

.matter-file-upload-card.upload-state-uploading [data-upload-close] {
  opacity: 0.72;
}

.matter-upload-progress {
  margin: 1rem 0 0;
  padding: 0.95rem;
  border-color: #b7e4ee;
  border-radius: 1.125rem;
  background: #eafafd;
}

.matter-upload-progress .matter-upload-progress__topline {
  display: grid;
  grid-template-columns: minmax(7.5rem, 0.9fr) minmax(20rem, 1.35fr) 3.5rem;
  gap: 0.9rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.matter-upload-progress [data-upload-progress-label] {
  display: block;
  min-width: 0;
  color: #1f2937;
  font-size: 0.95rem;
  line-height: 1.25;
  font-weight: 900;
  white-space: normal;
}

.matter-upload-progress [data-upload-progress-detail] {
  display: block;
  margin-top: 0.25rem;
  color: #475467;
  font-size: 0.82rem;
  line-height: 1.35;
  font-weight: 700;
}

.matter-upload-progress__meta {
  display: grid;
  grid-template-columns: 7.25rem 13.5rem;
  gap: 0.5rem;
  max-width: 21.25rem;
  margin-top: 0;
}

.matter-upload-progress__meta[hidden] {
  display: none;
}

.matter-upload-progress__metric {
  min-width: 0;
  display: grid;
  gap: 0.08rem;
  border: 1px solid rgba(183, 228, 238, 0.86);
  border-radius: 0.66rem;
  padding: 0.3rem 0.45rem;
  background: rgba(255, 255, 255, 0.58);
}

.matter-upload-progress__metric small {
  color: #667085;
  font-size: 0.62rem;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.matter-upload-progress__metric strong {
  min-width: 0;
  overflow: hidden;
  color: #263445;
  font-size: 0.76rem;
  font-weight: 850;
  line-height: 1.12;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matter-upload-progress [data-upload-progress-value] {
  width: 3.5rem;
  min-width: 3.5rem;
  color: #1f2937;
  font-size: 1rem;
  font-weight: 950;
  text-align: right;
}

.matter-upload-progress progress {
  height: 0.75rem;
  background: #cfe2eb;
}

.matter-upload-status-list {
  display: grid;
  gap: 0.32rem;
  max-height: 8.2rem;
  margin: 0.75rem 0 0;
  padding: 0;
  overflow: auto;
  list-style: none;
  scrollbar-width: thin;
  scrollbar-color: #9bd9e5 transparent;
}

.matter-upload-status-list[hidden] {
  display: none;
}

.matter-upload-status-list__item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
  border: 1px solid rgba(187, 225, 233, 0.8);
  min-height: 2.15rem;
  border-radius: 0.62rem;
  padding: 0.34rem 0.55rem;
  background: rgba(255, 255, 255, 0.72);
  color: #263445;
  font-size: 0.82rem;
  font-weight: 750;
}

.matter-upload-status-list__icon {
  width: 1.2rem;
  height: 1.2rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #e5f6fa;
  color: #087b96;
  font-size: 0.68rem;
  font-weight: 950;
}

.matter-upload-status-list__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matter-upload-status-list__state {
  color: var(--text-muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.matter-upload-status-list__item.is-done .matter-upload-status-list__icon {
  background: #e8f8f0;
  color: #17875b;
}

.matter-upload-status-list__item.is-skipped .matter-upload-status-list__icon {
  background: #fff5df;
  color: #a15c05;
}

.matter-upload-status-list__item.is-error .matter-upload-status-list__icon {
  background: #fff0ed;
  color: #b42318;
}

.matter-upload-issues,
.matter-upload-result {
  margin-top: 0.75rem;
  overflow: hidden;
  border: 1px solid #d6e8ee;
  border-radius: 1.125rem;
  background: #fff;
}

.matter-upload-issues[hidden],
.matter-upload-result[hidden] {
  display: none;
}

.matter-upload-issues__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 0.95rem;
  border-bottom: 1px solid #e2eef3;
  background: #f7fcfd;
  color: #1f2937;
  font-size: 0.88rem;
  font-weight: 900;
}

.matter-upload-issues__header small {
  color: #475467;
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

.matter-upload-issues__list {
  max-height: 9rem;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #b8c7cf transparent;
}

.matter-upload-issue {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.65rem;
  padding: 0.7rem 0.95rem;
  border-bottom: 1px solid #edf3f6;
}

.matter-upload-issue:last-child {
  border-bottom: 0;
}

.matter-upload-issue__type {
  min-width: 5.1rem;
  height: 1.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.68rem;
  line-height: 1;
  font-weight: 950;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.matter-upload-issue__type.is-skipped {
  background: #f3f4f6;
  color: #6b7280;
}

.matter-upload-issue__type.is-error {
  background: #fff0ed;
  color: #b42318;
}

.matter-upload-issue__message {
  min-width: 0;
  color: #344054;
  font-size: 0.82rem;
  line-height: 1.35;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.matter-upload-issue__message strong,
.matter-upload-issue__message small {
  display: block;
}

.matter-upload-issue__message small {
  margin-top: 0.2rem;
  color: #667085;
  font-size: 0.76rem;
  font-weight: 650;
}

.matter-upload-result {
  display: grid;
  gap: 0.35rem;
  padding: 0.9rem 0.95rem;
  border-color: #bce8cf;
  background: #e8f8f0;
  color: #126142;
  font-size: 0.88rem;
}

.matter-upload-result strong {
  font-weight: 950;
}

.matter-upload-result span {
  color: #426153;
  font-weight: 750;
}

.matter-file-upload-footer {
  padding-top: 1.25rem;
}

.matter-file-upload-footer > div {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.matter-file-upload-footer [data-upload-cancel],
.matter-file-upload-footer [data-upload-reset] {
  border-color: #a9e1ec;
  border-radius: 999px;
  background: #f8fdff;
  color: #087b96;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(15, 34, 45, 0.06);
}

.matter-file-upload-footer [data-upload-close] {
  border-color: #d6e3ea;
  border-radius: 999px;
  background: #fff;
  color: #253041;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(15, 34, 45, 0.06);
}

.matter-file-upload-footer .primary-action {
  min-height: 2.75rem;
  border-radius: 999px;
  box-shadow: 0 12px 24px rgba(8, 145, 178, 0.22);
}

.matter-file-upload-footer [data-upload-reset][hidden] {
  display: none;
}

@media (max-width: 640px) {
  .matter-file-upload-popover {
    align-items: start;
    padding: 0.75rem;
  }

  .matter-file-upload-popover .matter-file-upload-card {
    width: 100%;
    padding: 1.1rem;
  }

  .matter-file-picker__button,
  .matter-file-picker__summary,
  .matter-file-upload-footer > div,
  .matter-file-upload-footer button {
    width: 100%;
  }

  .matter-file-picker__summary {
    justify-content: center;
  }

  .matter-file-selection-preview {
    grid-template-columns: 1fr;
  }

  .matter-upload-progress .matter-upload-progress__topline {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .matter-upload-progress__meta {
    grid-column: 1 / -1;
    grid-template-columns: minmax(6.5rem, 0.8fr) minmax(10rem, 1.2fr);
    width: auto;
    max-width: none;
    min-width: 0;
    text-align: left;
  }

  .matter-upload-status-list__item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .matter-upload-status-list__state {
    grid-column: 2;
  }

  .matter-upload-issue {
    grid-template-columns: 1fr;
  }

  .matter-upload-issue__type {
    width: max-content;
  }
}

.matter-file-upload-drop:focus-within .matter-file-picker__button {
  outline: 3px solid rgba(9, 148, 179, 0.24);
  outline-offset: 2px;
}

html[data-theme="dark"] .matter-context-menu,
html[data-theme="dark"] .matter-file-upload-popover form {
  background: rgba(19, 27, 42, 0.98);
  border-color: rgba(148, 163, 184, 0.28);
}

html[data-theme="dark"] .matter-file-upload-drop {
  background: rgba(9, 148, 179, 0.11);
}

html[data-theme="dark"] .matter-file-picker__button--secondary {
  border-color: rgba(45, 212, 191, 0.25);
  background: rgba(15, 23, 42, 0.88);
  color: #5eead4;
}

html[data-theme="dark"] .matter-upload-progress {
  border-color: rgba(45, 212, 191, 0.22);
  background: rgba(15, 23, 42, 0.78);
}

html[data-theme="dark"] .matter-file-upload-header p,
html[data-theme="dark"] .matter-file-upload-header h2,
html[data-theme="dark"] .matter-upload-progress [data-upload-progress-label],
html[data-theme="dark"] .matter-upload-progress [data-upload-progress-value],
html[data-theme="dark"] .matter-upload-issues__header {
  color: #e5eef5;
}

html[data-theme="dark"] .matter-file-upload-header small,
html[data-theme="dark"] .matter-file-picker__summary,
html[data-theme="dark"] .matter-file-selection-summary__header small,
html[data-theme="dark"] .matter-upload-progress__meta,
html[data-theme="dark"] .matter-upload-progress [data-upload-progress-detail],
html[data-theme="dark"] .matter-upload-status-list__state,
html[data-theme="dark"] .matter-upload-issue__message small {
  color: #aebdca;
}

html[data-theme="dark"] .matter-upload-progress__metric {
  border-color: rgba(45, 212, 191, 0.2);
  background: rgba(15, 23, 42, 0.52);
}

html[data-theme="dark"] .matter-upload-progress__metric small {
  color: #94a3b8;
}

html[data-theme="dark"] .matter-upload-progress__metric strong {
  color: #dce7ef;
}

html[data-theme="dark"] .matter-file-upload-close {
  background: rgba(30, 41, 59, 0.95) !important;
  color: #e5eef5 !important;
}

html[data-theme="dark"] .matter-file-upload-drop {
  border-color: rgba(45, 212, 191, 0.3);
  color: #dce7ef;
}

html[data-theme="dark"] .matter-file-upload-drop__main,
html[data-theme="dark"] .matter-file-selection-summary__header,
html[data-theme="dark"] .matter-upload-status-list__name,
html[data-theme="dark"] .matter-upload-issue__message {
  color: #dce7ef;
}

html[data-theme="dark"] .matter-file-selection-summary,
html[data-theme="dark"] .matter-upload-issues {
  border-color: rgba(45, 212, 191, 0.18);
  background: rgba(15, 23, 42, 0.74);
}

html[data-theme="dark"] .matter-file-selection-preview li,
html[data-theme="dark"] .matter-upload-status-list__item {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(19, 27, 42, 0.72);
  color: #dce7ef;
}

html[data-theme="dark"] .matter-upload-issues__header {
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(19, 27, 42, 0.92);
}

html[data-theme="dark"] .matter-upload-issue {
  border-color: rgba(148, 163, 184, 0.16);
}

html[data-theme="dark"] .matter-upload-result {
  border-color: rgba(52, 211, 153, 0.28);
  background: rgba(20, 83, 45, 0.24);
  color: #bbf7d0;
}

html[data-theme="dark"] .matter-upload-result span {
  color: #a7f3d0;
}

html[data-theme="dark"] .matter-file-upload-footer [data-upload-cancel],
html[data-theme="dark"] .matter-file-upload-footer [data-upload-reset],
html[data-theme="dark"] .matter-file-upload-footer [data-upload-close] {
  border-color: rgba(45, 212, 191, 0.25);
  background: rgba(15, 23, 42, 0.88);
  color: #5eead4;
}

html[data-theme="dark"] .matter-file-upload-footer .primary-action {
  box-shadow: 0 12px 24px rgba(45, 212, 191, 0.14);
}
html[data-theme="dark"] .matter-file-row {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(19, 27, 42, 0.9);
}

html[data-theme="dark"] .matter-file-row.is-selected {
  border-color: rgba(45, 212, 191, 0.58);
  background: rgba(16, 65, 77, 0.82);
  box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.14), 0 16px 34px rgba(0, 0, 0, 0.22);
}

html[data-theme="dark"] .matter-file-row__icon {
  border-color: rgba(251, 146, 60, 0.28);
  background: rgba(251, 146, 60, 0.12);
  color: #fdba74;
}

html[data-theme="dark"] .matter-file-row__open {
  border-color: rgba(45, 212, 191, 0.28);
  background: rgba(45, 212, 191, 0.1);
  color: #5eead4;
}

.matter-file-preview-modal::backdrop {
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(2px);
}

.matter-file-preview-modal {
  width: min(1440px, calc(100vw - 2rem));
  max-width: none;
}

.matter-file-preview-modal.is-wide {
  width: calc(100vw - 1rem);
}

.matter-file-preview-card {
  width: 100%;
  height: min(92vh, 1040px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 0;
  overflow: hidden;
}

.matter-file-preview-modal.is-wide .matter-file-preview-card {
  height: calc(100vh - 1rem);
}

.matter-file-preview-card header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-soft);
}

.matter-file-preview-card header > div:first-child {
  min-width: 0;
}

.matter-file-preview-card h2,
.matter-file-preview-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matter-file-preview-actions {
  display: inline-flex;
  flex-shrink: 0;
  gap: 0.35rem;
  align-items: center;
}

.matter-file-preview-actions a,
.matter-file-preview-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 2.35rem;
  min-height: 2.35rem;
  border: 1px solid rgba(9, 148, 179, 0.24);
  border-radius: 0.75rem;
  background: #f8fdff;
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.matter-file-preview-actions [data-file-preview-close] {
  min-width: auto;
  padding-inline: 0.8rem;
  background: #102033;
  color: #fff;
}

.matter-file-preview-actions a:hover,
.matter-file-preview-actions button:hover {
  border-color: rgba(9, 148, 179, 0.44);
  box-shadow: 0 8px 22px rgba(32, 56, 88, 0.1);
}

.matter-file-preview-card iframe {
  width: 100%;
  height: 100%;
  min-height: 76vh;
  border: 0;
  background: #fff;
}

@media (max-width: 760px) {
  .matter-file-manager {
    grid-template-columns: minmax(0, 1fr) !important;
    width: min(100%, calc(100vw - 2.75rem));
    max-width: calc(100vw - 2.75rem);
    min-width: 0;
  }

  .matter-file-tree,
  .matter-file-browser,
  .matter-folder-panel,
  .matter-files-list--manager,
  .matter-file-row,
  .matter-tree-row__label {
    min-width: 0;
    max-width: 100%;
  }

  .matter-file-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .matter-file-row__open {
    grid-column: 3;
    grid-row: 1;
  }

  .matter-file-row__facts {
    grid-column: 2 / 4;
    grid-row: 2;
    justify-items: start;
  }

  .matter-file-row__type {
    grid-column: 1;
    grid-row: 2;
  }
}

.ai-readiness-pill--ready {
  background: #dcfce7 !important;
  color: #166534 !important;
  border-color: rgba(22, 101, 52, 0.24) !important;
}

.ai-readiness-pill--partial {
  background: #ffedd5 !important;
  color: #9a3412 !important;
  border-color: rgba(154, 52, 18, 0.24) !important;
}

.ai-readiness-pill--running {
  background: #ffedd5 !important;
  color: #9a3412 !important;
  border-color: rgba(154, 52, 18, 0.28) !important;
}

.ai-readiness-spinner {
  width: 0.62rem;
  height: 0.62rem;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  animation: ai-readiness-spin 0.8s linear infinite;
}

@keyframes ai-readiness-spin {
  to {
    transform: rotate(360deg);
  }
}

.ai-readiness-pill--missing {
  background: #fee2e2 !important;
  color: #991b1b !important;
  border-color: rgba(153, 27, 27, 0.24) !important;
}

.ai-readiness-pill--empty,
.ai-readiness-pill--archive,
.ai-readiness-pill--system {
  background: rgba(107, 123, 145, 0.13) !important;
  color: var(--text-muted) !important;
  border-color: rgba(107, 123, 145, 0.22) !important;
}


.matter-ai-status-card {
  width: min(920px, calc(100vw - 2rem));
  max-height: min(82vh, 860px);
  overflow: auto;
}

.matter-ai-status-card .modern-row--compact {
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, .8fr);
}

.matter-ai-status-card .modern-row__main,
.matter-ai-status-card .modern-row__meta {
  min-width: 0;
}

.matter-ai-status-card .modern-row__main small,
.matter-ai-status-card .modern-row__meta span,
.matter-ai-status-card .modern-row__meta small {
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 760px) {
  .matter-ai-status-card .modern-row--compact {
    grid-template-columns: 1fr;
  }
}

.matter-ai-status-modal {
  width: min(1180px, calc(100vw - 4rem));
  max-width: none;
  padding: 0;
}

.matter-ai-status-modal::backdrop {
  background: rgba(15, 23, 42, 0.34);
}

.matter-ai-status-card {
  box-sizing: border-box;
  width: 100% !important;
  max-width: none;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  overflow-x: hidden;
}

.matter-ai-status-card .modern-list {
  overflow: visible;
}

.matter-ai-status-card .modern-row--compact {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px) !important;
  align-items: start;
  width: 100%;
  box-sizing: border-box;
}

.matter-ai-status-card .modern-row__main,
.matter-ai-status-card .modern-row__meta {
  min-width: 0;
  max-width: 100%;
}

.matter-ai-status-card .modern-row__meta {
  justify-items: start;
  text-align: left;
}

.matter-ai-status-card .modern-row__main strong,
.matter-ai-status-card .modern-row__main small,
.matter-ai-status-card .modern-row__meta span,
.matter-ai-status-card .modern-row__meta small {
  white-space: normal !important;
  overflow-wrap: break-word;
  word-break: normal;
}

@media (max-width: 780px) {
  .matter-ai-status-modal {
    width: calc(100vw - 1rem);
  }

  .matter-ai-status-card .modern-row--compact {
    grid-template-columns: 1fr !important;
  }
}

/* Matter AI status modal - operational summary first, technical history second. */
.matter-ai-status-body {
  display: grid;
  gap: 0.75rem;
}

.matter-ai-current-status {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 1rem;
  border: 1px solid rgba(14, 116, 144, 0.18);
  border-radius: 1rem;
  padding: 1rem;
  background: linear-gradient(135deg, rgba(236, 254, 255, 0.92), rgba(255, 255, 255, 0.98));
}

.matter-ai-current-status--running,
.matter-ai-current-status--queued {
  border-color: rgba(2, 132, 199, 0.28);
  background: linear-gradient(135deg, rgba(224, 242, 254, 0.96), rgba(255, 255, 255, 0.98));
}

.matter-ai-current-status--done {
  border-color: rgba(22, 163, 74, 0.24);
  background: linear-gradient(135deg, rgba(220, 252, 231, 0.92), rgba(255, 255, 255, 0.98));
}

.matter-ai-current-status--failed {
  border-color: rgba(220, 38, 38, 0.26);
  background: linear-gradient(135deg, rgba(254, 226, 226, 0.88), rgba(255, 255, 255, 0.98));
}

.matter-ai-current-status__main,
.matter-ai-current-status__meta,
.matter-ai-current-status__meta div {
  min-width: 0;
}

.matter-ai-current-status__main p,
.matter-ai-current-status__meta dt {
  margin: 0 0 0.2rem;
  color: #0e7490;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.matter-ai-current-status__main h3 {
  margin: 0 0 0.55rem;
  color: #0f172a;
  font-size: 1.18rem;
}

.matter-ai-current-status__main small {
  display: block;
  color: #64748b;
  overflow-wrap: break-word;
}

.matter-ai-current-status__meta {
  display: grid;
  gap: 0.55rem;
  margin: 0;
}

.matter-ai-current-status__meta dd {
  margin: 0;
  color: #334155;
  overflow-wrap: break-word;
}

.matter-ai-history-details {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 0.9rem;
  background: rgba(248, 250, 252, 0.72);
  overflow: hidden;
}

.matter-ai-history-details summary {
  cursor: pointer;
  padding: 0.75rem 0.9rem;
  color: #0f172a;
  font-weight: 800;
  list-style-position: inside;
}

.matter-ai-history-details[open] summary {
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.matter-ai-technical-list {
  padding: 0.75rem;
}

.matter-ai-status-card .matter-ai-technical-list .modern-row--compact {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px) !important;
}

.matter-ai-status-card .matter-ai-technical-list .modern-row__main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 0.35rem;
  align-content: start;
}

.matter-ai-status-card .matter-ai-token {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 0.5rem;
  background: rgba(248, 250, 252, 0.86);
  color: #334155;
  padding: 0.24rem 0.42rem;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.75rem;
  line-height: 1.35;
  scrollbar-width: thin;
}

.matter-ai-status-card .matter-ai-token--link {
  text-decoration: none;
}

.matter-ai-status-card .matter-ai-token--link:hover,
.matter-ai-status-card .matter-ai-token--link:focus-visible {
  border-color: rgba(8, 145, 178, 0.55);
  color: #0369a1;
}

.matter-ai-status-card .matter-ai-step-cost {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  border: 1px solid rgba(14, 116, 144, 0.22);
  border-radius: 999px;
  background: rgba(236, 254, 255, 0.72);
  color: #0e7490;
  padding: 0.16rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.35;
}

.matter-ai-report-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  margin-top: 0.4rem;
  border: 1px solid rgba(8, 145, 178, 0.28);
  border-radius: 999px;
  background: rgba(236, 254, 255, 0.82);
  color: #0369a1;
  padding: 0.28rem 0.68rem;
  font-size: 0.78rem;
  font-weight: 800;
  text-decoration: none;
}

.matter-ai-report-link:hover,
.matter-ai-report-link:focus-visible {
  border-color: rgba(8, 145, 178, 0.55);
  background: #cffafe;
}

.matter-ai-cancel-form {
  display: inline-flex;
  margin: 0.4rem 0 0 0.35rem;
}

.matter-ai-cancel-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  border: 1px solid rgba(239, 68, 68, 0.32);
  border-radius: 999px;
  background: rgba(254, 242, 242, 0.88);
  color: #b91c1c;
  padding: 0.28rem 0.68rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.matter-ai-cancel-link:hover,
.matter-ai-cancel-link:focus-visible {
  border-color: rgba(220, 38, 38, 0.58);
  background: #fee2e2;
}

.matter-ai-status-card .modern-row__main .matter-ai-token,
.matter-ai-status-card .modern-row__meta .matter-ai-token {
  white-space: nowrap !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
  justify-self: stretch;
}

.matter-ai-error-block {
  min-width: 0;
  max-width: 100%;
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-radius: 0.65rem;
  background: rgba(254, 242, 242, 0.86);
  color: #7f1d1d;
  overflow: hidden;
}

.matter-ai-error-block summary {
  cursor: pointer;
  padding: 0.42rem 0.55rem;
  color: #991b1b;
  font-size: 0.78rem;
  font-weight: 800;
  list-style-position: inside;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matter-ai-error-block pre {
  max-height: 12rem;
  margin: 0;
  overflow: auto;
  border-top: 1px solid rgba(220, 38, 38, 0.16);
  padding: 0.6rem;
  color: #7f1d1d;
  font: 0.75rem/1.45 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  scrollbar-width: thin;
}

html[data-theme="dark"] .matter-ai-status-card .matter-ai-token {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.88);
  color: #cbd5e1;
}

html[data-theme="dark"] .matter-ai-status-card .matter-ai-step-cost {
  border-color: rgba(45, 212, 191, 0.26);
  background: rgba(13, 148, 136, 0.14);
  color: #99f6e4;
}

html[data-theme="dark"] .matter-ai-error-block {
  border-color: rgba(248, 113, 113, 0.28);
  background: rgba(69, 10, 10, 0.38);
  color: #fecaca;
}

html[data-theme="dark"] .matter-ai-error-block summary,
html[data-theme="dark"] .matter-ai-error-block pre {
  color: #fecaca;
}

html[data-theme="dark"] .matter-ai-error-block pre {
  border-top-color: rgba(248, 113, 113, 0.2);
}

@media (max-width: 900px) {
  .matter-ai-current-status,
  .matter-ai-status-card .matter-ai-technical-list .modern-row--compact {
    grid-template-columns: 1fr !important;
  }
}

.matter-ai-status-actions {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.matter-ai-status-actions [data-folder-status-refresh] {
  min-height: 2.45rem;
  border: 1px solid rgba(14, 116, 144, 0.22);
  border-radius: 0.75rem;
  padding: 0.55rem 0.85rem;
  background: #ecfeff;
  color: #0e7490;
  font-weight: 800;
}

.matter-ai-status-actions [data-folder-status-refresh]:disabled,
[data-folder-status-body].is-refreshing {
  opacity: 0.68;
}

/* Modal action bars must not inherit the global 32px close-button width. */
.matter-ai-status-card > header,
.matter-file-preview-card > header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: start;
  gap: 1rem;
  overflow: visible;
}

.matter-ai-status-card > header > div:first-child,
.matter-file-preview-card > header > div:first-child {
  min-width: 0;
}

.matter-ai-status-actions,
.matter-file-preview-actions {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.45rem;
  justify-self: end;
  max-width: min(52vw, 560px);
  min-width: max-content;
  overflow: visible;
}

.matter-ai-status-actions button,
.matter-file-preview-actions button,
.matter-file-preview-actions a {
  width: auto !important;
  min-width: max-content;
  min-height: 2.35rem;
  white-space: nowrap;
  border-radius: 0.75rem;
  padding: 0.55rem 0.8rem;
  line-height: 1;
  flex: 0 0 auto;
}

.matter-ai-status-actions [data-close-modal],
.matter-file-preview-actions [data-file-preview-close] {
  background: #102033;
  color: #fff;
  border-color: #102033;
}

@media (max-width: 720px) {
  .matter-ai-status-card > header,
  .matter-file-preview-card > header {
    grid-template-columns: 1fr;
  }

  .matter-ai-status-actions,
  .matter-file-preview-actions {
    justify-content: flex-start;
    justify-self: start;
    max-width: 100%;
    min-width: 0;
  }
}

.matter-llm-profile-modal {
  width: min(980px, calc(100vw - 32px));
}

.matter-llm-profile-card {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.matter-llm-profile-card header button[data-close-modal] {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 999px;
  font-size: 0;
  overflow: hidden;
}

.matter-llm-profile-card header button[data-close-modal]::before {
  content: "×";
  font-size: 1rem;
  line-height: 1;
}

.matter-llm-profile-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 10px;
  margin: 4px 0 16px;
}

.matter-llm-profile-summary span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6fbfd;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  padding: 9px 11px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.matter-llm-profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 12px;
}

.matter-llm-profile-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 14px;
  min-width: 0;
  cursor: pointer;
}

.matter-llm-profile-option:has(input:checked) {
  border-color: var(--brand);
  background: #e9f8fb;
  box-shadow: 0 0 0 2px rgba(34, 150, 184, 0.16);
}

.matter-llm-profile-option input {
  margin-top: 4px;
}

.matter-llm-profile-option strong,
.matter-llm-profile-option small,
.matter-llm-profile-option em,
.matter-llm-profile-facts {
  grid-column: 2;
}

.matter-llm-profile-option strong {
  display: block;
  color: var(--text);
  font-size: 0.98rem;
  overflow-wrap: anywhere;
}

.matter-llm-profile-option small {
  display: block;
  color: var(--muted);
  font-weight: 700;
  margin-top: 2px;
}

.matter-llm-profile-option em {
  color: var(--muted);
  font-style: normal;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.matter-llm-profile-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.matter-llm-profile-facts b {
  border-radius: 999px;
  background: #f1f7fb;
  color: var(--muted);
  font-size: 0.76rem;
  padding: 4px 8px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.matter-llm-profile-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.matter-llm-download-pill {
  text-decoration: none;
  color: var(--brand-dark);
  border-color: rgba(34, 150, 184, 0.35);
  background: #ecfbff;
  cursor: pointer;
  font: inherit;
}

.matter-llm-download-pill:hover,
.matter-llm-download-pill:focus-visible {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.matter-llm-download-pill.danger-action {
  color: #b42318;
  border-color: rgba(244, 63, 94, 0.28);
  background: #fff1f2;
}

.matter-llm-download-pill.danger-action:hover,
.matter-llm-download-pill.danger-action:focus-visible {
  color: #fff;
  background: #dc2626;
  border-color: #dc2626;
}

.matter-llm-download-pill:disabled,
.matter-llm-download-pill[data-busy="true"] {
  cursor: wait;
  opacity: 0.72;
}

@media (max-width: 760px) {
  .matter-llm-profile-summary,
  .matter-llm-profile-grid {
    grid-template-columns: 1fr;
  }
}

html[data-theme="dark"] .matter-llm-profile-summary span,
html[data-theme="dark"] .matter-llm-profile-option,
html[data-theme="dark"] .matter-llm-profile-facts b {
  background: #132236;
  border-color: rgba(148, 163, 184, 0.28);
  color: #b8c5d8;
}

html[data-theme="dark"] .matter-llm-profile-option:has(input:checked) {
  background: rgba(34, 150, 184, 0.16);
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.18);
}

html[data-theme="dark"] .matter-llm-profile-option strong {
  color: #f8fafc;
}

html[data-theme="dark"] .matter-llm-profile-option small,
html[data-theme="dark"] .matter-llm-profile-option em,
html[data-theme="dark"] .matter-llm-profile-note {
  color: #b8c5d8;
}

html[data-theme="dark"] .matter-llm-download-pill {
  color: #8be2f7;
  background: rgba(34, 150, 184, 0.14);
  border-color: rgba(56, 189, 248, 0.36);
}

/* Matter analysis sessions */
.matter-analysis-shell {
    display: grid;
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.matter-analysis-sidebar,
.matter-analysis-main {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(123, 167, 200, 0.26);
    border-radius: 24px;
    box-shadow: 0 18px 48px rgba(25, 55, 89, 0.08);
}

.matter-analysis-sidebar {
    padding: 1rem;
    min-height: 560px;
}

.matter-analysis-sidebar__header,
.matter-analysis-composer__bar,
.matter-analysis-message header,
.matter-analysis-message__summary,
.matter-analysis-message footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-width: 0;
    max-width: 100%;
    flex-wrap: wrap;
}

.matter-analysis-message__details {
    display: block;
}

.matter-analysis-message__summary {
    list-style: none;
    cursor: pointer;
}

.matter-analysis-message__summary::-webkit-details-marker {
    display: none;
}

.matter-analysis-sidebar button,
.matter-analysis-settings button,
.matter-analysis-composer button,
.matter-analysis-message button {
    border: 0;
    border-radius: 14px;
    padding: 0.65rem 0.9rem;
    color: #08233f;
    background: #e8f8fc;
    font-weight: 800;
    cursor: pointer;
}

.matter-analysis-session-list {
    display: grid;
    gap: 0.65rem;
    margin-top: 1rem;
}

.matter-analysis-session-list a {
    display: grid;
    gap: 0.25rem;
    padding: 0.9rem;
    border-radius: 18px;
    color: #10233f;
    text-decoration: none;
    background: #f6f9fd;
}

.matter-analysis-session-list a.is-active {
    background: linear-gradient(135deg, #dff8fc, #eef8ff);
    box-shadow: inset 4px 0 0 #0898b8;
}

.matter-analysis-session-list small,
.matter-analysis-session-list span,
.matter-analysis-message small,
.matter-analysis-readiness small {
    color: #677891;
}

.matter-analysis-main {
    display: grid;
    gap: 1rem;
    padding: 1rem;
    min-width: 0;
}

.matter-analysis-top {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
    gap: 1rem;
}

.matter-analysis-settings {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 0.8rem;
}

.matter-analysis-settings label,
.matter-analysis-composer label {
    display: grid;
    gap: 0.35rem;
    color: #56657a;
    font-size: 0.82rem;
    font-weight: 700;
}

.matter-analysis-settings input,
.matter-analysis-settings select,
.matter-analysis-settings textarea,
.matter-analysis-composer textarea,
.matter-analysis-prompt-tools select {
    width: 100%;
    border: 1px solid #cfe0f1;
    border-radius: 14px;
    padding: 0.75rem 0.85rem;
    background: #ffffff;
    color: #10233f;
}

.matter-analysis-settings__wide {
    grid-column: span 3;
}

.toggle-row {
    display: flex !important;
    grid-auto-flow: column;
    grid-template-columns: auto 1fr;
    align-items: center;
}

.matter-analysis-readiness {
    display: grid;
    gap: 1rem;
    border-radius: 22px;
    padding: 1rem;
    border: 1px solid #bee3f8;
    background: linear-gradient(135deg, #e8f7ff, #ffffff);
}

.matter-analysis-readiness.is-ready {
    border-color: #8ddeaa;
    background: linear-gradient(135deg, #e8ffef, #ffffff);
}

.matter-analysis-readiness.is-warning {
    border-color: #ffd08a;
    background: linear-gradient(135deg, #fff8e6, #ffffff);
}

.matter-analysis-readiness.is-blocked {
    border-color: #f5b2b2;
    background: linear-gradient(135deg, #fff0f0, #ffffff);
}

.matter-analysis-readiness span,
.matter-analysis-readiness dt {
    color: #08728a;
    font-size: 0.75rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.matter-analysis-readiness dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.35rem 0.75rem;
    margin: 0;
}

.matter-analysis-readiness h3 {
    margin: 0.2rem 0;
    font-size: 1.1rem;
}

.matter-analysis-readiness p {
    margin: 0;
    color: #475569;
    line-height: 1.5;
}

.matter-analysis-readiness dd {
    margin: 0;
    color: #10233f;
    font-weight: 800;
}

.matter-analysis-readiness__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
}

.matter-analysis-readiness__actions p {
    flex: 1 1 260px;
    font-weight: 800;
    color: #10233f;
}

.matter-analysis-readiness__actions form {
    margin: 0;
}

.matter-analysis-readiness__actions small {
    flex: 1 1 100%;
    color: #64748b;
    line-height: 1.4;
}

.matter-analysis-chat {
    display: grid;
    gap: 0.9rem;
    min-height: 260px;
    align-content: start;
    grid-auto-rows: max-content;
}

.matter-analysis-message {
    border: 1px solid #d9e7f5;
    border-radius: 20px;
    padding: 0.85rem 1rem;
    background: #ffffff;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.matter-analysis-message.is-user {
    margin-left: 12%;
    background: linear-gradient(135deg, #f7fbff, #ffffff);
}

.matter-analysis-message.is-assistant {
    margin-right: 8%;
}

.matter-analysis-message p {
    white-space: pre-wrap;
    line-height: 1.55;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.matter-analysis-message__title {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.matter-analysis-collapse-toggle {
    position: relative;
    width: 1.4rem;
    height: 1.4rem;
    flex: 0 0 1.4rem;
    border: 1px solid #9cb8d4;
    border-radius: 999px;
    padding: 0;
    background: transparent;
    color: #10233f;
    cursor: pointer;
    pointer-events: none;
    box-shadow: none;
    transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.matter-analysis-collapse-toggle span {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0.38rem;
    height: 0.38rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translate(-50%, -62%) rotate(45deg);
}

.matter-analysis-collapse-toggle[aria-expanded="false"] span {
    transform: translate(-58%, -50%) rotate(-45deg);
}

.matter-analysis-collapse-toggle:hover,
.matter-analysis-collapse-toggle:focus-visible {
    border-color: #0b9abd;
    color: #07839f;
    background: rgba(230, 245, 249, 0.52);
    outline: none;
    box-shadow: 0 0 0 2px rgba(11, 154, 189, 0.08);
}

.matter-analysis-collapse-toggle[aria-expanded="true"] {
    border-color: #0b9abd;
    color: #07839f;
    background: transparent;
}

.matter-analysis-message__details[open] .matter-analysis-collapse-toggle {
    border-color: #0b9abd;
    color: #07839f;
    background: transparent;
}

.matter-analysis-message__details:not([open]) .matter-analysis-collapse-toggle span {
    transform: translate(-58%, -50%) rotate(-45deg);
}

.matter-analysis-message__details[open] ~ .matter-analysis-message__content {
    max-height: none !important;
    overflow: visible !important;
}

.matter-analysis-message__details[open] ~ .matter-analysis-message__content > * {
    display: revert !important;
}

.matter-analysis-message__details[open] ~ .matter-analysis-message__content > :first-child {
    display: block !important;
    -webkit-line-clamp: unset !important;
}

.matter-analysis-message__meta {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    flex-wrap: wrap;
    min-width: 0;
}

.matter-analysis-message__meta form {
    margin: 0;
}

.matter-analysis-message__author {
    border-radius: 999px;
    padding: 0.22rem 0.55rem;
    background: #e0f2fe;
    color: #075985;
    font-size: 0.76rem;
    font-weight: 900;
    line-height: 1.2;
}

.matter-analysis-message-action {
    border-radius: 999px !important;
    padding: 0.28rem 0.55rem !important;
    background: #edf7fb !important;
    color: #0f5970 !important;
    font-size: 0.78rem !important;
    line-height: 1.15;
    box-shadow: inset 0 0 0 1px rgba(14, 116, 144, 0.18);
}

.matter-analysis-message-action.is-danger {
    background: #fff1f2 !important;
    color: #b91c1c !important;
    box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.35);
}

.matter-analysis-message.is-collapsed {
    padding-block: 0.65rem;
}

.matter-analysis-message.is-collapsed .matter-analysis-message__content {
    display: block;
    max-height: 4.9rem;
    overflow: hidden;
    white-space: normal;
    line-height: 1.55;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.matter-analysis-message.is-collapsed footer {
    display: flex;
}

.matter-analysis-composer {
    border: 1px solid #cfe8f5;
    border-radius: 24px;
    padding: 0.85rem;
    background: linear-gradient(135deg, #f3fbff, #ffffff);
}

.matter-analysis-composer textarea {
    min-height: 110px;
    resize: vertical;
}

.matter-analysis-prompt-tools {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.matter-analysis-composer .primary-action {
    background: #0797b7;
    color: #ffffff;
}

.matter-analysis-composer .primary-action:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.matter-analysis-events {
    border: 1px solid #dde9f5;
    border-radius: 18px;
    padding: 0.85rem;
}

.matter-analysis-events div {
    display: grid;
    grid-template-columns: minmax(180px, 0.35fr) minmax(0, 1fr) auto;
    gap: 0.75rem;
    padding: 0.55rem 0;
    border-top: 1px solid #eef3f9;
}

@media (max-width: 980px) {
    .matter-analysis-shell,
    .matter-analysis-top {
        grid-template-columns: 1fr;
    }

    .matter-analysis-settings {
        grid-template-columns: 1fr;
    }

    .matter-analysis-settings__wide {
        grid-column: auto;
    }

    .matter-analysis-message.is-user,
    .matter-analysis-message.is-assistant {
        margin-left: 0;
        margin-right: 0;
    }
}

/* Matter analysis visual refresh */
.matter-analysis-shell {
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 1.25rem;
}

.matter-analysis-sidebar,
.matter-analysis-main {
    border: 1px solid rgba(12, 104, 133, 0.13);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 252, 255, 0.9));
    box-shadow: 0 22px 55px rgba(15, 43, 72, 0.08);
}

.matter-analysis-sidebar {
    display: grid;
    align-content: start;
    gap: 0.9rem;
    min-height: 680px;
}

.matter-analysis-sidebar__header span,
.matter-analysis-hero span,
.matter-analysis-readiness span {
    color: #06728b;
    font-size: 0.72rem;
    font-weight: 950;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.matter-analysis-sidebar__header strong {
    display: block;
    margin-top: 0.12rem;
    font-size: 1.35rem;
}

.matter-analysis-sidebar__subheader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border-top: 1px solid #e3edf7;
    padding-top: 0.8rem;
}

.matter-analysis-sidebar__subheader small {
    color: #64748b;
    font-weight: 750;
}

.matter-analysis-new-session {
    display: grid;
    gap: 0.65rem;
    border: 1px solid #ccebf5;
    border-radius: 22px;
    padding: 0.8rem;
    background: linear-gradient(135deg, #eafbff, #ffffff 72%);
}

.matter-analysis-new-session label {
    display: grid;
    gap: 0.35rem;
    color: #52647a;
    font-size: 0.78rem;
    font-weight: 850;
}

.matter-analysis-new-session select,
.matter-analysis-settings input,
.matter-analysis-settings select,
.matter-analysis-settings textarea,
.matter-analysis-composer textarea,
.matter-analysis-prompt-tools select {
    border-color: #bcd9ed;
    border-radius: 18px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.matter-analysis-new-session button,
.matter-analysis-settings button,
.matter-analysis-composer button,
.matter-analysis-message button {
    border-radius: 18px;
    background: #0b9abd;
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(11, 154, 189, 0.18);
}

.matter-analysis-session-list a {
    border: 1px solid transparent;
    background: rgba(248, 251, 254, 0.92);
}

.matter-analysis-session-list a.is-active {
    border-color: #9bdded;
    background: linear-gradient(135deg, #dff8fc, #ffffff);
    box-shadow: inset 4px 0 0 #0898b8, 0 12px 28px rgba(8, 152, 184, 0.12);
}

.matter-analysis-main {
    gap: 1.1rem;
    padding: 1.1rem;
}

.matter-analysis-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border: 1px solid #cbe8f5;
    border-radius: 26px;
    padding: 1rem 1.1rem;
    background:
        radial-gradient(circle at 12% 20%, rgba(11, 154, 189, 0.12), transparent 28%),
        linear-gradient(135deg, #f2fbff, #ffffff 68%);
}

.matter-analysis-empty-session {
    min-height: 360px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 0.75rem;
    text-align: center;
    border: 1px dashed #bfe3ef;
    border-radius: 26px;
    padding: 3rem 1.5rem;
    background:
        radial-gradient(circle at 50% 10%, rgba(11, 154, 189, 0.13), transparent 32%),
        linear-gradient(135deg, #f8fdff, #ffffff);
}

.matter-analysis-empty-session span {
    color: #06728a;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.matter-analysis-empty-session h3 {
    margin: 0;
    font-size: 1.5rem;
}

.matter-analysis-empty-session p {
    max-width: 540px;
    margin: 0;
    color: #64748b;
    line-height: 1.45;
}
.matter-analysis-hero h3 {
    margin: 0.15rem 0;
    font-size: 1.35rem;
}

.matter-analysis-hero p {
    margin: 0;
    color: #64748b;
    font-weight: 750;
}

.matter-analysis-hero__badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: end;
    gap: 0.45rem;
}

.matter-analysis-hero__badges span {
    border: 1px solid #bfe3ef;
    border-radius: 999px;
    background: #ffffff;
    padding: 0.35rem 0.6rem;
    color: #075b70;
    font-size: 0.74rem;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: none;
}

.matter-analysis-top {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 330px);
}

.matter-analysis-settings {
    grid-template-columns: minmax(180px, 1fr) minmax(190px, 0.95fr) minmax(260px, 1.35fr);
    align-items: end;
    border: 1px solid #e2edf7;
    border-radius: 24px;
    padding: 0.9rem;
    background: #ffffff;
}

.matter-analysis-settings small {
    color: #738399;
    font-size: 0.72rem;
    line-height: 1.25;
}

.matter-analysis-settings__wide {
    grid-column: span 3;
}

.matter-analysis-settings .toggle-row {
    align-self: center;
    border: 1px dashed #d5e7f3;
    border-radius: 18px;
    padding: 0.65rem 0.75rem;
    background: #f7fbff;
}

.matter-analysis-settings button[type="submit"] {
    min-height: 52px;
    align-self: stretch;
}

.matter-analysis-readiness {
    min-height: 100%;
    border-radius: 24px;
}

.matter-analysis-chat {
    border: 1px solid #edf3f9;
    border-radius: 24px;
    padding: 0.75rem;
    background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.matter-analysis-message {
    box-shadow: 0 10px 30px rgba(15, 43, 72, 0.06);
}

.matter-analysis-composer {
    position: sticky;
    bottom: 1rem;
    border: 1px solid #bfe5f2;
    box-shadow: 0 20px 50px rgba(8, 74, 103, 0.12);
}

.matter-analysis-composer textarea {
    min-height: 150px;
    font-size: 1rem;
}

.matter-analysis-composer__bar {
    align-items: end;
}

.matter-analysis-prompt-tools select {
    min-width: min(420px, 44vw);
}


.matter-analysis-temperature {
    min-width: 132px;
}

.matter-analysis-temperature span {
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.matter-analysis-temperature input {
    width: 100%;
    border: 1px solid #cbe4f2;
    border-radius: 16px;
    padding: 0.72rem 0.8rem;
    background: #ffffff;
    color: #10213a;
    font: inherit;
    font-weight: 850;
}
.matter-analysis-composer .primary-action {
    min-height: 44px;
    padding-inline: 1.35rem;
    background: #0797b7;
}


.matter-analysis-window-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #91d9ed;
    border-radius: 999px;
    background: #e8fbff;
    color: #075b70;
    padding: 0.35rem 0.75rem;
    font-size: 0.74rem;
    font-weight: 950;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(8, 152, 184, 0.12);
}

.matter-layout--analysis-focus {
    grid-template-columns: 1fr;
    max-width: none;
}

.matter-layout--analysis-focus .matter-content {
    width: 100%;
    max-width: none;
}

.matter-layout--analysis-focus .matter-analysis-shell {
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    min-height: calc(100vh - 8rem);
}

.matter-layout--analysis-focus .matter-analysis-main {
    min-height: calc(100vh - 9rem);
}

.matter-workspace--analysis-focus .matter-hero,
.matter-workspace--analysis-focus .matter-tabs {
    display: none;
}
@media (max-width: 1180px) {
    .matter-analysis-settings {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .matter-analysis-settings__wide {
        grid-column: span 2;
    }
}

@media (max-width: 980px) {
    .matter-analysis-sidebar {
        min-height: auto;
    }

    .matter-analysis-hero,
    .matter-analysis-composer__bar {
        align-items: stretch;
        flex-direction: column;
    }

    .matter-analysis-settings,
    .matter-analysis-settings__wide {
        grid-column: auto;
        grid-template-columns: 1fr;
    }
}

/* Matter analysis interaction refresh */
.matter-analysis-session-item {
    border: 1px solid transparent;
    border-radius: 18px;
    background: rgba(248, 251, 254, 0.92);
}

.matter-analysis-session-item.is-active {
    border-color: #9bdded;
    background: linear-gradient(135deg, #dff8fc, #ffffff);
    box-shadow: inset 4px 0 0 #0898b8, 0 12px 28px rgba(8, 152, 184, 0.12);
}

.matter-analysis-session-item.is-loading {
    opacity: 0.72;
    pointer-events: none;
}

.matter-analysis-session-item a {
    display: grid;
    gap: 0.25rem;
    padding: 0.9rem;
    color: #10233f;
    text-decoration: none;
}

.matter-analysis-session-cost {
    width: max-content;
    border-radius: 999px;
    padding: 0.16rem 0.5rem;
    background: #e8fbff;
    color: #075b70;
    font-size: 0.76rem;
    font-style: normal;
    font-weight: 900;
}

.matter-analysis-cost-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border: 1px solid #d4edf6;
    border-radius: 16px;
    padding: 0.72rem 0.8rem;
    background: #f4fcff;
}

.matter-analysis-cost-summary > div {
    display: grid;
    gap: 0.18rem;
}

.matter-analysis-cost-summary span,
.matter-analysis-cost-summary small {
    color: #64748b;
    font-size: 0.76rem;
    font-weight: 800;
}

.matter-analysis-cost-summary strong {
    color: #0f2742;
    font-size: 1rem;
}

.matter-analysis-cost-help {
    width: 2rem;
    height: 2rem;
    border: 1px solid #9bdff0;
    border-radius: 999px;
    background: #ffffff;
    color: #075b70;
    font-weight: 900;
    cursor: pointer;
}

.matter-analysis-cost-help:hover,
.matter-analysis-cost-help:focus-visible {
    background: #e8fbff;
}

.matter-analysis-cost-card {
    max-width: 680px;
}

.matter-analysis-cost-breakdown {
    display: grid;
    gap: 0.6rem;
}

.matter-analysis-cost-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.18rem 0.85rem;
    align-items: start;
    border: 1px solid #dbeaf2;
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
    background: #f8fcff;
}

.matter-analysis-cost-line span {
    color: #0f2742;
    font-weight: 900;
}

.matter-analysis-cost-line strong {
    color: #075b70;
    font-size: 1rem;
}

.matter-analysis-cost-line small {
    grid-column: 1 / -1;
    color: #64748b;
    font-weight: 700;
}

.matter-analysis-cost-line--total {
    background: #ecfeff;
    border-color: #9bdff0;
}

.matter-analysis-session-list a,
.matter-analysis-session-list a.is-active {
    border: 0;
    background: transparent;
    box-shadow: none;
}

.matter-analysis-new-session-trigger {
    width: 100%;
    justify-content: center;
}

.matter-analysis-top,
.matter-analysis-readiness {
    display: none;
}

.matter-layout--analysis-focus {
    position: fixed;
    inset: 0.5rem;
    z-index: 80;
    overflow: auto;
    padding: 0.5rem;
    background: rgba(241, 247, 251, 0.98);
}

.matter-layout--analysis-focus .matter-analysis-shell {
    min-height: calc(100vh - 1rem);
}

.matter-analysis-message__content {
    display: grid;
    gap: 0.55rem;
    line-height: 1.6;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.matter-analysis-message__content p,
.matter-analysis-message__content ul,
.matter-analysis-message__content ol,
.matter-analysis-message__content h4 {
    margin: 0;
}

.matter-analysis-message__content ul,
.matter-analysis-message__content ol {
    padding-left: 1.25rem;
}

.matter-analysis-citation-link {
    display: inline;
    margin-inline: 0.02rem;
    border: 0;
    border-bottom: 1px dotted currentColor;
    border-radius: 0;
    padding: 0;
    background: transparent;
    color: #075b70;
    font: inherit;
    font-size: 0.9em;
    font-weight: 800;
    line-height: inherit;
    vertical-align: baseline;
    cursor: pointer;
}

.matter-analysis-citation-link:hover,
.matter-analysis-citation-link:focus {
    color: #0e7490;
    outline: 1px solid rgba(8, 145, 178, 0.28);
    outline-offset: 2px;
}

.matter-analysis-message .matter-analysis-message__content button.matter-analysis-citation-link {
    display: inline;
    width: auto;
    min-width: 0;
    height: auto;
    min-height: 0;
    margin: 0 0.02rem;
    border: 0;
    border-bottom: 1px dotted currentColor;
    border-radius: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
    color: #075b70;
    font: inherit;
    font-size: 0.9em;
    font-weight: 800;
    line-height: inherit;
    vertical-align: baseline;
    appearance: none;
}

.matter-analysis-message .matter-analysis-message__content button.matter-analysis-citation-link:hover,
.matter-analysis-message .matter-analysis-message__content button.matter-analysis-citation-link:focus {
    background: transparent;
    box-shadow: none;
    color: #0e7490;
}

.matter-analysis-source-legend {
    border: 1px solid #d7edf6;
    border-radius: 8px;
    background: #f8fcff;
    padding: 0.65rem 0.75rem;
}

.matter-analysis-source-legend summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    cursor: pointer;
    color: #075b70;
    font-weight: 900;
}

.matter-analysis-source-legend summary::-webkit-details-marker {
    display: none;
}

.matter-analysis-source-legend summary::before {
    content: ">";
    display: inline-grid;
    place-items: center;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 999px;
    background: #dff7fd;
    color: #0b88a6;
    font-size: 0.75rem;
    line-height: 1;
    transform: rotate(0deg);
    transition: transform 0.16s ease;
}

.matter-analysis-source-legend[open] summary::before {
    transform: rotate(90deg);
}

.matter-analysis-source-legend summary span {
    flex: 1;
}

.matter-analysis-source-legend summary small {
    color: #64748b;
    font-weight: 800;
}

.matter-analysis-source-legend__list {
    display: grid;
    gap: 0.5rem;
    margin-top: 0.65rem;
}

.matter-analysis-source-legend__item {
    display: grid;
    grid-template-columns: 2.7rem minmax(0, 1fr);
    gap: 0.45rem 0.65rem;
    border-top: 1px solid #e2eff6;
    padding: 0.55rem 0.35rem 0.55rem 0;
}

.matter-analysis-source-legend__item.is-openable {
    cursor: pointer;
}

.matter-analysis-source-legend__item.is-openable:hover,
.matter-analysis-source-legend__item.is-openable:focus {
    border-radius: 8px;
    background: #eefaff;
    outline: none;
}

.matter-analysis-source-legend__index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.4rem;
    height: 1.6rem;
    border-radius: 999px;
    background: #e6f8fe;
    color: #075b70;
    font-size: 0.78rem;
    font-weight: 950;
}

.matter-analysis-source-legend__item strong {
    display: block;
    color: #0f172a;
    font-size: 0.9rem;
}

.matter-analysis-source-legend__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    align-items: center;
    margin-top: 0.18rem;
    color: #475569;
    font-size: 0.82rem;
    line-height: 1.35;
}

.matter-analysis-source-legend__meta span {
    border-radius: 999px;
    padding: 0.12rem 0.45rem;
    background: #e6f8fe;
    color: #075b70;
    font-weight: 850;
}

.matter-analysis-source-legend__meta small {
    color: #475569;
    font: inherit;
}

.matter-analysis-source-legend__item p {
    margin: 0.28rem 0 0;
    color: #64748b;
    font-size: 0.82rem;
    line-height: 1.45;
}

.matter-analysis-message.is-collapsed {
    padding-block: 0.65rem;
}

.matter-analysis-message.is-collapsed .matter-analysis-message__content {
    display: block !important;
    max-height: 4.9rem !important;
    overflow: hidden !important;
    line-height: 1.55;
}

.matter-analysis-message.is-collapsed .matter-analysis-message__content > * {
    display: none;
}

.matter-analysis-message.is-collapsed .matter-analysis-message__content > :first-child {
    display: -webkit-box;
    max-width: 100%;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.matter-analysis-table-wrap {
    max-width: 100%;
    overflow-x: auto;
}

.matter-analysis-table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.matter-analysis-table th,
.matter-analysis-table td {
    border: 1px solid #dbeafe;
    padding: 0.55rem 0.65rem;
    text-align: left;
    vertical-align: top;
}

.matter-analysis-table th {
    background: #eaf8fd;
    color: #0f5970;
    font-weight: 900;
}

.matter-analysis-table td {
    background: #ffffff;
}

.matter-analysis-message footer small {
    color: #64748b;
    font-weight: 750;
}

.matter-analysis-important-toggle {
    display: inline-flex !important;
    grid-template-columns: none;
    grid-auto-flow: column;
    gap: 0.5rem;
    align-items: center;
    color: #334155;
    font-weight: 850;
}

.matter-analysis-important-toggle button {
    position: relative;
    width: 46px;
    height: 26px;
    border: 0;
    border-radius: 999px;
    padding: 0;
    background: #cbd5e1;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.1);
}

.matter-analysis-important-toggle button span {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
}

.matter-analysis-message footer form:has(input[name="isImportant"][value="False"]) .matter-analysis-important-toggle button,
.matter-analysis-message footer form:has(input[name="isImportant"][value="false"]) .matter-analysis-important-toggle button {
    background: #0b9abd;
}

.matter-analysis-message footer form:has(input[name="isImportant"][value="False"]) .matter-analysis-important-toggle button span,
.matter-analysis-message footer form:has(input[name="isImportant"][value="false"]) .matter-analysis-important-toggle button span {
    left: 23px;
}

.matter-analysis-wait {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0.65rem 0;
    border: 1px solid #91d9ed;
    border-radius: 999px;
    padding: 0.45rem 0.75rem;
    background: #e8fbff;
    color: #075b70;
    font-weight: 900;
}

.matter-analysis-wait[hidden] {
    display: none;
}

.matter-analysis-wait.is-error {
    border-color: #fecaca;
    background: #fff1f2;
    color: #be123c;
}

.matter-analysis-question-chain {
    display: grid;
    gap: 0.35rem;
    border: 1px solid #cfe8f5;
    border-radius: 14px;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.82);
}

.matter-analysis-question-chain[hidden] {
    display: none;
}

.matter-analysis-question-chain__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    color: #0b6880;
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.matter-analysis-question-chain__items {
    display: grid;
    gap: 0.28rem;
}

.matter-analysis-question-chain__item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.45rem;
    border: 1px solid #d7e8f4;
    border-radius: 10px;
    padding: 0.34rem 0.45rem;
    background: #f8fcff;
    color: #17324d;
    font-size: 0.82rem;
}

.matter-analysis-question-chain__cancel {
    width: 1.35rem;
    height: 1.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    padding: 0;
    background: #eef6fb;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 950;
    line-height: 1;
    cursor: pointer;
}

.matter-analysis-question-chain__cancel:hover {
    background: #fee2e2;
    color: #b91c1c;
}

.matter-analysis-question-chain__cancel:disabled {
    opacity: 0.32;
    cursor: default;
}

.matter-analysis-question-chain__index {
    width: 1.45rem;
    height: 1.45rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #e7f6fb;
    color: #087596;
    font-weight: 900;
}

.matter-analysis-question-chain__text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.matter-analysis-question-chain__status {
    color: #56657a;
    font-size: 0.74rem;
    font-weight: 850;
    white-space: nowrap;
}

.matter-analysis-question-chain__item[data-status="sending"],
.matter-analysis-question-chain__item[data-status="waiting"] {
    border-color: #8fd8ec;
    background: #eefbff;
}

.matter-analysis-question-chain__item[data-status="asked"] .matter-analysis-question-chain__status,
.matter-analysis-question-chain__item[data-status="done"] .matter-analysis-question-chain__status {
    color: #047857;
}

.matter-analysis-question-chain__item[data-status="retry"] .matter-analysis-question-chain__status {
    color: #b45309;
}

.matter-analysis-question-chain__item[data-status="failed"] {
    border-color: #fecaca;
    background: #fff1f2;
}

.matter-analysis-question-chain__item[data-status="failed"] .matter-analysis-question-chain__status {
    color: #be123c;
}

.matter-analysis-switch {
    display: inline-flex !important;
    grid-template-columns: none;
    grid-auto-flow: column;
    gap: 0.5rem;
    align-items: center;
}

.matter-analysis-switch input {
    position: absolute;
    opacity: 0;
}

.matter-analysis-switch > span {
    position: relative;
    width: 48px;
    height: 28px;
    border-radius: 999px;
    background: #cbd5e1;
}

.matter-analysis-switch > span::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
    transition: transform 0.18s ease;
}

.matter-analysis-switch input:checked + span {
    background: #0b9abd;
}

.matter-analysis-switch input:checked + span::after {
    transform: translateX(20px);
}

.matter-analysis-run-settings summary {
    list-style: none;
    border-radius: 18px;
    padding: 0.65rem 0.9rem;
    background: #172033;
    color: #fff;
    font-weight: 900;
    cursor: pointer;
}

.matter-analysis-run-settings[open] {
    display: grid;
    gap: 0.55rem;
    min-width: min(460px, 70vw);
    border: 1px solid #cbe4f2;
    border-radius: 20px;
    padding: 0.65rem;
    background: #ffffff;
    box-shadow: 0 18px 40px rgba(15, 43, 72, 0.14);
}

.matter-analysis-session-modal .modal-card {
    max-width: 620px;
}

.matter-analysis-session-modal label {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 0.7rem;
    color: #52647a;
    font-size: 0.78rem;
    font-weight: 850;
}

.matter-analysis-session-modal input,
.matter-analysis-session-modal select,
.matter-analysis-session-modal textarea {
    width: 100%;
    border: 1px solid #bcd9ed;
    border-radius: 16px;
    padding: 0.75rem 0.85rem;
}

.matter-analysis-session-menu {
    position: fixed;
    z-index: 7000;
    display: grid;
    gap: 0.25rem;
    border: 1px solid #d8e7f3;
    border-radius: 16px;
    padding: 0.4rem;
    background: #fff;
    box-shadow: 0 18px 48px rgba(15, 43, 72, 0.18);
}

.matter-analysis-session-menu[hidden] {
    display: none;
}

.matter-analysis-session-menu button {
    border: 0;
    border-radius: 12px;
    padding: 0.65rem 0.8rem;
    background: #fff;
    color: #10233f;
    font-weight: 850;
    text-align: left;
}

.matter-analysis-session-menu .danger-action {
    color: #be123c;
}

.matter-analysis-events {
    max-height: 280px;
    overflow: auto;
}

/* Matter analysis admin/debug refinements */
.matter-analysis-sidebar__toggle {
    width: 34px;
    height: 34px;
    border: 1px solid #bfdfef;
    border-radius: 999px;
    padding: 0;
    background: transparent;
    color: #0d6178;
    font-weight: 950;
    position: relative;
    font-size: 0;
    cursor: pointer;
    box-shadow: none;
    transition: border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.matter-analysis-sidebar__toggle::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0.5rem;
    height: 0.5rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translate(-35%, -50%) rotate(135deg);
}

.matter-analysis-sidebar.is-collapsed .matter-analysis-sidebar__toggle::before {
    transform: translate(-65%, -50%) rotate(-45deg);
}

.matter-analysis-sidebar__toggle:hover,
.matter-analysis-sidebar__toggle:focus-visible {
    border-color: #0b9abd;
    color: #07839f;
    outline: none;
    box-shadow: 0 0 0 3px rgba(11, 154, 189, 0.08);
}

.matter-analysis-sidebar.is-collapsed {
    width: 72px;
    min-width: 72px;
    overflow: hidden;
}

.matter-analysis-sidebar.is-collapsed .matter-analysis-sidebar__header div,
.matter-analysis-sidebar.is-collapsed .matter-analysis-sidebar__subheader,
.matter-analysis-sidebar.is-collapsed .matter-analysis-new-session-trigger,
.matter-analysis-sidebar.is-collapsed .matter-analysis-session-list,
.matter-analysis-sidebar.is-collapsed .matter-analysis-cost-summary {
    display: none;
}

.matter-analysis-message footer form.is-important .matter-analysis-important-toggle button {
    background: #0b9abd;
}

.matter-analysis-message footer form.is-important .matter-analysis-important-toggle button span {
    left: 23px;
}

.matter-analysis-admin-link {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #9a3412;
}

.matter-layout--analysis-focus .app-sidebar,
.matter-layout--analysis-focus .topbar,
.matter-layout--analysis-focus .matter-hero,
.matter-layout--analysis-focus .matter-tabs {
    display: none;
}

.matter-layout--analysis-focus {
    inset: 0;
    padding: 0;
}

/* Matter analysis focus/sidebar controls */
.matter-analysis-session-panel-action {
    cursor: pointer;
    font: inherit;
}

.matter-analysis-shell.is-session-sidebar-hidden {
    grid-template-columns: minmax(0, 1fr);
}

.matter-analysis-shell.is-session-sidebar-hidden .matter-analysis-sidebar {
    display: none;
}

.matter-layout--analysis-focus {
    z-index: 5000;
}

.matter-layout--analysis-focus .matter-analysis-shell.is-session-sidebar-hidden {
    grid-template-columns: minmax(0, 1fr);
}

.matter-layout--analysis-focus .matter-analysis-main {
    max-width: none;
}

/* Matter analysis technical event log */
.matter-analysis-events > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.45rem;
    padding: 0.45rem 0.55rem 0.7rem;
}

.matter-analysis-event-row {
    display: grid;
    grid-template-columns: minmax(120px, 180px) minmax(0, 1fr) minmax(180px, auto);
    gap: 0.75rem;
    align-items: center;
    min-width: 0;
    width: 100%;
    border: 1px solid #d7e8f3;
    border-radius: 14px;
    padding: 0.65rem 0.8rem;
    background: rgba(255, 255, 255, 0.9);
    color: #10233f;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.matter-analysis-event-row:hover,
.matter-analysis-event-row:focus-visible {
    border-color: #91d9ed;
    background: #eefbff;
    outline: none;
}

.matter-analysis-event-row__stage {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #0f2742;
    font-weight: 950;
    white-space: nowrap;
}

.matter-analysis-event-row__detail {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.matter-analysis-event-row__meta {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    min-width: 0;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 800;
    white-space: nowrap;
}

.matter-analysis-event-row__meta span {
    border-radius: 999px;
    padding: 0.1rem 0.45rem;
    background: #e8fbff;
    color: #075b70;
}

.matter-analysis-event-modal {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: min(1180px, 94vw);
    max-height: 88vh;
    border: 1px solid #bfe8f4;
    border-radius: 24px;
    padding: 0;
    overflow: hidden;
    background: #ffffff !important;
    color: #10233f;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
}

.matter-analysis-event-modal:not([open]) {
    display: none !important;
}

.matter-analysis-event-modal__header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid #d7e8f3;
    padding: 1rem 1.1rem;
    background: #ffffff;
}

.matter-analysis-event-modal__header span,
.matter-analysis-event-modal__body h4 {
    color: #0d6f88;
    font-size: 0.75rem;
    font-weight: 950;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.matter-analysis-event-modal__header h3,
.matter-analysis-event-modal__header p,
.matter-analysis-event-modal__body h4,
.matter-analysis-event-modal__body p {
    margin: 0;
}

.matter-analysis-event-modal__header p {
    color: #64748b;
    overflow-wrap: anywhere;
}

.matter-analysis-event-modal__body {
    display: grid;
    gap: 1rem;
    min-height: 0;
    overflow: auto;
    padding: 1rem 1.1rem 1.2rem;
    background: #ffffff;
}

.matter-analysis-event-modal__body section {
    display: grid;
    gap: 0.55rem;
}

.matter-analysis-event-modal pre {
    max-height: 58vh;
    overflow: auto;
    border: 1px solid #d7e8f3;
    border-radius: 16px;
    padding: 0.9rem;
    background: #f8fbfe;
    color: #10233f;
    font-size: 0.82rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 900px) {
    .matter-analysis-event-row {
        grid-template-columns: 1fr;
    }

    .matter-analysis-event-row__detail {
        white-space: normal;
    }

    .matter-analysis-event-row__meta {
        justify-content: flex-start;
    }
}

/* Matter analysis composer redesign from C:/tmp/lay chat */
.matter-analysis-composer--studio {
    position: sticky;
    bottom: 1rem;
    display: grid;
    gap: 0.75rem;
    border: 1px solid rgba(38, 174, 214, 0.34);
    border-radius: 28px;
    padding: 0.95rem;
    background: linear-gradient(135deg, rgba(244, 252, 255, 0.96), rgba(255, 255, 255, 0.96));
    box-shadow: 0 22px 55px rgba(7, 101, 133, 0.1);
}

.matter-analysis-composer--studio .matter-analysis-composer__surface {
    border: 1px solid #bfe0ee;
    border-radius: 21px;
    background: #ffffff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
    overflow: hidden;
}

.matter-analysis-composer--studio textarea {
    min-height: 132px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    resize: vertical;
    font-size: 1rem;
    line-height: 1.55;
}

.matter-analysis-composer--studio textarea:focus {
    outline: 2px solid rgba(10, 170, 203, 0.22);
    outline-offset: -2px;
}

.matter-analysis-composer--studio .matter-analysis-composer__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.matter-analysis-composer__left,
.matter-analysis-composer__right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.matter-analysis-composer__left {
    min-width: 0;
    flex: 1 1 auto;
}

.matter-analysis-composer__right {
    flex: 0 0 auto;
    justify-content: flex-end;
}

.matter-analysis-template-select {
    width: min(520px, 100%);
    min-width: min(360px, 100%);
    border: 1px solid #c6e1ef;
    border-radius: 16px;
    padding: 0.74rem 0.9rem;
    background: #ffffff;
    color: #10233f;
    font: inherit;
    font-weight: 750;
}

.matter-analysis-switch--composer {
    display: inline-flex !important;
    grid-template-columns: none !important;
    align-items: center;
    gap: 0.5rem !important;
    margin: 0;
    color: #51677e !important;
    white-space: nowrap;
}

.matter-analysis-composer--studio .matter-analysis-run-settings {
    position: relative;
}

.matter-analysis-composer--studio .matter-analysis-run-settings[open] {
    display: inline-block;
    min-width: 0;
    border: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.matter-analysis-composer--studio .matter-analysis-run-settings summary,
.matter-analysis-composer--studio [data-analysis-speech],
.matter-analysis-composer--studio .primary-action {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border-radius: 16px;
    padding: 0.72rem 1rem;
    font-weight: 900;
    line-height: 1;
}

.matter-analysis-composer--studio .matter-analysis-run-settings summary {
    background: #14233b;
    border: 1px solid #14233b;
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(20, 35, 59, 0.16);
}

.matter-analysis-composer--studio [data-analysis-speech] {
    background: #0b9abd;
    color: #ffffff;
}

.matter-analysis-composer--studio .primary-action {
    background: linear-gradient(135deg, #0aaacb, #027c9a);
    color: #ffffff;
    box-shadow: 0 14px 30px rgba(2, 132, 164, 0.22);
}

.matter-analysis-tools-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.75rem);
    z-index: 20;
    width: min(560px, calc(100vw - 2rem));
    max-height: min(76vh, 720px);
    overflow: auto;
    display: grid;
    gap: 0.85rem;
    border: 1px solid #c7e7f3;
    border-radius: 22px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 20px 50px rgba(13, 91, 120, 0.18);
}

.matter-analysis-tools-panel .matter-analysis-temperature,
.matter-analysis-tools-panel .matter-analysis-switch {
    margin: 0;
}

.matter-analysis-tools-panel .matter-analysis-switch--compact {
    display: inline-flex !important;
    grid-template-columns: none !important;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem !important;
    width: 100%;
}

.matter-analysis-wait {
    justify-self: end;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    border: 1px solid #bfe5f3;
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    background: #e8fbff;
    color: #075b70;
    font-size: 0.82rem;
    font-weight: 900;
}

.matter-analysis-wait[hidden] {
    display: none;
}

.matter-analysis-wait.is-error {
    justify-self: stretch;
    border-color: #fecaca;
    background: #fff1f2;
    color: #991b1b;
}

.matter-analysis-composer--studio .matter-analysis-question-chain {
    border-color: #c7e6f4;
    background: rgba(255, 255, 255, 0.9);
}

@media (max-width: 980px) {
    .matter-analysis-composer--studio .matter-analysis-composer__bar,
    .matter-analysis-composer__left,
    .matter-analysis-composer__right {
        align-items: stretch;
        flex-direction: column;
    }

    .matter-analysis-composer__right {
        width: 100%;
    }

    .matter-analysis-template-select,
    .matter-analysis-composer--studio .matter-analysis-run-settings,
    .matter-analysis-composer--studio [data-analysis-speech],
    .matter-analysis-composer--studio .primary-action {
        width: 100%;
    }

    .matter-analysis-tools-panel {
        position: static;
        width: 100%;
        margin-top: 0.75rem;
    }
}

/* Matter analysis composer: prompt library and icon actions */
.matter-analysis-composer--studio .matter-analysis-icon {
    width: 1.12rem;
    height: 1.12rem;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.matter-analysis-prompt-library {
    position: relative;
}

.matter-analysis-composer--studio .matter-analysis-template-select {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.matter-analysis-tool-button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px solid #bfe5f3;
    border-radius: 16px;
    padding: 0.72rem 1rem;
    background: #ffffff;
    color: #0b2943;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 10px 24px rgba(13, 91, 120, 0.08);
    cursor: pointer;
}

.matter-analysis-prompt-library__trigger {
    background: #ffffff;
    color: #087d9a;
}

.matter-analysis-prompt-library__trigger[aria-expanded="true"] {
    background: #e8faff;
    border-color: #55c7df;
}

.matter-analysis-popover-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid rgba(13, 145, 178, 0.13);
}

.matter-analysis-popover-head strong {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: #0b2943;
    font-weight: 950;
}

.matter-analysis-popover-head small {
    color: #688095;
    font-size: 0.78rem;
    font-weight: 800;
}

.matter-analysis-popover-head > span {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    margin-left: auto;
}

.matter-analysis-tools-close {
    min-width: 44px;
    min-height: 34px;
    border: 1px solid #bfe6f2;
    border-radius: 999px;
    padding: 0.35rem 0.8rem;
    background: #e7faff;
    color: #075f75;
    font-size: 0.78rem;
    font-weight: 950;
    cursor: pointer;
}

.matter-analysis-tools-close:hover {
    border-color: #0aa4c4;
    background: #d5f6ff;
}

.matter-analysis-prompt-popover {
    position: absolute;
    left: 0;
    bottom: calc(100% + 0.75rem);
    z-index: 25;
    width: min(445px, 88vw);
    border: 1px solid #c7e7f3;
    border-radius: 22px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 22px 70px rgba(13, 91, 120, 0.18);
}

.matter-analysis-prompt-popover[hidden] {
    display: none;
}

.matter-analysis-prompt-search {
    margin: 0.75rem 0.85rem 0.45rem;
    min-height: 40px;
    display: flex !important;
    grid-template-columns: none !important;
    align-items: center;
    gap: 0.55rem !important;
    border: 1px solid #cee7f1;
    border-radius: 14px;
    padding: 0 0.75rem;
    background: #ffffff;
    color: #7b8ea1 !important;
}

.matter-analysis-prompt-search input {
    min-width: 0;
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: #10233f;
    font: inherit;
    font-weight: 700;
}

.matter-analysis-prompt-grid {
    max-height: min(420px, 58vh);
    display: grid;
    gap: 0.7rem;
    padding: 0.65rem 0.85rem 1rem;
    overflow: auto;
}

.matter-analysis-prompt-scope {
    display: flex;
    gap: 0.35rem;
    margin: 0.7rem 0.85rem 0;
    padding: 0.25rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    background: rgba(248, 250, 252, 0.86);
}

.matter-analysis-prompt-scope button {
    flex: 1;
    border: 0;
    border-radius: 9px;
    padding: 0.42rem 0.55rem;
    background: transparent;
    color: #4b5874;
    font-weight: 800;
    cursor: pointer;
}

.matter-analysis-prompt-scope button.is-active {
    background: #ffffff;
    color: #10233f;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.matter-analysis-agent-levels {
    display: grid;
    gap: 0.55rem;
    margin: 0.75rem 0;
}

.matter-analysis-agent-levels label {
    display: grid !important;
    grid-template-columns: auto 1fr;
    column-gap: 0.6rem !important;
    row-gap: 0.18rem;
    align-items: start;
    border: 1px solid #d6ebf2;
    border-radius: 14px;
    padding: 0.65rem 0.75rem;
    background: #f8fcff;
    color: #10233f !important;
}

.matter-analysis-agent-levels input {
    margin-top: 0.18rem;
}

.matter-analysis-agent-levels span,
.matter-analysis-agent-levels small {
    grid-column: 2;
}

.matter-analysis-agent-levels span {
    font-weight: 900;
}

.matter-analysis-agent-levels small {
    color: #668095;
    font-weight: 700;
}

.matter-analysis-agent-levels--inline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0;
    min-width: min(760px, 100%);
}

.matter-analysis-agent-levels--inline label {
    min-height: 44px;
    display: inline-flex !important;
    grid-template-columns: none;
    align-items: center;
    gap: 0.42rem !important;
    border-color: #c8e5f0;
    border-radius: 16px;
    padding: 0.55rem 0.72rem;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(13, 91, 120, 0.07);
    cursor: pointer;
}

.matter-analysis-agent-levels--inline label:has(input:checked) {
    border-color: #1aa5c3;
    background: #e8faff;
    color: #075d72 !important;
}

.matter-analysis-agent-levels--inline input {
    margin: 0;
}

.matter-analysis-agent-levels--inline span {
    grid-column: auto;
    white-space: nowrap;
}

.matter-analysis-length-select {
    display: grid !important;
    gap: 0.4rem !important;
    margin: 0;
    padding: 0.85rem 1rem;
    color: #10233f !important;
    font-weight: 850;
}

.matter-analysis-length-select select {
    width: 100%;
    border: 1px solid #cfe5ef;
    border-radius: 12px;
    padding: 0.65rem 0.7rem;
    background: #fff;
    color: #10233f;
    font: inherit;
    font-weight: 800;
}

.matter-analysis-switch--modal {
    display: flex !important;
    align-items: center;
    gap: 0.75rem !important;
    color: #10233f !important;
}

.matter-analysis-prompt-item {
    width: 100%;
    display: flex !important;
    align-items: center;
    justify-content: flex-start !important;
    gap: 0.75rem !important;
    border: 1px solid transparent !important;
    border-radius: 15px !important;
    padding: 0.72rem !important;
    background: #f3fbff !important;
    color: #10233f !important;
    text-align: left;
    box-shadow: none !important;
}

.matter-analysis-prompt-item[hidden] {
    display: none !important;
}

.matter-analysis-prompt-item:hover,
.matter-analysis-prompt-item:focus-visible {
    border-color: #47c2df !important;
    outline: 0;
}

.matter-analysis-prompt-item__icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 12px;
    background: #dff6fc;
    color: #087d9a;
}

.matter-analysis-prompt-item strong,
.matter-analysis-prompt-item small {
    display: block;
}

.matter-analysis-prompt-item small {
    margin-top: 0.18rem;
    color: #6b7e92;
    font-size: 0.77rem;
    font-weight: 700;
    line-height: 1.35;
}

.matter-analysis-composer--studio .matter-analysis-run-settings summary {
    list-style: none;
}

.matter-analysis-composer--studio .matter-analysis-run-settings summary::-webkit-details-marker {
    display: none;
}

.matter-analysis-composer--studio .matter-analysis-run-settings[open] summary {
    background: #17243a;
    color: #ffffff;
}

.matter-analysis-composer--studio .matter-analysis-tools-panel {
    position: fixed;
    right: 1rem;
    bottom: 5.75rem;
    width: min(560px, calc(100vw - 2rem));
    max-height: min(72vh, calc(100vh - 7rem));
    padding: 0;
    overflow: auto;
    text-align: left;
}

@media (max-width: 980px) {
    .matter-analysis-composer--studio .matter-analysis-tools-panel {
        position: static;
        width: 100%;
        max-height: none;
    }
}

.matter-analysis-tool-row {
    padding: 0.85rem 1rem;
    border-top: 1px solid rgba(13, 145, 178, 0.11);
}

.matter-analysis-tool-row > strong {
    display: grid;
    gap: 0.18rem;
    margin-right: auto;
    color: #10233f;
    font-style: normal;
    text-align: left;
}

.matter-analysis-tool-row em {
    font-style: normal;
}

.matter-analysis-tool-row small {
    color: #6b7e92;
    font-size: 0.76rem;
    font-weight: 700;
}

.matter-analysis-tools-panel .matter-analysis-temperature {
    padding: 0.9rem 1rem 1rem;
    border-top: 1px solid rgba(13, 145, 178, 0.11);
}

.matter-analysis-speech-button {
    background: #0b9abd;
    border-color: #0b9abd;
    color: #ffffff;
}

.matter-analysis-run-button {
    min-width: 170px;
    padding-inline: 1.15rem !important;
}

.matter-analysis-run-button kbd {
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 8px;
    padding: 0.25rem 0.42rem;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 900;
}

@media (max-width: 980px) {
    .matter-analysis-prompt-library,
    .matter-analysis-prompt-library__trigger {
        width: 100%;
    }

    .matter-analysis-agent-levels--inline {
        width: 100%;
        min-width: 0;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .matter-analysis-agent-levels--inline label {
        justify-content: flex-start;
    }

    .matter-analysis-prompt-popover {
        position: static;
        width: 100%;
        margin-top: 0.75rem;
    }
}

@media (max-width: 620px) {
    .matter-analysis-agent-levels--inline {
        grid-template-columns: 1fr;
    }
}

/* Matter analysis dark theme */
html[data-theme="dark"] .matter-layout--analysis-focus {
    background: rgba(8, 18, 26, 0.98);
}

html[data-theme="dark"] .matter-analysis-sidebar,
html[data-theme="dark"] .matter-analysis-main,
html[data-theme="dark"] .matter-analysis-chat,
html[data-theme="dark"] .matter-analysis-composer,
html[data-theme="dark"] .matter-analysis-composer--studio,
html[data-theme="dark"] .matter-analysis-settings,
html[data-theme="dark"] .matter-analysis-new-session,
html[data-theme="dark"] .matter-analysis-empty-session {
    border-color: rgba(125, 211, 252, 0.2);
    background: linear-gradient(180deg, rgba(13, 27, 39, 0.98), rgba(10, 22, 34, 0.96));
    color: #eaf6ff;
    box-shadow: 0 22px 55px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .matter-analysis-hero {
    border-color: rgba(125, 211, 252, 0.24);
    background:
        radial-gradient(circle at 12% 20%, rgba(14, 165, 200, 0.18), transparent 30%),
        linear-gradient(135deg, rgba(14, 28, 42, 0.98), rgba(8, 18, 28, 0.98));
    color: #eaf6ff;
}

html[data-theme="dark"] .matter-analysis-sidebar__subheader {
    border-top-color: rgba(148, 163, 184, 0.22);
}

html[data-theme="dark"] .matter-analysis-sidebar__subheader small,
html[data-theme="dark"] .matter-analysis-session-list small,
html[data-theme="dark"] .matter-analysis-session-list span,
html[data-theme="dark"] .matter-analysis-message small,
html[data-theme="dark"] .matter-analysis-readiness small,
html[data-theme="dark"] .matter-analysis-hero p,
html[data-theme="dark"] .matter-analysis-empty-session p,
html[data-theme="dark"] .matter-analysis-settings small,
html[data-theme="dark"] .matter-analysis-temperature span,
html[data-theme="dark"] .matter-analysis-popover-head small,
html[data-theme="dark"] .matter-analysis-prompt-item small,
html[data-theme="dark"] .matter-analysis-tool-row small,
html[data-theme="dark"] .matter-analysis-message footer small,
html[data-theme="dark"] .matter-analysis-cost-summary span,
html[data-theme="dark"] .matter-analysis-cost-summary small,
html[data-theme="dark"] .matter-analysis-cost-line small,
html[data-theme="dark"] .matter-analysis-event-row__meta,
html[data-theme="dark"] .matter-analysis-event-modal__header p {
    color: #a9bbce;
}

html[data-theme="dark"] .matter-analysis-sidebar__header span,
html[data-theme="dark"] .matter-analysis-hero span,
html[data-theme="dark"] .matter-analysis-readiness span,
html[data-theme="dark"] .matter-analysis-empty-session span,
html[data-theme="dark"] .matter-analysis-event-modal__header span,
html[data-theme="dark"] .matter-analysis-event-modal__body h4 {
    color: #67e8f9;
}

html[data-theme="dark"] .matter-analysis-session-item,
html[data-theme="dark"] .matter-analysis-session-list a,
html[data-theme="dark"] .matter-analysis-message,
html[data-theme="dark"] .matter-analysis-message.is-assistant,
html[data-theme="dark"] .matter-analysis-message.is-user,
html[data-theme="dark"] .matter-analysis-composer--studio .matter-analysis-composer__surface,
html[data-theme="dark"] .matter-analysis-settings .toggle-row,
html[data-theme="dark"] .matter-analysis-cost-summary,
html[data-theme="dark"] .matter-analysis-cost-line,
html[data-theme="dark"] .matter-analysis-event-row {
    border-color: rgba(148, 163, 184, 0.22);
    background: rgba(15, 27, 40, 0.94);
    color: #eaf6ff;
}

html[data-theme="dark"] .matter-analysis-message-action {
    background: rgba(8, 47, 73, 0.92) !important;
    color: #bae6fd !important;
    box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.24);
}

html[data-theme="dark"] .matter-analysis-message-action.is-danger {
    background: rgba(69, 10, 10, 0.82) !important;
    color: #fecaca !important;
    box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.32);
}

html[data-theme="dark"] .matter-analysis-source-legend {
    border-color: rgba(125, 211, 252, 0.22);
    background: rgba(8, 23, 35, 0.78);
}

html[data-theme="dark"] .matter-analysis-source-legend summary,
html[data-theme="dark"] .matter-analysis-source-legend__item strong {
    color: #eaf6ff;
}

html[data-theme="dark"] .matter-analysis-source-legend summary::before,
html[data-theme="dark"] .matter-analysis-source-legend__index {
    background: rgba(14, 165, 200, 0.2);
    color: #67e8f9;
}

html[data-theme="dark"] .matter-analysis-source-legend__item {
    border-top-color: rgba(148, 163, 184, 0.22);
}

html[data-theme="dark"] .matter-analysis-source-legend__item.is-openable:hover,
html[data-theme="dark"] .matter-analysis-source-legend__item.is-openable:focus {
    background: rgba(14, 165, 200, 0.12);
}

html[data-theme="dark"] .matter-analysis-source-legend__meta span {
    background: rgba(14, 165, 200, 0.2);
    color: #67e8f9;
}

html[data-theme="dark"] .matter-analysis-source-legend__item p,
html[data-theme="dark"] .matter-analysis-source-legend__meta {
    color: #a9bbce;
}

html[data-theme="dark"] .matter-analysis-session-item.is-active,
html[data-theme="dark"] .matter-analysis-session-list a.is-active,
html[data-theme="dark"] .matter-analysis-agent-levels--inline label:has(input:checked) {
    border-color: rgba(34, 211, 238, 0.55);
    background: linear-gradient(135deg, rgba(8, 145, 178, 0.24), rgba(14, 28, 42, 0.98));
    color: #eaf6ff !important;
    box-shadow: inset 4px 0 0 #22d3ee, 0 12px 28px rgba(0, 0, 0, 0.22);
}

html[data-theme="dark"] .matter-analysis-session-item a,
html[data-theme="dark"] .matter-analysis-cost-summary strong,
html[data-theme="dark"] .matter-analysis-cost-line span,
html[data-theme="dark"] .matter-analysis-event-row__stage,
html[data-theme="dark"] .matter-analysis-popover-head strong,
html[data-theme="dark"] .matter-analysis-tool-row > strong,
html[data-theme="dark"] .matter-analysis-length-select,
html[data-theme="dark"] .matter-analysis-switch--modal,
html[data-theme="dark"] .matter-analysis-important-toggle,
html[data-theme="dark"] .matter-analysis-switch--composer {
    color: #eaf6ff !important;
}

html[data-theme="dark"] .matter-analysis-new-session label,
html[data-theme="dark"] .matter-analysis-settings label,
html[data-theme="dark"] .matter-analysis-composer label,
html[data-theme="dark"] .matter-analysis-session-modal label {
    color: #c9d8e8;
}

html[data-theme="dark"] .matter-analysis-new-session select,
html[data-theme="dark"] .matter-analysis-settings input,
html[data-theme="dark"] .matter-analysis-settings select,
html[data-theme="dark"] .matter-analysis-settings textarea,
html[data-theme="dark"] .matter-analysis-composer textarea,
html[data-theme="dark"] .matter-analysis-template-select,
html[data-theme="dark"] .matter-analysis-temperature input,
html[data-theme="dark"] .matter-analysis-length-select select,
html[data-theme="dark"] .matter-analysis-session-modal input,
html[data-theme="dark"] .matter-analysis-session-modal select,
html[data-theme="dark"] .matter-analysis-session-modal textarea {
    border-color: rgba(125, 211, 252, 0.24);
    background: #071522;
    color: #f1f8ff;
    box-shadow: none;
}

html[data-theme="dark"] .matter-analysis-composer textarea::placeholder,
html[data-theme="dark"] .matter-analysis-prompt-search input::placeholder {
    color: #8fa4b8;
}

html[data-theme="dark"] .matter-analysis-hero__badges span,
html[data-theme="dark"] .matter-analysis-session-cost,
html[data-theme="dark"] .matter-analysis-cost-help,
html[data-theme="dark"] .matter-analysis-window-action,
html[data-theme="dark"] .matter-analysis-event-row__meta span {
    border-color: rgba(34, 211, 238, 0.34);
    background: rgba(8, 145, 178, 0.16);
    color: #a5f3fc;
}

html[data-theme="dark"] .matter-analysis-cost-line--total {
    border-color: rgba(34, 211, 238, 0.45);
    background: rgba(8, 145, 178, 0.2);
}

html[data-theme="dark"] .matter-analysis-cost-line strong,
html[data-theme="dark"] .matter-analysis-cost-help:hover,
html[data-theme="dark"] .matter-analysis-cost-help:focus-visible {
    color: #67e8f9;
}

html[data-theme="dark"] .matter-analysis-table th,
html[data-theme="dark"] .matter-analysis-table td {
    border-color: rgba(125, 211, 252, 0.22);
}

html[data-theme="dark"] .matter-analysis-table th {
    background: rgba(8, 145, 178, 0.22);
    color: #a5f3fc;
}

html[data-theme="dark"] .matter-analysis-table td {
    background: rgba(12, 24, 37, 0.98);
    color: #eaf6ff;
}

html[data-theme="dark"] .matter-analysis-prompt-popover,
html[data-theme="dark"] .matter-analysis-tools-panel,
html[data-theme="dark"] .matter-analysis-run-settings[open],
html[data-theme="dark"] .matter-analysis-session-menu,
html[data-theme="dark"] .matter-analysis-event-modal {
    border-color: rgba(125, 211, 252, 0.24);
    background: #0d1b27 !important;
    color: #eaf6ff;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

html[data-theme="dark"] .matter-analysis-popover-head,
html[data-theme="dark"] .matter-analysis-tool-row,
html[data-theme="dark"] .matter-analysis-tools-panel .matter-analysis-temperature,
html[data-theme="dark"] .matter-analysis-event-modal__header {
    border-color: rgba(148, 163, 184, 0.2);
    background: #0d1b27;
}

html[data-theme="dark"] .matter-analysis-prompt-search {
    border-color: rgba(125, 211, 252, 0.24);
    background: #071522;
    color: #a9bbce !important;
}

html[data-theme="dark"] .matter-analysis-prompt-search input {
    color: #f1f8ff;
}

html[data-theme="dark"] .matter-analysis-prompt-item,
html[data-theme="dark"] .matter-analysis-tool-button,
html[data-theme="dark"] .matter-analysis-tools-close,
html[data-theme="dark"] .matter-analysis-agent-levels label,
html[data-theme="dark"] .matter-analysis-agent-levels--inline label,
html[data-theme="dark"] .matter-analysis-session-menu button {
    border-color: rgba(125, 211, 252, 0.2) !important;
    background: rgba(15, 27, 40, 0.96) !important;
    color: #eaf6ff !important;
    box-shadow: none;
}

html[data-theme="dark"] .matter-analysis-prompt-item:hover,
html[data-theme="dark"] .matter-analysis-prompt-item:focus-visible,
html[data-theme="dark"] .matter-analysis-event-row:hover,
html[data-theme="dark"] .matter-analysis-event-row:focus-visible,
html[data-theme="dark"] .matter-analysis-tool-button:hover,
html[data-theme="dark"] .matter-analysis-tool-button:focus-visible {
    border-color: rgba(34, 211, 238, 0.58) !important;
    background: rgba(8, 145, 178, 0.22) !important;
}

html[data-theme="dark"] .matter-analysis-prompt-item__icon {
    background: rgba(8, 145, 178, 0.24);
    color: #67e8f9;
}

html[data-theme="dark"] .matter-analysis-run-settings summary,
html[data-theme="dark"] .matter-analysis-composer--studio .matter-analysis-run-settings summary {
    border-color: rgba(125, 211, 252, 0.24);
    background: #071522;
    color: #f1f8ff;
    box-shadow: none;
}

html[data-theme="dark"] .matter-analysis-composer--studio .matter-analysis-run-settings[open] summary {
    background: rgba(8, 145, 178, 0.26);
}

html[data-theme="dark"] .matter-analysis-speech-button,
html[data-theme="dark"] .matter-analysis-composer--studio [data-analysis-speech],
html[data-theme="dark"] .matter-analysis-composer--studio .primary-action {
    border-color: #0891b2;
    background: linear-gradient(135deg, #0891b2, #036985);
    color: #ffffff;
}

html[data-theme="dark"] .matter-analysis-wait {
    border-color: rgba(34, 211, 238, 0.38);
    background: rgba(8, 145, 178, 0.18);
    color: #a5f3fc;
}

html[data-theme="dark"] .matter-analysis-wait.is-error {
    border-color: rgba(248, 113, 113, 0.38);
    background: rgba(127, 29, 29, 0.26);
    color: #fecaca;
}

html[data-theme="dark"] .matter-analysis-event-modal::backdrop {
    background: rgba(2, 6, 12, 0.66);
    backdrop-filter: blur(2px);
}

html[data-theme="dark"] .matter-analysis-event-modal__body {
    background: #0d1b27;
}

html[data-theme="dark"] .matter-analysis-event-modal pre {
    border-color: rgba(125, 211, 252, 0.22);
    background: #071522;
    color: #eaf6ff;
}

html[data-theme="dark"] .matter-analysis-session-menu .danger-action {
    color: #fca5a5 !important;
}

/* UI remediation audit fixes: legacy modules dark mode + mobile foundation */
html[data-theme="dark"] .task-workspace,
html[data-theme="dark"] .kanban-column,
html[data-theme="dark"] .calendar-legaldesk,
html[data-theme="dark"] .calendar-legaldesk-sidebar,
html[data-theme="dark"] .calendar-legaldesk-main,
html[data-theme="dark"] .calendar-legaldesk-board,
html[data-theme="dark"] .calendar-legaldesk-list,
html[data-theme="dark"] .calendar-source-panel,
html[data-theme="dark"] .lead-workspace,
html[data-theme="dark"] .work-panel,
html[data-theme="dark"] .activities-register,
html[data-theme="dark"] .activities-inbox,
html[data-theme="dark"] .case-registry,
html[data-theme="dark"] .registry-toolbar,
html[data-theme="dark"] .invoice-queue,
html[data-theme="dark"] .detail-pane,
html[data-theme="dark"] .module-filters,
html[data-theme="dark"] .user-settings-shell,
html[data-theme="dark"] .user-settings-nav,
html[data-theme="dark"] .user-settings-panel,
html[data-theme="dark"] .settings-form-card,
html[data-theme="dark"] .settings-table,
html[data-theme="dark"] .client-form-section,
html[data-theme="dark"] .client-form-panel {
  background: #0d1b27 !important;
  border-color: rgba(148, 163, 184, 0.24) !important;
  color: #eef6ff !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .calendar-legaldesk-day,
html[data-theme="dark"] .calendar-legaldesk-event,
html[data-theme="dark"] .module-table,
html[data-theme="dark"] .module-table header,
html[data-theme="dark"] .module-table > a,
html[data-theme="dark"] .module-table-row,
html[data-theme="dark"] .work-row,
html[data-theme="dark"] .lead-summary-row,
html[data-theme="dark"] .invoice-row,
html[data-theme="dark"] .activity-grid-header,
html[data-theme="dark"] .workload-row,
html[data-theme="dark"] .compact-register div,
html[data-theme="dark"] .team-side-section,
html[data-theme="dark"] .settings-table header,
html[data-theme="dark"] .settings-table label,
html[data-theme="dark"] .lead-modal-section,
html[data-theme="dark"] .wizard-panel,
html[data-theme="dark"] .admin-danger-card,
html[data-theme="dark"] .settings-grid label:not(:where(.settings-ui *)),
html[data-theme="dark"] .audit-row {
  background: rgba(15, 27, 40, 0.96) !important;
  border-color: rgba(148, 163, 184, 0.22) !important;
  color: #eef6ff !important;
}

html[data-theme="dark"] .module-table > a strong,
html[data-theme="dark"] .module-table-row strong,
html[data-theme="dark"] .modern-row__main strong,
html[data-theme="dark"] .workflow-item__content strong,
html[data-theme="dark"] .timeline-item__body strong,
html[data-theme="dark"] .work-row strong,
html[data-theme="dark"] .workload-row strong,
html[data-theme="dark"] .audit-row strong,
html[data-theme="dark"] .invoice-row strong,
html[data-theme="dark"] .invoice-row em,
html[data-theme="dark"] .activity-grid-row strong,
html[data-theme="dark"] .calendar-legaldesk-event strong,
html[data-theme="dark"] .calendar-legaldesk-day > strong,
html[data-theme="dark"] .detail-pane h2,
html[data-theme="dark"] .work-panel h2,
html[data-theme="dark"] .invoice-queue h2,
html[data-theme="dark"] .activities-inbox h2,
html[data-theme="dark"] .user-settings-heading p,
html[data-theme="dark"] .client-form-title h1,
html[data-theme="dark"] .client-form-title h2 {
  color: #f8fbff !important;
}

html[data-theme="dark"] .module-table > a small,
html[data-theme="dark"] .module-table-row small,
html[data-theme="dark"] .modern-row__main small,
html[data-theme="dark"] .modern-row__meta small,
html[data-theme="dark"] .workflow-item__content small,
html[data-theme="dark"] .workflow-item__owner,
html[data-theme="dark"] .timeline-item__body small,
html[data-theme="dark"] .timeline-item__body em,
html[data-theme="dark"] .work-row small,
html[data-theme="dark"] .work-row span,
html[data-theme="dark"] .audit-row small,
html[data-theme="dark"] .audit-row span,
html[data-theme="dark"] .invoice-row span,
html[data-theme="dark"] .invoice-row small,
html[data-theme="dark"] .activity-grid-row span,
html[data-theme="dark"] .activity-grid-row small,
html[data-theme="dark"] .calendar-legaldesk-event span,
html[data-theme="dark"] .detail-pane p,
html[data-theme="dark"] .detail-pane dt,
html[data-theme="dark"] .module-filters button,
html[data-theme="dark"] .user-settings-heading span,
html[data-theme="dark"] .client-form-section > aside h3 {
  color: #a9bbce !important;
}

html[data-theme="dark"] .module-filters button.is-active,
html[data-theme="dark"] .module-filters button:hover,
html[data-theme="dark"] .registry-tabs button.is-active,
html[data-theme="dark"] .registry-tabs button:hover,
html[data-theme="dark"] .activity-filter-strip button.is-active,
html[data-theme="dark"] .calendar-type-switches button.is-active,
html[data-theme="dark"] .calendar-view-buttons button.is-active,
html[data-theme="dark"] .calendar-view-buttons a.is-active,
html[data-theme="dark"] .client-form-section > aside a.is-active,
html[data-theme="dark"] .client-form-section > aside a:hover,
html[data-theme="dark"] .user-settings-nav a.is-active,
html[data-theme="dark"] .user-settings-nav a:hover {
  background: rgba(8, 145, 178, 0.22) !important;
  border-color: rgba(34, 211, 238, 0.45) !important;
  color: #a5f3fc !important;
}

html[data-theme="dark"] .registry-search,
html[data-theme="dark"] .activity-search,
html[data-theme="dark"] .task-search-group input,
html[data-theme="dark"] .calendar-search input,
html[data-theme="dark"] .module-shell input[type="search"],
html[data-theme="dark"] :is(.settings-grid, .form-grid) :is(input, select, textarea):not(:where(.settings-ui *)),
html[data-theme="dark"] .quick-contact-panel,
html[data-theme="dark"] .legaldesk-field-grid input,
html[data-theme="dark"] .legaldesk-field-grid select,
html[data-theme="dark"] .legaldesk-field-grid textarea {
  background: #071522 !important;
  border-color: rgba(125, 211, 252, 0.24) !important;
  color: #f1f8ff !important;
}

html[data-theme="dark"] .module-table > a:hover,
html[data-theme="dark"] .module-table-row:hover,
html[data-theme="dark"] .work-row:hover,
html[data-theme="dark"] .invoice-row:hover,
html[data-theme="dark"] .workload-row:hover,
html[data-theme="dark"] .audit-row:hover {
  background: rgba(8, 145, 178, 0.18) !important;
}

html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .matter-file-preview-modal {
  background: #0d1b27 !important;
  color: #eef6ff !important;
}

/* Dark mode backlog pass: shared controls, registries, CRM, billing, calendar, tasks and documents */
html[data-theme="dark"] .dashboard-personalization__settings-button,
html[data-theme="dark"] .registry-tabs button,
html[data-theme="dark"] .registry-modern__chips button,
html[data-theme="dark"] .calendar-type-tabs button,
html[data-theme="dark"] .calendar-type-switches button,
html[data-theme="dark"] .calendar-view-buttons button,
html[data-theme="dark"] .calendar-view-buttons a,
html[data-theme="dark"] .activity-filter-strip button,
html[data-theme="dark"] .task-view-actions > button,
html[data-theme="dark"] .task-mine-toggle,
html[data-theme="dark"] .secondary-action,
html[data-theme="dark"] .action-link-pill,
html[data-theme="dark"] .doc-row-action,
html[data-theme="dark"] .row-actions--compact button,
html[data-theme="dark"] .module-table .inline-form select,
html[data-theme="dark"] .activity-status-form select,
html[data-theme="dark"] .task-sort-control select,
html[data-theme="dark"] .task-card select,
html[data-theme="dark"] .task-card button,
html[data-theme="dark"] .task-context-menu,
html[data-theme="dark"] .task-context-menu a,
html[data-theme="dark"] .task-context-menu button,
html[data-theme="dark"] .task-context-menu select,
html[data-theme="dark"] .modal-card button.secondary-action,
html[data-theme="dark"] .modal-card a.secondary-action,
html[data-theme="dark"] .modal-card footer a.secondary-action,
html[data-theme="dark"] .modal-card .form-actions a.secondary-action,
html[data-theme="dark"] .modal-card .form-actions button.secondary-action,
html[data-theme="dark"] .activity-register-tools button {
  background: #071522 !important;
  border-color: rgba(125, 211, 252, 0.28) !important;
  color: #dff6ff !important;
  box-shadow: none;
}

html[data-theme="dark"] .registry-tabs button strong,
html[data-theme="dark"] .tabs button strong,
html[data-theme="dark"] .calendar-type-switches button span {
  background: rgba(14, 165, 200, 0.2) !important;
  color: #a5f3fc !important;
}

html[data-theme="dark"] .registry-tabs button.is-active,
html[data-theme="dark"] .registry-tabs button:hover,
html[data-theme="dark"] .registry-modern__chips button.is-active,
html[data-theme="dark"] .registry-modern__chips button:hover,
html[data-theme="dark"] .calendar-type-tabs button.is-active,
html[data-theme="dark"] .calendar-type-tabs button:hover,
html[data-theme="dark"] .calendar-type-switches button.is-active,
html[data-theme="dark"] .calendar-type-switches button:hover,
html[data-theme="dark"] .calendar-view-buttons button.is-active,
html[data-theme="dark"] .calendar-view-buttons button:hover,
html[data-theme="dark"] .calendar-view-buttons a.is-active,
html[data-theme="dark"] .calendar-view-buttons a:hover,
html[data-theme="dark"] .activity-filter-strip button.is-active,
html[data-theme="dark"] .activity-filter-strip button:hover,
html[data-theme="dark"] .task-view-actions > button.is-active,
html[data-theme="dark"] .task-view-actions > button:hover,
html[data-theme="dark"] .action-link-pill:hover,
html[data-theme="dark"] .doc-row-action:hover,
html[data-theme="dark"] .row-actions--compact button:hover,
html[data-theme="dark"] .dashboard-personalization__settings-button:hover {
  background: rgba(8, 145, 178, 0.28) !important;
  border-color: rgba(34, 211, 238, 0.5) !important;
  color: #a5f3fc !important;
}

html[data-theme="dark"] .module-shell,
html[data-theme="dark"] .module-card,
html[data-theme="dark"] .module-card > section,
html[data-theme="dark"] .module-shell--wide,
html[data-theme="dark"] .template-library,
html[data-theme="dark"] .contacts-workspace,
html[data-theme="dark"] .billing-workspace,
html[data-theme="dark"] .correspondence-workspace,
html[data-theme="dark"] .team-workspace,
html[data-theme="dark"] .module-table--templates,
html[data-theme="dark"] .client-detail-shell,
html[data-theme="dark"] .client-detail-card,
html[data-theme="dark"] .client-form-card,
html[data-theme="dark"] .client-form-section > aside,
html[data-theme="dark"] .client-form-section > main,
html[data-theme="dark"] .matter-file-manager,
html[data-theme="dark"] .matter-file-tree__items,
html[data-theme="dark"] .matter-folder-panel__body,
html[data-theme="dark"] .matter-analysis-tools-panel__related,
html[data-theme="dark"] .matter-analysis-related-list {
  background: #0d1b27 !important;
  border-color: rgba(148, 163, 184, 0.24) !important;
  color: #eef6ff !important;
}

html[data-theme="dark"] .module-empty,
html[data-theme="dark"] .process-note,
html[data-theme="dark"] .correspondence-path,
html[data-theme="dark"] .registry-group-hint,
html[data-theme="dark"] .activity-group-hint,
html[data-theme="dark"] .wizard-note,
html[data-theme="dark"] .calendar-alert-strip,
html[data-theme="dark"] .calendar-view-header,
html[data-theme="dark"] .calendar-legaldesk-header,
html[data-theme="dark"] .calendar-legaldesk-tools,
html[data-theme="dark"] .calendar-period-picker__menu,
html[data-theme="dark"] .calendar-alert-list article,
html[data-theme="dark"] .calendar-summary-strip article,
html[data-theme="dark"] .calendar-event-popover,
html[data-theme="dark"] .wizard-collision-list div,
html[data-theme="dark"] .wizard-collision-list em,
html[data-theme="dark"] .task-toolbar,
html[data-theme="dark"] .task-card,
html[data-theme="dark"] .activity-inbox-card,
html[data-theme="dark"] .calendar-legaldesk-day.is-muted,
html[data-theme="dark"] .calendar-legaldesk-event.is-active,
html[data-theme="dark"] .calendar-legaldesk-event--absence,
html[data-theme="dark"] .model-pill {
  background: rgba(15, 27, 40, 0.96) !important;
  border-color: rgba(148, 163, 184, 0.22) !important;
  color: #eaf6ff !important;
}

html[data-theme="dark"] .calendar-legaldesk-day.is-muted > strong,
html[data-theme="dark"] .calendar-titlebar h1,
html[data-theme="dark"] .calendar-titlebar strong,
html[data-theme="dark"] .calendar-period-picker__menu a,
html[data-theme="dark"] .calendar-view-label strong,
html[data-theme="dark"] .calendar-period-nav strong,
html[data-theme="dark"] .calendar-view-header h2,
html[data-theme="dark"] .calendar-alert-strip h2,
html[data-theme="dark"] .calendar-summary-strip strong,
html[data-theme="dark"] .activity-inbox-card strong,
html[data-theme="dark"] .activity-description strong,
html[data-theme="dark"] .contacts-workspace strong,
html[data-theme="dark"] .module-shell h2,
html[data-theme="dark"] .module-shell h3,
html[data-theme="dark"] .client-form-section label,
html[data-theme="dark"] .client-form-section strong,
html[data-theme="dark"] .team-side-section h3,
html[data-theme="dark"] .matter-tree-row strong,
html[data-theme="dark"] .matter-folder-panel h2,
html[data-theme="dark"] .matter-folder-panel h3 {
  color: #f8fbff !important;
}

html[data-theme="dark"] .calendar-view-label,
html[data-theme="dark"] .calendar-source-panel summary small,
html[data-theme="dark"] .calendar-source-option,
html[data-theme="dark"] .calendar-legaldesk-weekdays span,
html[data-theme="dark"] .calendar-list-day > strong,
html[data-theme="dark"] .calendar-alert-strip p,
html[data-theme="dark"] .calendar-summary-strip span,
html[data-theme="dark"] .activity-inbox-card p,
html[data-theme="dark"] .activities-empty,
html[data-theme="dark"] .activity-description small,
html[data-theme="dark"] .task-card span,
html[data-theme="dark"] .task-card small,
html[data-theme="dark"] .task-date,
html[data-theme="dark"] .task-sort-control span,
html[data-theme="dark"] .client-form-section > aside a,
html[data-theme="dark"] .contacts-workspace .filter-field span,
html[data-theme="dark"] .matter-tree-row,
html[data-theme="dark"] .matter-folder-panel small {
  color: #a9bbce !important;
}

html[data-theme="dark"] .contacts-workspace .filter-field select,
html[data-theme="dark"] .contacts-workspace .filter-field input,
html[data-theme="dark"] .module-shell select,
html[data-theme="dark"] .module-shell input,
html[data-theme="dark"] .module-shell textarea,
html[data-theme="dark"] .client-form-section input,
html[data-theme="dark"] .client-form-section select,
html[data-theme="dark"] .client-form-section textarea,
html[data-theme="dark"] .activity-modal-form input,
html[data-theme="dark"] .activity-modal-form select,
html[data-theme="dark"] .activity-modal-form textarea,
html[data-theme="dark"] .calendar-period-nav button,
html[data-theme="dark"] .calendar-period-picker__toggle,
html[data-theme="dark"] .calendar-event-popover button,
html[data-theme="dark"] .source-check {
  background: #071522 !important;
  border-color: rgba(125, 211, 252, 0.28) !important;
  color: #f1f8ff !important;
}

html[data-theme="dark"] .calendar-period-picker__menu::before {
  background: rgba(15, 27, 40, 0.96) !important;
  border-color: rgba(148, 163, 184, 0.22) !important;
}

html[data-theme="dark"] .calendar-period-picker__menu a:hover,
html[data-theme="dark"] .calendar-period-picker__menu a:focus-visible,
html[data-theme="dark"] .calendar-period-picker__menu a.is-current {
  background: rgba(8, 145, 178, 0.28) !important;
  color: #a5f3fc !important;
}

html[data-theme="dark"] .client-form-section footer,
html[data-theme="dark"] .modal-card footer,
html[data-theme="dark"] .activity-modal-form footer,
html[data-theme="dark"] .absence-wizard footer {
  background: rgba(13, 27, 39, 0.98) !important;
  border-color: rgba(148, 163, 184, 0.24) !important;
}

html[data-theme="dark"] .calendar-legaldesk-weekdays span,
html[data-theme="dark"] .calendar-legaldesk-day,
html[data-theme="dark"] .calendar-legaldesk-list > header,
html[data-theme="dark"] .calendar-list-day,
html[data-theme="dark"] .activity-grid-header span,
html[data-theme="dark"] .activity-grid-row,
html[data-theme="dark"] .activity-grid-row > span,
html[data-theme="dark"] .activity-grid-row > a {
  border-color: rgba(148, 163, 184, 0.2) !important;
}

html[data-theme="dark"] .calendar-type-tabs button[data-calendar-filter],
html[data-theme="dark"] .calendar-event--hearing,
html[data-theme="dark"] .calendar-event--deadline,
html[data-theme="dark"] .calendar-event--consultation,
html[data-theme="dark"] .calendar-event--internal,
html[data-theme="dark"] .calendar-event--absence,
html[data-theme="dark"] .calendar-absence-band,
html[data-theme="dark"] .timeline-row.has-warning {
  background: rgba(14, 165, 200, 0.12) !important;
  color: #dff6ff !important;
}

html[data-theme="dark"] .calendar-event--hearing.has-warning,
html[data-theme="dark"] .calendar-event--deadline.has-warning,
html[data-theme="dark"] .calendar-event--consultation.has-warning,
html[data-theme="dark"] .calendar-event--internal.has-warning {
  background: rgba(146, 64, 14, 0.2) !important;
  color: #fde68a !important;
}

html[data-theme="dark"] .wizard-steps button {
  background: rgba(15, 27, 40, 0.96) !important;
  border-color: rgba(148, 163, 184, 0.22) !important;
  color: #a9bbce !important;
}

html[data-theme="dark"] .wizard-steps button.is-active {
  background: rgba(8, 145, 178, 0.26) !important;
  border-color: rgba(34, 211, 238, 0.5) !important;
  color: #a5f3fc !important;
}

html[data-theme="dark"] .task-card {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}

html[data-theme="dark"] .task-card.is-selected {
  border-color: rgba(34, 211, 238, 0.54) !important;
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.14), 0 8px 20px rgba(0, 0, 0, 0.24);
}

html[data-theme="dark"] .task-context-menu .danger-action,
html[data-theme="dark"] .task-card__delete {
  background: rgba(127, 29, 29, 0.32) !important;
  border-color: rgba(248, 113, 113, 0.36) !important;
  color: #fecaca !important;
}

html[data-theme="dark"] .matter-tree-row svg,
html[data-theme="dark"] .matter-tree-row .folder-icon,
html[data-theme="dark"] .matter-folder-chip svg,
html[data-theme="dark"] .matter-folder-chip .folder-icon {
  color: #8bdaf0 !important;
  fill: currentColor;
  stroke: currentColor;
}

html[data-theme="dark"] .matter-context-menu,
html[data-theme="dark"] .matter-file-upload-popover form {
  background: rgba(13, 27, 39, 0.98) !important;
  border-color: rgba(148, 163, 184, 0.28) !important;
  color: #eef6ff !important;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

html[data-theme="dark"] .matter-context-menu button {
  color: #eef6ff !important;
}

html[data-theme="dark"] .matter-context-menu button:hover:not(:disabled) {
  background: rgba(8, 145, 178, 0.24) !important;
}

html[data-theme="dark"] .matter-context-menu__separator {
  background: rgba(148, 163, 184, 0.22) !important;
}

html[data-theme="dark"] .matter-context-menu button:disabled,
html[data-theme="dark"] button:disabled,
html[data-theme="dark"] .secondary-action:disabled {
  color: rgba(169, 187, 206, 0.48) !important;
  background: rgba(15, 27, 40, 0.62) !important;
  border-color: rgba(148, 163, 184, 0.16) !important;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: #7f93aa !important;
}

@media (max-width: 760px) {
  body {
    min-width: 320px;
  }

  .app-shell,
  .app-shell--v2 {
    --menu-width: 0px;
    grid-template-columns: minmax(0, 1fr);
  }

  .app-main {
    min-width: 0;
  }

  .topbar,
  .topbar--v2 {
    align-items: stretch;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: auto;
    padding: 0.55rem;
  }

  .topbar-start,
  .topbar-search-wrap,
  .topbar-actions,
  .topbar-actions--v2 {
    min-width: 0;
    width: 100%;
  }

  .topbar-search-wrap {
    order: 3;
  }

  .topbar-search {
    width: 100%;
    max-width: none;
  }

  .topbar-search-hints {
    max-width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .topbar-actions,
  .topbar-actions--v2 {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .module-page,
  .matter-workspace,
  .dashboard--premium,
  .user-settings-page {
    width: 100%;
    min-width: 0;
    padding: 0.65rem;
  }

  .page-header,
  .case-hero,
  .workspace-header {
    padding: 0.75rem;
  }

  .page-header h1,
  .workspace-header h1,
  .case-hero h1,
  .matter-hero h1 {
    font-size: 1.45rem;
    line-height: 1.12;
    overflow-wrap: anywhere;
  }

  .tab-strip,
  .case-tabs,
  .matter-tabs,
  .admin-tabs,
  .registry-tabs {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .tab-strip a,
  .case-tabs a,
  .matter-tabs a,
  .admin-tabs a,
  .registry-tabs button {
    flex: 0 0 auto;
  }

  .matter-edit-grid {
    grid-template-columns: 1fr;
  }

  .matter-edit-grid .span-2,
  .matter-edit-grid .span-3,
  .matter-edit-field--client,
  .matter-edit-field--clients,
  .matter-edit-field--analysis,
  .matter-edit-actions {
    grid-column: auto;
  }

  .matter-edit-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .registry-toolbar,
  .registry-toolbar--legaldesk,
  .registry-modern__controls,
  .registry-filter-stack,
  .activities-register-top,
  .calendar-legaldesk-header,
  .calendar-legaldesk-tools,
  .work-grid,
  .lead-workspace,
  .user-settings-shell,
  .client-form-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0.65rem;
    min-width: 0;
  }

  .registry-search,
  .registry-search--compact,
  .registry-filter-stack .registry-search,
  .registry-filter-stack .registry-search--compact {
    width: 100%;
    min-width: 0;
  }

  .module-table header,
  .activity-grid-header {
    display: none !important;
  }

  .module-table,
  .activities-register,
  .invoice-queue,
  .calendar-legaldesk-board {
    overflow-x: visible !important;
  }

  .module-table > a,
  .module-table-row,
  .invoice-row,
  .activity-grid-row,
  .workload-row,
  .audit-row,
  .modern-row--case,
  .modern-row--doc,
  .modern-row--document,
  .modern-row--team-member {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    min-width: 0 !important;
    gap: 0.35rem;
    align-items: start;
  }

  .module-table--clients header,
  .module-table--clients > a,
  .module-table--costs header,
  .module-table--costs > a,
  .module-table--correspondence header,
  .module-table--correspondence .module-table-row,
  .activity-grid,
  .activity-grid-header,
  .activity-grid-row {
    min-width: 0 !important;
  }

  .module-table > a > *,
  .module-table-row > *,
  .invoice-row > *,
  .activity-grid-row > *,
  .workload-row > *,
  .audit-row > * {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .report-grid,
  .report-status-grid,
  .kpi-grid,
  .dashboard-grid--main,
  .dashboard-grid--secondary,
  .quick-actions-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .calendar-legaldesk {
    grid-template-columns: minmax(0, 1fr);
  }

  .calendar-legaldesk-weekdays,
  .calendar-legaldesk-grid {
    min-width: 0 !important;
    grid-template-columns: repeat(7, minmax(38px, 1fr));
  }

  .calendar-legaldesk-day {
    min-height: 78px;
    padding: 0.32rem;
  }

  .calendar-legaldesk-event {
    min-width: 0;
  }

  .calendar-legaldesk-grid .calendar-legaldesk-event span:not(.event-dot) {
    display: none;
  }

  .modal {
    width: var(--modal-mobile-width, 100vw) !important;
    max-width: var(--modal-mobile-width, 100vw) !important;
    margin: 0;
  }

  .modal-card,
  .modal-card--wide {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 100dvh;
    border-radius: 0;
    overflow: auto;
  }

  .modal-card header,
  .modal-card footer,
  .user-settings-actions {
    position: sticky;
    z-index: 2;
    flex-wrap: wrap;
    background: inherit;
  }

  .modal-card header {
    top: 0;
  }

  .modal-card footer,
  .user-settings-actions {
    bottom: 0;
  }

  .lead-modal-grid,
  .compact-definition-list,
  .form-grid,
  .legaldesk-field-grid,
  .stack-form--inline,
  .automation-rule-form {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .user-settings-actions a,
  .user-settings-actions button {
    width: 100%;
  }
}
.ai-usage-report {
  gap: 14px;
}

.ai-usage-filters {
  display: grid;
  grid-template-columns: 260px 260px auto;
  gap: 12px;
  align-items: end;
  justify-content: start;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fbfd;
}

.ai-usage-filters label {
  display: grid;
  gap: 6px;
}

.ai-usage-custom-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 10px;
}

.ai-usage-custom-range[hidden] {
  display: none;
}

.ai-usage-filters span,
.ai-usage-totals dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.ai-usage-filters input,
.ai-usage-filters select {
  width: 100%;
  min-height: 42px;
  border: 2px solid #d7edf4;
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  padding: 0 2.35rem 0 0.8rem;
  font-weight: 760;
}

.ai-usage-filters select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #07566a 50%),
    linear-gradient(135deg, #07566a 50%, transparent 50%);
  background-position:
    calc(100% - 1.08rem) 52%,
    calc(100% - 0.78rem) 52%;
  background-size: 0.34rem 0.34rem, 0.34rem 0.34rem;
  background-repeat: no-repeat;
}

.ai-usage-filters select:focus,
.ai-usage-filters input:focus {
  border-color: #0ea5c6;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(14, 165, 198, 0.12);
}

.ai-usage-filters [data-ai-usage-apply] {
  min-height: 42px;
  border-color: #cfe0eb;
  background: #fff;
  padding-inline: 18px;
  white-space: nowrap;
}

.ai-usage-filters [data-ai-usage-apply]:hover,
.ai-usage-filters [data-ai-usage-apply]:focus-visible {
  border-color: #0ea5c6;
  color: var(--brand-dark);
  outline: none;
}

html[data-theme="dark"] .ai-usage-filters {
  background: rgba(15, 31, 43, 0.78);
  border-color: rgba(51, 65, 85, 0.9);
}

html[data-theme="dark"] .ai-usage-filters input,
html[data-theme="dark"] .ai-usage-filters select {
  border-color: rgba(34, 211, 238, 0.28);
  background-color: #0b1721;
}

html[data-theme="dark"] .ai-usage-filters select {
  background-image:
    linear-gradient(45deg, transparent 50%, #a5f3fc 50%),
    linear-gradient(135deg, #a5f3fc 50%, transparent 50%);
}

.ai-usage-totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.ai-usage-totals div {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
}

.ai-usage-totals dd {
  margin: 6px 0 2px;
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 850;
}

.ai-usage-totals small {
  color: var(--muted);
  font-weight: 700;
}

.ai-usage-monthly,
.ai-usage-tables {
  display: grid;
  gap: 12px;
}

.ai-usage-monthly h3,
.ai-usage-tables h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.admin-table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.admin-data-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  background: var(--surface);
}

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

.admin-data-table th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.admin-data-table tr:last-child td {
  border-bottom: 0;
}

@media (max-width: 920px) {
  .ai-usage-filters,
  .ai-usage-totals {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .ai-usage-custom-range {
    grid-template-columns: 1fr;
  }
}

/* Final override: collapsed AI answers must keep the importance toggle visible. */
.matter-analysis-message.is-assistant.is-collapsed footer {
  display: flex !important;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  margin-top: 0.4rem;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(207, 232, 245, 0.74);
}

.matter-analysis-message.is-assistant.is-collapsed footer > small {
  display: none;
}

.matter-analysis-message.is-assistant.is-collapsed [data-analysis-importance-form] {
  margin: 0;
}

.matter-analysis-message.is-assistant.is-collapsed .matter-analysis-important-toggle {
  gap: 0.4rem;
  font-size: 0.8rem;
}

.matter-analysis-message.is-assistant.is-collapsed .matter-analysis-important-toggle button {
  width: 40px;
  height: 22px;
}

.matter-analysis-message.is-assistant.is-collapsed .matter-analysis-important-toggle button span {
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
}

.matter-analysis-message.is-assistant.is-collapsed footer form.is-important .matter-analysis-important-toggle button span {
  left: 21px;
}

.matter-analysis-message__preview {
  color: #334155;
  margin-bottom: 0.35rem;
}

.matter-analysis-message__lazy-note {
  color: #64748b;
  font-size: 0.82rem;
  margin: 0;
}

.matter-analysis-message__lazy-note.is-error {
  color: #b91c1c;
}

.matter-analysis-message.is-collapsed .matter-analysis-message__details[open] ~ .matter-analysis-message__content {
  display: grid !important;
  max-height: none !important;
  overflow: visible !important;
}

.matter-analysis-message.is-collapsed .matter-analysis-message__details[open] ~ .matter-analysis-message__content > * {
  display: revert !important;
  max-height: none !important;
  overflow: visible !important;
  -webkit-line-clamp: unset !important;
}

.workspace-card__subsection {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.workspace-card__subsection > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.workspace-card__subsection h3 {
  margin: 0;
  font-size: 1rem;
}

.admin-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.inline-editor {
  margin-bottom: 1rem;
}

.inline-editor > summary,
.row-actions > summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
}

.row-actions form {
  display: grid;
  gap: 0.5rem;
  min-width: min(22rem, 78vw);
  margin-top: 0.5rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

/* Matter internal questions */
.matter-questions-panel header {
  align-items: flex-start;
}

.matter-question-attention {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 16px;
  padding: 12px 14px;
  border: 1px solid rgba(14, 165, 233, 0.24);
  border-radius: 14px;
  background: rgba(236, 254, 255, 0.82);
  color: #075985;
}

.matter-question-list {
  gap: 8px;
}

.matter-question-row {
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.matter-question-row--attention {
  border-color: rgba(14, 165, 233, 0.55);
  background: linear-gradient(90deg, rgba(236, 254, 255, 0.86), rgba(255, 255, 255, 0.94));
}

.matter-question-modal {
  max-height: min(88vh, 920px);
  overflow: auto;
}

.matter-question-form-grid fieldset {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(248, 250, 252, 0.78);
  min-width: 0;
}

.matter-question-form-grid > label {
  align-self: start;
}

.matter-question-form-grid select,
.matter-question-form-grid input {
  min-height: 44px;
}

.matter-question-form-grid select:not([multiple]) {
  height: 44px;
}

.matter-question-form-grid legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.matter-question-check-list {
  display: grid;
  gap: 8px;
  max-height: 150px;
  overflow: auto;
}

.matter-question-check-list label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid rgba(203, 213, 225, 0.72);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}

.matter-question-check-list--roles label {
  grid-template-columns: auto minmax(0, 1fr);
}

.matter-question-check-list small {
  color: var(--muted);
  font-size: 0.74rem;
}

.matter-question-recipient-builder {
  display: grid;
  gap: 10px;
}

.matter-question-recipient-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.matter-question-recipient-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 46px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.78);
}

.matter-question-recipient-selected p {
  margin: auto 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.matter-question-recipient-chip {
  display: inline-grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1px 8px;
  align-items: center;
  min-height: 36px;
  max-width: min(100%, 260px);
  border: 1px solid rgba(14, 165, 233, 0.32);
  border-radius: 999px;
  background: #ecfeff;
  color: #075985;
  padding: 5px 10px 5px 12px;
  text-align: left;
}

.matter-question-recipient-chip--role {
  border-color: rgba(124, 58, 237, 0.26);
  background: #f5f3ff;
  color: #5b21b6;
}

.matter-question-recipient-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matter-question-recipient-chip small {
  grid-column: 1;
  color: currentColor;
  font-size: 0.68rem;
  font-weight: 700;
  opacity: 0.72;
}

.matter-question-recipient-chip span {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  font-weight: 900;
}

.matter-question-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.matter-question-summary div {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.78);
}

.matter-question-summary dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.matter-question-summary dd {
  margin: 4px 0 0;
  font-weight: 700;
}

.matter-question-thread {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.matter-question-message {
  padding: 12px 14px;
  border: 1px solid rgba(186, 230, 253, 0.82);
  border-radius: 16px;
  background: rgba(240, 249, 255, 0.76);
}

.matter-question-message header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.matter-question-message p {
  margin: 0;
  white-space: pre-wrap;
}

.matter-question-reply {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.matter-question-reply label:not(.matter-question-close-toggle) {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.76rem;
}

.matter-question-reply textarea {
  min-height: 120px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  color: var(--ink);
  background: #fff;
  resize: vertical;
}

.matter-question-close-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 700;
}

.matter-question-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.workflow-item--question {
  border-color: rgba(14, 165, 233, 0.45);
  background: rgba(236, 254, 255, 0.78);
}

html[data-theme="dark"] .matter-question-attention,
html[data-theme="dark"] .matter-question-row--attention,
html[data-theme="dark"] .workflow-item--question {
  background: rgba(8, 47, 73, 0.5);
  color: #bae6fd;
}

html[data-theme="dark"] .matter-question-form-grid fieldset,
html[data-theme="dark"] .matter-question-summary div,
html[data-theme="dark"] .matter-question-check-list label,
html[data-theme="dark"] .matter-question-recipient-selected,
html[data-theme="dark"] .matter-question-reply textarea {
  background: rgba(15, 23, 42, 0.86);
}

html[data-theme="dark"] .matter-question-recipient-chip {
  background: rgba(8, 47, 73, 0.72);
  color: #bae6fd;
}

html[data-theme="dark"] .matter-question-recipient-chip--role {
  background: rgba(46, 16, 101, 0.56);
  color: #ddd6fe;
}

html[data-theme="dark"] .matter-question-message {
  background: rgba(8, 47, 73, 0.42);
}

@media (max-width: 900px) {
  .matter-question-recipient-picker {
    grid-template-columns: 1fr;
  }

  .matter-question-summary {
    grid-template-columns: 1fr;
  }
}
/* Dashboard personalization */
.dashboard-personalization {
  --panel: var(--surface);
  --panel-soft: var(--surface-soft, #f8fafc);
  --border: var(--line);
}

.dashboard-personalization__header {
  align-items: flex-start;
  gap: 16px;
  overflow: visible;
}

.dashboard-personalization__header > div:first-child {
  min-width: min(420px, 100%);
}

.dashboard-personalization__toolbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 0;
}

.dashboard-personalization__settings-button {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(14, 116, 144, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--brand-dark);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  cursor: pointer;
  transition:
    background-color 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.dashboard-personalization__settings-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}

.dashboard-personalization__settings-button:hover,
.dashboard-personalization__settings-button:focus-visible,
.dashboard-personalization__settings-button[aria-expanded="true"] {
  border-color: rgba(14, 116, 144, 0.32);
  background: #f8fbff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  outline: none;
  transform: translateY(-1px);
}

.dashboard-personalization__menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: max-content;
  padding: 10px;
  border: 1px solid rgba(203, 213, 225, 0.82);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.14);
}

.dashboard-personalization__menu::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 14px;
  width: 10px;
  height: 10px;
  border-top: 1px solid rgba(203, 213, 225, 0.82);
  border-left: 1px solid rgba(203, 213, 225, 0.82);
  background: inherit;
  transform: rotate(45deg);
}

.dashboard-personalization__toolbar form {
  display: flex;
  margin: 0;
}

.dashboard-personalization__toolbar .ghost-action,
.dashboard-personalization__toolbar .primary-action {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border-radius: 8px;
  padding: 0 14px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
}

.dashboard-personalization__toolbar .ghost-action {
  border: 1px solid rgba(14, 116, 144, 0.18);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.dashboard-personalization__toolbar .primary-action {
  align-self: center;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  box-shadow: 0 10px 20px rgba(14, 165, 196, 0.18);
}

.dashboard-personalization__toolbar .ghost-action:hover,
.dashboard-personalization__toolbar .ghost-action:focus-visible,
.dashboard-personalization__toolbar .primary-action:hover,
.dashboard-personalization__toolbar .primary-action:focus-visible {
  outline: none;
  transform: translateY(-1px);
}

.dashboard-personalization__toolbar .ghost-action:hover,
.dashboard-personalization__toolbar .ghost-action:focus-visible {
  border-color: rgba(14, 116, 144, 0.32);
  background: #f8fbff;
  color: var(--brand-dark);
}

.dashboard-personalization__toolbar .primary-action:hover,
.dashboard-personalization__toolbar .primary-action:focus-visible {
  background: #0788a5;
  border-color: #0788a5;
  box-shadow: 0 12px 24px rgba(14, 165, 196, 0.24);
}

.dashboard-personalized-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.dashboard-personalized-grid > .kpi-card {
  grid-column: span 4;
}

.dashboard-personalized-grid > .workspace-card {
  grid-column: span 4;
  align-content: start;
}

.dashboard-personalized-grid > .dashboard-widget--wide {
  grid-column: span 6;
}

.dashboard-personalized-grid > [data-dashboard-widget] {
  position: relative;
}

.dashboard-widget-handle,
.dashboard-widget-hide {
  display: none;
}

.dashboard-personalization.is-editing .dashboard-widget-handle,
.dashboard-personalization.is-editing .dashboard-widget-hide {
  display: inline-flex;
}

.dashboard-personalization.is-editing [data-dashboard-widget] {
  outline: 1px dashed color-mix(in srgb, var(--accent, #0ea5e9) 55%, transparent);
  outline-offset: 4px;
}

.dashboard-personalization.is-editing [data-dashboard-widget].is-dragging {
  opacity: 0.52;
}

.dashboard-widget-handle {
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: grab;
  font-weight: 800;
  line-height: 1;
}

.kpi-card .dashboard-widget-handle {
  position: absolute;
  top: 12px;
  left: 12px;
}

.dashboard-widget-hide {
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.dashboard-widget-hide:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.kpi-card .dashboard-widget-hide {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}

.dashboard-widget-catalog {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
}

.has-dashboard-widget-catalog {
  overflow: hidden;
}

.dashboard-widget-catalog__backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(15, 23, 42, 0.56);
  cursor: default;
}

.dashboard-widget-catalog__panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(1040px, 100%);
  max-height: min(780px, calc(100vh - 48px));
  min-height: 420px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
}

.dashboard-widget-catalog__panel > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.dashboard-widget-catalog__panel > header h2,
.dashboard-widget-catalog__panel > header p {
  margin: 0;
}

.dashboard-widget-catalog__panel > header h2 {
  margin-top: 3px;
  font-size: 1.25rem;
}

.dashboard-widget-catalog__panel > header p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.86rem;
}

.dashboard-widget-catalog__panel .eyebrow {
  color: var(--brand-dark);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.dashboard-widget-catalog__controls {
  display: grid;
  gap: 12px;
  padding: 16px 24px 10px;
}

.dashboard-widget-catalog__search input {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  font: inherit;
}

.dashboard-widget-catalog__search input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(14, 165, 196, 0.12);
  outline: none;
}

.dashboard-widget-catalog__categories {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.dashboard-widget-catalog__categories button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel);
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 750;
  cursor: pointer;
}

.dashboard-widget-catalog__categories button.is-active,
.dashboard-widget-catalog__categories button:focus-visible {
  border-color: var(--brand);
  background: rgba(14, 165, 196, 0.1);
  color: var(--brand-dark);
  outline: none;
}

.dashboard-widget-catalog__summary {
  padding: 0 24px 8px;
  color: var(--muted);
  font-size: 0.76rem;
}

.dashboard-widget-catalog__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  overflow-y: auto;
  padding: 0 24px 24px;
}

.dashboard-widget-catalog__item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  min-height: 150px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  text-align: left;
}

.dashboard-widget-catalog__preview {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(14, 165, 196, 0.16);
  border-radius: 8px;
  background: rgba(14, 165, 196, 0.08);
}

.dashboard-widget-catalog__content {
  min-width: 0;
}

.dashboard-widget-catalog__category {
  color: var(--brand-dark);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.dashboard-widget-catalog__content h3,
.dashboard-widget-catalog__content p {
  margin: 0;
}

.dashboard-widget-catalog__content h3 {
  margin-top: 3px;
  font-size: 0.98rem;
}

.dashboard-widget-catalog__content p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.dashboard-widget-catalog__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin-top: 11px;
  color: var(--muted);
  font-size: 0.7rem;
}

.dashboard-widget-catalog__add {
  min-width: 92px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--brand);
  border-radius: 7px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.dashboard-widget-catalog__add:disabled {
  border-color: var(--border);
  background: var(--panel);
  color: var(--muted);
  cursor: default;
}

.dashboard-widget-catalog__empty {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 180px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.dashboard-widget-catalog__empty strong {
  color: var(--text);
}

@media (max-width: 1100px) {
  .dashboard-personalized-grid > .kpi-card,
  .dashboard-personalized-grid > .workspace-card,
  .dashboard-personalized-grid > .dashboard-widget--wide {
    grid-column: span 6;
  }
}

@media (max-width: 720px) {
  .dashboard-personalization__header {
    align-items: stretch;
  }

  .dashboard-personalization__toolbar {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .dashboard-personalization__menu {
    right: 0;
    display: grid;
    width: min(220px, calc(100vw - 48px));
    min-width: 0;
    justify-content: stretch;
  }

  .dashboard-personalization__menu .ghost-action,
  .dashboard-personalization__menu .primary-action,
  .dashboard-personalization__menu form {
    width: 100%;
  }

  .dashboard-personalized-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-personalized-grid > .kpi-card,
  .dashboard-personalized-grid > .workspace-card,
  .dashboard-personalized-grid > .dashboard-widget--wide {
    grid-column: 1;
  }

  .dashboard-widget-catalog {
    align-items: end;
    padding: 0;
  }

  .dashboard-widget-catalog__panel {
    width: 100%;
    max-height: 92vh;
    min-height: 70vh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
  }

  .dashboard-widget-catalog__panel > header,
  .dashboard-widget-catalog__controls,
  .dashboard-widget-catalog__grid {
    padding-right: 16px;
    padding-left: 16px;
  }

  .dashboard-widget-catalog__summary {
    padding-right: 16px;
    padding-left: 16px;
  }

  .dashboard-widget-catalog__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-widget-catalog__item {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .dashboard-widget-catalog__preview {
    width: 44px;
    height: 44px;
  }

  .dashboard-widget-catalog__add {
    grid-column: 2;
    justify-self: start;
  }
}
/* share.lexcore */
.matter-share-panel {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--border, #d7e5f2);
  border-radius: 18px;
  background: var(--surface, #ffffff);
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
}

.matter-share-panel > header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.matter-share-panel p,
.share-card header p {
  margin: 0;
  color: var(--accent, #0099b8);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.matter-share-panel h3,
.matter-share-panel h4,
.share-card h1 {
  margin: 0;
  color: var(--text, #07172f);
}

.matter-share-panel small,
.share-card small {
  color: var(--muted, #60708a);
}

.matter-share-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.matter-share-modal::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

.matter-share-modal {
  width: min(860px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  overflow: visible;
}

.matter-share-modal-card {
  width: 100%;
  box-sizing: border-box;
  max-height: min(820px, 92vh);
  overflow-y: auto;
  overflow-x: hidden;
}

.matter-share-modal-card > header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 14px;
  min-width: 0;
}

.matter-share-modal-card > header > div {
  min-width: 0;
}

.matter-share-modal-card > header h2 {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.matter-share-modal-card > header button {
  flex: 0 0 auto;
  width: auto;
  max-width: 140px;
  white-space: nowrap;
}

.matter-share-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border, #d7e5f2);
  border-radius: 14px;
  background: var(--surface-muted, #f7fbff);
}

.matter-share-card h4,
.matter-share-card .span-2,
.matter-share-file-picker {
  grid-column: 1 / -1;
}

.matter-share-card label,
.share-form label {
  display: grid;
  gap: 5px;
  color: var(--text, #07172f);
  font-weight: 700;
  min-width: 0;
}

.matter-share-card label span,
.share-form label span {
  color: var(--muted, #60708a);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.matter-share-card .matter-share-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.matter-share-recipient-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.matter-share-recipient-field > .matter-share-label-row > label {
  color: var(--muted, #60708a);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.matter-share-add-contact {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  min-width: 26px;
  padding: 0;
  border: 1px solid var(--line, #d7e5f2);
  border-radius: 6px;
  background: var(--surface, #ffffff);
  color: var(--primary, #007f9f);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}

.matter-share-add-contact:hover,
.matter-share-add-contact:focus-visible {
  border-color: var(--primary, #007f9f);
  background: var(--surface-accent, #eefaff);
}

.matter-share-contact-creator {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line, #d7e5f2);
  border-radius: 10px;
  background: var(--surface, #ffffff);
}

.matter-share-contact-creator[hidden] {
  display: none;
}

.matter-share-contact-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.matter-share-contact-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.matter-share-contact-actions button {
  flex: 0 0 auto;
  border: 1px solid var(--primary, #007f9f);
  border-radius: 6px;
  background: var(--primary, #007f9f);
  color: #ffffff;
  padding: 8px 12px;
  font-weight: 700;
}

.matter-share-card input,
.matter-share-card select,
.share-form input,
.share-file-row input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid var(--border, #d7e5f2);
  border-radius: 10px;
  background: var(--input-bg, #ffffff);
  color: var(--text, #07172f);
  padding: 10px 12px;
}

.matter-share-card .primary-action {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.matter-share-card label.is-muted {
  opacity: 0.72;
}

.matter-share-file-picker {
  max-height: 170px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border, #d7e5f2);
  border-radius: 12px;
  min-width: 0;
}

.matter-share-file-picker label {
  display: flex;
  grid-template-columns: none;
  align-items: flex-start;
  gap: 8px;
  font-weight: 700;
}

.matter-share-file-picker [hidden] {
  display: none;
}

.matter-share-file-tree {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.matter-share-file-tree__folder {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding-left: calc(var(--share-file-depth, 0) * 16px);
}

.matter-share-file-tree__folder-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--text, #07172f);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.matter-share-file-tree__folder-name::before {
  content: "";
  width: 10px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent-soft, #d9f5fb);
  border: 1px solid var(--accent, #0099b8);
  flex: 0 0 auto;
}

.matter-share-file-picker .matter-share-file-tree__file {
  margin-left: calc(var(--share-file-depth, 0) * 16px);
}

.matter-share-file-picker input {
  width: auto;
  margin-top: 3px;
}

.matter-share-file-picker small {
  display: block;
  overflow-wrap: anywhere;
}

.matter-share-list {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.matter-share-row,
.share-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border, #d7e5f2);
  border-radius: 12px;
  background: var(--surface-muted, #f7fbff);
}

@media (max-width: 760px) {
  .matter-share-modal {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
  }

  .matter-share-modal-card {
    max-height: calc(100vh - 20px);
    padding: 14px;
  }

  .matter-share-modal-card > header {
    gap: 12px;
  }

  .matter-share-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .matter-share-card h4,
  .matter-share-card .span-2,
  .matter-share-file-picker {
    grid-column: 1;
  }

  .matter-share-contact-fields {
    grid-template-columns: 1fr;
  }

  .matter-share-contact-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

.share-page {
  max-width: 920px;
  margin: 48px auto;
  padding: 0 20px;
}

.share-public-body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #eef8fb 0%, #ffffff 100%);
  color: #0f2238;
}

.share-card {
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--border, #d7e5f2);
  border-radius: 20px;
  background: var(--surface, #ffffff);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
}

.share-meta,
.share-form,
.share-file-list {
  display: grid;
  gap: 12px;
}

.share-meta {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.share-meta span {
  padding: 10px 12px;
  border: 1px solid var(--border, #d7e5f2);
  border-radius: 12px;
  background: var(--surface-muted, #f7fbff);
  color: var(--text, #07172f);
  font-weight: 700;
}

.share-public-page {
  width: min(1480px, calc(100% - 40px));
  margin: 34px auto 56px;
}

.share-public-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.share-public-brandmark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.share-public-hero,
.share-public-context,
.share-public-grid {
  display: grid;
  gap: 16px;
}

.share-public-hero {
  grid-template-columns: minmax(280px, 0.72fr) minmax(420px, 1.28fr);
  align-items: stretch;
  margin-bottom: 16px;
}

.share-public-brand,
.share-public-title,
.share-public-context-card,
.share-public-card,
.share-public-screen {
  border: 1px solid #d7e7ef;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 46px rgba(26, 60, 84, 0.1);
}

.share-public-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px;
}

.share-public-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0794b6, #0aa7c9);
  color: #fff;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.share-public-brand strong {
  display: block;
  color: #07556a;
  font-size: 0.88rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.share-public-brand small,
.share-public-title span,
.share-public-context-card small,
.share-public-screen-header p,
.share-public-screen-header span {
  color: #607086;
}

.share-public-title {
  padding: 22px 24px;
}

.share-public-title p,
.share-public-card-header p {
  margin: 0 0 4px;
  color: #07556a;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.share-public-title h1,
.share-public-screen-header h1,
.share-public-screen-header h2,
.share-public-card h2 {
  margin: 0;
  color: #102033;
  letter-spacing: -0.02em;
}

.share-public-title h1,
.share-public-screen-header h1 {
  font-size: clamp(1.75rem, 2.8vw, 2.45rem);
  line-height: 1.06;
}

.share-public-title span {
  display: block;
  margin-top: 8px;
}

.share-public-message,
.share-public-notice {
  border: 1px solid #b7e9f4;
  border-radius: 14px;
  background: #dff6fb;
  color: #07556a;
  padding: 12px 14px;
  font-weight: 800;
}

.share-public-context {
  grid-template-columns: minmax(300px, 1.3fr) repeat(3, minmax(160px, 0.56fr));
  margin-bottom: 16px;
}

.share-public-context-card {
  min-width: 0;
  padding: 14px 16px;
}

.share-public-context-card span {
  display: block;
  margin-bottom: 5px;
  color: #8390a1;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.share-public-context-card strong {
  display: block;
  color: #102033;
  font-size: 0.94rem;
}

.share-public-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.share-public-grid--single {
  grid-template-columns: minmax(0, 1fr);
}

.share-public-card {
  display: grid;
  gap: 14px;
  padding: 24px;
}

.share-public-card--narrow {
  max-width: 680px;
  margin: 0 auto;
}

.share-public-card-header,
.share-public-screen-header,
.share-public-upload-queue header,
.share-public-upload-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.share-public-screen {
  min-width: 0;
  overflow: hidden;
}

.share-public-screen--inactive {
  opacity: 0.74;
}

.share-public-screen-header {
  padding: 20px 22px 16px;
  border-bottom: 1px solid #d7e7ef;
  background: linear-gradient(180deg, #fff, #f7fbfd);
}

.share-public-screen-header h2 {
  font-size: 1.35rem;
}

.share-public-screen-header p {
  margin: 0 0 4px;
  color: #07556a;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  line-height: 1.2;
  text-transform: uppercase;
}

.share-public-screen-header h1 + span,
.share-public-screen-header h2 + p {
  display: block;
  margin-top: 6px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.share-public-badge {
  white-space: nowrap;
  border: 1px solid #b9e7d8;
  border-radius: 999px;
  background: #e8f7f1;
  color: #0f8b66;
  padding: 7px 10px;
  font-size: 0.75rem;
  font-weight: 900;
}

.share-public-download,
.share-public-upload {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 14px;
  padding: 18px 22px 22px;
}

.share-public-toolbar,
.share-public-file-list,
.share-public-upload-queue,
.share-public-upload-list {
  display: grid;
  gap: 9px;
}

.share-public-download-main {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.share-public-toolbar {
  grid-template-columns: minmax(180px, 1fr) auto;
  align-items: end;
}

.share-public-search,
.share-public-note {
  display: grid;
  gap: 7px;
  color: #607086;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.share-public-search input,
.share-public-note textarea,
.share-public-access-form input {
  width: 100%;
  min-width: 0;
  border: 1px solid #d7e7ef;
  border-radius: 12px;
  background: #fff;
  color: #102033;
  font: inherit;
  padding: 10px 12px;
}

.share-public-file-list {
  max-height: 460px;
  overflow: auto;
}

.share-public-file-row,
.share-public-folder-row,
.share-public-upload-row,
.share-public-side,
.share-public-drop,
.share-public-note {
  border: 1px solid #d7e7ef;
  border-radius: 16px;
  background: #f7fbfd;
}

.share-public-file-row,
.share-public-folder-row {
  display: grid;
  grid-template-columns: auto 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin-left: calc(var(--share-depth, 0) * 20px);
  cursor: pointer;
}

.share-public-folder-row {
  grid-template-columns: 28px 46px minmax(0, 1fr) auto;
  background: #ffffff;
  cursor: default;
}

.share-public-file-row.is-share-tree-hidden,
.share-public-folder-row.is-share-tree-hidden,
.share-public-upload-row.is-share-tree-hidden {
  display: none;
}

.share-public-tree-toggle {
  width: 26px;
  height: 26px;
  border: 1px solid #d7e7ef;
  border-radius: 9px;
  background: #fff;
  color: #607086;
  display: grid;
  place-items: center;
  padding: 0;
}

.share-public-tree-toggle span {
  display: block;
  transition: transform 0.16s ease;
}

[data-share-expanded="true"] > .share-public-tree-toggle span {
  transform: rotate(90deg);
}

.share-public-file-row:hover,
.share-public-file-row:focus-within {
  border-color: #9adcea;
  background: #eefaff;
}

.share-public-file-row input {
  width: 18px;
  height: 18px;
}

.share-public-file-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  border: 1px solid #d7e7ef;
  background: #fff;
  color: #0794b6;
  font-size: 0.62rem;
  font-weight: 900;
}

.share-public-file-icon--pdf {
  background: #fff1f0;
  color: #b42318;
  border-color: #ffd1cc;
}

.share-public-file-icon--img {
  background: #eef7ff;
  color: #2276b9;
  border-color: #c8e5fb;
}

.share-public-file-icon--doc {
  background: #eef6ff;
  color: #2464b5;
  border-color: #c8ddfb;
}

.share-public-file-icon--folder {
  background: #fff9e9;
  color: #9b6500;
  border-color: #ffe2a5;
}

.share-public-file-main {
  min-width: 0;
}

.share-public-file-main strong,
.share-public-file-main small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-public-file-main strong {
  color: #102033;
  font-size: 0.88rem;
}

.share-public-file-main small,
.share-public-file-size,
.share-public-side span,
.share-public-upload-queue header span,
.share-public-upload-row small {
  color: #607086;
  font-size: 0.75rem;
  font-weight: 800;
}

.share-public-side {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 14px;
}

.share-public-side div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.share-public-side strong {
  color: #102033;
  font-size: 0.85rem;
}

.share-public-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid #d7e7ef;
  border-radius: 12px;
  background: #fff;
  color: #102033;
  padding: 9px 12px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 900;
  cursor: pointer;
}

.share-public-button--primary {
  border-color: transparent;
  background: linear-gradient(135deg, #0794b6, #0aa7c9);
  color: #fff;
  box-shadow: 0 10px 22px rgba(7, 148, 182, 0.2);
}

.share-public-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.share-public-access-form {
  display: grid;
  gap: 12px;
}

.share-public-access-form label {
  display: grid;
  gap: 7px;
  color: #607086;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.share-public-drop {
  grid-column: 1 / -1;
  min-height: 190px;
  display: grid;
  place-items: center;
  text-align: center;
  border-style: dashed;
  border-width: 2px;
  border-color: #9adcea;
  background: linear-gradient(180deg, #f8feff, #eefaff);
  padding: 22px;
}

.share-public-drop.is-dragging {
  border-color: #0794b6;
  background: #e6f9fd;
}

.share-public-drop strong {
  color: #102033;
  font-size: 1.05rem;
}

.share-public-drop p {
  margin: 6px 0 12px;
  color: #607086;
}

.share-public-drop input[type="file"],
.share-public-button input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.share-public-drop-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
}

.share-public-upload-queue,
.share-public-note,
.share-public-upload-actions {
  grid-column: 1 / -1;
}

.share-public-upload-queue {
  margin-top: 2px;
}

.share-public-upload-row {
  display: grid;
  grid-template-columns: 28px 44px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  margin-left: calc(var(--share-depth, 0) * 20px);
}

.share-public-upload-row .share-public-upload-kind {
  width: 34px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid #d7e7ef;
  color: #0794b6;
  font-size: 0.62rem;
  font-weight: 900;
}

.share-public-upload-row--folder .share-public-upload-kind {
  background: #fff9e9;
  color: #9b6500;
  border-color: #ffe2a5;
}

.share-public-upload-main {
  min-width: 0;
}

.share-public-upload-row strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #102033;
  font-size: 0.84rem;
}

.share-public-upload-size {
  color: #607086;
  font-size: 0.75rem;
  font-weight: 900;
  white-space: nowrap;
}

.share-public-icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid #ffd1cc;
  border-radius: 11px;
  background: #fff1f0;
  color: #b42318;
  display: grid;
  place-items: center;
  padding: 0;
}

.share-public-icon-button svg {
  width: 16px;
  height: 16px;
}

.share-public-item-progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef6fa;
  margin-top: 6px;
}

.share-public-item-progress span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #0794b6, #21c6df);
  transition: width 0.18s ease;
}

.share-public-upload-row.is-done .share-public-item-progress span {
  background: linear-gradient(90deg, #0f8b66, #28c28a);
}

.share-public-upload-row.is-error .share-public-item-progress span {
  background: linear-gradient(90deg, #b42318, #ef4444);
}

.share-public-upload.is-share-uploading {
  cursor: progress;
}

.share-public-upload.is-share-uploading .share-public-drop,
.share-public-upload.is-share-uploading .share-public-icon-button {
  pointer-events: none;
  opacity: 0.65;
}

.share-public-note {
  padding: 12px;
  background: #fff;
}

.share-public-note textarea {
  min-height: 92px;
  resize: vertical;
}

html[data-theme="dark"] .matter-share-panel,
html[data-theme="dark"] .matter-share-modal-card,
html[data-theme="dark"] .share-card {
  --surface: #071621;
  --surface-muted: #0b1d2a;
  --border: #20384a;
  --text: #e9f3fb;
  --muted: #9fb4c5;
  --input-bg: #06131d;
  --accent: #2cc7e8;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.32);
}

html[data-theme="dark"] .matter-share-card,
html[data-theme="dark"] .matter-share-file-picker,
html[data-theme="dark"] .matter-share-row,
html[data-theme="dark"] .share-file-row,
html[data-theme="dark"] .share-meta span {
  background: var(--surface-muted);
  border-color: var(--border);
  color: var(--text);
}

html[data-theme="dark"] .matter-share-card input,
html[data-theme="dark"] .matter-share-card select,
html[data-theme="dark"] .share-form input,
html[data-theme="dark"] .share-file-row input {
  background: var(--input-bg);
  border-color: var(--border);
  color: var(--text);
}

html[data-theme="dark"] .matter-share-file-tree__folder-name {
  color: var(--text);
}

html[data-theme="dark"] .matter-share-file-tree__folder-name::before {
  background: rgba(44, 199, 232, 0.18);
  border-color: rgba(44, 199, 232, 0.72);
}

@media (max-width: 900px) {
  .matter-share-grid,
  .matter-share-card,
  .share-meta,
  .matter-share-row,
  .share-file-row {
    grid-template-columns: 1fr;
  }

  .share-public-page {
    width: min(100% - 24px, 720px);
    margin: 20px auto 42px;
  }

  .share-public-hero,
  .share-public-context,
  .share-public-grid,
  .share-public-download,
  .share-public-upload,
  .share-public-toolbar {
    grid-template-columns: 1fr;
  }

  .share-public-screen-header,
  .share-public-card-header,
  .share-public-upload-queue header,
  .share-public-upload-actions {
    display: grid;
  }

  .share-public-file-row,
  .share-public-folder-row {
    grid-template-columns: auto 40px minmax(0, 1fr);
    margin-left: calc(var(--share-depth, 0) * 10px);
  }

  .share-public-folder-row {
    grid-template-columns: 28px 40px minmax(0, 1fr);
  }

  .share-public-file-size {
    grid-column: 3;
  }

  .share-public-upload-row {
    grid-template-columns: 28px 38px minmax(0, 1fr) auto;
    margin-left: calc(var(--share-depth, 0) * 10px);
  }

  .share-public-upload-row small {
    grid-column: 2 / -1;
  }
}

/* LEX-20: keep share tree rows horizontal even when earlier grid rules are overridden by viewport/layout quirks. */
.share-public-file-list .share-public-file-row,
.share-public-file-list .share-public-folder-row {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  width: calc(100% - (var(--share-depth, 0) * 20px));
  min-width: 0;
}

.share-public-file-list .share-public-tree-toggle {
  flex: 0 0 26px;
}

.share-public-file-list .share-public-file-row input[type="checkbox"] {
  flex: 0 0 18px;
}

.share-public-file-list .share-public-file-icon {
  flex: 0 0 40px;
}

.share-public-file-list .share-public-file-main {
  flex: 1 1 auto;
  min-width: 0;
}

.share-public-file-list .share-public-file-size {
  flex: 0 0 auto;
  margin-left: auto;
}

.share-public-upload-list .share-public-upload-row {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  width: calc(100% - (var(--share-depth, 0) * 20px));
  min-width: 0;
}

.share-public-upload-list .share-public-tree-toggle {
  flex: 0 0 26px;
}

.share-public-upload-list .share-public-upload-kind {
  flex: 0 0 34px;
}

.share-public-upload-list .share-public-upload-main {
  flex: 1 1 auto;
  min-width: 0;
}

.share-public-upload-list .share-public-upload-size,
.share-public-upload-list .share-public-icon-button {
  flex: 0 0 auto;
}

.share-public-file-list .share-public-file-row.is-share-tree-hidden,
.share-public-file-list .share-public-folder-row.is-share-tree-hidden,
.share-public-upload-list .share-public-upload-row.is-share-tree-hidden {
  display: none;
}

/* LEX-43: shared visually-hidden helper for analysis controls. */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
/* LEX-43 canonical Q/A card layout, ported from the approved HTML mock. */
.matter-analysis-chat {
  --qa-card-bg: #ffffff;
  --qa-border: #dbe8f7;
  --qa-border-soft: #e6eef8;
  --qa-text: #17223b;
  --qa-muted: #62708a;
  --qa-blue: #0e7490;
  --qa-blue-soft: #e8f8fc;
  --qa-blue-line: #b7e4ee;
  --qa-red: #e34141;
  --qa-red-soft: #fff0f0;
  --qa-shadow: 0 10px 24px rgba(22, 48, 88, 0.055);
  --qa-radius: 18px;
  --qa-rail-width: 72px;
  --qa-content-pad-x: 24px;
  --qa-collapsed-lines: 2;
  gap: 8px !important;
}

.matter-analysis-card.qa-card {
  width: 100%;
  min-width: 0;
  margin: 8px 0 !important;
  overflow: hidden;
  border: 1px solid var(--qa-border);
  border-radius: var(--qa-radius);
  background: var(--qa-card-bg);
  box-shadow: var(--qa-shadow);
}

.matter-analysis-card .qa-row.matter-analysis-message,
.matter-analysis-card .qa-row.matter-analysis-message.is-user,
.matter-analysis-card .qa-row.matter-analysis-message.is-assistant {
  position: relative;
  display: grid;
  grid-template-columns: var(--qa-rail-width) minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.matter-analysis-card .qa-row::before,
.matter-analysis-card .qa-row::after {
  content: none !important;
}

.matter-analysis-card .rail {
  position: relative;
  display: flex;
  justify-content: center;
  min-width: 0;
  padding-top: 15px;
}

.matter-analysis-card .qa-question .rail::after,
.matter-analysis-card .qa-answer .rail::before {
  content: "";
  position: absolute;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: var(--qa-blue-line);
  z-index: 0;
}

.matter-analysis-card .qa-question .rail::after {
  top: 54px;
  bottom: 0;
}

.matter-analysis-card .qa-answer .rail::before {
  top: 0;
  height: 15px;
}

.matter-analysis-card .rail-icon {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--qa-blue-line);
  border-radius: 999px;
  background: #fff;
  color: var(--qa-blue);
  box-shadow: 0 2px 6px rgba(42, 127, 206, 0.08);
}

.matter-analysis-card .rail-icon svg {
  width: 18px;
  height: 18px;
}

.matter-analysis-card .row-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  min-width: 0;
  padding: 13px var(--qa-content-pad-x) 13px 0;
}

.matter-analysis-card .qa-question .row-panel,
.matter-analysis-card .qa-answer .row-panel {
  grid-template-columns: minmax(0, 1fr);
}

.matter-analysis-card .qa-answer .row-panel {
  border-top: 1px solid var(--qa-border-soft);
  padding-top: 17px;
  padding-bottom: 17px;
}

.matter-analysis-card .row-main {
  min-width: 0;
}

.matter-analysis-card .question-head,
.matter-analysis-card .answer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 18px;
  min-width: 0;
  margin-bottom: 3px;
}

.matter-analysis-card .question-head .type-chip,
.matter-analysis-card .answer-head .type-chip {
  margin-bottom: 0;
}

.matter-analysis-card .question-head .actions,
.matter-analysis-card .answer-head .actions {
  flex: 0 0 auto;
  padding-top: 0;
}

.matter-analysis-card .type-chip,
.matter-analysis-card .matter-analysis-message__title {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
  color: var(--qa-blue) !important;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.25;
  white-space: nowrap;
}

.matter-analysis-card .type-chip svg {
  width: 15px;
  height: 15px;
}

.matter-analysis-card .question-text,
.matter-analysis-card .question-preview,
.matter-analysis-card .answer-title,
.matter-analysis-card .answer-preview,
.matter-analysis-card .answer-content {
  min-width: 0;
  max-width: none;
  padding: 0 !important;
  color: var(--qa-text);
  cursor: pointer;
}

.matter-analysis-card .question-text {
  margin: 0;
  font-size: 14px;
  font-weight: 740;
  line-height: 1.35;
}

.matter-analysis-card .question-preview {
  margin: 0;
  color: var(--qa-text);
  font-size: 14px;
  font-weight: 740;
  line-height: 1.35;
}

.matter-analysis-card:not(.is-open) .question-text.has-preview {
  display: none !important;
}

.matter-analysis-card.is-open .question-preview {
  display: none !important;
}

.matter-analysis-card .answer-title {
  margin: 0;
  color: var(--qa-text);
  font-size: 14px;
  font-weight: 840;
  line-height: 1.35;
  letter-spacing: 0;
  cursor: text;
}

.matter-analysis-card .answer-preview {
  margin: 4px 0 0;
  color: #3f4b64;
  font-size: 13px;
  line-height: 1.45;
  cursor: text;
}

.matter-analysis-card:not(.is-open) .answer-preview {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--qa-collapsed-lines);
}

.matter-analysis-card.is-open .answer-preview {
  display: none !important;
}

.matter-analysis-card .answer-content {
  display: none !important;
  margin-top: 4px;
  color: #38445c;
  font-size: 13px;
  line-height: 1.45;
  cursor: text;
}

.matter-analysis-card.is-open .answer-content {
  display: block !important;
  margin-top: 14px;
}

.matter-analysis-card .answer-content > :first-child {
  margin-top: 0 !important;
}

.matter-analysis-card .answer-content h4 {
  margin: 0 0 6px !important;
  color: var(--qa-text);
  font-size: 14px;
  font-weight: 840;
  line-height: 1.35;
  letter-spacing: 0;
}

.matter-analysis-card .answer-content p {
  margin: 4px 0 0;
}

.matter-analysis-card .answer-content ul {
  margin: 9px 0 0 0;
  padding-left: 18px;
}

.matter-analysis-card .answer-content li + li {
  margin-top: 5px;
}

.matter-analysis-card .answer-content table {
  width: 100%;
  max-width: 100%;
}

.matter-analysis-card .qa-answer.is-collapsed .answer-content .matter-analysis-source-legend,
.matter-analysis-card .qa-answer.is-collapsed .answer-content .matter-analysis-message__lazy-note {
  display: none !important;
}

.matter-analysis-card .answer-footer {
  display: none !important;
  align-items: center;
  gap: 20px;
  margin-top: 17px;
  padding: 12px var(--qa-content-pad-x) 0 0 !important;
  border-top: 1px solid var(--qa-border-soft);
  color: var(--qa-muted);
  font-weight: 650;
  flex-wrap: wrap;
}

.matter-analysis-card.is-open .answer-footer {
  display: flex !important;
}

.matter-analysis-card .actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-width: max-content;
  white-space: nowrap;
  color: var(--qa-muted);
  font-size: 11px;
  padding-top: 1px;
}

.matter-analysis-card .actions form {
  margin: 0 !important;
}

.matter-analysis-card .pill,
.matter-analysis-card .important-btn,
.matter-analysis-card .icon-btn {
  appearance: none;
  font: inherit;
}

.matter-analysis-card .pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 11px !important;
  border-radius: 999px !important;
  font-size: 11px !important;
  font-weight: 750 !important;
  line-height: 1.15;
}

.matter-analysis-card .pill-admin {
  border: 0;
  background: var(--qa-blue-soft);
  color: var(--qa-blue);
}

.matter-analysis-card .pill-delete {
  border: 1px solid #ffd1d1;
  background: var(--qa-red-soft) !important;
  color: var(--qa-red) !important;
  cursor: pointer;
  box-shadow: none !important;
}

.matter-analysis-card .important-btn {
  position: relative;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 26px;
  padding: 3px 10px;
  border: 1px solid var(--qa-border);
  border-radius: 999px;
  background: #fff;
  color: #33415d;
  cursor: pointer;
  font-size: 11px !important;
  font-weight: 750;
  line-height: 1.15;
  white-space: nowrap;
}

.matter-analysis-card .important-btn > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.matter-analysis-card .important-btn > span::before {
  content: "";
  width: 13px;
  height: 13px;
  border: 1.5px solid currentColor;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 56%, 79% 91%, 50% 70%, 21% 91%, 32% 56%, 2% 35%, 39% 35%);
}

.matter-analysis-card form.is-important .important-btn {
  color: var(--qa-blue);
  border-color: var(--qa-blue-line);
  background: #fbfdff;
}

.matter-analysis-card form.is-important .important-btn > span::before {
  background: currentColor;
}

.matter-analysis-card .important-btn button {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  opacity: 0;
  cursor: pointer;
}

.matter-analysis-card .icon-btn,
.matter-analysis-card .matter-analysis-collapse-toggle {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: transparent !important;
  color: var(--qa-blue) !important;
  box-shadow: none !important;
  cursor: pointer;
}

.matter-analysis-card .matter-analysis-collapse-toggle,
.matter-analysis-card .matter-analysis-collapse-toggle * {
  cursor: pointer;
}

.matter-analysis-card .icon-btn svg,
.matter-analysis-card .matter-analysis-collapse-toggle svg {
  width: 15px;
  height: 15px;
  transition: transform 0.16s ease;
}

.matter-analysis-card .matter-analysis-collapse-toggle[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.matter-analysis-card .icon-btn:hover,
.matter-analysis-card .important-btn:hover,
.matter-analysis-card .pill-delete:hover {
  filter: brightness(0.98);
}

.matter-analysis-card .date {
  color: #526783;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.15;
}

@media (max-width: 920px) {
  .matter-analysis-shell,
  .matter-layout--analysis-focus .matter-analysis-shell,
  .matter-analysis-top {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .matter-analysis-sidebar,
  .matter-analysis-main,
  .matter-analysis-chat {
    width: 100%;
    min-width: 0;
  }

  .matter-analysis-chat {
    --qa-rail-width: 54px;
    --qa-content-pad-x: 14px;
  }

  .matter-analysis-card .row-panel {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .matter-analysis-card .actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    min-width: 0;
    white-space: normal;
  }

  .matter-analysis-card .question-head,
  .matter-analysis-card .answer-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .matter-analysis-chat {
    --qa-rail-width: 42px;
  }

  .matter-analysis-card .rail-icon {
    width: 31px;
    height: 31px;
  }

  .matter-analysis-card .rail-icon svg {
    width: 15px;
    height: 15px;
  }

  .matter-analysis-card .pill {
    min-height: 23px;
    padding-inline: 10px !important;
  }

  .matter-analysis-card .important-btn {
    min-height: 25px;
  }

  .matter-analysis-card .date {
    width: 100%;
  }
}

html[data-theme="dark"] .matter-analysis-chat {
  --qa-card-bg: #0e1a24;
  --qa-border: rgba(98, 142, 180, 0.34);
  --qa-border-soft: rgba(98, 142, 180, 0.26);
  --qa-text: #eef6ff;
  --qa-muted: #9fb0c3;
  --qa-blue: #5eead4;
  --qa-blue-soft: rgba(20, 184, 166, 0.18);
  --qa-blue-line: rgba(94, 234, 212, 0.34);
  --qa-red-soft: rgba(127, 29, 29, 0.22);
}

html[data-theme="dark"] .matter-analysis-card .rail-icon,
html[data-theme="dark"] .matter-analysis-card .important-btn {
  background: #0b1721;
}

html[data-theme="dark"] .matter-analysis-card .answer-content,
html[data-theme="dark"] .matter-analysis-card .answer-title,
html[data-theme="dark"] .matter-analysis-card .answer-preview,
html[data-theme="dark"] .matter-analysis-card .answer-content p,
html[data-theme="dark"] .matter-analysis-card .answer-content li,
html[data-theme="dark"] .matter-analysis-card .date {
  color: #dbeafe;
}

.person-picker {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-height: 2.5rem;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--border, #cbd5e1);
  background: var(--surface, #fff);
}

.person-picker:focus-within { border-color: var(--brand, #0284c7); box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.12); }
.person-picker__selected { display: contents; }
.person-picker__input { min-width: 9rem; flex: 1 1 9rem; border: 0; outline: 0; background: transparent; padding: 0.3rem; }
.person-picker__tag { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.22rem 0.45rem; background: #e0f2fe; color: #075985; font-size: 0.82rem; }
.person-picker__tag a { color: inherit; text-decoration: underline; }
.person-picker__tag button { border: 0; background: transparent; color: inherit; cursor: pointer; font: inherit; line-height: 1; padding: 0; }
.person-picker__options { position: absolute; z-index: 30; top: calc(100% + 0.25rem); left: 0; right: 0; max-height: 13rem; overflow: auto; border: 1px solid var(--border, #cbd5e1); background: var(--surface, #fff); box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16); }
.person-picker__option { display: block; width: 100%; border: 0; border-bottom: 1px solid var(--border-soft, #e2e8f0); background: transparent; padding: 0.55rem 0.65rem; text-align: left; cursor: pointer; }
.person-picker__empty { padding: 0.65rem; color: var(--muted); font-size: 0.82rem; }
.person-picker__option:hover, .person-picker__option.is-active { background: #e0f2fe; }
html[data-theme="dark"] .person-picker { background: #10202d; border-color: #35516a; }
html[data-theme="dark"] .person-picker__options { background: #10202d; border-color: #35516a; }
html[data-theme="dark"] .person-picker__option:hover, html[data-theme="dark"] .person-picker__option.is-active { background: #164e63; }

.searchable-select {
  position: relative;
  display: flex;
  min-height: 2.5rem;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--border, #cbd5e1);
  background: var(--surface, #fff);
}

.searchable-select:focus-within { border-color: var(--brand, #0284c7); box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.12); }
.searchable-select__selected { display: contents; }
.searchable-select .searchable-select__input {
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0.3rem;
  color: var(--muted, #64748b);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 650;
  line-height: 1.35;
}

.searchable-select .searchable-select__input::placeholder {
  color: var(--muted, #64748b);
  opacity: 0.9;
}
.searchable-select__clear,
.person-picker__clear {
  flex: 0 0 1.75rem;
  width: 1.75rem;
  min-height: 1.75rem;
  align-self: center;
  border: 0;
  background: transparent;
  color: var(--muted, #64748b);
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.searchable-select__clear:hover,
.searchable-select__clear:focus-visible,
.person-picker__clear:hover,
.person-picker__clear:focus-visible {
  color: var(--text, #0f172a);
  background: var(--surface-soft, #f1f5f9);
  outline: 0;
}
.searchable-select__options { position: absolute; z-index: 30; top: calc(100% + 0.25rem); left: 0; right: 0; max-height: 16rem; overflow: auto; border: 1px solid var(--border, #cbd5e1); background: var(--surface, #fff); box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16); }
.searchable-select__option {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border-soft, #e2e8f0);
  background: transparent;
  padding: 0.48rem 0.65rem;
  color: var(--muted, #64748b);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}
.searchable-select__option:hover, .searchable-select__option.is-active { background: #e0f2fe; }
.searchable-select__empty { padding: 0.7rem; color: var(--muted, #64748b); font-weight: 600; }
.searchable-select__hint {
  position: sticky;
  bottom: 0;
  padding: 0.48rem 0.65rem;
  border-top: 1px solid var(--border-soft, #e2e8f0);
  background: #f8fafc;
  color: var(--muted, #64748b);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
}
html[data-theme="dark"] .searchable-select { background: #10202d; border-color: #35516a; }
html[data-theme="dark"] .searchable-select__options { background: #10202d; border-color: #35516a; }
html[data-theme="dark"] .searchable-select__input,
html[data-theme="dark"] .searchable-select__option { color: #a9bfd0; }
html[data-theme="dark"] .searchable-select__hint { background: #162b3a; border-color: #294154; color: #a9bfd0; }
html[data-theme="dark"] .searchable-select__option:hover, html[data-theme="dark"] .searchable-select__option.is-active { background: #164e63; }

html[data-theme="dark"] .global-search-dialog,
html[data-theme="dark"] .global-search-dialog__input,
html[data-theme="dark"] .global-search-dialog__close {
  background: #10202d;
  border-color: #35516a;
  color: #e2e8f0;
}

html[data-theme="dark"] .global-search-dialog__header,
html[data-theme="dark"] .global-search-results,
html[data-theme="dark"] .global-search-group + .global-search-group,
html[data-theme="dark"] .global-search-result {
  border-color: #294154;
}

html[data-theme="dark"] .global-search-dialog__input input,
html[data-theme="dark"] .global-search-result__title {
  color: #f8fafc;
}

html[data-theme="dark"] .global-search-dialog__summary,
html[data-theme="dark"] .global-search-result__subtitle {
  color: #a9bfd0;
}

html[data-theme="dark"] .global-search-result__meta {
  color: #7891a5;
}

html[data-theme="dark"] .global-search-group__header {
  background: #162b3a;
  border-color: #294154;
}

html[data-theme="dark"] .global-search-group__header span {
  background: #0b1721;
  color: #a9bfd0;
}

html[data-theme="dark"] .global-search-result:hover,
html[data-theme="dark"] .global-search-result:focus-visible,
html[data-theme="dark"] .global-search-result.is-active {
  background: #123847;
}

.team-schedule-workspace { margin-top: .4rem; border-top: 1px solid #d7e2ea; padding: .9rem 1rem; background: #f8fbfd; }
.team-schedule-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.team-schedule-header p, .team-schedule-settings p, .team-schedule-requests p { margin: 0 0 .3rem; color: #05748a; font-size: .72rem; font-weight: 800; letter-spacing: .06em; }
.team-schedule-header h2, .team-schedule-settings h3, .team-schedule-requests h3 { margin: 0; color: #17263a; }
.team-schedule-header span { color: #64748b; font-size: .9rem; }
.team-schedule-navigation, .team-schedule-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.team-schedule-navigation a, .team-schedule-actions button, .team-schedule-people button { border: 1px solid #c8d8e4; background: #fff; color: #14536a; padding: .48rem .7rem; text-decoration: none; font: inherit; cursor: pointer; }
.team-schedule-actions { margin: 1rem 0; }
.team-schedule-actions form { margin: 0; }
.team-schedule-actions .primary-action { background: #0789a7; border-color: #0789a7; color: #fff; }
.team-schedule-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-top: 1rem; background: #d7e2ea; border: 1px solid #d7e2ea; }
.team-schedule-metrics div { min-height: 5.2rem; padding: .85rem 1rem; background: #fff; }
.team-schedule-metrics span { display: block; color: #617387; font-size: .78rem; }
.team-schedule-metrics strong { display: block; margin-top: .45rem; color: #102b3d; font-size: 1.08rem; }
.team-schedule-grid-wrap { overflow-x: auto; border: 1px solid #d7e2ea; background: #fff; }
.team-schedule-grid { width: 100%; min-width: 920px; border-collapse: collapse; font-size: .82rem; }
.team-schedule-grid th, .team-schedule-grid td { border-right: 1px solid #e2ebf0; border-bottom: 1px solid #e2ebf0; padding: .55rem; vertical-align: top; text-align: left; }
.team-schedule-grid thead th { background: #eaf5f8; color: #35576a; font-size: .74rem; text-transform: uppercase; }
.team-schedule-grid tbody th { min-width: 12rem; color: #1d3344; }
.team-schedule-grid td { min-width: 8.3rem; height: 4.8rem; color: #476273; }
.team-schedule-grid td strong, .team-schedule-grid td small { display: block; }
.team-schedule-grid td small { margin-top: .25rem; color: #71869a; font-size: .7rem; }
.team-schedule-grid .is-absence { background: #fff7e7; color: #9a5b12; }
.team-schedule-grid .link-button { padding: 0; border: 0; background: transparent; color: #b42318; font: inherit; font-size: .72rem; cursor: pointer; }
.user-color-dot { display: inline-block; width: .65rem; height: .65rem; margin-right: .4rem; border-radius: 50%; }
.team-schedule-settings, .team-schedule-requests { margin-top: 1.25rem; border: 1px solid #d7e2ea; background: #fff; }
.team-schedule-settings > header, .team-schedule-requests > header { display: flex; align-items: center; justify-content: space-between; padding: 1rem; border-bottom: 1px solid #e2ebf0; }
.team-schedule-requests > p { padding: 1rem; color: #64748b; font-size: .9rem; letter-spacing: 0; }
.team-schedule-requests > header button { border: 1px solid #c8d8e4; background: #fff; padding: .45rem .7rem; color: #14536a; font: inherit; cursor: pointer; }
.team-schedule-people { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.team-schedule-people article { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .2rem .5rem; min-height: 5.25rem; padding: .8rem 1rem; border-right: 1px solid #e2ebf0; border-bottom: 1px solid #e2ebf0; }
.team-schedule-people article small, .team-schedule-people article > span:last-of-type { grid-column: 2; color: #6e8293; font-size: .76rem; }
.team-schedule-people article button { grid-column: 3; grid-row: 1 / span 2; }
.team-schedule-requests table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.team-schedule-requests th, .team-schedule-requests td { padding: .7rem 1rem; border-bottom: 1px solid #e2ebf0; text-align: left; }
.team-schedule-requests th { color: #607589; font-size: .72rem; text-transform: uppercase; }
.schedule-required { display: block; margin: 1rem 0; font-weight: 700; }
.standard-hours { width: 100%; border-collapse: collapse; font-size: .84rem; }
.standard-hours th, .standard-hours td { padding: .35rem; border-bottom: 1px solid #e2ebf0; text-align: left; }
.standard-hours input, .standard-hours select { max-width: 100%; }
html[data-theme="dark"] .team-schedule-workspace { background: #10202d; border-color: #35516a; }
html[data-theme="dark"] .team-schedule-header h2, html[data-theme="dark"] .team-schedule-settings h3, html[data-theme="dark"] .team-schedule-requests h3, html[data-theme="dark"] .team-schedule-grid tbody th { color: #e3f0f7; }
html[data-theme="dark"] .team-schedule-metrics, html[data-theme="dark"] .team-schedule-grid-wrap, html[data-theme="dark"] .team-schedule-settings, html[data-theme="dark"] .team-schedule-requests { border-color: #35516a; background: #10202d; }
html[data-theme="dark"] .team-schedule-metrics div, html[data-theme="dark"] .team-schedule-grid td, html[data-theme="dark"] .team-schedule-people article { background: #10202d; border-color: #35516a; }
html[data-theme="dark"] .team-schedule-grid thead th { background: #173244; border-color: #35516a; color: #c7dce8; }
@media (max-width: 900px) { .team-schedule-header { align-items: flex-start; flex-direction: column; } .team-schedule-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } .team-schedule-people { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .team-schedule-workspace { margin-inline: -.5rem; padding: 1rem .5rem; } .team-schedule-metrics { grid-template-columns: 1fr 1fr; } .team-schedule-navigation a { flex: 1 1 auto; text-align: center; } }

[data-team-planning-workspace="true"] {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
}

[data-team-planning-workspace="true"] .team-schedule-grid-wrap {
  max-width: 100%;
}

.team-planning-panels,
.team-planning-forms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.5rem;
  min-width: 0;
}

[data-team-planning-workspace="true"] .team-schedule-grid th,
[data-team-planning-workspace="true"] .team-schedule-grid td {
  height: auto;
  padding: 0.55rem;
  vertical-align: middle;
  white-space: normal;
}

[data-team-planning-workspace="true"] .team-schedule-grid small {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
}

[data-team-planning-workspace="true"] .team-dashboard-list,
.own-planning-panel {
  min-width: 0;
  border-top: 1px solid var(--line-soft, #d7e2ea);
  padding: 1rem 0;
  overflow-wrap: anywhere;
}

.team-planning-forms form,
.team-planning-forms label,
.own-planning-panel .work-schedule-settings,
.own-planning-panel label {
  display: grid;
  gap: 0.4rem;
  align-content: start;
  min-width: 0;
}

.team-planning-forms form,
.own-planning-panel .work-schedule-settings {
  gap: 0.75rem;
}

.team-planning-forms label,
.own-planning-panel label {
  font-size: 0.82rem;
  color: var(--muted);
}

[data-team-planning-workspace="true"] input:not([type="hidden"]):not([type="checkbox"]),
.team-planning-forms select,
.own-planning-panel input:not([type="hidden"]):not([type="checkbox"]),
.own-planning-panel select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--line, #d0d9e2);
  border-radius: 3px;
  padding: 0.4rem 0.55rem;
  background: var(--surface, #fff);
  color: var(--ink);
  font: inherit;
}

.team-planning-forms label:has(input[type="checkbox"]),
.own-planning-panel label:has(input[type="checkbox"]) {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
}

[data-team-planning-workspace="true"] button,
.own-planning-panel button {
  justify-self: start;
  min-height: 34px;
  max-width: 100%;
  border: 1px solid var(--line, #d0d9e2);
  border-radius: 3px;
  padding: 0.4rem 0.7rem;
  background: var(--surface, #fff);
  color: var(--brand-dark, #05748a);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: normal;
  cursor: pointer;
}

.own-planning-summary > header,
.own-planning-summary > div {
  display: grid;
  grid-template-columns: minmax(56px, 0.6fr) repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  align-items: center;
  min-height: 38px;
  border-bottom: 1px solid var(--line-soft, #d7e2ea);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.own-planning-panel .work-schedule-settings + .work-schedule-settings {
  border-top: 1px solid var(--line-soft, #d7e2ea);
  margin-top: 1rem;
  padding-top: 1rem;
}

.own-schedule-history-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.own-schedule-history-wrap .standard-hours {
  min-width: 640px;
}

@media (max-width: 760px) {
  .team-planning-panels,
  .team-planning-forms { grid-template-columns: minmax(0, 1fr); }
}

.team-page-nav { display: flex; flex-wrap: wrap; gap: .25rem; margin: 0 0 1rem; padding: .35rem; border: 1px solid #d7e2ea; background: #fff; }
.dashboard-approval-notice { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: .75rem 0; padding: .8rem 1rem; border-left: 4px solid #d28700; background: #fff7e6; color: #6e4500; text-decoration: none; }
.dashboard-approval-notice strong, .dashboard-approval-notice span { display: block; }
.dashboard-approval-notice div span { margin-top: .2rem; font-size: .88rem; }
.dashboard-approval-notice > span { color: #8a5600; font-weight: 800; white-space: nowrap; }
.team-page-nav a { padding: .55rem .8rem; color: #476273; text-decoration: none; font-weight: 700; }
.team-page-nav a:hover, .team-page-nav a.is-active { background: #dff3f6; color: #056b82; }
.team-control-pane, .team-side-section, .compact-register, .compact-register div, .compact-register dd { min-width: 0; max-width: 100%; }
.team-control-pane { overflow: hidden; }
.compact-register dd { overflow-wrap: anywhere; }
.compact-register select { width: 100%; max-width: 100%; box-sizing: border-box; }
.modal-shell { width: min(620px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); margin: auto; border: 1px solid #c8d8e4; border-radius: 6px; padding: 0; background: #fff; box-shadow: 0 20px 50px rgba(15, 35, 52, .26); overflow: auto; }
.modal-shell::backdrop { background: rgba(15, 23, 42, .42); }
.modal-shell form { display: grid; gap: 1rem; padding: 1.25rem; }
.modal-shell header, .modal-shell footer { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.modal-shell header { padding-bottom: 1rem; border-bottom: 1px solid #dbe6ed; }
.modal-shell header p { margin: 0 0 .3rem; color: #05748a; font-size: .72rem; font-weight: 800; letter-spacing: .06em; }
.modal-shell header h2 { margin: 0; color: #152a3b; font-size: 1.2rem; }
.modal-shell header button { width: 2rem; height: 2rem; border: 1px solid #c8d8e4; background: #f8fbfd; color: #34546a; font-weight: 800; cursor: pointer; }
.modal-shell footer { align-items: center; justify-content: flex-end; padding-top: 1rem; border-top: 1px solid #dbe6ed; }
.modal-shell .form-grid { gap: .85rem; }
.modal-shell .form-grid label { min-width: 0; }
.modal-shell .form-grid input, .modal-shell .form-grid select { width: 100%; box-sizing: border-box; }
.modal-shell .primary-action { min-height: 2.45rem; }
.work-schedule-settings { display: grid; gap: 1rem; }
.work-schedule-settings .standard-hours { display: table; width: auto; min-width: min(100%, 640px); max-width: 100%; border: 1px solid #d7e2ea; }
.work-schedule-settings .standard-hours th { padding: .55rem .65rem; background: #edf6f9; color: #476273; font-size: .74rem; text-transform: uppercase; }
.work-schedule-settings .standard-hours td { padding: .45rem .65rem; white-space: nowrap; }
.work-schedule-settings .standard-hours input[type="time"] { width: 7.4rem; }
.work-schedule-settings .standard-hours input[type="number"] { width: 5.4rem; }
.work-schedule-settings .standard-hours select { width: 7.8rem; }
.work-schedule-settings .user-settings-actions { margin: 0; padding: 1rem 0 0; border-top: 1px solid #dbe6ed; }
.work-schedule-user-picker { display: grid; grid-template-columns: minmax(8rem, auto) minmax(16rem, 28rem); align-items: center; gap: .7rem; padding: .75rem; border: 1px solid #d7e2ea; background: #f8fbfd; }
.work-schedule-user-picker span { font-weight: 700; color: #34546a; }
.admin-schedule-settings { display: grid; gap: .5rem; }
.admin-schedule-settings details { border: 1px solid #d7e2ea; background: #fff; }
.admin-schedule-settings summary { display: grid; grid-template-columns: minmax(14rem, 1fr) 9rem 10rem; gap: .75rem; align-items: center; padding: .8rem 1rem; cursor: pointer; }
.admin-schedule-settings summary span, .admin-schedule-settings summary em { color: #617387; font-size: .85rem; font-style: normal; }
.admin-schedule-settings details form { display: grid; gap: .8rem; padding: .9rem 1rem 1rem; border-top: 1px solid #d7e2ea; }
.admin-schedule-settings details footer { display: flex; justify-content: flex-end; }
.admin-schedule-settings .standard-hours { width: auto; min-width: 640px; }
html[data-theme="dark"] .team-page-nav, html[data-theme="dark"] .modal-shell { border-color: #35516a; background: #10202d; }
html[data-theme="dark"] .modal-shell header, html[data-theme="dark"] .modal-shell footer { border-color: #35516a; }
html[data-theme="dark"] .modal-shell header h2 { color: #e3f0f7; }
@media (max-width: 560px) { .team-page-nav a { flex: 1 1 calc(50% - .25rem); text-align: center; } .modal-shell { width: calc(100vw - 1rem); max-height: calc(100vh - 1rem); } .modal-shell form { padding: 1rem; } .modal-shell .form-grid { grid-template-columns: 1fr; } .modal-shell .span-2 { grid-column: auto; } }
@media (max-width: 760px) { .work-schedule-settings, .admin-schedule-settings details { overflow-x: auto; padding-bottom: .25rem; } .work-schedule-user-picker { grid-template-columns: 1fr; } .admin-schedule-settings summary { grid-template-columns: 1fr; gap: .2rem; } }

.page-breadcrumbs { display: flex; align-items: center; gap: .45rem; margin: 0 0 .65rem; color: #7a8d9d; font-size: .78rem; }
.page-breadcrumbs a { color: #0a7188; text-decoration: none; }
.pisp-updates-page { display: grid; width: 100%; max-width: 100%; min-width: 0; gap: .8rem; overflow: hidden; }
.pisp-updates-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.15rem; }
.pisp-updates-header h1 { margin: .12rem 0 .25rem; font-size: 1.35rem; letter-spacing: 0; }
.pisp-updates-header p { margin: 0; color: #607589; font-size: .82rem; }
.pisp-updates-header .pisp-updates-eyebrow { color: #0a7188; font-size: .7rem; font-weight: 800; text-transform: uppercase; }
.pisp-sync-status { overflow: hidden; border: 1px solid #d7e2ea; border-radius: 8px; background: #fff; }
.pisp-sync-status > header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 1rem; border-bottom: 1px solid #e2ebf0; background: #f8fbfd; }
.pisp-sync-status > header h2 { margin: 0; font-size: .88rem; }
.pisp-sync-status > header span,
.pisp-sync-account > span:not(.pisp-sync-state) {
    color: var(--muted);
    font-family: var(--font-sans);
    font-size: var(--type-meta);
    font-weight: var(--type-regular);
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
}
.pisp-sync-account { display: grid; grid-template-columns: minmax(12rem, 1fr) minmax(18rem, 2fr) auto; align-items: center; gap: 1rem; padding: .72rem 1rem; border-bottom: 1px solid #e2ebf0; }
.pisp-sync-account:last-child { border-bottom: 0; }
.pisp-sync-state {
    justify-self: end;
    color: var(--muted);
    font-family: var(--font-sans);
    font-size: var(--type-meta);
    font-weight: var(--type-medium);
    line-height: 1.4;
}
.pisp-sync-state--completed { color: color-mix(in srgb, var(--success) 45%, var(--text)); }
.pisp-sync-state--failed,
.pisp-sync-state--completedwitherrors { color: color-mix(in srgb, var(--warning) 40%, var(--text)); }
.pisp-sync-details { grid-column: 1 / -1; padding: .65rem .75rem; border: 1px solid #ead8b8; border-radius: 6px; background: #fffaf0; color: #664719; font-size: .78rem; }
.pisp-sync-details summary { width: fit-content; cursor: pointer; color: #8a5400; font-weight: 800; }
.pisp-sync-details p { margin: .45rem 0 0; line-height: 1.45; }
.pisp-sync-details__message { color: #563b13; font-weight: 700; }
.pisp-sync-account > .pisp-sync-state--limited {
    color: var(--text);
}
.pisp-source-availability {
    display: grid;
    grid-column: 1 / -1;
    min-width: 0;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: var(--type-table);
    font-weight: var(--type-regular);
    line-height: 1.5;
}
.pisp-source-availability p { margin: 0; }
.pisp-source-availability strong { font-weight: var(--type-medium); }
.pisp-source-availability__help { color: var(--muted); font-size: var(--type-meta); }
@media (forced-colors: active) {
    .pisp-source-availability { border-color: CanvasText; background: Canvas; color: CanvasText; }
    .pisp-source-availability__help,
    .pisp-sync-account > span,
    .pisp-sync-account > .pisp-sync-state--limited,
    .pisp-sync-status > header span { color: CanvasText; }
}

.dashboard-integration-alert {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .75rem;
  margin: 0 0 1rem;
  padding: .8rem 1rem;
  border: 1px solid #e5b65c;
  border-left-width: 4px;
  border-radius: 6px;
  background: #fff8e8;
  color: #68430a;
  text-decoration: none;
}
.dashboard-integration-alert.is-error { border-color: #d66161; background: #fff1f1; color: #7f1d1d; }
.dashboard-integration-alert__icon { display: grid; width: 1.65rem; height: 1.65rem; place-items: center; border-radius: 50%; background: #b76b00; color: #fff; font-weight: 800; }
.dashboard-integration-alert.is-error .dashboard-integration-alert__icon { background: #b42323; }
.dashboard-integration-alert__content { display: grid; gap: .15rem; min-width: 0; }
.dashboard-integration-alert__content strong { color: inherit; font-size: .9rem; }
.dashboard-integration-alert__content span { font-size: .78rem; line-height: 1.4; }
.dashboard-integration-alert__action { white-space: nowrap; color: inherit; font-size: .78rem; font-weight: 800; }

html[data-theme="dark"] .dashboard-integration-alert { border-color: #765b2c; background: #302817; color: #f0d7a5; }
html[data-theme="dark"] .dashboard-integration-alert.is-error { border-color: #8f3f48; background: #351d22; color: #ffc7ce; }

@media (max-width: 720px) {
  .dashboard-integration-alert { grid-template-columns: auto minmax(0, 1fr); }
  .dashboard-integration-alert__action { grid-column: 2; white-space: normal; }
}
.pisp-updates-filters { display: grid; grid-template-columns: repeat(3, minmax(10rem, 1fr)) auto auto; align-items: end; gap: .75rem; padding: .85rem 1rem; border: 1px solid #d7e2ea; border-radius: 8px; background: #f8fbfd; }
.pisp-updates-filters label { display: grid; gap: .35rem; color: #496477; font-size: .76rem; font-weight: 700; }
.pisp-updates-filters select { width: 100%; min-height: 2.35rem; border: 1px solid #c7d7e2; border-radius: 6px; background: #fff; padding: .4rem .6rem; color: #173247; font: inherit; }
.pisp-updates-filters .pisp-updates-checkbox { display: flex; flex-direction: row; align-items: center; min-height: 2.5rem; white-space: nowrap; }
.pisp-update-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); overflow: hidden; border: 1px solid #d7e2ea; border-radius: 8px; background: #fff; }
.pisp-update-metrics div { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .8rem 1rem; border-right: 1px solid #e2ebf0; }
.pisp-update-metrics div:last-child { border-right: 0; }
.pisp-update-metrics span { color: #607589; font-size: .78rem; font-weight: 700; }
.pisp-update-metrics strong { color: #0a6f85; font-size: 1.2rem; }
.pisp-change-list { width: 100%; max-width: 100%; min-width: 0; overflow: hidden; border: 1px solid #d7e2ea; border-radius: 8px; background: #fff; }
.pisp-change-row { display: grid; width: 100%; max-width: 100%; min-width: 0; grid-template-columns: minmax(6rem, 8rem) minmax(0, 1fr) minmax(9rem, auto); gap: 1rem; align-items: center; min-height: 5rem; padding: .85rem 1rem; border-bottom: 1px solid #e2ebf0; }
.pisp-change-row:last-child { border-bottom: 0; }
.pisp-change-row.is-read { background: #fbfdfe; opacity: .78; }
.pisp-change-row.is-unread { border-left: 3px solid #0795ad; }
.pisp-change-row__type { display: grid; gap: .25rem; }
.pisp-change-row__type span { color: #61778a; font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.pisp-change-row__type strong { color: #0a6f85; font-size: .82rem; }
.pisp-change-row__content { min-width: 0; }
.pisp-change-row__content a { color: #14334a; font-weight: 800; text-decoration: none; }
.pisp-change-row__content p { margin: .25rem 0; color: #4f6577; font-size: .84rem; }
.pisp-change-row__content .pisp-change-row__matter { display: flex; flex-wrap: wrap; gap: .2rem; color: #315267; }
.pisp-change-row__meta { display: flex; flex-wrap: wrap; gap: .35rem 1rem; color: #7a8d9d; font-size: .75rem; }
.pisp-change-row__meta strong { color: #496477; }
.pisp-change-row__actions { display: flex; min-width: 0; align-items: center; justify-content: flex-end; gap: .5rem; }
.pisp-change-row__actions .secondary-action { white-space: nowrap; }
.pisp-updates-page .case-listing-pagination { max-width: 100%; min-width: 0; }
.pisp-updates-page .case-listing-pagination > div { min-width: 0; flex-wrap: wrap; justify-content: flex-end; }
.case-listing-pagination__ellipsis { display: inline-grid; min-width: 1.5rem; min-height: 2rem; place-items: center; color: #718598; }
.pisp-change-row .icon-action { width: 2.25rem; height: 2.25rem; border: 1px solid #bdd2de; background: #fff; color: #08748a; cursor: pointer; }
.modern-row--matter-activity[id] { scroll-margin-top: 7rem; }
.modern-row--matter-activity[id]:target { outline: 2px solid #0795ad; outline-offset: -2px; background: #effbfe; }
html[data-theme="dark"] .pisp-sync-status, html[data-theme="dark"] .pisp-update-metrics, html[data-theme="dark"] .pisp-change-list { border-color: #35516a; background: #10202d; }
html[data-theme="dark"] .pisp-sync-status > header, html[data-theme="dark"] .pisp-sync-account, html[data-theme="dark"] .pisp-update-metrics div, html[data-theme="dark"] .pisp-change-row { border-color: #35516a; }
html[data-theme="dark"] .pisp-sync-status > header { background: #142938; }
html[data-theme="dark"] .pisp-sync-details { border-color: #765b2c; background: #302817; color: #f0d7a5; }
html[data-theme="dark"] .pisp-sync-details summary, html[data-theme="dark"] .pisp-sync-details__message { color: #ffd789; }
html[data-theme="dark"] .pisp-updates-filters { border-color: #35516a; background: #142938; }
html[data-theme="dark"] .pisp-change-row.is-read { background: #122532; }
html[data-theme="dark"] .pisp-change-row__content a { color: #e3f0f7; }
@media (max-width: 900px) { .pisp-updates-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pisp-update-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pisp-sync-account { grid-template-columns: 1fr; gap: .25rem; } .pisp-sync-state { justify-self: start; } }
@media (max-width: 560px) { .pisp-updates-header { align-items: stretch; flex-direction: column; } .pisp-updates-header form, .pisp-updates-header button { width: 100%; } .pisp-updates-filters { grid-template-columns: 1fr; } .pisp-update-metrics { grid-template-columns: 1fr; } .pisp-update-metrics div { border-right: 0; border-bottom: 1px solid #e2ebf0; } .pisp-change-row { grid-template-columns: 1fr; } .pisp-change-row__type { grid-column: 1; grid-template-columns: auto auto; justify-content: start; gap: .5rem; } .pisp-change-row__content { grid-column: 1; } .pisp-change-row__actions { grid-column: 1; justify-content: space-between; } }

/* Shared hour-grid calendar for day, four-day and week views. */
.calendar-timeline {
  --calendar-time-gutter: 4.25rem;
  --calendar-hour-height: 60px;
  --calendar-scrollbar-width: 0px;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid #d1dce5;
  border-radius: 8px;
  background: #fff;
}
.calendar-timeline-header,
.calendar-timeline-grid {
  display: grid;
  min-width: calc(var(--calendar-time-gutter) + var(--calendar-timeline-columns) * 8.5rem);
  grid-template-columns: var(--calendar-time-gutter) repeat(var(--calendar-timeline-columns), minmax(8.5rem, 1fr));
}
.calendar-timeline-header {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 3.4rem;
  border-bottom: 1px solid #d1dce5;
  background: #f8fbfd;
  padding-right: var(--calendar-scrollbar-width);
}
.calendar-timeline-header > span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  border-right: 1px solid #dbe4ea;
  color: #63788a;
  font-size: .76rem;
  font-weight: 700;
}
.calendar-timeline-header > span strong { color: #18384e; font-size: .9rem; }
.calendar-timeline-header > span.is-today { box-shadow: inset 0 -3px 0 #0795ad; color: #08748a; }
.calendar-timeline-header .calendar-timeline-corner { justify-content: flex-end; padding-right: .65rem; font-size: .68rem; font-weight: 600; }
.calendar-timeline-all-day {
  display: grid;
  min-width: calc(var(--calendar-time-gutter) + var(--calendar-timeline-columns) * 8.5rem);
  grid-template-columns: var(--calendar-time-gutter) repeat(var(--calendar-timeline-columns), minmax(8.5rem, 1fr));
  border-bottom: 1px solid #d1dce5;
  background: #fff;
  padding-right: var(--calendar-scrollbar-width);
}
.calendar-timeline-all-day > span { padding: .45rem .55rem; color: #62798a; font-size: .66rem; text-align: right; }
.calendar-timeline-all-day > div { display: grid; min-width: 0; gap: .2rem; padding: .25rem; border-left: 1px solid #dbe4ea; }
.calendar-timeline-all-day-event { overflow: hidden; border: 0; border-left: 3px solid var(--calendar-owner-color, #0795ad); border-radius: 4px; background: #edf7fa; padding: .2rem .3rem; color: #18384e; font-size: .68rem; font-weight: 700; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.calendar-timeline-scroll { max-height: min(68vh, 840px); overflow-y: auto; }
.calendar-timeline-grid { position: relative; height: calc(24 * var(--calendar-hour-height)); }
.calendar-timeline-hours { position: relative; border-right: 1px solid #cfdbe3; background: #fff; }
.calendar-timeline-hours span {
  position: absolute;
  top: calc(var(--calendar-hour-index) * var(--calendar-hour-height));
  right: .55rem;
  transform: translateY(-50%);
  color: #62798a;
  font-size: .68rem;
  font-variant-numeric: tabular-nums;
}
.calendar-timeline-day { position: relative; min-width: 0; border-right: 1px solid #dbe4ea; background: #fff; }
.calendar-timeline-day.is-today { background: #fbfeff; }
.calendar-timeline-hour-slot {
  position: absolute;
  z-index: 0;
  top: calc(var(--calendar-hour-index) * var(--calendar-hour-height));
  right: 0;
  left: 0;
  height: var(--calendar-hour-height);
  border-top: 1px solid #e2e9ee;
  cursor: pointer;
}
.calendar-timeline-hour-slot:hover { background: #f2fafc; }
.calendar-timeline-event {
  position: absolute;
  z-index: 2;
  top: var(--calendar-event-top);
  left: calc((100% / var(--calendar-event-lanes, 1)) * var(--calendar-event-lane, 0) + 3px);
  width: calc(100% / var(--calendar-event-lanes, 1) - 6px);
  height: max(24px, var(--calendar-event-height));
  min-height: 0;
  display: block;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--calendar-owner-color, #0795ad) 55%, #fff);
  border-left: 4px solid var(--calendar-owner-color, #0795ad);
  border-radius: 5px;
  background: color-mix(in srgb, var(--calendar-owner-color, #0795ad) 14%, #fff);
  box-sizing: border-box;
  padding: .25rem .35rem 1.35rem;
  color: #18384e;
  text-align: left;
}
.calendar-timeline-event:hover,
.calendar-timeline-event:focus-visible { z-index: 4; box-shadow: 0 4px 12px rgba(20, 51, 74, .18); }
.calendar-timeline-resize-handle {
  position: absolute;
  z-index: 5;
  right: .25rem;
  left: .25rem;
  height: .45rem;
  cursor: ns-resize;
  touch-action: none;
}
.calendar-timeline-resize-handle--start { top: 0; }
.calendar-timeline-resize-handle--end { bottom: 0; }
.calendar-timeline-resize-handle::after {
  content: "";
  position: absolute;
  right: 40%;
  left: 40%;
  height: 2px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--calendar-owner-color, #0795ad) 70%, #18384e);
  opacity: 0;
}
.calendar-timeline-resize-handle--start::after { top: .12rem; }
.calendar-timeline-resize-handle--end::after { bottom: .12rem; }
.calendar-timeline-event:hover .calendar-timeline-resize-handle::after,
.calendar-timeline-event.is-resizing .calendar-timeline-resize-handle::after { opacity: 1; }
.calendar-timeline-event.is-resizing { z-index: 6; box-shadow: 0 5px 15px rgba(20, 51, 74, .24); }
.calendar-timeline-event .calendar-timeline-event-time { display: block; color: inherit; font-size: var(--type-table); font-weight: var(--type-regular); }
.calendar-timeline-event strong {
  display: -webkit-box;
  max-height: 2.36em;
  margin-top: .08rem;
  overflow: hidden;
  font-size: .72rem;
  line-height: 1.18;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.calendar-timeline-event small {
  position: absolute;
  right: 4.75rem;
  bottom: .28rem;
  left: .35rem;
  display: block;
  overflow: hidden;
  color: #526b7c;
  font-size: .62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendar-timeline-event .calendar-event-status { position: absolute; right: .25rem; bottom: .2rem; max-width: calc(100% - .5rem); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-timeline-event[data-event-private-busy="true"] { padding-bottom: .25rem; }
.calendar-timeline-event > .calendar-event-owner {
  display: block;
  color: inherit;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .72rem;
  line-height: 1.25;
}
.calendar-timeline-event .calendar-timeline-event-time {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.calendar-timeline-event strong {
  display: block;
  max-height: none;
  font-weight: 600;
  font-size: .75rem;
  line-height: 1.25;
  white-space: nowrap;
}
.calendar-timeline-event.is-compact {
  display: flex;
  align-items: center;
  gap: .25rem;
  padding: .18rem .3rem;
  overflow: hidden;
}
.calendar-timeline-event.is-compact .calendar-timeline-event-time {
  display: block;
  flex: 0 1 auto;
  max-width: 55%;
  margin: 0;
}
.calendar-timeline-event.is-compact strong {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  max-height: none;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendar-timeline-event.is-compact small,
.calendar-timeline-event.is-compact .calendar-event-owner,
.calendar-timeline-event.is-compact .calendar-event-status {
  display: none;
}
.calendar-timeline > .calendar-empty-state { margin: .75rem; }
html[data-theme="dark"] .calendar-timeline,
html[data-theme="dark"] .calendar-timeline-header,
html[data-theme="dark"] .calendar-timeline-all-day,
html[data-theme="dark"] .calendar-timeline-hours,
html[data-theme="dark"] .calendar-timeline-day { border-color: #35516a; background: #10202d; }
html[data-theme="dark"] .calendar-timeline-all-day > div { border-color: #35516a; }
html[data-theme="dark"] .calendar-timeline-all-day-event { background: #183343; color: #e3f0f7; }
html[data-theme="dark"] .calendar-timeline-day.is-today { background: #122734; }
html[data-theme="dark"] .calendar-timeline-hour-slot { border-color: #294457; }
html[data-theme="dark"] .calendar-timeline-hour-slot:hover { background: #152c3a; }
html[data-theme="dark"] .calendar-timeline-header > span strong,
html[data-theme="dark"] .calendar-timeline-event { color: #e3f0f7; }
html[data-theme="dark"] .calendar-timeline-event { background: color-mix(in srgb, var(--calendar-owner-color, #0795ad) 22%, #10202d); }
@media (max-width: 700px) {
  .calendar-timeline { --calendar-time-gutter: 3.5rem; }
  .calendar-timeline-header,
  .calendar-timeline-all-day,
  .calendar-timeline-grid { min-width: calc(var(--calendar-time-gutter) + var(--calendar-timeline-columns) * 9rem); }
}
.matter-activity-delete-form .button-link--danger {
  appearance: none;
  border: 0;
  background: transparent;
  color: #c53b3b;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.3rem;
}

.matter-activity-delete-form .button-link--danger:hover,
.matter-activity-delete-form .button-link--danger:focus-visible {
  color: #922727;
  text-decoration: underline;
}
/* Internal document generator */
.document-generator-page,
.document-generation-page {
  display: grid;
  gap: 12px;
}

.document-template-row {
  grid-template-columns: minmax(0, 1fr) 220px auto;
}

.document-template-row:focus-visible {
  border-color: #0891b2;
  outline: 3px solid rgb(8 145 178 / 18%);
  outline-offset: 2px;
}

.document-template-archive-action {
  min-height: 32px;
  padding: .42rem .68rem;
  font-size: .76rem;
}

.document-template-history {
  margin-top: 8px;
}

.document-template-history > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
}

.document-template-dialog {
  width: min(1760px, calc(100vw - 1rem));
  max-width: none;
  max-height: calc(100vh - 1rem);
  overflow: hidden;
}

.document-template-editor {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  max-height: calc(100vh - 1rem);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1.25rem;
}

.document-template-editor > header {
  align-items: flex-start;
  padding-bottom: .9rem;
  border-bottom: 1px solid var(--line);
}

.document-template-editor > header > div {
  display: grid;
  gap: .2rem;
}

.document-template-editor > header h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1.25;
}

.document-template-editor > header p,
.document-template-editor > header span {
  margin: 0;
  color: var(--muted);
  font-size: .8rem;
}

.document-template-editor__meta,
.document-template-editor__policy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.document-template-editor label {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.document-template-editor label > span {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 800;
}

.document-template-label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  width: fit-content;
}

.document-template-help {
  position: relative;
  display: inline-flex;
  z-index: 5;
  font-weight: 400;
}

.document-template-help summary {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid #9fb4c8;
  border-radius: 50%;
  background: var(--surface);
  color: #47627b;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  list-style: none;
}

.document-template-help summary::-webkit-details-marker { display: none; }

.document-template-help[open] summary {
  border-color: #0891b2;
  color: #06758d;
}

.document-template-help > span {
  position: fixed;
  z-index: 10000;
  display: grid;
  width: min(310px, calc(100vw - 3rem));
  max-height: min(240px, calc(100vh - 2rem));
  overflow-y: auto;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #bfd0df;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 10px 28px rgb(15 35 52 / 18%);
  color: #334e68;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  white-space: normal;
}

.document-template-help > span strong {
  color: #102a43;
  font-size: 12px;
}

.document-template-html-editor {
  overflow: visible;
}

.document-template-html-editor .html-template-surface,
.document-template-html-editor .html-template-source {
  min-height: clamp(280px, 40vh, 560px);
}

.document-template-field-picker {
  display: inline-flex !important;
  width: auto;
  gap: 0 !important;
}

.document-template-field-picker select {
  width: 240px !important;
  min-height: 32px !important;
  padding: .35rem 2rem .35rem .6rem !important;
  border-color: #9fb4c8 !important;
  background: var(--surface) !important;
  color: var(--text) !important;
  font-size: .78rem !important;
  font-weight: 700;
}

.document-template-html-editor .html-template-source {
  width: 100%;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: .82rem;
}

.document-template-editor input:not([type="checkbox"]),
.document-template-editor select,
.document-template-editor textarea {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1.4;
  padding: .65rem .75rem;
}

.document-template-editor input:not([type="checkbox"]),
.document-template-editor select {
  min-height: 40px;
}

.document-template-editor textarea {
  resize: vertical;
}

.document-template-editor > label > textarea[name="HtmlContent"] {
  min-height: clamp(230px, 34vh, 430px);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: .82rem;
}

.document-template-placeholder-summary {
  padding: 10px 12px;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  background: #f0f9ff;
  color: #075985;
}

.document-template-parser-result {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  line-height: 1.4;
}

.document-template-parser-result[hidden] { display: none; }
.document-template-parser-result.is-pending { background: #f8fafc; color: #526d82; }
.document-template-parser-result.is-success { border-color: #9ed9bb; background: #effaf4; color: #146c43; }
.document-template-parser-result.is-error { border-color: #f0b7b7; background: #fff5f5; color: #a12626; }
.document-template-parser-result ul { margin: 0; padding-left: 1.25rem; }

.document-template-fields-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.document-template-fields {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  table-layout: fixed;
}

.document-template-editor .document-template-fields { min-width: 1480px; }

.document-template-fields th,
.document-template-fields td {
  padding: 8px;
  border-bottom: 1px solid #e5edf4;
  text-align: left;
  vertical-align: top;
}

.document-template-fields th {
  background: #f7fafc;
  color: #5b708a;
  font-size: 12px;
}

.document-template-editor .document-template-fields th:nth-child(1) { width: 120px; }
.document-template-editor .document-template-fields th:nth-child(2) { width: 170px; }
.document-template-editor .document-template-fields th:nth-child(3) { width: 150px; }
.document-template-editor .document-template-fields th:nth-child(4) { width: 190px; }
.document-template-editor .document-template-fields th:nth-child(5) { width: 175px; }
.document-template-editor .document-template-fields th:nth-child(6) { width: 210px; }
.document-template-editor .document-template-fields th:nth-child(7) { width: 190px; }
.document-template-editor .document-template-fields th:nth-child(8) { width: 140px; }
.document-template-editor .document-template-fields th:nth-child(9) { width: 90px; }

.document-template-fields th .document-template-help {
  margin-left: 3px;
  vertical-align: middle;
}

html[data-theme="dark"] .document-template-help > span {
  border-color: #49657a;
  background: #142838;
  color: #d8e5ed;
}

html[data-theme="dark"] .document-template-help > span strong { color: #f2f7fa; }
html[data-theme="dark"] .document-template-parser-result.is-pending { background: #172b39; color: #c7d7e2; }
html[data-theme="dark"] .document-template-parser-result.is-success { background: #113326; color: #b8f0d0; }
html[data-theme="dark"] .document-template-parser-result.is-error { background: #3a1b22; color: #ffc7c7; }

.document-template-fields input,
.document-template-fields select {
  min-width: 0;
  font-size: .78rem;
}

.document-template-instruction-cell {
  vertical-align: middle !important;
}

.document-template-instruction-trigger {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--muted);
  text-align: left;
}

.document-template-instruction-trigger:hover,
.document-template-instruction-trigger:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.document-template-instruction-trigger span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-template-instruction-dialog {
  width: min(760px, calc(100vw - 32px));
  max-width: 760px;
}

.document-template-instruction-editor {
  width: 100%;
  max-width: none;
}

.document-template-instruction-editor > label {
  display: grid;
  gap: 8px;
}

.document-template-instruction-editor textarea {
  width: 100%;
  min-height: 260px;
  resize: vertical;
}

.document-template-instruction-editor > footer {
  justify-content: flex-end;
}

.document-template-editor > footer {
  position: sticky;
  bottom: -1.25rem;
  z-index: 2;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin: 0 -1.25rem -1.25rem;
  padding: .9rem 1.25rem 1.25rem;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.document-template-editor > footer > button:first-child {
  margin-right: auto;
}

.document-generation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.document-generation-fields,
.document-generation-side {
  padding: 16px;
}

.document-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 14px;
}

.document-generation-side {
  position: sticky;
  top: 88px;
  display: grid;
  gap: 12px;
}

.document-generation-side form,
.document-generation-side a {
  width: 100%;
}

.document-field-row {
  min-width: 0;
  padding: 14px 0;
  border-bottom: 1px solid #dce6ef;
}

.document-field-row.is-compact {
  padding: 9px 0;
}

.document-field-row.is-attention {
  padding: 14px 12px;
  border-left: 3px solid #0891b2;
  background: #f8fbfd;
}

.document-generation-complete {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #9ad9be;
  border-radius: 6px;
  background: #eefbf5;
  color: #17603f;
}

.document-generation-complete span {
  color: #426658;
  font-size: .85rem;
}

.document-field-row__heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.document-field-row__heading > div {
  display: grid;
  gap: 3px;
}

.document-field-row__heading code {
  color: #64748b;
  font-size: .78rem;
}

.document-field-reason {
  margin: 6px 0 10px;
  color: #64748b;
}

.document-field-edit {
  display: grid;
  gap: 4px;
}

.document-field-edit textarea {
  min-height: 42px;
  max-height: 120px;
  resize: vertical;
}

.document-field-value {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border: 1px solid #dbe4ec;
  background: #f8fafc;
}

.document-field-row.is-compact .document-field-value {
  min-height: 38px;
  padding: 6px 9px;
}

.document-field-value > span {
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.document-field-actions {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  gap: 8px;
}

.document-field-toolbar {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: nowrap;
}

.document-field-toolbar > button,
.document-field-toolbar > form > button {
  flex: 0 0 auto;
}

.document-field-toolbar .document-field-retry {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.document-field-toolbar [data-field-retry-feedback] {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-field-feedback,
.document-client-source-modal [data-client-source-feedback],
.document-field-retry [data-field-retry-feedback] {
  min-height: 1.2em;
  margin: 0;
  color: #52667a;
  font-size: .84rem;
}

.document-client-source-dialog {
  width: min(720px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
}

.document-client-source-modal {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.document-client-source-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.document-client-source-fields label,
.document-client-source-fields input {
  min-width: 0;
  width: 100%;
}

.document-client-source-modal header > div {
  min-width: 0;
}

.document-client-source-modal header p {
  overflow-wrap: anywhere;
}

.document-client-source-modal footer {
  flex-wrap: wrap;
}

.document-field-candidates {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.document-field-candidates button {
  display: flex;
  width: 100%;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
}

.document-field-candidates small {
  display: block;
  color: #64748b;
}

.document-field-row blockquote {
  margin: 8px 0;
  padding: 10px;
  border-left: 3px solid #0891b2;
  background: #f8fafc;
}

.document-field-provenance {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 5px;
  color: #60758a;
  font-size: .8rem;
}

.document-field-provenance > span {
  flex: 0 0 auto;
  font-weight: 700;
}

.document-field-provenance > div {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.document-source-reference {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #087a9b;
  font: inherit;
  text-align: left;
  text-decoration: underline;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.document-source-reference:disabled {
  color: #718096;
  text-decoration: none;
  cursor: default;
}

.document-field-source-details {
  margin-top: 5px;
  color: #52667a;
  font-size: .82rem;
}

.document-source-review-dialog {
  width: 95vw;
  max-width: 95vw;
  height: 95vh;
  max-height: 95vh;
  margin: auto;
  overflow: hidden;
}

.document-source-review-modal {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  box-sizing: border-box;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  overflow: hidden;
}

.document-source-review-modal > header {
  min-height: 0;
  padding-bottom: 8px;
}

.document-source-review-modal > header h2 {
  margin: 0;
}

.document-source-review-layout {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 10px;
}

.document-source-review-layout > aside {
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto 1fr;
  gap: 8px;
}

.document-source-review-layout > aside .registry-search,
.document-source-review-list {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.document-source-review-list {
  min-height: 0;
  overflow: auto;
  border: 1px solid #dbe4ec;
}

.document-source-review-list section > h3 {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0;
  padding: 8px 10px;
  border-bottom: 1px solid #dbe4ec;
  background: #edf5f8;
  font-size: .84rem;
  overflow-wrap: anywhere;
}

.document-source-review-item {
  display: grid;
  width: 100%;
  gap: 2px;
  padding: 9px 10px;
  border: 0;
  border-bottom: 1px solid #e6edf2;
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.document-source-review-item:hover,
.document-source-review-item.is-active {
  background: #eaf8fb;
}

.document-source-review-item strong,
.document-source-review-item small {
  overflow-wrap: anywhere;
}

.document-source-review-item small {
  color: #64748b;
}

.document-source-preview {
  display: grid;
  min-height: 0;
  overflow: hidden;
  grid-template-rows: auto 1fr;
  border: 1px solid #dbe4ec;
  background: #f8fafc;
}

.document-source-preview > header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid #dbe4ec;
  background: #fff;
}

.document-source-preview > header > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.document-source-preview > header strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-source-preview > header span {
  color: #64748b;
  font-size: .82rem;
}

.document-source-preview iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.document-source-preview-empty {
  place-self: center;
  padding: 24px;
  color: #64748b;
  text-align: center;
}

.document-field-retry .secondary-action {
  min-height: 34px;
  padding: 6px 12px;
}

.document-source-picker {
  min-width: 0;
  padding: 12px;
  border: 1px solid #dbe4ec;
}

.document-source-picker legend {
  font-weight: 700;
}

.document-source-option {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 8px 0;
  border-top: 1px solid #edf2f6;
}

.document-source-option span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.document-source-option strong,
.document-source-option small {
  overflow-wrap: anywhere;
}

.document-source-option small {
  color: #66798b;
}

.document-source-selected,
.document-source-group {
  margin-top: 12px;
}

.document-source-selected {
  padding: 10px;
  border: 1px solid #8bd3e2;
  background: #f0fbfd;
}

.document-source-selected h3,
.document-source-group h3 {
  margin: 0;
  font-size: .9rem;
}

.document-source-groups {
  max-height: 380px;
  overflow: auto;
  overflow-x: hidden;
}

.document-generation-row {
  color: inherit;
  text-decoration: none;
}

@media (max-width: 980px) {
  .document-generation-layout,
  .document-field-grid,
  .document-template-editor__meta,
  .document-template-editor__policy {
    grid-template-columns: 1fr;
  }

  .document-source-review-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(180px, 35%) minmax(300px, 1fr);
  }

  .document-generation-side {
    position: static;
  }

  .document-template-row {
    grid-template-columns: 1fr;
  }

  .document-template-dialog {
    width: calc(100vw - 1rem);
    max-height: calc(100vh - 1rem);
  }

  .document-template-editor {
    max-height: calc(100vh - 1rem);
    padding: 1rem;
  }
}

@media (max-width: 640px) {
  .document-client-source-dialog {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
  }

  .document-client-source-fields {
    grid-template-columns: 1fr;
  }

  .document-client-source-modal footer {
    justify-content: stretch;
  }

  .document-client-source-modal footer button {
    flex: 1 1 100%;
  }

  .matter-hero h1 {
    font-size: 1.2rem;
    line-height: 1.25;
  }
}

.agent-analysis__mobile-settings {
  min-width: 0;
  flex: 1 1 auto;
}

.agent-analysis__mobile-settings > summary {
  display: none;
}

@media (max-width: 900px) {
  body.agent-analysis-page {
    min-width: 0;
  }

  .agent-analysis-page .agent-analysis {
    width: calc(100% - 16px);
    margin: 10px auto 16px;
  }

  .agent-analysis-page .agent-analysis__header {
    gap: 8px;
    margin-bottom: 10px;
  }

  .agent-analysis-page .agent-analysis__header h1 {
    margin: 2px 0;
    font-size: 1.45rem;
    line-height: 1.15;
    overflow-wrap: anywhere;
  }

  .agent-analysis-page .agent-analysis__header p {
    font-size: 0.82rem;
    line-height: 1.4;
  }

  .agent-analysis-page .agent-analysis__workspace,
  .agent-analysis-page .agent-analysis__workspace.is-sessions-collapsed {
    gap: 8px;
    grid-template-columns: minmax(0, 1fr);
  }

  .agent-analysis-page .agent-analysis__sessions-body {
    max-height: min(38dvh, 320px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .agent-analysis-page .agent-analysis__workspace.is-sessions-collapsed .agent-analysis__sessions {
    display: block;
  }

  .agent-analysis-page .agent-analysis__workspace.is-sessions-collapsed .agent-analysis__sessions > header {
    justify-content: space-between;
    padding: 11px 14px;
  }

  .agent-analysis-page .agent-analysis__workspace.is-sessions-collapsed .agent-analysis__sessions > header > div {
    display: block;
  }

  .agent-analysis-page .agent-analysis__workspace.is-sessions-collapsed .agent-analysis__sessions-body {
    display: none;
  }

  .agent-analysis-page .agent-analysis__conversation {
    height: calc(100dvh - 16px);
    min-height: 600px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .agent-analysis-page .agent-analysis__conversation > header,
  .agent-analysis-page .agent-analysis__messages,
  .agent-analysis-page .agent-analysis__composer {
    width: 100%;
    min-width: 0;
  }

  .agent-analysis-page .agent-analysis__messages {
    gap: 14px;
    padding: 16px 14px;
    font-size: 0.9rem;
  }

  .agent-analysis-page .agent-analysis__message-content {
    line-height: 1.55;
  }
}

@media (max-width: 760px) {
  .topbar--v2 {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 6px 8px;
    padding: 8px;
  }

  .topbar-start {
    grid-column: 1;
    grid-row: 1;
    width: auto;
  }

  .topbar-search-wrap {
    display: none;
  }

  .topbar-actions--v2 {
    grid-column: 2;
    grid-row: 1;
    width: auto;
    min-width: 0;
    justify-content: flex-end;
    flex-wrap: nowrap;
    overflow: visible;
  }

  .topbar-actions--v2 > * {
    flex: 0 0 auto;
  }

  .topbar-actions--v2 .work-timer {
    width: auto;
    flex-wrap: nowrap;
  }

  .topbar-actions--v2 .profile-chip__name {
    display: none;
  }

  .topbar-mobile-search {
    display: inline-grid;
    width: 34px;
    height: 34px;
    border-radius: 9px;
  }
}

@media (min-width: 761px) and (max-width: 1024px) {
  .topbar--v2 {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: auto;
    padding: 8px;
  }

  .topbar-start {
    grid-column: 1;
    grid-row: 1;
    width: auto;
  }

  .topbar-search-wrap {
    grid-column: 1 / -1;
    grid-row: 2;
    order: initial;
    width: 100%;
    max-width: none;
  }

  .topbar-actions--v2 {
    grid-column: 2;
    grid-row: 1;
    width: auto;
    min-width: 0;
    margin-left: 0;
    flex-wrap: nowrap;
    overflow: visible;
  }

  .topbar-actions--v2 > * {
    flex: 0 0 auto;
  }

}

@media (max-width: 420px) {
  .topbar-actions--v2 {
    gap: 5px;
  }

  .topbar-actions--v2 .work-timer {
    padding: 1px;
  }

  .topbar-actions--v2 .work-timer output {
    min-width: 58px;
    min-height: 30px;
    padding-inline: 3px;
    font-size: 0.7rem;
  }

  .topbar-actions--v2 .work-timer button {
    width: 28px;
    min-width: 28px;
    min-height: 30px;
  }

  .topbar-actions--v2 .profile-chip {
    min-height: 34px;
    padding-inline: 3px;
  }

  .topbar-actions--v2 .profile-chip__avatar {
    width: 26px;
    height: 26px;
  }
}

@media (max-width: 1024px) {
  .topbar-search {
    min-height: 38px;
    border-radius: 10px;
  }

  .topbar-search-hints {
    display: none;
  }
}

@media (max-width: 900px) {
  .agent-analysis-page .agent-analysis__composer {
    gap: 3px;
    padding: 7px 9px;
  }

  .agent-analysis-page .agent-analysis__synthesis-bar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
    padding-bottom: 6px;
  }

  .agent-analysis-page .agent-analysis__synthesis-bar span {
    margin-right: 0;
    white-space: nowrap;
  }

  .agent-analysis-page .agent-analysis__synthesis-bar select {
    width: 100%;
    min-width: 0;
    padding: 5px 24px 5px 8px;
  }

  .agent-analysis-page .agent-analysis__synthesis-bar button[data-mobile-label] {
    min-width: 0;
    padding-inline: 10px;
    font-size: 0;
  }

  .agent-analysis-page .agent-analysis__synthesis-bar button[data-mobile-label]::after {
    content: attr(data-mobile-label);
    font-size: 0.76rem;
  }

  .agent-analysis-page .agent-analysis__composer > label {
    font-size: 0.66rem;
  }

  .agent-analysis-page .agent-analysis__composer textarea {
    height: 40px;
    min-height: 40px;
    max-height: 120px;
    padding: 8px 9px;
    resize: none;
    transition: height 140ms ease, min-height 140ms ease;
  }

  .agent-analysis-page .agent-analysis__composer textarea:focus,
  .agent-analysis-page .agent-analysis__composer textarea:not(:placeholder-shown) {
    height: 88px;
    min-height: 88px;
    resize: vertical;
  }

  .agent-analysis-page .agent-analysis__composer footer {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  .agent-analysis-page .agent-analysis__mobile-settings {
    flex: 1 1 auto;
  }

  .agent-analysis-page .agent-analysis__mobile-settings[open] {
    flex-basis: 100%;
  }

  .agent-analysis-page .agent-analysis__mobile-settings > summary {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 5px 9px;
    color: var(--brand-dark);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
    list-style: none;
  }

  .agent-analysis-page .agent-analysis__mobile-settings > summary::-webkit-details-marker {
    display: none;
  }

  .agent-analysis-page .agent-analysis__mobile-settings > summary::before {
    content: "+";
    font-size: 1rem;
  }

  .agent-analysis-page .agent-analysis__mobile-settings[open] > summary::before {
    content: "−";
  }

  .agent-analysis-page .agent-analysis__mobile-settings .agent-analysis__composer-meta {
    margin-top: 8px;
  }

  .agent-analysis-page .agent-analysis__commands {
    width: auto;
    flex: 0 0 auto;
    margin-left: auto;
  }

  .agent-analysis-page .agent-analysis__composer button {
    width: auto;
    min-width: 80px;
    min-height: 34px;
  }

  .agent-analysis-page .agent-analysis__turn-options {
    gap: 8px;
  }

  .agent-analysis-page .agent-analysis__usage-panel {
    margin-top: 0;
    padding-top: 4px;
  }

  .agent-analysis-page .agent-analysis__usage-panel > summary {
    gap: 6px;
    font-size: 0.68rem;
  }

  .agent-analysis-page .app-footer {
    min-height: 22px;
    padding: 3px 8px 5px;
    font-size: 0.62rem;
    line-height: 1.2;
  }
}

@media (max-width: 560px) {
  .agent-analysis-page .agent-analysis__conversation > header {
    position: relative;
    gap: 6px;
    padding: 9px 10px;
  }

  .agent-analysis-page .agent-analysis__conversation > header > div:first-child {
    min-width: 0;
    padding-right: 76px;
  }

  .agent-analysis-page .agent-analysis__conversation-tools {
    width: 100%;
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 5px;
    overflow: visible;
  }

  .agent-analysis-page .agent-analysis__conversation-tools button,
  .agent-analysis-page .agent-analysis__detach {
    width: auto;
    min-width: 0;
    flex: 0 0 auto;
    padding-inline: 9px;
  }

  .agent-analysis-page .agent-analysis__conversation-tools [data-mobile-label] {
    font-size: 0;
  }

  .agent-analysis-page .agent-analysis__conversation-tools [data-mobile-label]::after {
    content: attr(data-mobile-label);
    font-size: 0.76rem;
  }

  .agent-analysis-page .agent-analysis__conversation-tools .agent-analysis__status {
    position: absolute;
    top: 9px;
    right: 10px;
    padding: 4px 8px;
  }

  .agent-analysis-page .agent-analysis__message-actions {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 7px;
  }

  .agent-analysis-page .agent-analysis__message-actions button,
  .agent-analysis-page .agent-analysis__message-actions label {
    width: auto;
    flex: 0 0 auto;
  }

  .agent-analysis-page .agent-analysis__citation {
    padding: 8px 9px;
  }

  .agent-analysis-page .agent-analysis__citation-content {
    padding-left: 0;
  }
}
/* Result dispatch uses the existing work surface, without nested cards. */
.dispatch-page { max-width: 1100px; }
.dispatch-page > section, .dispatch-form { padding: 16px 0; border-bottom: 1px solid #d5dce1; }
.dispatch-page h2, .task-waiting-queue h2 { font-size: 1.2rem; margin: 0 0 12px; }
.dispatch-page h3, .task-waiting-queue h3 { font-size: 1rem; margin: 16px 0 8px; }
.dispatch-page form, .dispatch-page label { min-width: 0; }
.dispatch-page .dispatch-event-form { display: grid; gap: 10px; margin-top: 16px; }
.dispatch-page .dispatch-event-form label { display: grid; gap: 4px; }
.dispatch-page button, .dispatch-page .primary-action { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.dispatch-page details { padding: 12px 0; border-top: 1px solid #d5dce1; }
.dispatch-page summary { cursor: pointer; font-weight: 600; }
.dispatch-page p, .dispatch-page small, .dispatch-page dd, .dispatch-page li, .task-waiting-row > * { overflow-wrap: anywhere; min-width: 0; }
.dispatch-page small, .dispatch-history-event small { display: block; }
.dispatch-current { display: grid; gap: 12px; }
.dispatch-current > .primary-action { justify-self: start; }
.dispatch-current > p { margin: 0; }
.dispatch-page button:not(.primary-action) { min-height: 34px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); cursor: pointer; }
.dispatch-history-event { padding: 10px 0; }
.task-waiting-queue { margin-bottom: 24px; }
.task-waiting-row { display: grid; grid-template-columns: 2fr 1fr 1.5fr 1.5fr; gap: 8px; padding: 9px 0; border-bottom: 1px solid #d5dce1; align-items: start; color: inherit; }
.task-urgent-form { border-left: 3px solid #b35c20; padding-left: 12px; }
@media (max-width: 640px) {
    .dispatch-page .form-grid, .task-waiting-row { grid-template-columns: minmax(0, 1fr); }
    .dispatch-page .span-2 { grid-column: auto; }
    .dispatch-page .button-row { flex-wrap: wrap; }
}

.billing-agreements { display: grid; gap: 14px; padding: 0 0 18px; border-bottom: 1px solid var(--line); }
.billing-agreements, .agreement-row, .billing-preview, .billing-preview__lines { min-width: 0; max-width: 100%; }
.billing-agreements__header { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.billing-agreements__header p, .billing-agreements__header h2 { margin: 0; }
.billing-agreements__header h2 { font-size: 1.18rem; }
.billing-agreements__header span { display: block; margin-top: 4px; color: var(--text-muted); }
.agreement-row { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(240px, 2fr) auto; gap: 10px 16px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); }
.agreement-row__identity, .agreement-row__versions { display: grid; gap: 3px; min-width: 0; }
.agreement-row__identity span, .agreement-row__identity small, .agreement-row__versions span { overflow-wrap: anywhere; }
.agreement-row__versions span, .agreement-row__identity small { color: var(--text-muted); font-size: .82rem; }
.agreement-preview-form, .agreement-condition-form { grid-column: 1 / -1; display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.agreement-preview-form label, .agreement-condition-form label { display: grid; gap: 4px; min-width: 0; font-size: .85rem; }
.agreement-preview-form label { flex: 1 1 150px; max-width: 300px; }
.agreement-preview-form label:first-child { flex: 2 1 260px; }
.agreement-condition-form label { flex: 1 1 320px; }
.billing-agreements input:not([type="hidden"]), .billing-agreements select { box-sizing: border-box; width: 100%; min-width: 0; min-height: 38px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface, #fff); color: var(--text); font: inherit; }
.billing-agreements button:not(.primary-action) { box-sizing: border-box; min-height: 38px; max-width: 100%; padding: 7px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface, #fff); color: var(--text); font: inherit; font-weight: 600; white-space: normal; overflow-wrap: anywhere; cursor: pointer; }
.billing-agreements :is(input, select, button):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.billing-agreements button:disabled { opacity: .55; cursor: not-allowed; }
.agreement-row > .inline-form { justify-self: start; }
.billing-preview { display: grid; gap: 12px; padding: 14px 0; border-top: 2px solid var(--accent); }
.billing-preview > header { display: flex; justify-content: space-between; gap: 12px; }
.billing-preview > header div { display: grid; gap: 3px; }
.billing-preview__totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 18px; }
.billing-preview__totals span { display: grid; gap: 2px; color: var(--text-muted); }
.billing-preview__totals strong { color: var(--text); overflow-wrap: anywhere; }
.billing-preview__decisions { margin: 0; padding-left: 20px; color: var(--warning-text, #7a3e00); }
.billing-preview__lines { display: grid; overflow-x: auto; }
.billing-preview__lines > div { display: grid; grid-template-columns: minmax(180px, 2fr) minmax(120px, 1fr) 75px repeat(3, 90px); gap: 8px; min-width: 760px; padding: 8px 0; border-top: 1px solid var(--line); }
.billing-preview__lines small { grid-column: 1 / -1; color: var(--text-muted); }
.agreement-rate-rules { display: grid; gap: 8px; min-width: 0; }
.agreement-rate-rules [data-agreement-rate-row] { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr 1fr 1fr auto; gap: 7px; }
.agreement-rate-rules input, .agreement-rate-rules select { min-width: 0; }
.billing-agreements, .agreement-wizard { --agreement-font-body: 14px; --agreement-font-help: 13px; font-size: var(--agreement-font-body); line-height: 1.5; }
.client-detail-page :is(.client-section-menu a, .client-section-menu > strong, .page-actions button, .page-actions a) { font-size: 14px; }
.billing-agreements :is(.agreement-row__identity small, .agreement-row__versions small, .agreement-row > small) { font-size: var(--agreement-font-help); }
.billing-agreements .billing-agreements__header h2 { font-size: 20px; }
.modal.agreement-wizard { width: min(1320px, calc(100vw - 32px)); max-width: none; overflow: hidden; }
.agreement-wizard .agreement-wizard__card { box-sizing: border-box; display: flex; flex-direction: column; width: 100%; max-height: calc(100dvh - 32px); padding: 0; gap: 0; overflow: hidden; }
.agreement-wizard .agreement-wizard__card button { box-sizing: border-box; min-height: 38px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface, #fff); color: var(--text); font: inherit; font-size: var(--agreement-font-body); font-weight: 600; cursor: pointer; }
.agreement-wizard .agreement-wizard__card button.primary-action { background: var(--brand, #0891b2); border-color: var(--brand, #0891b2); color: #fff; }
.agreement-wizard .agreement-wizard__card button:hover { border-color: var(--brand, #0891b2); }
.agreement-wizard .agreement-wizard__card > header button { width: 32px; min-height: 32px; height: 32px; padding: 5px; }
.agreement-wizard .agreement-wizard__card > header { flex: 0 0 auto; padding: 20px 24px; margin: 0; border-bottom: 1px solid var(--line); align-items: center; }
.agreement-wizard .agreement-wizard__card > header h2 { font-size: 20px; line-height: 1.4; }
.agreement-wizard .agreement-wizard__card > header p { font-size: 12px; font-weight: 600; letter-spacing: 0; }
.agreement-wizard .billing-agreement-form { display: flex; flex-direction: column; min-height: 0; gap: 0; margin: 0; }
.agreement-wizard__layout { display: grid; grid-template-columns: 220px minmax(0,1fr); min-height: 0; }
.agreement-wizard__nav { padding: 20px 12px; border-right: 1px solid var(--line); background: var(--surface-muted, #f5f8fa); }
.agreement-wizard__nav ol { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.agreement-wizard .agreement-wizard__nav button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 8px; border: 1px solid transparent; background: transparent; color: var(--text); text-align: left; }
.agreement-wizard__nav b { display: grid; place-items: center; flex: 0 0 24px; height: 24px; border: 1px solid var(--line); border-radius: 4px; font-size: .8rem; }
.agreement-wizard .agreement-wizard__nav button[aria-current="step"] { background: var(--surface, #fff); border-color: var(--brand, #0891b2); color: var(--brand, #08738b); }
.agreement-wizard__body { min-width: 0; min-height: 0; height: min(620px, calc(100dvh - 230px)); overflow-y: auto; padding: 24px; scrollbar-gutter: stable; }
.agreement-wizard [hidden] { display: none !important; }
.agreement-wizard h3 { margin: 0 0 20px; font-size: 18px; color: var(--text); }
.agreement-wizard h4 { font-size: .95rem; margin: 20px 0 8px; }
.agreement-wizard__grid, .agreement-wizard__models, .agreement-wizard__extras { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px 22px; }
.agreement-wizard label, .agreement-wizard__field { display: grid; align-content: start; gap: 6px; min-width: 0; margin: 0; font-size: var(--agreement-font-body); font-weight: 600; color: var(--text); }
.agreement-wizard label > span { color: var(--text); }
.agreement-wizard :is(small, .agreement-wizard__group > p) { display: block; margin: 0; color: var(--text-muted, #536575); font-size: var(--agreement-font-help); line-height: 1.5; font-weight: 400; overflow-wrap: anywhere; }
.agreement-wizard small { margin-top: 2px; }
.agreement-wizard .agreement-wizard__body p { font-size: var(--agreement-font-help); line-height: 1.5; font-weight: 400; text-transform: none; letter-spacing: 0; }
.agreement-wizard em { color: #b42318; font-style: normal; }
.agreement-wizard :is(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),select) { box-sizing: border-box; display: block; width: 100%; min-width: 0; min-height: 40px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface, #fff); color: var(--text); font: inherit; font-weight: 400; }
.agreement-wizard input[readonly] { background: var(--surface-muted, #f5f8fa); }
.agreement-wizard [aria-invalid="true"] { border-color: #b42318 !important; }
.agreement-wizard :is(input,select,button):focus-visible { outline: 2px solid var(--brand, #0891b2); outline-offset: 2px; }
.agreement-wizard .agreement-wizard__choice { display: flex; align-items: flex-start; gap: 10px; font-weight: 600; cursor: pointer; }
.agreement-wizard .agreement-wizard__choice :is(input[type="checkbox"],input[type="radio"]) { appearance: auto; width: 17px; height: 17px; min-width: 17px; min-height: 17px; flex: 0 0 17px; padding: 0; margin: 2px 0 0; accent-color: var(--brand, #0891b2); }
.agreement-wizard__choice > span { min-width: 0; }
.agreement-wizard__models > label { padding: 14px; border: 1px solid var(--line); border-radius: 6px; }
.agreement-wizard__models > label:has(input:checked) { border-color: var(--brand, #0891b2); background: var(--surface-muted, #f5f8fa); }
.agreement-wizard .agreement-wizard__group { min-width: 0; border: 0; border-top: 1px solid var(--line); padding: 20px 0 0; margin: 22px 0 0; }
.agreement-wizard__group legend { padding: 0 8px 0 0; font-size: 16px; font-weight: 600; }
.agreement-wizard__group > .agreement-wizard__choice { margin: 12px 0; }
.agreement-wizard__group > label[data-agreement-scope-matters] { margin-top: 16px; }
.agreement-wizard__full { grid-column: 1 / -1; }
.agreement-wizard .agreement-rate-rules [data-agreement-rate-row] { grid-template-columns: var(--agreement-rate-columns); align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line); gap: 10px; }
.agreement-wizard [data-agreement-rate-row] button { margin-top: 24px; width: 32px; height: 40px; padding: 6px; }
.agreement-wizard button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.agreement-wizard [data-add-agreement-rate] { justify-self: start; }
.agreement-wizard__checklist { min-width: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface, #fff); }
.agreement-wizard__checklist-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.agreement-wizard .agreement-wizard__checklist-head input { min-height: 32px; max-width: 320px; padding: 6px 8px; }
.agreement-wizard__checklist-head small { margin: 0; white-space: nowrap; }
.agreement-wizard__checklist-options { display: grid; max-height: 240px; overflow-y: auto; padding: 6px; gap: 2px; }
.agreement-wizard__field:has(select[name="CoveredServiceKeys"]) .agreement-wizard__checklist-options { grid-template-columns: repeat(2,minmax(0,1fr)); }
.agreement-wizard .agreement-wizard__checklist-options label { padding: 7px 8px; border-radius: 4px; font-weight: 400; }
.agreement-wizard__checklist-options label:has(input:checked) { background: var(--surface-muted, #f0f7fa); }
.agreement-wizard__checklist-error { color: #b42318; padding: 0 12px 8px; font-size: .8rem; font-weight: 400; }
.agreement-wizard__extras { gap: 26px; }
.agreement-wizard__extras .agreement-wizard__group { margin: 0; }
.agreement-wizard__extras [data-agreement-extra-fields] { margin-top: 16px; }
.agreement-wizard .agreement-wizard__footer { flex: 0 0 auto; align-items: center; justify-content: flex-end; flex-wrap: wrap; padding: 16px 24px; margin: 0; border-top: 1px solid var(--line); background: var(--surface, #fff); }
.agreement-wizard__footer > button:first-child { margin-right: auto; }
.agreement-wizard__footer > span { margin-right: 12px; font-size: var(--agreement-font-help); color: var(--text-muted); }
.agreement-wizard__notice { padding: 12px 0; border-top: 1px solid var(--line); color: var(--text-muted); font-size: .85rem; }
.agreement-config-summary { grid-column: 1 / -1; padding: 8px 0; }
.agreement-config-summary > summary { font-weight: 600; cursor: pointer; }
.agreement-terms-summary, .agreement-terms-summary dl { display: grid; gap: 0; margin: 8px 0; }
:is(.agreement-terms-summary, .agreement-terms-summary dl) > div { display: grid; grid-template-columns: minmax(140px, .6fr) minmax(0, 1.4fr); gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.agreement-terms-summary dt { color: var(--text-muted); font-size: var(--agreement-font-body, 14px); }
.agreement-terms-summary dd { margin: 0; font-size: var(--agreement-font-body, 14px); overflow-wrap: anywhere; }
.agreement-terms-summary dd p { margin: 0 0 5px; }
@media (max-width: 1100px) {
    .agreement-wizard .agreement-rate-rules [data-agreement-rate-row] { grid-template-columns: repeat(3,minmax(0,1fr)); }
    .agreement-wizard__layout { grid-template-columns: 190px minmax(0,1fr); }
    .agreement-wizard [data-agreement-rate-row] button { margin-top: 24px; }
}
@media (max-width: 760px) {
    .modal.agreement-wizard { width: calc(100vw - 16px); }
    .agreement-wizard .agreement-wizard__card { max-height: calc(100dvh - 16px); }
    .agreement-wizard__layout { grid-template-columns: minmax(0,1fr); }
    .agreement-wizard__nav { padding: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
    .agreement-wizard__nav ol { grid-template-columns: repeat(5,minmax(0,1fr)); gap: 3px; }
    .agreement-wizard .agreement-wizard__nav button { flex-direction: column; gap: 4px; padding: 5px 2px; font-size: .7rem; text-align: center; height: 100%; }
    .agreement-wizard__nav b { flex-basis: auto; width: 24px; }
    .agreement-wizard__body { height: calc(100dvh - 300px); padding: 16px; }
    .agreement-wizard__grid, .agreement-wizard__models, .agreement-wizard__extras { grid-template-columns: minmax(0,1fr); gap: 16px; }
    .agreement-wizard__field:has(select[name="CoveredServiceKeys"]) .agreement-wizard__checklist-options { grid-template-columns: minmax(0,1fr); }
    .agreement-wizard .agreement-rate-rules [data-agreement-rate-row] { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .agreement-wizard .agreement-wizard__card > header, .agreement-wizard .agreement-wizard__footer { padding: 12px 16px; }
    .agreement-wizard__footer > span { display: none; }
    :is(.agreement-terms-summary, .agreement-terms-summary dl) > div { grid-template-columns: minmax(0,1fr); gap: 4px; }
}
@media (max-width: 800px) {
    .billing-agreements__header, .billing-preview > header { align-items: stretch; flex-direction: column; }
    .agreement-row, .billing-preview__totals, .agreement-rate-rules [data-agreement-rate-row] { grid-template-columns: minmax(0, 1fr); }
    .agreement-preview-form label, .agreement-preview-form label:first-child, .agreement-condition-form label { flex: 1 1 100%; width: 100%; max-width: none; }
}
.billing-settlements { display: grid; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.billing-settlements__header, .settlement-card > header, .settlement-card > footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.billing-settlements__header :is(p,h2), .settlement-card > header :is(strong,span) { margin: 0; }
.billing-settlements__header h2 { font-size: 1.18rem; }
.billing-settlements__header span, .settlement-card > header span { color: var(--text-muted); }
.settlement-prepare { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.settlement-prepare label, .settlement-lines label, .settlement-review-grid label, .settlement-action-form label { display: grid; gap: 4px; min-width: 0; font-size: .84rem; }
.settlement-prepare :is(input:not([type="checkbox"]):not([type="hidden"]),select), .settlement-lines :is(input:not([type="checkbox"]):not([type="hidden"]),select), .settlement-review-grid :is(input,textarea), .settlement-action-form input { box-sizing: border-box; width: 100%; min-width: 0; min-height: 38px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface,#fff); color: var(--text); font: inherit; }
.settlement-check { display: flex !important; align-items: center; gap: 8px; }
.settlement-check input[type="checkbox"] { appearance: auto; box-sizing: border-box; width: 16px; height: 16px; min-width: 16px; min-height: 16px; flex: 0 0 16px; margin: 0; padding: 0; accent-color: var(--brand); }
.settlement-expenses { display: grid; gap: 8px; min-width: 0; border: 1px solid var(--line); border-radius: 6px; }
.settlement-expenses article { display: grid; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.settlement-expenses article:first-of-type { border-top: 0; }
.settlement-expenses article > div { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px; }
.settlement-expenses .is-disabled { opacity: .55; }
.settlement-card { display: grid; gap: 12px; min-width: 0; padding: 14px 0; border-top: 2px solid var(--accent); }
.settlement-card > header > div { display: grid; gap: 3px; min-width: 0; }
.settlement-owners { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.settlement-owners span { display: grid; gap: 2px; color: var(--text-muted); }
.settlement-issues, .settlement-line__issue { margin: 0; color: var(--warning-text,#7a3e00); }
.settlement-lines { display: grid; gap: 8px; }
.settlement-line { display: grid; grid-template-columns: minmax(0,2fr) minmax(150px,1fr) minmax(120px,.6fr) 80px; gap: 10px 12px; align-items: start; padding: 14px 0; border-top: 1px solid var(--line); }
.settlement-line.has-issue { border-left: 3px solid #b95c00; padding-left: 9px; }
.settlement-line__identity { grid-column: 1 / -1; display: grid; gap: 2px; min-width: 0; }
.settlement-line__description { grid-column: 1 / 3; }
.settlement-line--expense .settlement-line__description { grid-column: 1; }
.settlement-line__classification { grid-column: 2; }
.settlement-line__amount { grid-column: 3; }
.settlement-line__currency { grid-column: 4; }
.settlement-line__reason, .settlement-line__exclude { grid-column: 1 / -1; }
.settlement-form-actions { display: flex; justify-content: flex-end; padding-top: 8px; }
.settlement-line__identity :is(span,small) { color: var(--text-muted); overflow-wrap: anywhere; }
.settlement-line details, .settlement-line__issue { grid-column: 1 / -1; }
.settlement-review-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.settlement-review-grid form { display: grid; align-content: start; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; }
.settlement-action-form { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.settlement-inline-error { grid-column: 1 / -1; padding: 8px 10px; border-left: 3px solid #b42318; background: #fff1f0; color: #8f1711; }
.settlement-audit p { margin: 6px 0; color: var(--text-muted); font-size: .84rem; overflow-wrap: anywhere; }
.settlement-card > footer { justify-content: flex-start; flex-wrap: wrap; }
.settlement-card > footer span { margin-left: auto; font-weight: 600; }
html[data-theme="dark"] .settlement-inline-error { background: #341b1b; color: #ffb4ac; }
.task-blocker {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .32rem;
  min-width: 0;
}

.task-blocker .task-blocker__badge {
  flex: 0 0 auto;
  border: 1px solid #f3b2b9;
  border-radius: 5px;
  padding: .08rem .34rem;
  background: #fff1f2;
  color: #b42318;
  font-size: .72rem;
  font-weight: 800;
  line-height: 1.25;
}

.task-blocker .task-blocker__label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  line-height: 1.35;
}

.task-blocker .task-blocker__description {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.35;
}

html[data-theme="dark"] .task-blocker .task-blocker__badge {
  border-color: #8f3f48;
  background: #351d22;
  color: #ffc7ce;
}
@media (max-width: 800px) {
  .settlement-prepare, .settlement-owners, .settlement-line, .settlement-review-grid, .settlement-expenses article > div { grid-template-columns: minmax(0,1fr); }
  .billing-settlements__header, .settlement-card > header, .settlement-card > footer { align-items: stretch; flex-direction: column; }
  .settlement-card > footer span { margin-left: 0; }
  .settlement-line > label { grid-column: 1 / -1; }
}
.activity-linked-context {
  margin: 0 0 12px;
  border-bottom: 1px solid var(--border-color, #d7dce2);
  padding: 0 0 10px;
}

.activity-linked-context summary {
  cursor: pointer;
  font-weight: 600;
}

.activity-linked-context dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  margin: 10px 0 0;
}

.activity-linked-context dl div,
.activity-cost-row {
  min-width: 0;
}

.activity-linked-context dt {
  color: var(--muted-color, #667085);
  font-size: 0.75rem;
}

.activity-linked-context dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.activity-costs {
  border: 1px solid var(--border-color, #d7dce2);
  padding: 12px;
  margin: 0;
  min-width: 0;
}

.activity-cost-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: end;
  margin-bottom: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.activity-cost-row > button { justify-self: end; }
.activity-costs > button { width: auto; }
.cost-editor-fields { min-width: 0; width: 100%; }
.cost-editor-fields > label { min-width: 0; }

.team-workday-report.activity-day-stats { margin: 20px 0 0; padding: 0; border: 0; }
.workday-query-grid { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 20px; }
.workday-query-grid label { display: grid; gap: 6px; min-width: 180px; }
.workday-summary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 520px)); gap: 16px; }
.workday-summary-grid .activity-day-summary { border: 1px solid var(--line-soft); border-radius: 6px; padding: 16px; margin: 0; background: var(--surface, #fff); }
.workday-summary-heading { display: grid; gap: 5px; }
.team-task-estimates { margin-top: 20px; }
.team-task-estimates table { width: 100%; border-collapse: collapse; }
.team-task-estimates th, .team-task-estimates td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); text-align: left; }
.team-task-estimates th { white-space: nowrap; }
.archived-tasks { display: grid; gap: 12px; }
.archived-tasks > header, .archived-tasks > article { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.archived-tasks > article { border-bottom: 1px solid var(--line-soft); padding: 16px 0; }
.archived-tasks article > div { flex: 1 1 240px; min-width: 0; }
.archived-tasks small { display: block; margin-top: 4px; color: var(--muted); }
.team-task-estimates thead { background: var(--surface-soft, #eef7fa); color: var(--muted, #526b7c); }
.team-task-estimates td:nth-child(2) { min-width: 180px; }
.team-task-estimates td:last-child { min-width: 240px; }
.team-task-estimates td:nth-child(n+4):nth-child(-n+6) { white-space: nowrap; }
.team-task-estimates small { display: block; margin-top: 4px; color: var(--muted-color, #667085); }
.team-workday-report input, .team-workday-report select {
  box-sizing: border-box; width: 100%; min-height: 36px; padding: 7px 10px;
  border: 1px solid var(--line, #d0d9e2); border-radius: 4px;
  background: var(--surface, #fff); color: var(--ink); font: inherit;
}
.team-workday-report .workday-query-grid button { width: auto; }
.schedule-profile-dialog.modal-shell { width: min(860px, calc(100vw - 32px)); max-width: calc(100vw - 32px); box-sizing: border-box; }
.schedule-profile-dialog > form { min-width: 0; }
.schedule-profile-table { overflow-x: auto; margin: 20px 0; }
.schedule-profile-dialog .standard-hours { table-layout: fixed; min-width: 650px; }
.schedule-profile-dialog .standard-hours th, .schedule-profile-dialog .standard-hours td { padding: 8px 6px; }
.schedule-profile-dialog .standard-hours th:nth-child(2) { width: 65px; }
.schedule-profile-dialog input:not([type="checkbox"]):not([type="hidden"]), .schedule-profile-dialog select {
  width: 100%; min-width: 0; min-height: 36px; box-sizing: border-box;
  border: 1px solid var(--line, #d0d9e2); border-radius: 4px; padding: 6px;
  font: inherit; color: var(--ink); background: var(--surface, #fff);
}
.schedule-profile-dialog input[type="checkbox"] { width: 17px; height: 17px; }
.schedule-profile-dialog footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
.schedule-profile-dialog footer button:not(.primary-action) { border: 1px solid var(--line, #d0d9e2); border-radius: 4px; padding: 8px 14px; color: var(--ink); background: var(--surface, #fff); font: inherit; }

@media (max-width: 760px) {
  .activity-linked-context dl,
  .activity-cost-row {
    grid-template-columns: 1fr;
  }
}
/* PISP context composition matrix in context definitions. */
.pisp-context-rules { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.pisp-context-rules p { max-width: 75rem; color: var(--muted); font-size: .85rem; line-height: 1.5; }
.pisp-context-matrix-scroll { max-width: 100%; overflow-x: auto; }
.pisp-context-matrix { border-collapse: collapse; font-size: .85rem; }
.pisp-context-matrix caption { padding: .5rem; text-align: left; font-weight: 600; }
.pisp-context-matrix th, .pisp-context-matrix td { padding: .6rem; border: 1px solid var(--line); text-align: center; }
.pisp-context-matrix th { background: var(--surface); font-weight: 600; }
.pisp-context-matrix select { min-width: 8rem; padding: .5rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; font: inherit; }
