:root {
  color-scheme: light;
  --ink: #080808;
  --muted: #5f5f5f;
  --soft: #8b8b8b;
  --line: rgba(0, 0, 0, 0.14);
  --line-soft: rgba(0, 0, 0, 0.08);
  --panel: rgba(255, 255, 255, 0.78);
  --white: #ffffff;
  --brand: #12355b;
  --brand-hover: #0c2745;
  --brand-soft: #dce8f4;
  --brand-line: #9bb5cf;
  --success: #1d6541;
  --success-soft: #dcebe3;
  --warning: #9a6a14;
  --warning-soft: #f3ead6;
  --danger: #8f1d1d;
  --danger-soft: #f1dddd;
  --info: #335c67;
  --info-soft: #dde8ea;
  --bg: #f7f7f6;
  --surface: var(--panel);
  --surface-muted: rgba(220, 232, 244, 0.62);
  --text: var(--ink);
  --accent: var(--brand);
  --accent-strong: var(--brand-hover);
  font-family: "Geist", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@font-face {
  font-family: "Geist";
  src: url("/assets/fonts/Geist-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist";
  src: url("/assets/fonts/Geist-Medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist";
  src: url("/assets/fonts/Geist-SemiBold.otf") format("opentype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Tiempos Fine";
  src: url("/assets/fonts/TiemposFine-Light.otf") format("opentype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(220, 232, 244, 0.34) 0%, rgba(247, 247, 246, 0) 240px),
    var(--bg);
  color: var(--text);
  font-weight: 400;
  font-synthesis-weight: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: var(--white);
  padding: 0 14px;
  cursor: pointer;
  font-weight: 500;
  box-shadow: 0 10px 24px rgba(18, 53, 91, 0.14);
}

button:hover {
  background: var(--accent-strong);
}

button.secondary-action,
.button-link {
  display: inline-grid;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 0 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  text-decoration: none;
}

button.session-pill {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  padding: 8px 12px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: none;
}

button.session-pill:hover {
  background: var(--brand-soft);
  color: var(--brand);
}

button.secondary-action:hover,
.button-link:hover {
  background: var(--brand-soft);
  color: var(--brand);
}

button.danger-action {
  border-color: rgba(143, 29, 29, 0.28);
  background: var(--danger-soft);
  color: var(--danger);
  box-shadow: none;
}

button.danger-action:hover {
  background: #ead0d0;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--brand-line);
  outline-offset: 2px;
}

input,
select,
textarea {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  padding: 0 10px;
  font-weight: 400;
}

textarea {
  min-height: 74px;
  padding: 10px;
  resize: vertical;
}

label span,
.select-label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
}

.auth-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  padding: 24px;
  box-shadow:
    inset 3px 0 0 var(--brand),
    0 18px 48px rgba(8, 8, 8, 0.1);
}

.auth-wordmark {
  width: 164px;
  height: auto;
}

.auth-panel h1 {
  margin-bottom: 0;
  font-size: 1.35rem;
  line-height: 1.2;
  font-weight: 500;
}

.auth-copy {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.auth-primary,
.auth-secondary {
  display: inline-grid;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--brand);
  border-radius: 6px;
  padding: 0 16px;
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
}

.auth-primary {
  background: var(--brand);
  color: var(--white);
  box-shadow: 0 10px 24px rgba(18, 53, 91, 0.14);
}

.auth-primary:hover {
  background: var(--brand-hover);
}

.auth-secondary {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

.auth-secondary:hover {
  background: var(--brand-soft);
  color: var(--brand);
}

.auth-note {
  margin: 0;
  color: var(--soft);
  font-size: 0.85rem;
}

.auth-note:empty {
  display: none;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  padding: 24px 18px;
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  margin-bottom: 28px;
}

.brand-wordmark {
  display: block;
  width: 172px;
  max-width: 100%;
  height: auto;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 400;
  text-align: left;
  box-shadow: none;
}

.nav-item:hover,
.nav-item.active {
  background: var(--surface-muted);
  color: var(--brand);
}

.nav-item.active {
  border-color: var(--brand-line);
  font-weight: 500;
}

.main-panel {
  position: relative;
  padding: 30px;
}

.topbar,
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.section-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.topbar {
  margin-bottom: 28px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.workspace-switcher-trigger {
  min-height: 34px;
  max-width: min(440px, calc(100vw - 420px));
  justify-content: flex-start;
  gap: 8px;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 5px 9px;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.workspace-switcher-trigger:hover,
.workspace-switcher-trigger[aria-expanded="true"] {
  border-color: var(--brand-line);
  background: var(--brand-soft);
  color: var(--brand);
}

.workspace-switcher-trigger.empty {
  color: var(--muted);
}

#workspace-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(0.92rem, 1.4vw, 1.08rem);
  font-weight: 500;
}

.workspace-popover {
  position: absolute;
  top: 78px;
  left: 30px;
  z-index: 24;
  display: grid;
  gap: 12px;
  width: min(460px, calc(100vw - 60px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.995);
  padding: 14px;
  box-shadow:
    inset 3px 0 0 var(--brand),
    0 24px 70px rgba(8, 8, 8, 0.22);
}

.workspace-settings-popover {
  position: fixed;
  top: 24px;
  right: 30px;
  z-index: 30;
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  overflow: auto;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.995);
  padding: 14px;
  box-shadow:
    inset 3px 0 0 var(--brand),
    0 24px 70px rgba(8, 8, 8, 0.24);
}

.workspace-settings-form {
  display: grid;
  gap: 12px;
}

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

.settings-grid small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.76rem;
}

.unit-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
}

.account-section .unit-input input {
  width: 100%;
  height: 38px;
  min-height: 38px;
  border-radius: 6px 0 0 6px;
}

.unit-input > span {
  height: 38px;
  min-height: 38px;
  display: inline-grid;
  align-items: center;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 6px 6px 0;
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
}

.settings-checks {
  display: grid;
  gap: 6px;
  margin-top: 2px;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
  padding: 8px 10px;
  font-size: 0.84rem;
}

.account-section .checkbox-line input {
  appearance: none;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  min-height: 16px;
  display: grid;
  place-items: center;
  margin: 0;
  border: 1px solid var(--brand-line);
  border-radius: 4px;
  background: var(--white);
  padding: 0;
}

.account-section .checkbox-line input::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--brand);
  transform: scale(0);
}

.account-section .checkbox-line input:checked {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.account-section .checkbox-line input:checked::before {
  transform: scale(1);
}

.checkbox-line span {
  display: inline;
  margin-bottom: 0;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 400;
  line-height: 1.3;
  text-transform: none;
}

.workspace-options {
  display: grid;
  gap: 8px;
  max-height: min(320px, 46dvh);
  overflow: auto;
}

.workspace-option-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 6px;
}

.workspace-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-color: var(--line-soft);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 9px 10px;
  text-align: left;
  box-shadow: none;
}

