:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #070806;
  --ink-soft: #20221d;
  --muted: #766e61;
  --muted-strong: #565043;
  --paper: #e8dfcd;
  --paper-deep: #d8ceb9;
  --panel: rgba(255, 255, 255, 0.84);
  --panel-solid: #ffffff;
  --line: #d4c8b3;
  --line-strong: #bfb29c;
  --accent: #d6f36a;
  --accent-strong: #98b928;
  --accent-deep: #1c2713;
  --accent-soft: #f1fad0;
  --blue: #354a3e;
  --blue-soft: #e8eee2;
  --gold: #a98137;
  --gold-soft: #f4ead5;
  --rose: #ae4744;
  --rose-soft: #f6e3df;
  --plum: #5d6050;
  --plum-soft: #ebe8df;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.12);
  --shadow-soft: 0 12px 34px rgba(0, 0, 0, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(244, 238, 225, 0.92), rgba(232, 223, 205, 0.98)),
    linear-gradient(115deg, rgba(214, 243, 106, 0.14), transparent 44%, rgba(7, 8, 6, 0.04));
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(7, 8, 6, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(7, 8, 6, 0.03) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.46), transparent 76%);
}

#authRoot:empty {
  display: none;
}

.app-shell[hidden] {
  display: none !important;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 520px) minmax(320px, 1fr);
  background:
    radial-gradient(circle at top left, rgba(214, 243, 106, 0.22), transparent 32%),
    linear-gradient(135deg, #f7f1e2 0%, #e6dcc7 100%);
}

.auth-panel {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 48px;
  background: rgba(255, 251, 242, 0.9);
  border-right: 1px solid rgba(191, 178, 156, 0.42);
  box-shadow: 22px 0 44px rgba(20, 28, 16, 0.08);
}

.auth-brand {
  display: grid;
  gap: 10px;
}

.auth-brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 800;
  color: #070806;
  background: var(--accent);
  border-radius: 12px;
  box-shadow: 0 14px 32px rgba(152, 185, 40, 0.18);
}

.auth-brand h1,
.auth-card h2,
.auth-copy h2 {
  margin: 0;
}

.auth-brand p,
.auth-copy p,
.auth-card p {
  margin: 0;
  color: var(--muted-strong);
}

.auth-card {
  display: grid;
  gap: 14px;
  padding: 26px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(212, 200, 179, 0.8);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
}

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

.auth-form .field {
  gap: 6px;
}

.auth-form .field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-strong);
  margin-bottom: 6px;
}

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

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

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

.auth-google-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 0 16px;
  color: #1f1f1f;
  font-weight: 700;
  background: #ffffff;
  border: 1px solid rgba(191, 178, 156, 0.9);
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(20, 28, 16, 0.06);
}

.auth-google-button:hover {
  background: #fbfbfb;
  border-color: rgba(160, 149, 130, 0.92);
}

.auth-google-button-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}

.auth-google-button-icon svg {
  display: block;
  width: 20px;
  height: 20px;
}

.auth-google-help {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: rgba(191, 178, 156, 0.72);
}

.auth-switch {
  color: var(--muted-strong);
  font-size: 13px;
}

.auth-switch button {
  padding: 0;
  color: var(--ink);
  font-weight: 700;
  background: transparent;
  border: 0;
}

.auth-provider-sheet[hidden] {
  display: none;
}

.auth-provider-sheet {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 8, 6, 0.34);
  backdrop-filter: blur(8px);
}

.auth-provider-sheet-card {
  width: min(460px, 100%);
  display: grid;
  gap: 14px;
  padding: 24px;
  background: rgba(255, 253, 248, 0.98);
  border: 1px solid rgba(191, 178, 156, 0.78);
  border-radius: 20px;
  box-shadow: 0 26px 64px rgba(12, 18, 10, 0.18);
}

.auth-provider-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auth-provider-sheet-header h3 {
  margin: 0;
  font-size: 18px;
}

.auth-provider-options {
  display: grid;
  gap: 10px;
}

.auth-provider-note {
  font-size: 12px;
  color: var(--muted);
}

.auth-shell-loading {
  grid-template-columns: minmax(320px, 520px) minmax(320px, 1fr);
}

.auth-panel-loading {
  align-content: center;
}

.auth-loading-card {
  justify-items: start;
  gap: 12px;
  min-height: 220px;
}

.auth-loading-spinner {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 4px solid rgba(191, 178, 156, 0.45);
  border-top-color: var(--accent-strong);
  animation: auth-spin 0.9s linear infinite;
}

.auth-copy {
  display: grid;
  align-content: center;
  gap: 22px;
  padding: 56px;
}

.auth-copy-card {
  display: grid;
  gap: 10px;
  max-width: 520px;
  padding: 28px;
  background: rgba(7, 8, 6, 0.9);
  color: rgba(255, 255, 255, 0.92);
  border-radius: 22px;
  box-shadow: 0 30px 60px rgba(15, 23, 14, 0.22);
}

.auth-copy-card p,
.auth-copy-card li {
  color: rgba(255, 255, 255, 0.74);
}

.auth-copy-card ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

@keyframes auth-spin {
  to {
    transform: rotate(360deg);
  }
}

.auth-error {
  padding: 10px 12px;
  color: #7a1d1a;
  background: rgba(246, 227, 223, 0.92);
  border: 1px solid rgba(174, 71, 68, 0.24);
  border-radius: 10px;
}

.auth-success {
  padding: 10px 12px;
  color: #294b34;
  background: rgba(214, 243, 106, 0.2);
  border: 1px solid rgba(152, 185, 40, 0.24);
  border-radius: 10px;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  padding: 22px 18px;
  overflow-y: auto;
  color: rgba(255, 255, 255, 0.9);
  background:
    linear-gradient(180deg, rgba(3, 5, 3, 0.99), rgba(9, 12, 7, 0.99) 64%, rgba(0, 0, 0, 0.99)),
    #050604;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 16px 0 46px rgba(15, 29, 24, 0.16);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 6px 16px;
  border-bottom: 1px solid rgba(214, 243, 106, 0.18);
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #070806;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0;
  background: var(--accent);
  border: 1px solid rgba(214, 243, 106, 0.62);
  border-radius: var(--radius);
  box-shadow: 0 14px 28px rgba(214, 243, 106, 0.15);
}

.brand h1 {
  margin: 0;
  font-size: 17px;
  line-height: 1.1;
  letter-spacing: 0;
}

.brand p {
  margin: 4px 0 0;
  color: rgba(214, 243, 106, 0.76);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  position: relative;
  width: 100%;
  min-height: 38px;
  padding: 9px 12px 9px 14px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.74);
  text-align: left;
  letter-spacing: 0;
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav button::before {
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 3px;
  content: "";
  background: transparent;
  border-radius: 999px;
}

.nav button:hover {
  color: #ffffff;
  background: rgba(214, 243, 106, 0.08);
  transform: translateX(1px);
}

.nav button.active {
  color: #ffffff;
  background: rgba(214, 243, 106, 0.14);
  box-shadow: inset 0 0 0 1px rgba(214, 243, 106, 0.2);
}

.nav button.active::before {
  background: var(--accent);
}

.sidebar-note {
  padding: 14px;
  margin-top: auto;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  line-height: 1.45;
  background: rgba(214, 243, 106, 0.08);
  border: 1px solid rgba(214, 243, 106, 0.18);
  border-radius: var(--radius);
}

