:root {
  --bg: #eef4fb;
  --bg-accent: #dfeeff;

  --panel: rgba(255, 255, 255, 0.96);
  --panel-strong: #ffffff;

  --line: #c7d6ea;
  --line-strong: #aebfd8;

  --text: #0f172a;
  --muted: #475569;
  --muted-text: #64748b;

  --primary: #2563eb;
  --primary-strong: #1e3a8a;
  --primary-soft: rgba(37, 99, 235, 0.12);

  --success: #10b981;
  --success-strong: #059669;
  --success-soft: rgba(16, 185, 129, 0.14);

  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.18);

  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.14);

  --surface-subtle: #f3f8ff;
  --surface-input: #f7faff;
  --surface-table: #f8fbff;
  --surface-table-header: #e8f0fb;
  --surface-table-header-strong: #dbe7f7;

  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  --shadow-strong: 0 22px 50px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.95), transparent 26%),
    linear-gradient(135deg, var(--bg) 0%, #f3f8ff 42%, var(--bg-accent) 100%);
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font: inherit;
}

.page-shell {
  max-width: 1720px;
  margin: 0 auto;
  padding: 32px;
}

.hero,
.workspace {
  display: grid;
  gap: 24px;
}

.hero {
  grid-template-columns: 1fr;
  align-items: start;
  margin-bottom: 24px;
}

.hero-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 24px;
  align-items: start;
}

.hero-head-wide {
  grid-template-columns: minmax(0, 1fr) auto;
}

.hero-title-block h1 {
  max-width: none;
}

.workspace {
  grid-template-columns: 1fr;
  align-items: start;
}

.document-stage,
.content {
  display: grid;
  gap: 24px;
  align-content: start;
}

.dashboard-shell {
  gap: 24px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 24px;
}