.workspace-option-settings,
button.workspace-option-settings.secondary-action {
  min-height: 0;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  box-shadow: none;
}

.workspace-option.active {
  border-color: var(--brand-line);
  background: var(--brand-soft);
  color: var(--brand);
}

.workspace-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.workspace-option small {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: capitalize;
}

.workspace-create-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 600;
  letter-spacing: 0;
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

strong {
  font-weight: 600;
}

.select-label {
  flex: 1;
  min-width: 220px;
}

.select-label select {
  width: 100%;
}

.inline-form,
.invite-form {
  display: grid;
  align-items: end;
  gap: 12px;
}

.inline-form {
  grid-template-columns: minmax(220px, 320px) auto;
}

.invite-form {
  grid-template-columns: minmax(220px, 1fr) 150px auto;
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 18px;
}

.form-popover {
  position: absolute;
  top: 52px;
  right: 0;
  z-index: 6;
  width: min(720px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0;
  background: rgba(255, 255, 255, 0.995);
  padding: 14px;
  box-shadow:
    inset 3px 0 0 var(--brand),
    0 24px 70px rgba(8, 8, 8, 0.2);
}

#invite-form.form-popover {
  grid-template-columns: minmax(220px, 1fr) 140px;
  align-items: end;
  width: min(560px, 100%);
  border-top: 0;
}

#invite-form .pane-header,
#invite-form .form-actions {
  grid-column: 1 / -1;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric-block,