.main {
  min-width: 0;
  padding: 24px 30px 34px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0 18px;
  margin-bottom: 16px;
  background: linear-gradient(180deg, rgba(232, 223, 205, 0.98), rgba(232, 223, 205, 0.82));
  backdrop-filter: blur(18px);
}

.topbar h2 {
  margin: 0;
  color: var(--ink);
  font-size: 25px;
  font-weight: 750;
  line-height: 1.16;
  letter-spacing: 0;
}

.topbar p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.privacy-toggle {
  flex: 0 0 auto;
}

.privacy-toggle.active {
  color: #ffffff;
  background: rgba(28, 39, 19, 0.96);
  border-color: rgba(28, 39, 19, 0.96);
  box-shadow: 0 10px 24px rgba(7, 8, 6, 0.14);
}

.search {
  width: min(320px, 36vw);
  height: 38px;
  padding: 0 13px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: border 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.panel-search {
  width: min(320px, 100%);
}

.panel-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: rgba(152, 185, 40, 0.7);
  outline: none;
  box-shadow: 0 0 0 4px rgba(214, 243, 106, 0.26);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 14px;
  color: #070806;
  font-weight: 680;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  background: var(--accent);
  border: 1px solid rgba(152, 185, 40, 0.72);
  border-radius: var(--radius);
  box-shadow: 0 14px 26px rgba(7, 8, 6, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.42);
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
  background: #e1fb7b;
  box-shadow: 0 18px 34px rgba(7, 8, 6, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.48);
}