.document-stage {
  grid-template-columns: minmax(280px, 340px) minmax(150px, 185px) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.table-stage {
  grid-column: 1 / -1;
  min-width: 0;
  display: grid;
  gap: 24px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  padding: 20px;
}

.mono-text {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.eyebrow {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.4rem, 4vw, 4.6rem);
  max-width: 12ch;
}

.hero-copy,
.status-text,
.muted,
.field span {
  color: var(--muted);
}

.hero-copy {
  max-width: 56ch;
  font-size: 1.05rem;
  line-height: 1.65;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

input[type="text"],
input[type="password"],
input[type="file"],
textarea,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--surface-input);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

input[type="text"]:hover,
input[type="password"]:hover,
input[type="file"]:hover,
textarea:hover,
select:hover {
  border-color: #93aed0;
  background: #f2f7ff;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="file"]:focus,
textarea:focus,
select:focus {
  outline: none;
  background: #ffffff;
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 0 0 4px rgba(37, 99, 235, 0.14);
}

.primary-button,
.secondary-button,
.table-select-button,
.icon-button {
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease, color 120ms ease;
}

.primary-button {
  width: 100%;
  background: linear-gradient(135deg, var(--primary-strong) 0%, var(--primary) 100%);
  color: white;
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.26);
  font-weight: 700;
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(37, 99, 235, 0.3);
}

.secondary-button,
.table-select-button {
  background: #eaf2ff;
  color: var(--primary-strong);
  border: 1px solid rgba(37, 99, 235, 0.16);
  font-weight: 600;
}

.secondary-button:hover:not(:disabled),
.table-select-button:hover:not(:disabled) {
  background: #dce9ff;
}

.primary-button:disabled,
.secondary-button:disabled,
.table-select-button:disabled,
.icon-button:disabled {
  background: #e2e8f0;
  color: #94a3b8;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.78;
  filter: saturate(0.75);
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.hidden-link {
  display: none;
}

.table-select-button.active {
  background: linear-gradient(135deg, var(--primary-strong) 0%, var(--primary) 100%);
  color: white;
}

.table-button-list {
  display: grid;
  gap: 10px;
}

.table-selector-panel {
  width: 100%;
  max-width: 100%;
  padding: 14px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.table-selector-panel h2 {
  font-size: 1rem;
}

.table-ribbon {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}

.pdf-preview-panel {
  min-height: 400px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
}

.session-card {
  display: grid;
  gap: 14px;
}

.compact-copy {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

.pdf-frame-shell {
  height: 600px;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: auto;
  background: #f3f7fc;
}

.pdf-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.pdf-zoom-button {
  min-width: 42px;
  padding: 8px 12px;
}

.pdf-zoom-label {
  min-width: 56px;
  text-align: center;
  font-size: 0.92rem;
  color: var(--muted);
}

.pdf-preview-frame {
  width: 100%;
  min-height: 100%;
  background: #edf3fa;
  padding: 14px;
  display: grid;
  gap: 16px;
}

.pdf-page {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.10);
}

.pdf-page-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: white;
}

.pdf-source-image {
  display: block;
  max-width: none;
  height: auto;
  background: white;
}

.pdf-page-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pdf-table-box {
  position: absolute;
  border: 2px solid rgba(22, 163, 74, 0.82);
  background: rgba(22, 163, 74, 0.12);
  border-radius: 8px;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.pdf-table-box.active {
  border-color: rgba(202, 138, 4, 0.98);
  background: rgba(250, 204, 21, 0.2);
  transform: scale(1.01);
}

.pdf-table-box.removed {
  border-color: rgba(220, 38, 38, 0.86);
  background: rgba(220, 38, 38, 0.14);
}

.pdf-table-label {
  position: absolute;
  top: -28px;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.94);
  color: white;
  font-size: 0.74rem;
  line-height: 1;
  white-space: nowrap;
  pointer-events: auto;
}

.pdf-table-remove {
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: inherit;
  cursor: pointer;
  font: inherit;
  line-height: 1;
  padding: 0;
}

.pdf-table-remove:hover,
.pdf-table-remove:focus-visible {
  background: rgba(255, 255, 255, 0.32);
  outline: none;
}

.pdf-preview-empty {
  align-self: start;
  margin: 0;
}

.table-ribbon .muted {
  margin: 0;
}

.drop-zone {
  display: grid;
  gap: 8px;
  justify-items: start;
  padding: 22px;
  border: 2px dashed rgba(37, 99, 235, 0.42);
  border-radius: 18px;
  background: rgba(234, 242, 255, 0.72);
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.drop-zone.drag-active,
.drop-zone:focus-visible {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.98);
  transform: translateY(-1px);
  outline: none;
}

.drop-zone-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.selected-files {
  min-height: 80px;
}

.selected-file-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.selected-file-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(203, 213, 225, 0.9);
}

.selected-file-copy {
  display: grid;
  gap: 4px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.status-card {
  display: grid;
  gap: 4px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(203, 213, 225, 0.9);
}

.status-card-label {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.document-list-panel .table-container {
  overflow-x: auto;
}

.document-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(180px, 240px);
  gap: 14px;
  margin-bottom: 18px;
  align-items: end;
}

.document-filter-field {
  margin-bottom: 0;
}

.workflow-table th,
.workflow-table td {
  padding: 12px 14px;
}

.workflow-table {
  table-layout: auto;
}

.workflow-table th,
.workflow-table td {
  min-width: 0;
}

.sort-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0;
  cursor: pointer;
  font-weight: 700;
  text-align: left;
}

.sort-button.active {
  color: var(--primary);
}

.sort-indicator {
  color: var(--muted);
  font-size: 0.85rem;
}

.document-cell {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.document-cell-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.document-cell strong,
.document-cell .mono-text {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.workflow-table .table-actions {
  white-space: nowrap;
  justify-content: flex-end;
}

.info-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border: 1px solid rgba(148, 163, 184, 0.5);
  border-radius: 999px;
  color: var(--muted-text);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  flex: 0 0 auto;
}

.info-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  min-width: 14rem;
  max-width: 18rem;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.96);
  color: #f8fafc;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.4;
  white-space: pre-line;
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  z-index: 20;
}

.info-tooltip:hover::after,
.info-tooltip:focus-visible::after {
  opacity: 1;
}

.document-download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.5);
  border-radius: 999px;
  background: transparent !important;
  color: var(--muted-text) !important;
  font-size: 0.76rem;
  line-height: 1;
  flex: 0 0 auto;
  font-weight: 700;
}

.document-download-button:hover,
.document-download-button:focus-visible {
  background: rgba(226, 232, 240, 0.7) !important;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  white-space: nowrap;
  font-weight: 600;
}

.status-uploaded {
  background: #e2e8f0;
  color: #334155;
}