.empty-surface,
.member-row,
.danger-panel,
.activity-card,
.activity-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow:
    0 18px 40px rgba(8, 8, 8, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.metric-block {
  padding: 16px;
}

.metric-label,
.subtle {
  color: var(--muted);
  font-size: 0.86rem;
}

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

.metric-block strong {
  display: block;
  margin-top: 6px;
  font-weight: 600;
}

.empty-surface {
  padding: 22px;
}

.empty-surface p {
  color: var(--muted);
  max-width: 680px;
  margin-bottom: 0;
}

.member-list {
  display: grid;
  gap: 8px;
}

#view-members {
  position: relative;
}

#people-panel,
#providers-panel,
#documents-panel,
#email-intake-panel,
#activity-panel {
  position: relative;
}

.danger-panel {
  display: grid;
  align-items: start;
  gap: 16px;
  margin-top: 18px;
  padding: 14px;
  border-color: rgba(143, 29, 29, 0.24);
  background: rgba(241, 221, 221, 0.46);
}

.danger-panel p {
  margin-bottom: 0;
  color: var(--muted);
}

.delete-workspace-controls,
.delete-workspace-form {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.delete-workspace-form {
  width: 100%;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
}

.document-policy {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.upload-zone {
  display: grid;
  gap: 6px;
  place-items: center;
  min-height: 130px;
  border: 1px dashed var(--brand-line);
  border-radius: 8px;
  background: rgba(220, 232, 244, 0.44);
  color: var(--brand);
  cursor: pointer;
  margin-bottom: 12px;
  padding: 22px;
  text-align: center;
}

.upload-zone span {
  color: var(--muted);
}

.upload-zone.drag-active {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.document-status {
  min-height: 26px;
  margin-bottom: 12px;
}

.document-list {
  display: grid;
  gap: 8px;
}

#people-list,
#claims-list,
#members-list {
  margin-top: 12px;
}

.profile-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  margin-bottom: 14px;
  padding: 14px;
  box-shadow:
    0 18px 40px rgba(8, 8, 8, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.profile-form.form-popover {
  margin: 0;
  background: rgba(255, 255, 255, 0.995);
  box-shadow:
    inset 3px 0 0 var(--brand),
    0 24px 70px rgba(8, 8, 8, 0.2);
}

#claims-panel {
  position: relative;
}

.claim-create-popover {
  position: absolute;
  top: 52px;
  right: 0;
  z-index: 3;
  width: min(720px, 100%);
  margin: 0;
  background: rgba(255, 255, 255, 0.995);
  box-shadow:
    inset 3px 0 0 var(--brand),
    0 24px 70px rgba(8, 8, 8, 0.22);
}

.profile-form input,
.profile-form select,
.profile-form textarea {
  width: 100%;
}

.account-popover {
  position: fixed;
  top: 24px;
  right: 30px;
  z-index: 30;
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  overflow: auto;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.995);
  padding: 14px;
  box-shadow:
    inset 3px 0 0 var(--brand),
    0 24px 70px rgba(8, 8, 8, 0.24);
}

.account-section {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
  padding: 12px;
}

.account-section input {
  width: 100%;
}

.account-help,
.account-future p {
  margin: 4px 0 0;
}

.account-inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.account-email-list {
  display: grid;
  gap: 8px;
}

.account-email-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  padding: 9px 10px;
}

.account-email-row > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.account-email-row strong,
.account-email-row span {
  overflow-wrap: anywhere;
}

.account-email-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.account-email-row button,
.account-footer button {
  min-height: 30px;
  padding: 0 10px;
}

.account-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.account-footer .document-status {
  margin: 0;
}

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

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-label input {
  width: auto;
  min-height: 0;
}

.checkbox-label span {
  margin-bottom: 0;
}

.readiness-panel {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  margin: 0;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.62);
}

.readiness-summary {
  align-items: center;
  display: flex;
  gap: 10px;
}

.readiness-panel ul {
  color: var(--muted);
  margin: 10px 0 0;
  padding-left: 20px;
}

.modal-open {
  overflow: hidden;
}