.button.secondary {
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.68);
  border-color: var(--line);
  box-shadow: 0 9px 20px rgba(20, 29, 25, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.button.secondary:hover {
  background: #ffffff;
  box-shadow: 0 13px 28px rgba(20, 29, 25, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.compact-button {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 12px;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  cursor: pointer;
  opacity: 0;
}

.text-link {
  display: inline;
  padding: 0;
  color: #354a3e;
  font-weight: 760;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: rgba(53, 74, 62, 0.28);
  text-underline-offset: 3px;
  background: transparent;
  border: 0;
}

.text-link:hover {
  color: #070806;
  text-decoration-color: var(--accent-strong);
}

.button.danger {
  color: #ffffff;
  background: linear-gradient(180deg, #bc4b49, #973836);
  border-color: rgba(167, 58, 58, 0.72);
  box-shadow: 0 10px 20px rgba(187, 75, 75, 0.16);
}

.view {
  display: none;
}

.view.active,
.view.active-view {
  display: block;
}

#dashboard.active,
#dashboard.active-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.kpi {
  position: relative;
  min-height: 124px;
  padding: 18px;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid rgba(212, 200, 179, 0.92);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.kpi::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  content: "";
  background: var(--accent);
}

.kpi:nth-child(2)::before {
  background: #070806;
}

.kpi:nth-child(3)::before {
  background: var(--gold);
}

.kpi:nth-child(4)::before {
  background: #646853;
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 27px;
  font-weight: 760;
  letter-spacing: 0;
}

.kpi small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-toolbar {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
}

.dashboard-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.dashboard-kpi {
  width: 100%;
  min-height: auto;
  text-align: left;
  cursor: pointer;
}

.dashboard-kpi-trend {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.dashboard-kpi:hover {
  transform: translateY(-1px);
  border-color: rgba(152, 185, 40, 0.42);
}

.dashboard-command-grid {
  display: contents;
}

.dashboard-standard-flow {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.dashboard-main-column,
.dashboard-side-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  width: 100%;
}

.dashboard-main-column > .panel,
.dashboard-side-column > .panel,
.dashboard-main-column > .dashboard-panel,
.dashboard-side-column > .dashboard-panel,
.dashboard-main-column > .dashboard-wide-panel,
.dashboard-side-column > .dashboard-wide-panel {
  margin-top: 0;
  align-self: stretch;
  width: 100%;
}

.dashboard-panel,
.dashboard-wide-panel,
.panel {
  height: auto;
  max-width: 100%;
}

.dashboard-main-column > .panel + .panel,
.dashboard-side-column > .panel + .panel,
.dashboard-main-column > .dashboard-panel + .dashboard-panel,
.dashboard-side-column > .dashboard-panel + .dashboard-panel,
.dashboard-main-column > .dashboard-wide-panel + .dashboard-wide-panel,
.dashboard-side-column > .dashboard-wide-panel + .dashboard-wide-panel {
  margin-top: 0;
}

.dashboard-module-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: 16px;
  align-items: start;
}

.dashboard-module-slot {
  position: relative;
  min-width: 0;
  container-type: inline-size;
}

.dashboard-module-slot.size-standard {
  grid-column: span 4;
}

.dashboard-module-slot.size-wide {
  grid-column: span 6;
}

.dashboard-module-slot.size-full {
  grid-column: 1 / -1;
}

.dashboard-module-slot.is-dragging {
  opacity: 0.42;
}

.dashboard-module-slot.drop-target .panel {
  border-color: rgba(152, 185, 40, 0.82);
  box-shadow: 0 0 0 3px rgba(214, 243, 106, 0.22);
}

.dashboard-module-slot.drop-before::before,
.dashboard-module-slot.drop-after::after {
  position: absolute;
  right: 0;
  left: 0;
  z-index: 3;
  height: 3px;
  content: "";
  background: rgba(152, 185, 40, 0.88);
  border-radius: 999px;
}

.dashboard-module-slot.drop-before::before {
  top: -8px;
}

.dashboard-module-slot.drop-after::after {
  bottom: -8px;
}

.dashboard-module-resizer {
  position: absolute;
  right: 6px;
  bottom: 6px;
  z-index: 4;
  width: 24px;
  height: 24px;
  padding: 0;
  cursor: nwse-resize;
  background:
    linear-gradient(135deg, transparent 0 48%, rgba(119, 142, 30, 0.35) 48% 56%, transparent 56% 100%),
    linear-gradient(135deg, transparent 0 62%, rgba(119, 142, 30, 0.62) 62% 70%, transparent 70% 100%);
  border: 0;
  border-radius: 6px;
  opacity: 0.88;
}

.dashboard-module-slot.is-resizing .panel {
  box-shadow: 0 0 0 3px rgba(214, 243, 106, 0.22);
}

.dashboard-drag-handle {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.dashboard-drag-handle:active {
  cursor: grabbing;
}

.dashboard-layout-editor {
  display: grid;
  gap: 10px;
}

.dashboard-layout-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(212, 200, 179, 0.72);
  border-radius: 10px;
}

.dashboard-layout-row.is-hidden {
  opacity: 0.68;
}

.dashboard-layout-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
}

.dashboard-layout-toggle input {
  margin-top: 2px;
}

.dashboard-layout-toggle strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
}

.dashboard-layout-toggle small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.dashboard-size-field {
  min-width: 0;
}

.dashboard-command-grid--charts {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.dashboard-command-grid--footer {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.dashboard-panel,
.dashboard-wide-panel {
  display: grid;
  gap: 14px;
  align-self: start;
  height: auto;
  overflow: hidden;
  max-width: 100%;
  container-type: inline-size;
}

.dashboard-panel > .panel-header,
.dashboard-wide-panel > .panel-header {
  margin-bottom: 0;
}

.dashboard-panel > :last-child,
.dashboard-wide-panel > :last-child {
  margin-bottom: 0;
}

.dashboard-panel .mini-kpi-grid,
.dashboard-wide-panel .mini-kpi-grid {
  margin-bottom: 0;
}

.dashboard-panel .table-wrap,
.dashboard-wide-panel .table-wrap {
  min-width: 0;
  border-radius: 8px;
}

.dashboard-panel table,
.dashboard-wide-panel table {
  min-width: min(640px, 100%);
}

@container (max-width: 560px) {
  .dashboard-panel,
  .dashboard-wide-panel {
    gap: 12px;
  }

  .dashboard-panel .panel-header,
  .dashboard-wide-panel .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-panel .toolbar,
  .dashboard-wide-panel .toolbar {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .dashboard-panel .toolbar .button,
  .dashboard-wide-panel .toolbar .button {
    flex: 0 1 auto;
    min-width: 0;
  }

  .dashboard-panel .mini-kpi-grid,
  .dashboard-wide-panel .mini-kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  }

  .dashboard-panel table,
  .dashboard-wide-panel table {
    min-width: 560px;
  }
}

@container (max-width: 480px) {
  .dashboard-panel,
  .dashboard-wide-panel {
    padding: 14px;
  }

  .dashboard-panel .panel-header h3,
  .dashboard-wide-panel .panel-header h3 {
    font-size: 15px;
  }

  .dashboard-panel .hint,
  .dashboard-wide-panel .hint {
    font-size: 11px;
  }

  .aging-bucket,
  .vintage-bar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    align-items: start;
  }

  .aging-bucket span,
  .vintage-bar span {
    grid-column: 1;
  }

  .aging-bucket > div,
  .vintage-bar > i {
    grid-column: 1 / -1;
    width: 100%;
  }

  .aging-bucket b,
  .vintage-bar b {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
  }

  .vintage-bar small {
    grid-column: 1 / -1;
    justify-self: start;
    text-align: left;
  }

  .dashboard-panel table[data-table-compact="true"],
  .dashboard-wide-panel table[data-table-compact="true"] {
    min-width: 520px;
  }

  .dashboard-panel table[data-table-compact="true"] th,
  .dashboard-panel table[data-table-compact="true"] td,
  .dashboard-wide-panel table[data-table-compact="true"] th,
  .dashboard-wide-panel table[data-table-compact="true"] td {
    padding: 8px 9px;
    font-size: 11px;
  }
}

@container (max-width: 380px) {
  .aging-bucket,
  .vintage-bar {
    grid-template-columns: 1fr;
  }

  .aging-bucket b,
  .vintage-bar b,
  .vintage-bar small {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
    text-align: left;
  }

  .dashboard-panel .mini-kpi-grid,
  .dashboard-wide-panel .mini-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.next30-table-wrap {
  overflow-x: auto;
}

.next30-table {
  min-width: 0;
  table-layout: auto;
}

.next30-table th,
.next30-table td {
  font-size: 12px;
}

.next30-table th {
  white-space: nowrap;
}

.next30-table td {
  vertical-align: middle;
}

.next30-table .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.next30-contract-cell {
  white-space: nowrap;
  font-weight: 700;
}

.next30-client-cell,
.next30-client-cell a {
  overflow-wrap: anywhere;
}

.next30-table .status-pill {
  white-space: nowrap;
}

.payoff-tracker-table-wrap {
  overflow-x: visible;
}

.payoff-tracker-table {
  min-width: 0;
  table-layout: fixed;
}

.payoff-tracker-table th,
.payoff-tracker-table td {
  font-size: 12px;
  vertical-align: middle;
}

.payoff-tracker-table th:nth-child(1),
.payoff-tracker-table td:nth-child(1) {
  width: 42%;
}

.payoff-tracker-table th:nth-child(2),
.payoff-tracker-table td:nth-child(2) {
  width: 34%;
}

.payoff-tracker-table th:nth-child(3),
.payoff-tracker-table td:nth-child(3) {
  width: 120px;
}

.payoff-tracker-table .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.payoff-tracker-party-cell,
.payoff-tracker-window-cell {
  min-width: 0;
}

.payoff-tracker-party-cell strong,
.payoff-tracker-party-cell span,
.payoff-tracker-window-cell span,
.payoff-tracker-window-cell strong {
  display: block;
}

.payoff-tracker-party-cell strong,
.payoff-tracker-window-cell strong {
  color: var(--ink);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.payoff-tracker-party-cell span,
.payoff-tracker-window-cell span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
}

.payoff-tracker-party-cell span {
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.payoff-tracker-window-cell span {
  margin-top: 3px;
}

.mini-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.compact-mini-grid {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.mini-kpi {
  min-width: 0;
  padding: 11px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(212, 200, 179, 0.76);
  border-radius: 8px;
}

.mini-kpi span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  text-transform: uppercase;
}

.mini-kpi strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.mini-kpi small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.action-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.action-tabs article {
  min-width: 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(212, 200, 179, 0.7);
  border-radius: 8px;
}

.priority-card {
  background: rgba(248, 250, 238, 0.92);
  border-color: rgba(152, 185, 40, 0.32);
}

.action-tabs h4 {
  margin: 0 0 10px;
  font-size: 14px;
}

.combo-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(28px, 1fr));
  gap: 6px;
  align-items: end;
  max-width: 100%;
  min-height: 180px;
  overflow: hidden;
  padding: 10px 0;
}

.chart-month {
  display: grid;
  grid-template-rows: 18px 1fr 16px;
  gap: 4px;
  min-height: 144px;
  padding: 0;
  color: var(--muted);
  text-align: center;
  background: transparent;
  border: 0;
}

.chart-month i,
.chart-month b {
  align-self: end;
  width: 36%;
  min-height: 3px;
  margin: 0 auto;
  border-radius: 8px 8px 2px 2px;
}

.chart-month i {
  grid-row: 2;
  margin-right: 50%;
  background: #98b928;
}

.chart-month b {
  grid-row: 2;
  margin-left: 50%;
  background: #354a3e;
}

.chart-month em {
  font-size: 10px;
  font-style: normal;
}

.svg-chart-shell {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  overflow: hidden;
}

.svg-chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.svg-grid-line {
  stroke: rgba(53, 74, 62, 0.12);
  stroke-width: 1;
}

.svg-axis-line {
  stroke: rgba(53, 74, 62, 0.28);
  stroke-width: 1;
}

.svg-axis-label {
  fill: var(--muted);
  font-size: 11px;
}

.svg-axis-value {
  fill: var(--muted);
  font-size: 10px;
}

.cashflow-chart-shell {
  position: relative;
  margin-bottom: 14px;
}

.chart-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 700;
}

.chart-legend span {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.legend-originations {
  background: #98b928;
}

.legend-collections {
  background: #354a3e;
}

.legend-remaining-funding {
  background: #c9b48a;
}

.legend-realized {
  background: #7a4f17;
}

.legend-unrealized {
  background: #354a3e;
}

.cashflow-bar {
  transition: opacity 120ms ease, transform 120ms ease;
}

.cashflow-chart-shell [data-cashflow-tooltip] {
  cursor: pointer;
}

.cashflow-group:hover .cashflow-bar,
.cashflow-group:focus-within .cashflow-bar {
  opacity: 0.88;
}

.aging-donut-layout {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr);
  gap: 10px 12px;
  align-items: start;
}

.aging-donut-shell {
  margin-bottom: 0;
  align-self: center;
}

.aging-donut-segment {
  cursor: pointer;
  transition: opacity 120ms ease, transform 120ms ease;
}

.aging-donut-segment:hover,
.aging-donut-segment:focus {
  opacity: 0.88;
}

.aging-donut-center-label {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.aging-donut-center-value {
  fill: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.aging-donut-legend {
  display: grid;
  gap: 6px;
}

.aging-donut-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  color: var(--ink);
  text-align: left;
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(212, 200, 179, 0.68);
  border-radius: 8px;
}

.aging-donut-row-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1px 7px;
  align-items: center;
  min-width: 0;
}

.aging-donut-swatch {
  grid-row: 1 / span 2;
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.aging-donut-row strong,
.aging-donut-row small,
.aging-donut-row b {
  min-width: 0;
  overflow-wrap: anywhere;
}

.aging-donut-row strong {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.2;
}

.aging-donut-row small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
}

.aging-donut-row b {
  text-align: right;
  font-size: 12px;
  white-space: nowrap;
}

.aging-donut-layout .notice {
  grid-column: 1 / -1;
  margin-top: 0;
  padding: 8px 10px;
  font-size: 11px;
}

@container (max-width: 440px) {
  .aging-donut-layout {
    grid-template-columns: 1fr;
  }

  .aging-donut-shell {
    max-width: 156px;
    justify-self: center;
  }
}

.chart-tooltip {
  position: absolute;
  z-index: 8;
  display: grid;
  gap: 4px;
  max-width: 220px;
  padding: 10px 12px;
  color: #fffdf8;
  pointer-events: none;
  background: rgba(20, 32, 20, 0.96);
  border: 1px solid rgba(152, 185, 40, 0.28);
  border-radius: 10px;
  box-shadow: 0 18px 36px rgba(15, 29, 24, 0.22);
}

.chart-tooltip[hidden] {
  display: none;
}

.chart-tooltip strong,
.chart-tooltip span {
  display: block;
}

.chart-tooltip strong {
  font-size: 12px;
}

.chart-tooltip span {
  font-size: 11px;
  line-height: 1.3;
}

.chart-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.button.secondary.active {
  color: #142014;
  background: rgba(214, 243, 106, 0.76);
  border-color: rgba(152, 185, 40, 0.8);
  box-shadow: 0 12px 24px rgba(20, 29, 25, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.aging-distribution,
.vintage-bars {
  display: grid;
  gap: 10px;
}

.aging-bucket,
.vintage-bar {
  display: grid;
  grid-template-columns: minmax(135px, 0.8fr) minmax(0, 1.4fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 9px;
  color: var(--ink);
  text-align: left;
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(212, 200, 179, 0.68);
  border-radius: 8px;
}

.aging-bucket > *,
.vintage-bar > * {
  min-width: 0;
}

.aging-bucket span,
.vintage-bar span {
  overflow-wrap: anywhere;
}

.aging-bucket b,
.vintage-bar b,
.vintage-bar small {
  justify-self: end;
  text-align: right;
  overflow-wrap: anywhere;
}

.aging-bucket div,
.vintage-bar i {
  height: 9px;
  overflow: hidden;
  background: rgba(53, 74, 62, 0.1);
  border-radius: 999px;
}

.aging-bucket div i,
.vintage-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
}

.bucket-3 div i { background: var(--gold); }
.bucket-4 div i,
.bucket-5 div i { background: #bb4b4b; }

.vintage-bar {
  grid-template-columns: 82px minmax(0, 1fr) auto auto;
  width: 100%;
  font: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.link-button {
  padding: 0;
  color: var(--ink);
  font: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.link-button:hover {
  color: #566c10;
}

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 16px;
}

.grid-two > * {
  min-width: 0;
}

.panel {
  min-width: 0;
  padding: 18px;
  background: var(--panel);
  border: 1px solid rgba(212, 200, 179, 0.95);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.panel + .panel {
  margin-top: 16px;
}

.panel.compact {
  padding: 14px;
}

.panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-header h3,
.panel h3 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 740;
  letter-spacing: 0;
}

.panel-header p,
.panel > p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.eyebrow {
  margin: 0;
  color: #778e1e;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.subhead {
  margin: 4px 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.workspace-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.workspace-head h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.workspace-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 680px;
}

table[data-table-compact="true"] {
  min-width: 0;
}

table[data-table-compact="true"] th,
table[data-table-compact="true"] td {
  padding: 9px 10px;
  overflow-wrap: anywhere;
  white-space: normal;
}

table[data-table-compact="true"] .sort-header {
  font-size: 10px;
  line-height: 1.2;
  white-space: normal;
}

thead {
  background: #f0e8d8;
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f0e8d8;
}

.sort-header {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  min-height: 22px;
  padding: 0;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  background: transparent;
  border: 0;
}

.sort-header:hover,
.sort-header.active {
  color: var(--ink);
}

.sort-header span {
  color: var(--accent-strong);
  font-size: 10px;
  letter-spacing: 0;
}

tbody tr {
  transition: background 140ms ease;
}

tbody tr:hover {
  background: #fffbf1;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td {
  color: var(--ink-soft);
  font-size: 13px;
}

.record-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.record-card strong {
  color: var(--ink);
  font-size: 15px;
}

.record-card small {
  color: var(--muted);
}

.bar-list {
  display: grid;
  gap: 10px;
  max-width: 100%;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.82fr) minmax(0, 0.9fr) minmax(180px, 1.18fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  color: var(--ink);
  text-align: left;
  background: rgba(255, 255, 255, 0.46);
  border: 1px solid rgba(212, 200, 179, 0.72);
  border-radius: 10px;
}

button.bar-row {
  cursor: pointer;
}

button.bar-row:hover,
button.bar-row:focus-visible {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(152, 185, 40, 0.58);
  outline: none;
}

.bar-row.tone-warn {
  border-color: rgba(196, 149, 53, 0.4);
}

.bar-row.tone-danger {
  border-color: rgba(187, 75, 75, 0.4);
}

.bar-row.tone-danger .bar-fill {
  background: #bb4b4b;
}

.bar-row.tone-warn .bar-fill {
  background: #c49535;
}

.bar-row.tone-accent .bar-fill {
  background: #98b928;
}

.bar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.bar-meta strong {
  min-width: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.bar-meta span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-align: right;
  white-space: nowrap;
}

.bar-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.bar-copy small,
.bar-copy em {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 9px;
  overflow: hidden;
  min-width: 0;
  background: #dcd2bd;
  border-radius: 999px;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #1b2115);
  border-radius: inherit;
}

.agenda-list,
.bucket-row {
  display: grid;
  gap: 10px;
}

.bucket-row {
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  margin-bottom: 12px;
}

.bucket-card,
.agenda-item {
  width: 100%;
  color: var(--ink);
  text-align: left;
  background: rgba(255, 255, 255, 0.46);
  border: 1px solid rgba(212, 200, 179, 0.72);
  border-radius: 10px;
}

.bucket-card {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
}

.bucket-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  text-transform: uppercase;
}

.bucket-card strong {
  font-size: 20px;
}

.bucket-card small,
.agenda-item span,
.agenda-item small {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.agenda-item {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
}

.agenda-item strong {
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.bucket-card.tone-warn,
.agenda-item.tone-warn {
  border-color: rgba(196, 149, 53, 0.4);
}

.bucket-card.tone-danger,
.agenda-item.tone-danger {
  border-color: rgba(187, 75, 75, 0.4);
}

.bucket-card:hover,
.bucket-card:focus-visible,
.agenda-item:hover,
.agenda-item:focus-visible {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(152, 185, 40, 0.58);
  outline: none;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  background: #edf2ef;
  border: 1px solid rgba(105, 115, 125, 0.18);
  border-radius: 999px;
}

.status-active,
.status-approved,
.status-funded_active,
.status-signed,
.status-generated,
.status-sent,
.status-complete,
.status-paid,
.status-accepted,
.status-ready {
  color: #25320c;
  background: var(--accent-soft);
  border-color: rgba(152, 185, 40, 0.28);
}

.status-new,
.status-draft,
.status-under_review,
.status-pending,
.status-prepared,
.status-application,
.status-open {
  color: #354a3e;
  background: var(--blue-soft);
  border-color: rgba(53, 74, 62, 0.18);
}

.status-waiting,
.status-requested,
.status-verbal_commitment,
.status-countered,
.status-watchlist,
.status-review_due,
.status-warning {
  color: #8a5d18;
  background: var(--gold-soft);
  border-color: rgba(183, 121, 31, 0.22);
}

.status-declined,
.status-critical,
.status-voided,
.status-cancelled,
.status-overdue,
.status-rejected,
.status-at_risk,
.status-collection_issue,
.status-settlement_risk,
.status-attorney_issue,
.status-client_issue,
.status-other,
.status-auto_markup_paused,
.status-review_overdue {
  color: #9d3939;
  background: var(--rose-soft);
  border-color: rgba(187, 75, 75, 0.22);
}

.status-closed,
.status-repaid,
.status-impaired,
.status-manual_value,
.status-info,
.status-none {
  color: #5e4c73;
  background: var(--plum-soft);
  border-color: rgba(104, 85, 124, 0.18);
}

.intake-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.schedule-preview-panel {
  min-width: 0;
  margin-top: 16px;
}

.schedule-preview-panel table {
  min-width: 0;
}

.step-button {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  align-items: flex-start;
  width: 100%;
  min-width: 140px;
  padding: 12px;
  color: var(--muted-strong);
  text-align: left;
  background: transparent;
  border: 1px solid rgba(105, 115, 125, 0.12);
  border-radius: var(--radius);
  transition: background 150ms ease, color 150ms ease;
}

.step-button span:first-child {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #566c10;
  font-size: 12px;
  font-weight: 800;
  background: #f3f8d6;
  border: 1px solid rgba(152, 185, 40, 0.22);
  border-radius: 999px;
}

.step-button small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.step-button:hover {
  background: #fffbf1;
}

.step-button.active {
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(20, 29, 25, 0.07);
}

.step-button.active span:first-child {
  color: #070806;
  background: var(--accent);
}

.wizard-main {
  min-width: 0;
}

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

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

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border 150ms ease, box-shadow 150ms ease;
}

.field textarea {
  min-height: 98px;
  resize: vertical;
}

.field small {
  color: var(--muted);
  font-size: 12px;
}

.compact-field {
  min-width: 168px;
}

.compact-field span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
}

.intake-actions {
  justify-content: flex-end;
  padding-top: 14px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 10px;
  color: var(--ink-soft);
  font-size: 13px;
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.check-row input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.linked-record-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.linked-record-panel .panel-header {
  margin-bottom: 0;
}

.linked-record-panel .toolbar {
  margin: 0;
}

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

.review-schedule-block {
  margin-top: 18px;
}

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

.settings-stack {
  display: grid;
  gap: 16px;
}

.company-profile-panel {
  gap: 0;
}

.company-profile-toolbar {
  margin: 0;
}

.company-profile-sheet {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 22px;
}

.company-profile-row {
  display: grid;
  grid-template-columns: minmax(140px, 180px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 14px 0;
  border-bottom: 1px solid rgba(212, 200, 179, 0.7);
}

.company-profile-row:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.company-profile-row span {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.company-profile-row strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.company-profile-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  padding-top: 6px;
}

.reports-shell {
  display: grid;
  gap: 16px;
}

.report-hero,
.report-card {
  display: grid;
  gap: 14px;
}

.reports-flow {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  gap: 16px;
  align-items: start;
}

.reports-main-column,
.reports-side-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.report-export-groups {
  display: grid;
  gap: 16px;
}

.statement-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.statement-controls-stacked {
  grid-template-columns: 1fr;
  align-items: start;
}

.statement-control-group {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(220px, 320px);
  gap: 12px;
  align-items: end;
}

.statement-year-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.statement-year-chip {
  min-width: 88px;
  margin: 0;
}

.statement-year-chip.active {
  color: #f7f4ec;
  background: #445735;
  border-color: #445735;
}

.statement-control-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 10px;
  background: #fffbf1;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.statement-control-checkbox span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.statement-export-toolbar {
  margin: 0;
  justify-content: flex-end;
}

.reports-side-column .statement-controls,
.reports-side-column .statement-controls-stacked {
  grid-template-columns: 1fr;
  align-items: start;
}

.reports-side-column .statement-control-group {
  grid-template-columns: 1fr;
}

.reports-side-column .statement-export-toolbar {
  justify-content: flex-start;
}

.reports-side-column .statement-control-checkbox {
  width: 100%;
}

.statement-preview-card {
  display: grid;
  gap: 14px;
  padding: 14px 16px;
  background: #fffbf1;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.statement-preview-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(212, 200, 179, 0.85);
}

.statement-preview-header strong {
  color: var(--ink);
  font-size: 15px;
}

.statement-preview-header span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.statement-preview-lines,
.statement-year-preview {
  display: grid;
  gap: 8px;
}

.statement-preview-line,
.statement-year-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(212, 200, 179, 0.65);
}

.statement-preview-line:last-child,
.statement-year-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.statement-preview-line span,
.statement-year-row span {
  color: var(--ink);
  font-size: 13px;
}

.statement-preview-line strong,
.statement-year-row strong {
  color: var(--ink);
  font-size: 14px;
  white-space: nowrap;
}

.statement-preview-line.total {
  padding-top: 8px;
  border-top: 2px solid rgba(168, 152, 124, 0.9);
}

.statement-preview-line.total span,
.statement-preview-line.total strong {
  font-weight: 800;
}

.report-export-groups h4 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 13px;
}

.template-settings-toolbar {
  display: grid;
  gap: 14px;
}

.template-settings-toolbar-main {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 12px;
  align-items: end;
}

.template-settings-select {
  margin: 0;
}

.template-settings-actions {
  margin: 0;
  justify-content: flex-end;
}

.compact-detail-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pricing-template-readonly {
  display: grid;
  gap: 18px;
}

.pricing-template-schedule {
  margin-top: 2px;
}

.pricing-template-inline-edit {
  display: grid;
  gap: 18px;
}

.pricing-template-edit-controls {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(180px, 220px) minmax(0, 1fr);
  gap: 12px;
  align-items: end;
}

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

.template-period-list div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: #fffbf1;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.template-period-list span,
.field-note {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.template-period-list strong {
  color: var(--ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.pricing-template-form {
  display: grid;
  gap: 12px;
}

.template-tag-manager {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.template-tag-manager-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.template-tag-manager-header h4 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}

.docusign-settings-shell {
  display: grid;
  gap: 16px;
}

.docusign-settings-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  background: linear-gradient(135deg, #fffdf7 0%, #f6f0df 100%);
  border: 1px solid rgba(202, 187, 154, 0.75);
  border-radius: 12px;
}

.docusign-settings-hero strong {
  display: block;
  color: var(--ink);
  font-size: 18px;
}

.docusign-settings-hero-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.docusign-settings-hero p {
  margin: 6px 0 0;
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.5;
}

.docusign-env-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.docusign-env-pill.sandbox {
  color: #7a4f17;
  background: rgba(234, 197, 120, 0.28);
  border: 1px solid rgba(190, 142, 61, 0.38);
}

.docusign-env-pill.production {
  color: #2d5d3d;
  background: rgba(167, 224, 187, 0.28);
  border: 1px solid rgba(76, 145, 100, 0.34);
}

.docusign-settings-actions {
  margin: 0;
  justify-content: flex-end;
}

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

.docusign-settings-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  background: #fffbf1;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.docusign-settings-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.docusign-settings-card-header h4 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}

.docusign-settings-card > .hint {
  margin: 0;
  line-height: 1.5;
}

.docusign-identity-block,
.docusign-flow-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(212, 200, 179, 0.72);
  border-radius: 10px;
}

.docusign-identity-block strong,
.docusign-flow-item strong {
  font-size: 13px;
  color: var(--ink);
}

.docusign-identity-block span,
.docusign-flow-item span {
  font-size: 12px;
  color: var(--muted-strong);
  line-height: 1.45;
}

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

.docusign-mini-stats > div {
  display: grid;
  gap: 4px;
  padding: 10px 11px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(212, 200, 179, 0.68);
  border-radius: 10px;
}

.docusign-mini-stats span {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.docusign-mini-stats strong {
  font-size: 13px;
  color: var(--ink);
}

.docusign-flow-list {
  display: grid;
  gap: 10px;
}

.docusign-connection-note {
  margin: 0;
}

.signature-pipeline-list {
  display: grid;
  gap: 10px;
}

.signature-pipeline-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(212, 200, 179, 0.72);
  border-radius: 12px;
}

.signature-pipeline-main {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 0;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
}

.signature-pipeline-main strong {
  font-size: 13px;
  color: var(--ink);
}

.signature-pipeline-main span,
.signature-pipeline-main small {
  color: var(--muted-strong);
}

.signature-pipeline-main span {
  font-size: 12px;
}

.signature-pipeline-main small {
  font-size: 11px;
}

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

.template-tag-builder-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

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

.template-tag-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(110px, 0.65fr) minmax(110px, 0.65fr) minmax(160px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  background: #fffbf1;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.template-tag-row span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.template-tag-row strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.template-tag-actions {
  display: inline-flex;
  gap: 8px;
  justify-content: flex-end;
}

.notice.subtle {
  background: #fffefa;
}

.wizard-picker-panel {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.wizard-picker-panel .panel-header {
  margin-bottom: 0;
}

.wizard-picker-panel .panel-header h3 {
  font-size: 15px;
}

.wizard-picker-panel .hint {
  font-size: 12px;
}

.wizard-picker-panel .table-wrap {
  border-radius: 10px;
}

.wizard-picker-panel table[data-table-compact="true"] th,
.wizard-picker-panel table[data-table-compact="true"] td {
  padding: 7px 9px;
  font-size: 12px;
}

.wizard-picker-panel table[data-table-compact="true"] th:last-child,
.wizard-picker-panel table[data-table-compact="true"] td:last-child {
  width: 92px;
  text-align: right;
}

.wizard-picker-row {
  cursor: pointer;
}

.wizard-picker-row:focus-visible {
  outline: 2px solid rgba(122, 79, 23, 0.34);
  outline-offset: -2px;
}

.wizard-picker-row:hover td {
  background: rgba(201, 180, 138, 0.16);
}

.wizard-picker-row.selected td {
  background: rgba(214, 243, 106, 0.26);
}

.wizard-picker-link {
  font-weight: 700;
}

.template-placer {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

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

.template-placer-header h4,
.template-placer-inspector h5 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}

.template-placer-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: stretch;
}

.template-placer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: start;
}

.template-placer-pages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.template-placer-page-wrap {
  display: grid;
  gap: 8px;
}

.template-placer-page-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.template-placer-page {
  position: relative;
  width: 100%;
  aspect-ratio: 8.5 / 11;
  background: #fff;
  border: 1px solid rgba(30, 41, 59, 0.14);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  cursor: crosshair;
}

.template-placer-page-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(15, 23, 42, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.06) 1px, transparent 1px);
  background-size: 8.333% 8.333%;
  pointer-events: none;
}

.template-placement-node {
  --role-fill: rgba(214, 243, 106, 0.88);
  --role-border: rgba(7, 8, 6, 0.2);
  --role-shadow: rgba(15, 23, 42, 0.14);
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  color: #0f172a;
  background: var(--role-fill);
  border: 1px solid var(--role-border);
  border-radius: 6px;
  box-shadow: 0 2px 8px var(--role-shadow);
  cursor: grab;
  overflow: hidden;
  text-align: center;
  flex-direction: column;
  gap: 1px;
}

.template-placement-node.selected {
  outline: 2px solid #7c3aed;
  outline-offset: 1px;
}

.template-placement-node-label {
  display: block;
  width: 100%;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-placement-node-group {
  display: block;
  max-width: 100%;
  color: rgba(15, 23, 42, 0.72);
  font-size: 8px;
  font-style: normal;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-placement-node.type-checkbox,
.template-placement-node.type-radio_option {
  border-style: dashed;
}

.template-placement-node.type-text,
.template-placement-node.type-date_signed {
  box-shadow: inset 0 0 0 1px rgba(120, 53, 15, 0.12), 0 2px 8px var(--role-shadow);
}

.template-placement-node.type-initial {
  border-radius: 999px;
}

.template-segmented-button.role-client,
.template-tool-card.role-client.active,
.template-active-tool.role-client,
.template-placement-node.role-client {
  --role-fill: rgba(214, 243, 106, 0.88);
  --role-border: rgba(92, 126, 11, 0.34);
  --role-shadow: rgba(92, 126, 11, 0.18);
}

.template-segmented-button.role-attorney,
.template-tool-card.role-attorney.active,
.template-active-tool.role-attorney,
.template-placement-node.role-attorney {
  --role-fill: rgba(191, 219, 254, 0.92);
  --role-border: rgba(59, 130, 246, 0.28);
  --role-shadow: rgba(59, 130, 246, 0.16);
}

.template-segmented-button.role-purchaser,
.template-tool-card.role-purchaser.active,
.template-active-tool.role-purchaser,
.template-placement-node.role-purchaser {
  --role-fill: rgba(244, 208, 255, 0.92);
  --role-border: rgba(168, 85, 247, 0.28);
  --role-shadow: rgba(168, 85, 247, 0.16);
}

.template-placer-inspector {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #fffbf1;
  border: 1px solid var(--line);
  border-radius: 8px;
  position: static;
  align-content: start;
  min-height: min-content;
  padding-bottom: 22px;
}

.template-placer-inspector .toolbar {
  position: sticky;
  bottom: 0;
  padding-top: 10px;
  background: linear-gradient(to bottom, rgba(255, 251, 241, 0), #fffbf1 24px);
}

.wide-dialog-body {
  width: 100%;
  min-height: 0;
}

.dialog-card.template-placer-modal {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-content: stretch;
  overflow: hidden;
  padding: 14px 16px;
  border-radius: 0;
  border: 0;
  box-shadow: none;
}

.dialog-card.template-placer-modal footer {
  margin-top: 12px;
  padding-top: 12px;
}

.template-placer-dialog {
  display: grid;
  grid-template-columns: 520px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  min-height: 0;
  height: 100%;
}

.template-preview-panel,
.template-placer-panel {
  display: grid;
  gap: 12px;
  min-height: 0;
}

.template-placer-panel {
  grid-template-rows: auto auto minmax(0, 1fr);
  max-height: 100%;
  overflow: auto;
  padding-right: 10px;
  padding-bottom: 20px;
}

.template-placer-toolbar {
  display: grid;
  grid-auto-flow: row;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  background: #fffbf1;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.template-tool-section {
  display: grid;
  gap: 8px;
}

.template-toolbar-row {
  display: grid;
  gap: 8px;
}

.template-tool-metadata {
  gap: 12px;
}

.template-mode-segmented {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.template-segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.template-segmented-button {
  --role-fill: #fff;
  --role-border: var(--line);
  min-height: 36px;
  padding: 8px 10px;
  color: var(--ink-soft);
  background: var(--role-fill);
  border: 1px solid var(--role-border);
  border-radius: 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.template-segmented-button.active {
  color: #0f172a;
  background: var(--role-fill);
  border-color: var(--role-border);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42);
}

.template-zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.template-zoom-readout {
  min-width: 58px;
  text-align: center;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

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

.template-tool-card {
  --role-fill: #fff;
  --role-border: var(--line);
  display: grid;
  gap: 4px;
  min-height: 72px;
  padding: 12px;
  text-align: left;
  color: var(--ink-soft);
  background: var(--role-fill);
  border: 1px solid var(--role-border);
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}

.template-tool-card strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.2;
}

.template-tool-card small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.template-tool-card.active {
  background: var(--role-fill);
  border-color: var(--role-border);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.1);
}

.template-active-tool {
  --role-fill: #fff;
  --role-border: rgba(7, 8, 6, 0.14);
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  background: var(--role-fill);
  border: 1px solid var(--role-border);
  border-radius: 8px;
}

.template-active-tool span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.template-active-tool strong {
  color: var(--ink);
  font-size: 13px;
}

.template-active-tool small {
  color: var(--muted);
  font-size: 11px;
}

.template-preview-panel-header {
  display: grid;
  gap: 4px;
}

.template-preview-panel-header h4 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}

.template-preview-surface {
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: auto;
  padding: 18px;
  background: #f7f3ea;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.pdf-surface {
  display: grid;
  gap: 18px;
  justify-items: center;
}

.template-preview-page-wrap {
  display: grid;
  gap: 8px;
  width: 100%;
  justify-items: center;
}

.template-preview-page-shell {
  position: relative;
  display: inline-block;
  background: #fff;
  border: 1px solid rgba(30, 41, 59, 0.12);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.template-preview-canvas {
  display: block;
  background: #fff;
}

.template-preview-page-overlay {
  position: absolute;
  inset: 0;
  cursor: crosshair;
}

.template-preview-page-overlay.select-mode {
  cursor: default;
}

.table-input {
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  color: var(--ink);
  background: #fffefa;
  border: 1px solid rgba(212, 200, 179, 0.95);
  border-radius: 8px;
}

.detail-grid div {
  padding: 12px;
  background: #fffbf1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 14px;
}

.action-menu {
  position: relative;
}

.action-menu summary {
  list-style: none;
}

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

.action-menu-list {
  position: absolute;
  right: 0;
  z-index: 15;
  display: grid;
  gap: 8px;
  width: min(260px, calc(100vw - 32px));
  min-width: 190px;
  max-width: calc(100vw - 32px);
  padding: 10px;
  margin-top: 8px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(15, 29, 24, 0.16);
}

.action-menu-list .button {
  width: 100%;
  justify-content: flex-start;
}

.application-queue .table-wrap,
.application-queue table,
.application-queue tbody,
.application-queue tr,
.application-queue td {
  overflow: visible;
}

.application-queue .table-wrap {
  position: relative;
}

.application-queue td:last-child {
  width: 1%;
  white-space: nowrap;
}

.detail-dialog-body {
  display: grid;
  gap: 16px;
}

.detail-dialog-body .kpi-grid {
  margin-bottom: 0;
}

.detail-kpis .kpi {
  min-height: 104px;
  padding: 14px;
}

.detail-kpis .kpi strong {
  font-size: 21px;
}

.detail-section {
  display: grid;
  gap: 10px;
}

.document-preview {
  width: 100%;
  min-height: min(72vh, 820px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}

.document-preview-frame {
  width: 100%;
  min-height: min(72vh, 820px);
  border: 0;
  background: #fff;
}

.risk-valuation-card {
  padding: 14px;
  background: rgba(255, 250, 240, 0.72);
  border: 1px solid rgba(183, 121, 31, 0.18);
  border-radius: var(--radius);
}

.risk-valuation-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.detail-section h4 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 780;
}

.json-preview {
  width: 100%;
  min-height: min(54vh, 520px);
  padding: 12px;
  overflow: auto;
  color: var(--ink-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre;
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.import-tabs,
.import-preview,
.mapping-editor {
  display: grid;
  gap: 14px;
}

.import-tabs {
  margin-top: 16px;
}

.import-preview {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.import-preview h4 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
}

.mapping-editor {
  padding: 14px;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.mapping-editor h4 {
  margin: 0;
  font-size: 14px;
}

.mapping-preview {
  min-height: 130px;
}

.import-preview code {
  display: block;
  max-width: 520px;
  max-height: 120px;
  overflow: auto;
  color: var(--ink-soft);
  font-size: 11px;
  white-space: pre-wrap;
}

.activity-feed {
  display: grid;
  gap: 10px;
}

.activity-item,
.activity-feed article {
  display: grid;
  gap: 2px;
  padding: 12px;
  background: #fffbf1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.activity-item strong,
.activity-feed article strong {
  color: var(--ink);
}

.activity-item small,
.activity-feed article span {
  color: var(--muted);
  font-size: 12px;
}

.activity-feed article p {
  margin: 0;
  color: var(--muted-strong);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.activity-feed article strong,
.activity-feed article span {
  overflow-wrap: anywhere;
}

.notice,
.empty {
  padding: 14px;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.7);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

.notice strong,
.empty strong {
  color: var(--ink);
}

.notice.good {
  color: #25320c;
  background: var(--accent-soft);
  border-color: rgba(152, 185, 40, 0.28);
}

.notice.warn {
  color: #8a5d18;
  background: var(--gold-soft);
  border-color: rgba(183, 121, 31, 0.22);
}

.notice.danger {
  color: #9d3939;
  background: var(--rose-soft);
  border-color: rgba(187, 75, 75, 0.22);
}

.compact-empty {
  padding: 10px 12px;
  font-size: 12px;
}

.record-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}

.record-card dl {
  display: grid;
  grid-template-columns: minmax(120px, 0.42fr) minmax(0, 0.58fr);
  gap: 8px 12px;
  margin: 2px 0 0;
}

.record-card dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.record-card dd {
  min-width: 0;
  margin: 0;
  color: var(--ink-soft);
  text-align: right;
  overflow-wrap: anywhere;
}

dialog {
  width: min(820px, calc(100vw - 36px));
  max-height: min(86vh, 820px);
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
}

dialog.template-placer-shell {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
}

dialog::backdrop {
  background: rgba(10, 18, 16, 0.42);
  backdrop-filter: blur(10px);
}

.dialog-card {
  padding: 20px;
  overflow: auto;
  background: var(--panel-solid);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.dialog-card header,
.dialog-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-card header {
  margin-bottom: 16px;
}

.dialog-header-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.dialog-header-main h3 {
  min-width: 0;
}

.dialog-card footer {
  justify-content: flex-end;
  padding-top: 16px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.dialog-card h3 {
  margin: 0;
  font-size: 19px;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--muted-strong);
  font-weight: 800;
  background: #f5f7f3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.icon-button:hover {
  color: var(--ink);
  background: #ffffff;
}

.topbar-icon-button {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.74);
}

.topbar-icon-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topbar-icon-button svg circle {
  fill: currentColor;
  stroke: none;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(10, 18, 16, 0.42);
  backdrop-filter: blur(10px);
}

.dialog-backdrop.active {
  display: flex;
}

.dialog {
  width: min(780px, 100%);
  max-height: min(86vh, 780px);
  padding: 20px;
  overflow: auto;
  background: var(--panel-solid);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.dialog-header h3 {
  margin: 0;
  font-size: 19px;
}

.dialog-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  display: none;
  max-width: 360px;
  padding: 12px 14px;
  color: #ffffff;
  background: rgba(13, 45, 40, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.toast.active {
  display: block;
}

::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(105, 115, 125, 0.34);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}

@media (max-width: 1280px) {
  .main {
    padding: 20px 22px 28px;
  }

  .company-profile-sheet {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .review-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1180px) {
  .dashboard-standard-flow {
    grid-template-columns: 1fr;
  }

  .reports-flow {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-two {
    grid-template-columns: 1fr;
  }

  .template-settings-toolbar-main,
  .template-tag-manager-header,
  .template-placer-header,
  .docusign-settings-hero,
  .company-profile-form,
  .pricing-template-edit-controls,
  .statement-controls,
  .statement-controls-stacked,
  .statement-control-group {
    grid-template-columns: 1fr;
  }

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

  .template-tag-builder-grid,
  .template-tag-row,
  .template-placer-layout,
  .template-placer-dialog,
  .template-placer-dialog-layout {
    grid-template-columns: 1fr;
  }

  .template-tool-palette,
  .template-segmented {
    grid-template-columns: 1fr;
  }

  .template-tag-actions {
    justify-content: flex-start;
  }

  .template-placer-inspector {
    position: static;
  }

  .intake-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .detail-grid,
  .compact-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    z-index: 20;
    height: auto;
    max-height: none;
    padding: 10px 14px 12px;
    gap: 10px;
    overflow: hidden;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 14px 36px rgba(15, 29, 24, 0.18);
  }

  .brand {
    flex-shrink: 0;
    padding: 0;
    border-bottom: 0;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    font-size: 16px;
  }

  .brand h1 {
    font-size: 15px;
  }

  .brand p,
  .sidebar-note {
    display: none;
  }

  .nav {
    display: flex;
    gap: 8px;
    padding-bottom: 2px;
    margin: 0 -4px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav button {
    flex: 0 0 auto;
    width: auto;
    min-height: 34px;
    padding: 8px 11px;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
  }

  .nav button::before {
    display: none;
  }

  .nav button:hover {
    transform: none;
  }

  .main {
    padding: 18px;
  }

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

  .actions {
    flex-wrap: wrap;
  }

  .search {
    width: 100%;
  }

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

  .schedule-preview-panel {
    grid-column: auto;
  }

  .intake-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-panel,
  .auth-copy {
    padding: 24px 18px;
  }

  .auth-row {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 14px;
  }

  .statement-preview-header,
  .statement-preview-line,
  .statement-year-row {
    grid-template-columns: 1fr;
  }

  .statement-preview-header {
    display: grid;
  }

  .statement-preview-header span,
  .statement-preview-line strong,
  .statement-year-row strong {
    text-align: left;
  }

  .dashboard-toolbar {
    display: block;
  }

  .dashboard-strip,
  .action-tabs {
    grid-template-columns: 1fr;
  }

  .mini-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-module-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-module-slot.size-standard,
  .dashboard-module-slot.size-wide,
  .dashboard-module-slot.size-full {
    grid-column: auto;
  }

  .aging-bucket,
  .vintage-bar {
    grid-template-columns: 1fr;
  }

  .company-profile-sheet,
  .detail-grid,
  .compact-detail-grid,
  .review-grid {
    grid-template-columns: 1fr;
  }

  .company-profile-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .action-menu-list {
    right: auto;
    left: 0;
  }

  .next30-table th,
  .next30-table td {
    font-size: 11px;
  }

  .payoff-tracker-table th,
  .payoff-tracker-table td {
    font-size: 11px;
    padding: 8px 8px;
  }

  .next30-table th,
  .next30-table td {
    padding: 8px 8px;
  }

  .next30-table th:nth-child(3),
  .next30-table td:nth-child(3) {
    min-width: 132px;
  }

  .next30-table .status-pill {
    padding-inline: 8px;
  }
}

@container (max-width: 700px) {
  .next30-table th,
  .next30-table td {
    padding: 7px 7px;
  }

  .payoff-tracker-table th,
  .payoff-tracker-table td {
    padding: 7px 7px;
  }

  .payoff-tracker-table th:nth-child(3),
  .payoff-tracker-table td:nth-child(3) {
    width: 108px;
  }
}

@media (min-width: 721px) and (max-width: 1040px) {
  .dashboard-module-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .dashboard-module-slot.size-standard {
    grid-column: span 3;
  }

  .dashboard-module-slot.size-wide {
    grid-column: span 6;
  }
}

@media (max-width: 680px) {
  .intake-steps,
  .form-grid,
  .company-profile-form,
  .detail-grid,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-layout-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: 1fr;
  }

  .step-button {
    min-width: 0;
  }

  .sidebar {
    padding: 9px 10px 10px;
  }

  .nav {
    display: flex;
    grid-template-columns: none;
  }

  .nav button {
    min-height: 32px;
    padding: 7px 10px;
    font-size: 12px;
  }

  .main {
    padding: 14px;
  }

  .workspace-head,
  .panel-header,
  .dialog-card header,
  .dialog-card footer {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar h2 {
    font-size: 22px;
  }

  .panel,
  .kpi {
    padding: 14px;
  }

  table {
    min-width: 500px;
  }

  th,
  td {
    padding: 10px 11px;
  }

  .toolbar .button,
  .toolbar .file-button,
  .workspace-head .button {
    width: 100%;
  }

  .dashboard-panel .toolbar .button,
  .dashboard-wide-panel .toolbar .button,
  .dashboard-panel .toolbar .file-button,
  .dashboard-wide-panel .toolbar .file-button {
    width: auto;
  }

  .toolbar .button {
    white-space: normal;
  }

  .bar-row {
    grid-template-columns: 1fr;
  }

  dialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }

  .dialog-card {
    padding: 14px;
  }

  .detail-dialog-body .table-wrap {
    margin: 0 -2px;
    width: calc(100% + 4px);
  }

  .json-preview {
    min-height: 58vh;
    font-size: 11px;
  }

  .dialog-footer {
    flex-direction: column-reverse;
  }

  .dialog-footer .button {
    width: 100%;
  }
}

@container (max-width: 540px) {
  .bar-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .bar-meta {
    display: grid;
    justify-content: stretch;
  }

  .bar-meta span {
    text-align: left;
  }

  .bar-copy small,
  .bar-copy em {
    white-space: normal;
  }

  .action-tabs {
    grid-template-columns: 1fr;
  }

  .aging-bucket,
  .vintage-bar {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  body::before,
  .sidebar,
  .topbar,
  .button,
  .dialog-backdrop,
  .toast {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .main {
    padding: 0;
  }

  .view {
    display: block !important;
  }

  .panel,
  .kpi,
  .table-wrap {
    box-shadow: none;
    break-inside: avoid;
  }
}