.status-processing {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-needs_review {
  background: #fef3c7;
  color: #a16207;
}

.status-review_in_progress {
  background: #ede9fe;
  color: #6d28d9;
}

.status-ready_to_export {
  background: #d1fae5;
  color: #047857;
}

.status-exported {
  background: #dcfce7;
  color: #166534;
}

.workflow-box {
  margin-top: 18px;
  display: grid;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid rgba(203, 213, 225, 0.9);
}

.metadata-box,
.client-box {
  margin-top: 18px;
  display: grid;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid rgba(203, 213, 225, 0.9);
}

.intake-box {
  margin-bottom: 18px;
  display: grid;
  gap: 10px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(203, 213, 225, 0.9);
}

.intake-box .muted,
.intake-box .status-text {
  margin: 0;
}

.intake-address-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.typeahead-shell {
  position: relative;
}

.typeahead-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  display: grid;
  gap: 4px;
  max-height: 260px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 20px 36px rgba(15, 23, 42, 0.16);
}

.typeahead-list.hidden {
  display: none;
}

.typeahead-option {
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
}

.typeahead-option:hover,
.typeahead-option:focus-visible,
.typeahead-option.active {
  background: #eaf2ff;
  outline: none;
}

.typeahead-empty {
  margin: 0;
  padding: 10px 12px;
}

.metadata-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.metadata-value {
  margin: 4px 0 0;
  font-weight: 700;
}

.workflow-status-text {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.validation-box {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f4f8fd;
}

.validation-header {
  margin-bottom: 8px;
}

.validation-summary {
  display: grid;
  gap: 10px;
}

.validation-state,
.validation-section {
  display: grid;
  gap: 6px;
}

.validation-state-valid {
  color: var(--success-strong);
}

.validation-state-valid strong {
  color: var(--success-strong);
}

.validation-section-title-error {
  color: var(--danger);
}

.validation-section-title-warning {
  color: #b45309;
}

.validation-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}

.validation-item-button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  line-height: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
  transition: background-color 120ms ease, color 120ms ease;
}

.validation-item-button:hover,
.validation-item-button:focus-visible {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
  outline: none;
}

.validation-overflow {
  list-style: none;
  margin-left: -18px;
}

.validation-overflow-indicator {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: var(--primary);
  font-weight: 600;
  cursor: help;
}

.validation-overflow-indicator::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  min-width: 18rem;
  max-width: 26rem;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.96);
  color: #f8fafc;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.4;
  white-space: pre-line;
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  z-index: 25;
}

.validation-overflow-indicator:hover::after,
.validation-overflow-indicator:focus-visible::after {
  opacity: 1;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  align-items: center;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 24px;
}

.auth-copy-panel {
  display: grid;
  align-content: center;
  gap: 14px;
  padding-block: 28px;
}

.auth-hero-row {
  display: grid;
  grid-template-columns: 600px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.auth-hero-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.auth-form-panel {
  align-self: center;
}

.auth-logo {
  height: 300px;
  max-width: 100%;
  width: auto;
  justify-self: center;
}

.auth-copy-panel .eyebrow,
.auth-copy-panel h1,
.auth-copy-panel .hero-copy {
  margin: 0;
}

.admin-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.customer-admin-shell {
  gap: 24px;
}

.customer-admin-editor-panel,
.customer-admin-client-panel {
  display: grid;
  gap: 18px;
}

.customer-admin-save-button {
  width: auto;
}

.customer-admin-section-copy {
  margin: 8px 0 0;
  max-width: 60ch;
}

.entry-type-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.customer-admin-type-editor {
  display: grid;
  grid-template-columns: minmax(260px, 360px) auto;
  gap: 16px;
  align-items: end;
}

.customer-admin-type-actions {
  justify-content: flex-start;
}

.customer-admin-layout-actions {
  justify-content: flex-end;
  margin-top: -4px;
  margin-bottom: 6px;
}

.customer-admin-columns-table .data-table td {
  vertical-align: middle;
}

.customer-admin-inline-input,
.customer-admin-inline-select {
  min-width: 0;
}

.customer-admin-reference-list-editor {
  display: grid;
  gap: 10px;
}

.customer-admin-reference-create-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.customer-list-create-card {
  grid-column: 1 / -1;
}

.customer-admin-actions-column {
  width: 92px;
  text-align: right;
}

.customer-admin-required-column {
  white-space: nowrap;
}

.checkbox-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--muted);
}

.checkbox-field input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
}

.customer-admin-delete-button {
  color: var(--muted);
}

.customer-admin-empty-state {
  margin: 0;
  padding: 6px 0;
}