.claim-workspace {
  position: fixed;
  top: 14px;
  right: 14px;
  bottom: auto;
  left: 14px;
  z-index: 20;
  height: calc(100vh - 28px);
  height: calc(100dvh - 28px);
  min-height: 0;
  max-height: calc(100vh - 28px);
  max-height: calc(100dvh - 28px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  align-content: stretch;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(247, 247, 246, 0.98);
  box-shadow: 0 28px 90px rgba(8, 8, 8, 0.28);
  overflow: hidden;
  padding: 14px;
}

.claim-workspace.hidden {
  display: none;
}

.claim-workspace-header,
.pane-header,
.claim-header-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.claim-workspace-header h2,
.pane-header h2 {
  margin-bottom: 0;
}

.claim-header-actions {
  justify-content: flex-end;
}

.compact-select {
  min-width: 180px;
}

.claim-workspace-grid {
  grid-row: 3;
  min-height: 0;
  height: 100%;
  align-self: stretch;
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(340px, 1.25fr) minmax(360px, 1fr);
  align-items: stretch;
  gap: 12px;
}

#claim-detail-form {
  position: absolute;
  top: 112px;
  left: 50%;
  z-index: 4;
  width: min(760px, calc(100% - 48px));
  max-height: min(72dvh, 620px);
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.995);
  box-shadow:
    inset 3px 0 0 var(--brand),
    0 24px 70px rgba(8, 8, 8, 0.24);
  transform: translateX(-50%);
}

.claim-output-popover {
  position: absolute;
  top: 112px;
  right: 24px;
  z-index: 4;
  width: min(560px, calc(100% - 48px));
  max-height: min(76dvh, 680px);
  overflow: auto;
  display: grid;
  gap: 10px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.995);
  padding: 12px;
  box-shadow:
    inset 3px 0 0 var(--brand),
    0 24px 70px rgba(8, 8, 8, 0.24);
}

.output-readiness {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
}

.output-warning-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.claim-output-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.claim-output-actions button {
  min-height: 30px;
}

.claim-output-list {
  display: grid;
  gap: 5px;
}

.claim-output-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.74);
  padding: 6px 7px;
}

.claim-output-row .document-main {
  gap: 1px;
}

.claim-output-row strong {
  font-size: 0.86rem;
  font-weight: 600;
}

.claim-output-row .subtle {
  font-size: 0.76rem;
}

.cover-draft-block {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  padding: 8px;
}

.cover-draft-block textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  font: 0.8rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.claim-doc-pane,
.claim-preview-pane,
.claim-lines-pane {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  display: grid;
  gap: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.claim-doc-pane {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.claim-preview-pane {
  position: relative;
  grid-template-rows: auto minmax(0, 1fr);
}

.claim-preview-pane.link-picker-open {
  grid-template-rows: auto minmax(0, 1fr);
}

.claim-lines-pane {
  grid-template-rows: minmax(0, 1fr);
}

.claim-doc-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.claim-workspace label span,
.claim-workspace .select-label span {
  margin-bottom: 3px;
  font-size: 0.68rem;
}

.claim-workspace input,
.claim-workspace select {
  min-height: 30px;
  padding: 0 8px;
}

.claim-workspace button {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 6px;
}

.claim-workspace button.secondary-action,
.claim-workspace .button-link {
  min-height: 30px;
  padding: 0 10px;
}

.claim-document-list,
.claim-line-list,
.claim-evidence-list,
.claim-document-preview {
  min-height: 0;
  overflow: auto;
}

.claim-line-list-panel,
.claim-line-editor-panel {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  display: grid;
}

.claim-line-list-panel {
  grid-template-rows: minmax(0, 2fr) auto minmax(0, 1fr);
  gap: 0;
}

.claim-line-editor-panel {
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.claim-pane-section {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: stretch;
  gap: 8px;
}

.claim-document-list,
.claim-line-list,
.claim-evidence-list {
  display: grid;
  align-content: start;
  gap: 8px;
  overflow: auto;
}

.claim-pane-divider {
  position: relative;
  height: 16px;
  margin: 2px 0;
  background: transparent;
  cursor: row-resize;
}

.claim-pane-divider::before {
  content: "";
  position: absolute;
  top: 7px;
  right: 0;
  left: 0;
  height: 1px;
  background: var(--line);
}

.claim-pane-divider::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 50%;
  width: 34px;
  height: 5px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transform: translateX(-50%);
  opacity: 0;
}

.claim-pane-divider:hover::after,
.claim-pane-divider:focus-visible::after {
  opacity: 1;
}

.claim-document-card {
  width: 100%;
  min-height: 76px;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 7px;
  text-align: left;
  box-shadow: none;
}

.claim-document-card:hover,
.claim-document-card.selected {
  border-color: var(--brand-line);
  background: var(--brand-soft);
}

.document-thumb {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--white);
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 600;
}

.document-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.document-thumb-frame {
  width: 180px;
  height: 160px;
  border: 0;
  pointer-events: none;
  transform: scale(0.355);
  transform-origin: top left;
  background: var(--white);
}

.document-card-text {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.document-card-text strong,
.document-card-text span {
  overflow-wrap: anywhere;
}

.document-card-text strong {
  font-weight: 600;
}

.claim-document-preview {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fdfdfc;
}

.claim-document-preview img,
.claim-document-preview iframe {
  display: block;
  width: 100%;
  min-height: 100%;
  border: 0;
}

.claim-document-preview iframe {
  height: 100%;
}

.claim-document-preview img {
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.document-text-preview {
  min-height: 100%;
  margin: 0;
  padding: 14px;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--ink);
  font: 0.86rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.evidence-link-popover {
  position: absolute;
  top: 66px;
  left: 12px;
  right: 12px;
  z-index: 2;
  max-height: min(40dvh, 260px);
  overflow: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.72fr);
  align-items: end;
  gap: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.995);
  padding: 8px;
  box-shadow:
    inset 3px 0 0 var(--brand),
    0 18px 44px rgba(8, 8, 8, 0.16);
}

.evidence-link-popover > div:first-child,
.evidence-link-popover fieldset,
.evidence-link-popover .form-actions {
  grid-column: 1 / -1;
}

.evidence-link-popover fieldset {
  margin: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 6px;
}

.evidence-link-popover legend {
  padding: 0 3px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
}

.evidence-link-popover label span {
  margin-bottom: 3px;
  font-size: 0.68rem;
}

.evidence-link-popover select {
  min-height: 30px;
  padding: 0 8px;
}

.evidence-link-popover button,
.evidence-link-popover button.secondary-action {
  min-height: 30px;
  padding: 0 10px;
}

.evidence-link-popover .form-actions {
  justify-content: flex-end;
  gap: 6px;
}

.evidence-role-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.checkbox-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  padding: 4px 7px;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
}

.checkbox-chip input {
  appearance: none;
  width: 12px;
  height: 12px;
  min-height: 12px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 1px solid var(--brand-line);
  border-radius: 3px;
  background: var(--white);
}

.checkbox-chip input::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 1px;
  transform: scale(0);
  background: var(--brand);
}

.checkbox-chip input:checked::before {
  transform: scale(1);
}

.checkbox-chip:has(input:checked) {
  border-color: var(--brand-line);
  color: var(--brand);
  background: var(--brand-soft);
}

.checkbox-chip:has(input:disabled) {
  opacity: 0.62;
}

.claim-line-row,
.claim-evidence-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 8px 9px;
}

.claim-line-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.claim-line-row.selected {
  border-color: var(--brand-line);
  background: var(--brand-soft);
}

.claim-line-row strong,
.claim-evidence-row strong {
  line-height: 1.15;
  font-weight: 600;
}

.claim-line-row .subtle,
.claim-evidence-row .subtle {
  line-height: 1.25;
}

.claim-workspace .warning-chip,
.claim-workspace .success-chip,
.claim-workspace .info-chip,
.claim-workspace .danger-chip {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
  line-height: 1;
  text-transform: capitalize;
  white-space: nowrap;
}

.claim-line-row > .warning-chip,
.claim-line-row > .success-chip,
.claim-line-row > .info-chip,
.claim-line-row > .danger-chip {
  align-self: start;
  margin-top: 1px;
}

.claim-line-row .document-actions,
.claim-evidence-row .document-actions {
  grid-column: 1 / -1;
  justify-content: flex-start;
}

.compact-action,
button.compact-action,
a.compact-action,
.button-link.compact-action,
button.secondary-action.compact-action,
button.danger-action.compact-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  line-height: 1.1;
  box-shadow: none;
}

.button-link.compact-action {
  text-decoration: none;
}

.compact-actions {
  gap: 5px;
}

.claim-workspace .compact-actions {
  gap: 3px;
}