.customer-admin-client-grid {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.customer-admin-client-sidebar {
  display: grid;
  gap: 16px;
}

.customer-admin-create-client-card {
  margin-top: 0;
  display: grid;
  gap: 14px;
}

.customer-admin-create-client-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.customer-admin-create-client-panel.hidden {
  display: none;
}

.customer-admin-create-client-fields {
  display: grid;
  gap: 12px;
}

.customer-admin-records-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.customer-admin-records-sidebar,
.customer-admin-records-main {
  display: grid;
  gap: 16px;
}

.customer-admin-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}

.customer-admin-record-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.customer-admin-client-directory,
.customer-admin-account-list {
  display: grid;
  gap: 10px;
}

.customer-admin-directory-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(248, 251, 255, 0.82);
  color: var(--text);
  text-align: left;
  padding: 12px 14px;
  display: grid;
  gap: 4px;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.customer-admin-directory-item:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.28);
  background: rgba(233, 242, 255, 0.95);
}

.customer-admin-directory-item.active {
  border-color: rgba(37, 99, 235, 0.36);
  background: rgba(220, 233, 255, 0.95);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.customer-admin-directory-title {
  font-weight: 700;
}

.customer-admin-directory-meta {
  font-size: 0.9rem;
  color: var(--muted);
}

.customer-admin-client-card {
  margin-top: 0;
  min-height: 172px;
}

.customer-admin-client-name {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.customer-admin-client-meta {
  margin: 8px 0 0;
}

.customer-admin-lists-grid {
  min-width: 0;
}

.customer-admin-dynamic-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.customer-list-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(248, 251, 255, 0.82);
  padding: 18px;
}

.compact-panel-header {
  gap: 16px;
}

.compact-panel-header h3 {
  margin: 0;
  font-size: 1.12rem;
}

.customer-list-field {
  margin-bottom: 0;
}

.customer-list-field textarea {
  min-height: 300px;
  resize: vertical;
  line-height: 1.5;
}

.customer-admin-reference-header-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

.customer-admin-reference-title-input {
  min-width: 0;
}

.customer-admin-danger-button {
  border-color: rgba(220, 38, 38, 0.28);
  color: #b91c1c;
}

.customer-admin-danger-button:hover:not(:disabled),
.customer-admin-danger-button:focus-visible:not(:disabled) {
  border-color: rgba(220, 38, 38, 0.38);
  background: rgba(254, 242, 242, 0.88);
  color: #991b1b;
}

.customer-admin-list-note {
  margin-top: 0;
}

.admin-list-panel {
  grid-column: 1 / -1;
}

.table-pill {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #eaf2ff;
  color: var(--primary-strong);
  padding: 8px 8px 8px 10px;
  font-size: 0.86rem;
  line-height: 1.25;
  font-weight: 600;
}

.table-pill:hover {
  background: #dce9ff;
}

.table-pill.active {
  background: linear-gradient(135deg, var(--primary-strong) 0%, var(--primary) 100%);
  color: white;
}

.table-pill-button {
  min-width: 0;
  flex: 1 1 auto;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}

.table-pill-remove {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0 1px;
  font-weight: 700;
  font-size: 0.82rem;
  opacity: 0.82;
}

.toolbar-row,
.action-group,
.header-inner {
  display: flex;
  gap: 10px;
  align-items: center;
}

.table-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.table-panel-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  padding-bottom: 14px;
}

.table-title-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.table-nav-button {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eaf2ff;
  color: var(--primary-strong);
  border: 1px solid rgba(37, 99, 235, 0.16);
  font-weight: 700;
  line-height: 1;
}

.editable-cell-shell.cell-invalid {
  outline: 2px solid rgba(220, 38, 38, 0.2);
  background: rgba(220, 38, 38, 0.06);
  border-color: rgba(220, 38, 38, 0.28);
}

.editable-cell-shell.cell-invalid:hover,
.editable-cell-shell.cell-invalid:focus-within {
  border-color: rgba(220, 38, 38, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 0 0 3px rgba(220, 38, 38, 0.10);
}

.editable-cell-shell.cell-warning {
  outline: 2px solid rgba(245, 158, 11, 0.18);
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.26);
}

.editable-cell-shell.cell-warning:hover,
.editable-cell-shell.cell-warning:focus-within {
  border-color: rgba(217, 119, 6, 0.38);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 0 0 3px rgba(245, 158, 11, 0.10);
}

.document-delete-button {
  min-width: 40px;
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(220, 38, 38, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.trash-icon {
  line-height: 1;
  font-size: 1rem;
}

.toolbar-row {
  justify-content: space-between;
  flex-wrap: wrap;
}

.mapping-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 16px;
  margin-top: 18px;
  align-items: stretch;
}

.mapping-controls {
  min-width: 0;
}

.mapping-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px 14px;
  align-items: start;
}