.claim-workspace .compact-action,
.claim-workspace button.compact-action,
.claim-workspace a.compact-action,
.claim-workspace .button-link.compact-action,
.claim-workspace button.secondary-action.compact-action,
.claim-workspace button.danger-action.compact-action {
  height: 22px;
  padding: 0 5px;
  border-radius: 5px;
  font-size: 0.66rem;
}

.compact-form {
  margin-bottom: 0;
  padding: 10px;
  min-height: 0;
  overflow: auto;
  box-shadow: none;
}

.compact-header {
  margin-top: 0;
}

.compact-empty {
  padding: 14px;
}

.document-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px 14px;
}

.claim-list-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.claim-row-side {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.claim-row-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.document-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.document-main strong,
.document-main span {
  overflow-wrap: anywhere;
}

.document-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
}

.member-row strong,
.member-row span {
  overflow-wrap: anywhere;
}

.role-chip {
  border-radius: 999px;
  border: 1px solid var(--brand-line);
  background: var(--brand-soft);
  color: var(--brand);
  padding: 4px 9px;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: capitalize;
}

.member-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.member-role-select {
  min-height: 30px;
  width: auto;
  min-width: 116px;
  padding: 4px 28px 4px 8px;
  border-radius: 6px;
  font-size: 0.82rem;
}

.member-confirm-popover {
  position: absolute;
  top: 52px;
  right: 0;
  z-index: 4;
  display: grid;
  gap: 10px;
  width: min(420px, 100%);
  border: 1px solid rgba(143, 29, 29, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.995);
  padding: 14px;
  box-shadow:
    inset 3px 0 0 var(--danger),
    0 24px 70px rgba(8, 8, 8, 0.22);
}

.member-confirm-popover p {
  margin: 0;
  color: var(--muted);
}

.warning-chip,
.success-chip,
.info-chip,
.danger-chip {
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.8rem;
  font-weight: 500;
}

.warning-chip {
  border: 1px solid rgba(154, 106, 20, 0.28);
  background: var(--warning-soft);
  color: var(--warning);
}

.success-chip {
  border: 1px solid rgba(29, 101, 65, 0.24);
  background: var(--success-soft);
  color: var(--success);
}

.info-chip {
  border: 1px solid rgba(51, 92, 103, 0.22);
  background: var(--info-soft);
  color: var(--info);
}

.danger-chip {
  border: 1px solid rgba(143, 29, 29, 0.28);
  background: var(--danger-soft);
  color: var(--danger);
}

.alias-panel,
.intake-card,
.intake-attachment-row,
.provider-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow:
    0 18px 40px rgba(8, 8, 8, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.alias-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding: 14px;
}

.alias-panel strong,
.copy-alias-button {
  overflow-wrap: anywhere;
  font-weight: 600;
}

.copy-alias-button {
  min-height: 0;
  width: fit-content;
  max-width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  padding: 2px 0;
  text-align: left;
  box-shadow: none;
  cursor: copy;
}

.copy-alias-button:hover:not(:disabled),
.copy-alias-button:focus-visible:not(:disabled) {
  border-color: transparent;
  background: transparent;
  color: var(--brand);
  box-shadow: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.copy-alias-button:disabled {
  color: var(--ink);
  cursor: default;
  opacity: 1;
}

.intake-list,
.intake-attachments,
.provider-list {
  display: grid;
  gap: 8px;
}

.intake-card,
.provider-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.intake-header,
.intake-attachment-row,
.provider-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.intake-header div,
.intake-attachment-row div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.intake-card strong,
.intake-attachment-row strong,
.provider-card strong,
.document-main strong,
.member-row strong {
  font-weight: 600;
}

.intake-attachment-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
  padding: 10px 12px;
  box-shadow: none;
}

.intake-attachment-row .document-actions {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  justify-content: end;
  align-items: center;
  gap: 8px;
}

.intake-attachment-row .document-actions button:not(.compact-action),
.intake-attachment-row .document-actions button.secondary-action:not(.compact-action),
.intake-attachment-row .document-actions button.danger-action:not(.compact-action) {
  width: 82px;
  min-height: 34px;
  padding: 0 8px;
  justify-content: center;
}

.provider-card p {
  margin-bottom: 0;
}

.activity-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.85fr);
  align-items: stretch;
  gap: 12px;
}

.activity-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
  gap: 10px;
  min-height: 0;
  max-height: calc(100dvh - 250px);
  padding: 14px;
  overflow: hidden;
}