.compact-field {
  margin-bottom: 0;
}

.mapping-grid select.mapping-select-invalid,
.entry-type-mappings-grid select.mapping-select-invalid {
  border-color: rgba(220, 38, 38, 0.72);
  background: var(--surface-input);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 0 0 2px rgba(220, 38, 38, 0.12);
}

.mapping-grid select.mapping-select-invalid:hover,
.mapping-grid select.mapping-select-invalid:focus,
.entry-type-mappings-grid select.mapping-select-invalid:hover,
.entry-type-mappings-grid select.mapping-select-invalid:focus {
  border-color: rgba(220, 38, 38, 0.82);
  background: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 0 0 4px rgba(220, 38, 38, 0.14);
}

.mapping-grid select.mapping-select-warning,
.entry-type-mappings-grid select.mapping-select-warning {
  border-color: rgba(217, 119, 6, 0.72);
  background: var(--surface-input);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 0 0 2px rgba(245, 158, 11, 0.14);
}

.mapping-grid select.mapping-select-warning:hover,
.mapping-grid select.mapping-select-warning:focus,
.entry-type-mappings-grid select.mapping-select-warning:hover,
.entry-type-mappings-grid select.mapping-select-warning:focus {
  border-color: rgba(217, 119, 6, 0.82);
  background: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 0 0 4px rgba(245, 158, 11, 0.12);
}

.mapping-validation-box {
  margin-top: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.mapping-validation-box .validation-header {
  margin-bottom: 6px;
}

.mapping-validation-box .validation-summary {
  flex: 1 1 auto;
  gap: 8px;
}

.compact-actions {
  align-content: end;
}

.compact-actions .secondary-button {
  width: 100%;
}

.entry-type-mappings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px 14px;
  margin-top: 12px;
}

.mapping-static-note {
  min-height: 48px;
  border: 1px dashed rgba(37, 99, 235, 0.25);
  border-radius: 14px;
  padding: 12px 14px;
  background: #f8fbff;
  color: var(--muted);
  line-height: 1.35;
}

.table-container {
  overflow-x: hidden;
  overflow-y: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel-strong);
  table-layout: fixed;
}

th,
td {
  border: 1px solid #cfdbeb;
  padding: 0;
  vertical-align: top;
}

th {
  background: linear-gradient(180deg, var(--surface-table-header) 0%, var(--surface-table-header-strong) 100%);
}

tbody td {
  background: var(--surface-table);
}

tbody td:not(.row-actions) {
  padding: 4px;
  vertical-align: bottom;
}