.activity-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.activity-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding: 10px 12px;
  box-shadow: none;
}

.activity-row strong,
.activity-row span,
.activity-metadata {
  overflow-wrap: anywhere;
}

.activity-metadata {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.compact-empty {
  padding: 14px;
  color: var(--muted);
}

.provider-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.provider-detail {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
  padding: 10px 12px;
}

.provider-detail ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.provider-detail li {
  margin-bottom: 4px;
}

.app-message {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  max-width: min(420px, calc(100vw - 44px));
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  color: var(--ink);
  padding: 10px 12px;
  box-shadow:
    inset 3px 0 0 var(--brand),
    0 18px 46px rgba(8, 8, 8, 0.18);
}

.app-message.toast-success {
  border-color: rgba(29, 101, 65, 0.24);
  box-shadow:
    inset 3px 0 0 var(--success),
    0 18px 46px rgba(8, 8, 8, 0.18);
}

.app-message.toast-warning {
  border-color: rgba(154, 106, 20, 0.28);
  box-shadow:
    inset 3px 0 0 var(--warning),
    0 18px 46px rgba(8, 8, 8, 0.18);
}

.app-message.toast-danger {
  border-color: rgba(143, 29, 29, 0.28);
  box-shadow:
    inset 3px 0 0 var(--danger),
    0 18px 46px rgba(8, 8, 8, 0.18);
}

.view-section > .document-status,
#people-status,
#providers-status,
#documents-status,
#email-intake-status,
#activity-status,
#claims-status {
  min-height: 0;
  margin: 0;
}

.app-dialog {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(8, 8, 8, 0.18);
}

.app-dialog-panel {
  display: grid;
  gap: 12px;
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.995);
  padding: 14px;
  box-shadow:
    inset 3px 0 0 var(--brand),
    0 24px 70px rgba(8, 8, 8, 0.24);
}

.app-dialog-panel p {
  color: var(--muted);
  margin-bottom: 0;
}

.app-dialog-panel input {
  width: 100%;
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .claim-workspace {
    overflow: auto;
    height: auto;
    max-height: calc(100dvh - 28px);
  }

  .claim-workspace-grid {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .claim-doc-pane,
  .claim-preview-pane,
  .claim-lines-pane {
    height: auto;
    min-height: 320px;
    max-height: min(70dvh, 560px);
  }

  .claim-doc-filters {
    grid-template-columns: 1fr;
  }

  .claim-lines-pane {
    grid-template-rows: minmax(0, 1fr);
  }
}

@media (max-width: 780px) {
  .auth-screen {
    align-items: start;
    padding: 18px;
  }

  .auth-panel {
    padding: 20px;
  }

  .auth-actions {
    display: grid;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .workspace-switcher-trigger {
    max-width: 100%;
  }

  .workspace-popover {
    top: 118px;
    left: 18px;
    width: calc(100vw - 36px);
  }

  .inline-form,
  .invite-form,
  .account-inline-form,
  .account-email-row,
  .workspace-create-form,
  .delete-workspace-form,
  .status-grid,
  .document-row,
  .danger-panel,
  .activity-layout,
  .alias-panel,
  .intake-header,
  .intake-attachment-row,
  .profile-form,
  .provider-header,
  .provider-detail-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .section-header-actions,
  .claim-row-side,
  .claim-row-chips,
  .document-actions {
    justify-content: flex-start;
    justify-items: start;
  }

  .claim-create-popover,
  .form-popover {
    position: static;
    width: 100%;
    margin-bottom: 14px;
  }

  .account-popover,
  .workspace-settings-popover {
    top: 12px;
    right: 12px;
    left: 12px;
    width: auto;
  }

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

  .activity-card {
    max-height: min(70dvh, 560px);
  }

  .claim-workspace {
    inset: 8px;
    overflow: auto;
    grid-template-rows: auto auto auto auto;
  }

  .claim-workspace-header,
  .claim-header-actions,
  .pane-header {
    align-items: stretch;
    flex-direction: column;
  }

  .claim-doc-pane,
  .claim-preview-pane,
  .claim-lines-pane {
    min-height: 320px;
    max-height: min(72dvh, 620px);
  }

  .main-panel {
    padding: 20px;
  }
}