.editable-cell-shell {
  background: linear-gradient(180deg, #ffffff 0%, #f4f8fd 100%);
  border: 1px solid transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
  transition:
    background-color 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.column-header {
  position: relative;
}

.column-header.dragging {
  opacity: 0.5;
}

.column-header.drop-target::after {
  content: "";
  position: absolute;
  inset: 8px auto 8px 0;
  width: 3px;
  border-radius: 999px;
  background: var(--primary);
}

.header-inner {
  justify-content: space-between;
  padding: 10px 12px;
  gap: 8px;
}

.header-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.drag-handle {
  cursor: grab;
  color: var(--muted);
  font-size: 1rem;
  user-select: none;
}

.header-title,
.data-cell {
  min-height: 24px;
  outline: none;
}

.header-title {
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 6px 8px;
  border: 1px dashed transparent;
  border-radius: 8px;
  transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.header-title[contenteditable="true"]:hover {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(37, 99, 235, 0.24);
}

.header-title[contenteditable="true"]:focus {
  background: #ffffff;
  border-color: rgba(37, 99, 235, 0.46);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.header-title.amount-header {
  text-align: right;
  width: 100%;
}

table.dense-headers .header-inner {
  padding: 8px 8px;
  gap: 6px;
}

table.dense-headers .header-main {
  gap: 6px;
}

table.dense-headers .drag-handle {
  font-size: 0.82rem;
}

table.dense-headers .header-title {
  font-size: 0.78rem;
  line-height: 1.1;
  padding: 4px 6px;
}

table.rotated-headers th.column-header {
  height: 180px;
  vertical-align: bottom;
}

table.rotated-headers .header-inner {
  height: 180px;
  align-items: stretch;
  justify-content: space-between;
  padding: 8px 6px;
}

table.rotated-headers .header-main {
  flex: 1;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 4px;
}

table.rotated-headers .drag-handle {
  font-size: 0.72rem;
  align-self: flex-start;
}

table.rotated-headers .header-title {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  overflow-wrap: normal;
  text-overflow: ellipsis;
  max-height: 140px;
  max-width: 28px;
  padding: 4px 2px;
  font-size: 0.74rem;
  line-height: 1;
}

table.rotated-headers .header-title.amount-header {
  text-align: left;
  width: auto;
}

.data-cell {
  margin: 0;
  padding: 10px 12px;
  min-height: 56px;
  display: block;
  overflow-wrap: anywhere;
  white-space: normal;
}

.editable-cell-shell:hover {
  border-color: rgba(37, 99, 235, 0.28);
  background: linear-gradient(180deg, #ffffff 0%, #edf4ff 100%);
}

.editable-cell-shell:focus-within {
  border-color: rgba(37, 99, 235, 0.52);
  background: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 0 0 3px rgba(37, 99, 235, 0.14);
}

.data-cell.amount-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-cell.date-cell {
  font-variant-numeric: tabular-nums;
}

.table-cell-select {
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding: 10px 12px;
}

.table-cell-typeahead-shell {
  position: relative;
}

.table-cell-typeahead-input {
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
}

.table-cell-typeahead-input:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.52);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.table-cell-typeahead-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 35;
  display: grid;
  gap: 4px;
  max-height: min(260px, 48vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.16);
}

.table-cell-typeahead-list.hidden {
  display: none;
}

.data-cell.positive-value {
  color: #047857;
}

.data-cell.negative-value {
  color: #b91c1c;
}

.row-actions {
  width: 70px;
  text-align: center;
  background: #eaf1f8;
}

.icon-button {
  background: transparent;
  color: var(--danger);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
}

.table-nav-button {
  background: #eaf2ff;
  color: var(--primary-strong);
  border: 1px solid rgba(37, 99, 235, 0.16);
}

.table-nav-button:hover:not(:disabled),
.table-nav-button:focus-visible:not(:disabled) {
  background: #dce9ff;
  color: var(--primary-strong);
  outline: none;
}

.sticky-note {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #eaf2ff;
  color: var(--muted);
  border: 1px solid rgba(37, 99, 235, 0.14);
}

.modal-shell {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1000;
}

.modal-shell.hidden {
  display: none;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: rgba(248, 250, 252, 0.72);
  backdrop-filter: blur(6px);
}

.loading-overlay.hidden {
  display: none;
}

.loading-card {
  min-width: 220px;
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 22px 24px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 22px;
  background: var(--panel-strong);
  box-shadow: var(--shadow-strong);
}

.loading-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(37, 99, 235, 0.14);
  border-top-color: var(--primary);
  border-radius: 999px;
  animation: review-spin 0.9s linear infinite;
}

.loading-text {
  margin: 0;
  color: var(--text);
  font-weight: 600;
}

@keyframes review-spin {
  to {
    transform: rotate(360deg);
  }
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.34);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(520px, calc(100vw - 32px));
  background: var(--panel-strong);
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow-strong);
  padding: 22px;
}

.confirm-modal-card {
  width: min(460px, calc(100vw - 32px));
}

.confirm-modal-copy {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.confirm-danger-button {
  background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
  box-shadow: 0 10px 26px rgba(220, 38, 38, 0.24);
}

.confirm-danger-button:hover:not(:disabled) {
  box-shadow: 0 14px 32px rgba(220, 38, 38, 0.28);
}

.modal-actions {
  justify-content: flex-end;
}

.modal-actions .primary-button {
  width: auto;
}

@media (max-width: 960px) {
  .page-shell {
    padding: 18px;
  }

  .hero,
  .workspace,
  .document-stage,
  .hero-head,
  .auth-layout,
  .admin-grid,
  .customer-admin-records-grid,
  .customer-admin-client-grid,
  .customer-admin-dynamic-lists,
  .customer-admin-type-editor,
  .dashboard-grid,
  .document-toolbar {
    grid-template-columns: 1fr;
  }

  .table-selector-panel {
    max-height: 260px;
  }

  .mapping-layout {
    grid-template-columns: 1fr;
  }

  .mapping-grid {
    grid-template-columns: 1fr 1fr;
  }

  .customer-admin-edit-grid {
    grid-template-columns: 1fr;
  }

  .entry-type-mappings-grid {
    grid-template-columns: 1fr 1fr;
  }

  .status-grid {
    grid-template-columns: 1fr 1fr;
  }

  h1 {
    max-width: none;
  }
}
