:root {
  --bg: #090b0e;
  --surface: #12151b;
  --surface-muted: #15181e;
  --ink: #f8fafc;
  --ink-soft: #cbd5e1;
  --muted: #64748b;
  --line: #1e242f;
  --line-strong: #2d3748;
  --primary: #2563eb;
  --primary-strong: #3b82f6;
  --primary-soft: rgba(37, 99, 235, 0.12);
  --success: #10b981;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --radius: 10px;
  --sidebar: 220px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible {
  outline: 3px solid rgba(122, 167, 255, .32);
  outline-offset: 2px;
}
.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 30;
  background: var(--ink);
  color: white;
  padding: 8px 12px;
  border-radius: var(--radius);
}
.skip-link:focus { top: 12px; }
.app-frame {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100dvh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 20px 14px;
  background: #1c1e21;
  color: #e9eef2;
}
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  color: white;
}
.brand-lockup:hover { text-decoration: none; }
.brand-lockup strong { display: block; font-size: 17px; letter-spacing: 0; }
.brand-lockup small { display: block; color: #9fb0bf; margin-top: 1px; }
.login-brand { color: var(--ink); padding: 0; margin-bottom: 18px; }
.login-brand small { color: var(--muted); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--primary);
}
.nav-stack { display: grid; gap: 6px; }
.nav-stack a,
.nav-button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius);
  color: #d9e2ea;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.nav-stack a:hover,
.nav-button:hover {
  background: rgba(255, 255, 255, .08);
  color: white;
  text-decoration: none;
}
.nav-stack a > span:not(.nav-count),
.nav-button span {
  min-width: 0;
}
.nav-count {
  margin-left: auto;
  min-width: 24px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  color: #9fb0bf;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.nav-stack a:hover .nav-count {
  color: white;
  background: rgba(255, 255, 255, .14);
}
.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.12);
}
.main {
  min-width: 0;
  padding: 28px 30px 48px;
}
.messages { margin-bottom: 16px; }
.message {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid rgba(103, 211, 145, .34);
  border-radius: var(--radius);
  background: rgba(103, 211, 145, .12);
  color: #d6f7e1;
}
.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.context-hero,
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
}
.context-hero {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: 26px; line-height: 1.2; }
h2 { margin-bottom: 14px; font-size: 18px; line-height: 1.3; }
p { color: var(--muted); }
.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.meta-line span,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13px;
}
.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.button:hover,
button:hover { text-decoration: none; border-color: var(--primary); }
.button.primary,
button.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}
.button.primary:hover,
button.primary:hover { background: var(--primary-strong); }
.button.secondary {
  background: var(--surface);
  color: var(--ink-soft);
}
.button.danger {
  border-color: rgba(255, 107, 99, .42);
  background: var(--danger);
  color: white;
}
.button.danger:hover {
  border-color: var(--danger);
  background: #e65a53;
}
.button.is-success { background: var(--success); border-color: var(--success); color: white; }
.has-modal {
  overflow: hidden;
}
.confirm-dialog[hidden] {
  display: none;
}
.confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
}
.confirm-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .62);
  backdrop-filter: blur(4px);
}
.confirm-dialog-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 18px;
  width: min(440px, 100%);
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #191c21;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .52);
}
.confirm-dialog-panel h2 {
  margin: 2px 0 8px;
  font-size: 20px;
}
.confirm-dialog-message {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.65;
}
.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
input, select, textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: #101214;
  color: var(--ink);
  font: inherit;
}
input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
}
textarea { min-height: 104px; resize: vertical; }
label { color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.toolbar input { max-width: 560px; }
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.data-table th,
.data-table td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.data-table th {
  background: #232529;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.table-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 700;
}
.table-action:hover { text-decoration: none; background: #263858; }
.inline-delete-form { margin: 0; }
.table-action.danger {
  border: 1px solid rgba(255, 107, 99, .28);
  background: rgba(255, 107, 99, .1);
  color: var(--danger);
  font: inherit;
  cursor: pointer;
}
.table-action.danger:hover {
  background: rgba(255, 107, 99, .18);
  text-decoration: none;
}
.empty {
  padding: 34px;
  text-align: center;
  color: var(--muted);
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.summary-grid div,
.copy-panel,
.record-panel,
.section-block,
.form-panel,
.login-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.summary-grid div { padding: 16px; }
.section-block { padding: 18px; }
.inline-payment-form {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #15181c;
}
.inline-payment-grid {
  display: grid;
  grid-template-columns: minmax(150px, 1.25fr) repeat(5, minmax(102px, .82fr)) minmax(120px, .76fr);
  gap: 8px;
  align-items: end;
}
.compact-payment-entry-grid {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #171a1f;
}
.inline-payment-form label {
  font-size: 12px;
  line-height: 1.15;
}
.inline-payment-form input,
.inline-payment-form textarea {
  min-height: 34px;
  border-radius: 7px;
}
.inline-payment-form textarea {
  min-height: 38px;
  max-height: 66px;
}
.inline-notes-field {
  grid-column: span 6;
}
.inline-payment-actions {
  display: flex;
  justify-content: flex-end;
}
.inline-payment-actions .button {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
}
.percent-input-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #101214;
}
.percent-input-shell:focus-within {
  border-color: var(--primary-strong);
  box-shadow: 0 0 0 3px rgba(72, 126, 255, .16);
}
.percent-input-shell input {
  min-height: 32px;
  border: 0;
  background: transparent;
}
.percent-input-shell input:focus {
  box-shadow: none;
}
.percent-input-shell span {
  padding-right: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.payment-schedule-table {
  table-layout: fixed;
}
.payment-schedule-table th,
.payment-schedule-table td {
  height: 58px;
  padding-block: 10px;
  vertical-align: middle;
}
.payment-schedule-row {
  cursor: pointer;
}
.payment-schedule-row:hover td {
  background: rgba(122, 167, 255, .06);
}
.payment-schedule-row:focus-visible {
  outline: 2px solid var(--primary-strong);
  outline-offset: -2px;
}
.payment-node-cell strong {
  display: block;
  color: var(--ink);
  line-height: 1.25;
}
.payment-amount-stack {
  display: grid;
  align-content: center;
  gap: 4px;
  min-height: 38px;
  justify-items: end;
  line-height: 1.15;
}
.payment-amount-stack strong {
  color: var(--ink);
  font-weight: 800;
}
.payment-amount-stack span {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.payment-table-actions {
  display: table-cell;
  overflow: visible;
  text-align: center;
  vertical-align: middle;
}
.payment-row-menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0;
}
.payment-row-menu .row-action-trigger {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 8px;
}
.payment-row-menu .row-action-panel {
  min-width: 156px;
  padding: 6px;
}
.payment-row-menu .row-menu-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  column-gap: 9px;
  align-items: center;
  box-sizing: border-box;
  height: 34px;
  min-height: 34px;
  padding: 0 9px;
  justify-content: start;
}
.payment-row-menu .row-menu-item .icon {
  width: 17px;
  height: 17px;
  justify-self: center;
}
.row-menu-item.danger {
  border: 0;
  background: transparent;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}
.row-menu-item.danger:hover {
  background: rgba(255, 107, 99, .12);
}
.contract-detail-panel {
  display: grid;
  gap: 12px;
}
.contract-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #1c1e21, #191b1f);
  box-shadow: var(--shadow);
}
.contract-detail-head h1 {
  margin: 2px 0 6px;
  font-size: 24px;
  line-height: 1.1;
}
.contract-detail-head .actions {
  flex: 0 0 auto;
}
.detail-title-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}
.detail-title-kicker .eyebrow {
  margin: 0;
}
.detail-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #15181c;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
}
.detail-back-link:hover,
.detail-back-link:focus-visible {
  border-color: var(--primary-strong);
  background: var(--primary-soft);
  color: var(--ink);
  text-decoration: none;
}
.detail-back-link .icon {
  width: 15px;
  height: 15px;
}
.contract-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
  gap: 12px;
  align-items: stretch;
}
.compact-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
  gap: 12px;
  align-items: stretch;
}
.detail-metrics-rail {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.detail-metric,
.detail-side-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #15181c;
}
.detail-metric {
  min-height: 70px;
  padding: 10px 8px;
}
.detail-metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.detail-metric strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.compact-detail-card {
  min-height: 0;
  padding: 14px;
}
.contract-detail-grid .contract-service-section {
  grid-column: 1;
}
.contract-detail-grid .attachment-section {
  grid-column: 2;
  grid-row: 1 / span 2;
}
.mini-section-head {
  display: grid;
  gap: 2px;
  margin-bottom: 10px;
}
.mini-section-head h2 {
  margin: 2px 0 0;
  font-size: 18px;
  line-height: 1.2;
}
.attachment-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.contract-detail-panel + .section-block {
  margin-top: 12px;
}
.summary-grid span,
.metric-row span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}
.summary-grid strong,
.metric-row strong {
  display: block;
  margin-top: 3px;
  font-size: 23px;
  font-variant-numeric: tabular-nums;
}
.invoice-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, .8fr);
  gap: 18px;
  align-items: start;
}
.payment-detail-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}
.payment-detail-edit-form {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #15181c;
}
.payment-detail-edit-grid {
  grid-template-columns: minmax(180px, 1.1fr) minmax(150px, .8fr) minmax(150px, .8fr);
}
.compact-payment-metrics {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}
.compact-payment-metrics .detail-metric {
  min-height: 74px;
}
.compact-payment-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}
.compact-payment-meta div {
  min-height: 74px;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #15181c;
}
.compact-payment-meta span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.compact-payment-meta strong {
  display: block;
  margin-top: 6px;
}
.payment-workbench-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 12px;
}
.payment-workbench-card {
  display: grid;
  gap: 12px;
  align-content: start;
}
.payment-workbench-card .mini-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.payment-workbench-card .mini-section-head .button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 10px;
}
.invoice-profile-hover {
  position: relative;
  display: inline-flex;
}
.invoice-profile-trigger {
  white-space: nowrap;
}
.invoice-profile-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  display: none;
  width: min(440px, calc(100vw - 42px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #191c21;
  box-shadow: 0 18px 38px rgba(0, 0, 0, .42);
}
.invoice-profile-hover:hover .invoice-profile-popover,
.invoice-profile-hover:focus-within .invoice-profile-popover {
  display: grid;
  gap: 9px;
}
.invoice-profile-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.invoice-profile-popover-head h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
}
.invoice-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  margin: 0;
}
.invoice-profile-grid div {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #101214;
}
.invoice-profile-grid dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.invoice-profile-grid dd {
  min-width: 0;
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.35;
}
.inline-action-form {
  display: grid;
  gap: 10px;
}
.inline-action-form[hidden] {
  display: none;
}
.compact-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  align-items: end;
}
.collection-action-grid input[type="file"] {
  padding: 8px;
  background: #101214;
}
.record-stack {
  display: grid;
  gap: 8px;
}
.workbench-record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #15181c;
}
.record-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.record-main strong {
  color: var(--ink);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}
.record-main span,
.record-main small {
  color: var(--muted);
  font-size: 12px;
}
.record-side {
  display: flex;
  gap: 6px;
  align-items: center;
}
.record-side form {
  margin: 0;
}
.record-side .icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.record-side .icon-button .icon {
  width: 17px;
  height: 17px;
}
.danger-icon {
  color: #ff6b6b;
}
.record-attachments {
  grid-column: 1 / -1;
  padding-top: 2px;
}
.record-edit-form {
  grid-column: 1 / -1;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #171a1f;
}
.record-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.record-edit-actions .button {
  min-height: 34px;
  padding: 7px 10px;
}
.compact-file-card {
  min-height: 48px;
  padding: 9px;
}
.compact-empty {
  min-height: 44px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #15181c;
}
.instant-upload-form {
  margin: 0;
}
.compact-attachment-grid {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}
.payment-notes-strip {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin-top: 12px;
}
.payment-notes-strip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.payment-notes-strip strong {
  color: var(--ink-soft);
  font-weight: 600;
}
.copy-panel,
.record-panel { padding: 18px; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.copy-textarea {
  min-height: 420px;
  font-family: "Cascadia Mono", Consolas, "Microsoft YaHei", monospace;
  line-height: 1.7;
  background: #101214;
}
.helper {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.record-panel {
  position: sticky;
  top: 24px;
}
.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.metric-row strong { margin: 0; font-size: 20px; text-align: right; }
.stack-form,
.form-panel {
  display: grid;
  gap: 14px;
}
.form-panel { max-width: 820px; padding: 20px; }
.stack-form > div,
.form-panel > div {
  display: grid;
  gap: 6px;
}
.compact-hero {
  padding: 12px 16px;
  margin-bottom: 12px;
}
.compact-hero h1 {
  font-size: 22px;
}
.compact-hero p {
  font-size: 14px;
}
.compact-hero p:last-child {
  margin-bottom: 0;
}
.compact-form {
  width: min(100%, 1440px);
  max-width: none;
  padding: 14px;
}
.contract-entry-layout,
.customer-entry-layout,
.payment-entry-layout {
  display: grid;
  grid-template-columns: minmax(430px, .78fr) minmax(560px, 1fr);
  gap: 12px;
  align-items: start;
}
.contract-entry-main,
.contract-entry-side,
.customer-entry-main,
.customer-entry-side,
.payment-entry-main,
.payment-entry-side {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #17191c;
}
.contract-entry-side,
.customer-entry-side,
.payment-entry-side {
  position: sticky;
  top: 20px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}
.contract-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.customer-form-grid,
.payment-form-grid,
.collection-form-grid,
.invoice-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.two-column-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.contract-name-field input {
  max-width: 100%;
}
.payment-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.form-field {
  display: grid;
  gap: 5px;
}
.customer-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 6px;
  align-items: center;
}
.compact-add-button {
  width: 96px;
  min-height: 36px;
  padding-inline: 8px;
  white-space: nowrap;
}
.inline-customer-modal[hidden] {
  display: none;
}
.inline-customer-modal {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  padding: 24px;
}
.inline-customer-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(0, 0, 0, .62);
  backdrop-filter: blur(4px);
}
.inline-customer-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  width: min(760px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #17191c;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .52);
}
.inline-customer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0;
}
.checkbox-field {
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  align-content: center;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #101214;
}
.checkbox-field label {
  margin: 0;
}
.field-span-2 {
  grid-column: span 2;
}
.field-span-all {
  grid-column: 1 / -1;
}
.compact-form textarea {
  min-height: 58px;
  resize: vertical;
}
.compact-form .service-content-field textarea {
  min-height: 120px;
  max-height: 180px;
}
.compact-form .notes-field textarea {
  min-height: 76px;
  max-height: 130px;
}
.compact-form input,
.compact-form select {
  min-height: 36px;
}
.compact-form input[type="checkbox"] {
  min-height: 18px;
}
.compact-form label {
  font-size: 12px;
}
.contract-preview-panel {
  display: grid;
  gap: 10px;
  min-height: min(720px, calc(100vh - 330px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #111417;
}
.contract-preview-panel .mini-section-head {
  margin-bottom: 0;
}
.contract-preview-surface {
  position: relative;
  display: grid;
  min-height: min(650px, calc(100vh - 410px));
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #0d0f11;
}
.contract-preview-empty,
.contract-preview-fallback {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}
.contract-preview-empty .icon {
  width: 42px;
  height: 42px;
  color: var(--primary-strong);
}
.contract-preview-fallback strong {
  max-width: 100%;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.contract-preview-surface iframe,
.contract-preview-surface img {
  width: 100%;
  height: 100%;
  min-height: min(650px, calc(100vh - 410px));
  border: 0;
}
.contract-preview-surface img {
  object-fit: contain;
  padding: 10px;
}
.compact-form .form-actions {
  margin-top: 10px;
}
.errorlist {
  margin: 0;
  padding-left: 18px;
  color: var(--danger);
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.sticky-actions {
  position: sticky;
  bottom: 0;
  margin: 4px -18px -18px;
  padding: 14px 18px;
  background: rgba(28, 30, 33, .94);
  border-top: 1px solid var(--line);
}
.login-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 20% 0, rgba(122, 167, 255, .18), transparent 28%), #111315;
}
.login-shell {
  display: grid;
  place-items: center;
  width: min(100%, 520px);
}
.login-panel,
.login-card {
  width: min(420px, calc(100vw - 32px));
  padding: 24px;
}
.login-panel {
  border: 1px solid #30343a;
  border-radius: 8px;
  background: #1c1e21;
  box-shadow: 0 22px 70px rgba(0, 0, 0, .34);
}
.login-panel .login-brand {
  color: #f1f3f5;
}
.login-panel .login-brand small,
.login-panel p {
  color: #9aa0a6;
}
.login-panel .brand-mark {
  background: #315fbd;
}
.login-heading {
  padding-bottom: 18px;
}
.login-heading h1 {
  margin-bottom: 0;
  color: #f1f3f5;
  font-size: 24px;
}
.login-form label {
  color: #c8d0da;
}
.login-form input {
  border-color: #30343a;
  background: #101214;
  color: #f1f3f5;
}
.login-form input:focus {
  border-color: #7aa7ff;
  outline: 3px solid rgba(122, 167, 255, .22);
}
.login-submit {
  margin-top: 4px;
  border-color: #3d70d8;
  background: #315fbd;
}
.login-card h1 { margin-bottom: 18px; }
.full { width: 100%; }

.workspace-page {
  display: grid;
  gap: 16px;
}
.workspace-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.workspace-page-head h1 {
  color: var(--ink);
}
.workspace-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 10px;
  max-width: 760px;
}
.customer-ledger {
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 0;
  overflow: auto;
}
.customer-row {
  display: grid;
  grid-template-columns:
    minmax(160px, 1.5fr)
    minmax(76px, .75fr)
    minmax(90px, .8fr)
    minmax(120px, 1fr)
    minmax(112px, .9fr)
    minmax(130px, 1.1fr)
    minmax(56px, .45fr);
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 56px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.customer-row:not(.customer-row-head):hover {
  border-color: #7aa7ff;
  background: #20242a;
}
.customer-row[data-row-href] {
  cursor: pointer;
}
.customer-row[data-row-href]:focus-visible {
  outline: 2px solid #7aa7ff;
  outline-offset: 2px;
}
.customer-row-head {
  min-height: 34px;
  padding-block: 7px;
  background: #17191c;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 2;
}
.customer-cell {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 13px;
}
.customer-title-cell {
  display: grid;
  gap: 2px;
}
.customer-title-cell strong {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.customer-actions {
  position: relative;
  display: flex;
  gap: 5px;
  justify-content: flex-end;
  overflow: visible;
}
.customer-actions .table-action {
  min-height: 28px;
  padding: 4px 7px;
  font-size: 12px;
}
.payment-ledger {
  display: grid;
  gap: 8px;
  align-content: start;
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px 16px 28px;
  overflow: auto;
}
.payment-row {
  display: grid;
  grid-template-columns:
    minmax(138px, 1.35fr)
    minmax(96px, .9fr)
    minmax(128px, 1.1fr)
    minmax(76px, .65fr)
    minmax(112px, .95fr)
    minmax(84px, .75fr)
    minmax(82px, .72fr)
    minmax(72px, .65fr)
    minmax(64px, .55fr)
    minmax(40px, .35fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--ew-line);
  border-radius: 8px;
  background: var(--ew-panel);
  color: var(--ew-text);
}
.payment-row:not(.payment-row-head):hover {
  border-color: var(--ew-accent);
  background: #20242a;
}
.payment-row[data-row-href] {
  cursor: pointer;
}
.payment-row[data-row-href]:focus-visible {
  outline: 2px solid var(--ew-accent);
  outline-offset: 2px;
}
.payment-row-head {
  min-height: 34px;
  padding-block: 7px;
  background: #17191c;
  color: var(--ew-muted);
  font-size: 12px;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 2;
}
.payment-cell {
  min-width: 0;
  color: var(--ew-muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.payment-title-cell {
  display: grid;
  gap: 2px;
}
.payment-title-cell strong {
  overflow: hidden;
  color: var(--ew-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.payment-money {
  display: grid;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}
.payment-money span,
.payment-progress span {
  color: var(--ew-muted);
  font-size: 13px;
}
.payment-progress {
  display: grid;
  gap: 5px;
}
.payment-actions {
  position: relative;
  display: flex;
  justify-content: flex-end;
  overflow: visible;
}
.workspace-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  align-items: stretch;
}
.workspace-card {
  display: grid;
  gap: 14px;
  min-height: 210px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.workspace-card:hover {
  border-color: #7aa7ff;
  background: #20242a;
}
.card-main {
  display: grid;
  gap: 4px;
}
.card-main h2 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
}
.card-main p {
  margin: 0;
}
.card-fields {
  display: grid;
  gap: 0;
  margin: 0;
}
.card-fields div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.card-fields dt,
.payment-amounts span,
.card-footer {
  color: var(--muted);
}
.card-fields dd {
  min-width: 0;
  margin: 0;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}
.card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: auto;
}
.payment-grid {
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}
.payment-amounts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.payment-amounts div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #17191c;
}
.payment-amounts span,
.payment-amounts strong {
  display: block;
}
.payment-amounts strong {
  margin-top: 3px;
  color: white;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}
.card-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  font-size: 13px;
}

@media (max-width: 980px) {
  .app-frame { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }
  .brand-lockup { min-width: max-content; }
  .nav-stack { display: flex; }
  .sidebar-footer { margin-left: auto; margin-top: 0; padding-top: 0; border-top: 0; }
  .main { padding: 20px 16px 36px; }
  .invoice-layout { grid-template-columns: 1fr; }
  .record-panel { position: static; }
  .contract-entry-layout,
  .customer-entry-layout,
  .payment-entry-layout { grid-template-columns: 1fr; }
  .contract-entry-side,
  .customer-entry-side,
  .payment-entry-side { position: static; }
  .contract-detail-head { flex-direction: column; align-items: stretch; }
  .contract-detail-grid,
  .compact-detail-grid { grid-template-columns: 1fr; }
  .contract-detail-grid .contract-service-section,
  .contract-detail-grid .attachment-section {
    grid-column: auto;
    grid-row: auto;
  }
  .detail-metrics-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inline-payment-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .inline-notes-field { grid-column: span 2; }
}

@media (max-width: 720px) {
  .context-hero,
  .page-head,
  .toolbar,
  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .detail-metrics-rail { grid-template-columns: 1fr; }
  .compact-payment-metrics,
  .compact-payment-meta,
  .compact-action-grid,
  .invoice-profile-grid { grid-template-columns: 1fr; }
  .compact-info-list { grid-template-columns: 1fr; }
  .compact-related-list a { grid-template-columns: 1fr; }
  .compact-related-list em { text-align: left; }
  .two-column-form-grid { grid-template-columns: 1fr; }
  .inline-payment-grid { grid-template-columns: 1fr; }
  .inline-notes-field { grid-column: auto; }
  .data-table { display: block; overflow-x: auto; }
  .copy-textarea { min-height: 300px; }
}

/* Eagle-inspired contract workspace */
body:has(.eagle-workspace) {
  background: #111315;
  color: #e8eaed;
  overflow: hidden;
}
body:has(.eagle-workspace) .app-frame {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100dvh;
}
body:has(.eagle-workspace) .sidebar {
  display: flex;
}
body:has(.eagle-workspace) .main {
  padding: 0;
  width: auto;
  min-height: 100dvh;
}
.eagle-workspace {
  --ew-bg: #111315;
  --ew-panel: #1c1e21;
  --ew-panel-soft: #232529;
  --ew-panel-lift: #2d3035;
  --ew-line: #30343a;
  --ew-text: #f1f3f5;
  --ew-muted: #9aa0a6;
  --ew-faint: #6f767f;
  --ew-accent: #7aa7ff;
  --ew-good: #67d391;
  --ew-warn: #f2b45b;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  background: var(--ew-bg);
  color: var(--ew-text);
}
.workspace-center {
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--ew-line);
}
.workspace-toolbar h2 {
  margin: 0;
  color: var(--ew-text);
  font-size: 17px;
  line-height: 1.25;
}
.eagle-workspace .eyebrow {
  color: var(--ew-muted);
  font-size: 12px;
}
.workspace-center {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #141619;
}
.workspace-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--ew-line);
  background: #15171a;
}
.eagle-workspace .button {
  border-color: var(--ew-line);
  background: var(--ew-panel-soft);
  color: var(--ew-text);
}
.eagle-workspace .button.primary {
  border-color: #3d70d8;
  background: #315fbd;
  color: white;
}
.eagle-workspace .button.secondary:hover,
.eagle-workspace .button.primary:hover {
  border-color: var(--ew-accent);
}
.asset-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--ew-line);
}
.asset-search input {
  min-height: 38px;
  border-color: var(--ew-line);
  background: #101214;
  color: var(--ew-text);
}
.icon-button {
  min-height: 38px;
  padding: 0;
  border-color: var(--ew-line);
  background: var(--ew-panel-soft);
  color: var(--ew-muted);
}
.contract-ledger {
  display: grid;
  gap: 8px;
  align-content: start;
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px 16px 28px;
  overflow: auto;
}
.contract-row {
  display: grid;
  position: relative;
  z-index: 1;
  grid-template-columns:
    minmax(150px, 1.6fr)
    minmax(90px, 1fr)
    minmax(78px, .85fr)
    minmax(78px, .7fr)
    minmax(42px, .35fr)
    minmax(72px, .75fr)
    minmax(70px, .7fr)
    minmax(104px, 1fr)
    minmax(80px, .8fr)
    minmax(48px, .45fr)
    minmax(40px, .35fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--ew-line);
  border-radius: 8px;
  background: var(--ew-panel);
  color: var(--ew-text);
}
.contract-row:not(.contract-row-head):hover,
.contract-row:not(.contract-row-head):focus-within {
  border-color: var(--ew-accent);
  background: #20242a;
  z-index: 50 !important;
}
.contract-row[data-row-href] {
  cursor: pointer;
}
.contract-row[data-row-href]:focus-visible {
  outline: 2px solid var(--ew-accent);
  outline-offset: 2px;
}
.contract-row-head {
  min-height: 34px;
  padding-block: 7px;
  background: #17191c;
  color: var(--ew-muted);
  font-size: 12px;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 2;
}
.contract-cell {
  min-width: 0;
  color: var(--ew-muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.contract-title-cell {
  display: grid;
  gap: 2px;
}
.contract-title-cell strong {
  color: var(--ew-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.contract-customer-link {
  display: inline-block;
  max-width: 100%;
  color: var(--ew-text);
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}
.contract-customer-link:hover,
.contract-customer-link:focus-visible {
  color: var(--ew-accent);
  text-decoration: none;
}
.contract-service-cell {
  overflow: visible;
}
.service-preview {
  position: relative;
  display: inline-flex;
}
.service-preview-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--ew-line);
  border-radius: 8px;
  background: #17191c;
  color: var(--ew-muted);
  cursor: help;
}
.service-preview-trigger .icon {
  width: 16px;
  height: 16px;
}
.service-preview-trigger:hover,
.service-preview:focus-within .service-preview-trigger {
  border-color: var(--ew-accent);
  background: #202a3c;
  color: var(--ew-text);
}
.service-preview-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  z-index: 24;
  display: none;
  width: min(300px, 42vw);
  max-height: 180px;
  transform: translateX(-50%);
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid var(--ew-line);
  border-radius: 8px;
  background: #191c21;
  color: var(--ew-text);
  box-shadow: 0 18px 38px rgba(0, 0, 0, .42);
}
.service-preview:hover .service-preview-popover,
.service-preview:focus-within .service-preview-popover {
  display: block;
}
.service-preview-popover strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ew-accent);
  font-size: 12px;
}
.service-preview-popover p {
  margin: 0;
  color: var(--ew-text);
  font-size: 13px;
  line-height: 1.65;
  white-space: normal;
}
.service-preview-empty {
  color: var(--ew-muted);
}
.asset-code,
.contract-money span,
.contract-progress span {
  color: var(--ew-muted);
  font-size: 13px;
}
.asset-code {
  color: var(--ew-accent);
  font-family: "Cascadia Mono", Consolas, monospace;
}
.contract-money {
  display: grid;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}
.progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #0d0f11;
}
.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ew-accent), var(--ew-good));
}
.eagle-workspace .status-pill {
  min-height: 22px;
  border-color: var(--ew-line);
  background: var(--ew-panel-soft);
  color: var(--ew-muted);
}
.contract-progress {
  display: grid;
  gap: 5px;
  overflow: visible;
}
.payment-progress-hover {
  position: relative;
  display: grid;
  gap: 5px;
  cursor: default;
}
.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.payment-count-inline {
  color: var(--ew-muted);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.payment-count-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  display: none;
  min-width: 260px;
  max-width: 320px;
  max-height: 230px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--ew-line);
  border-radius: 8px;
  background: #191c21;
  color: var(--ew-text);
  box-shadow: 0 18px 38px rgba(0, 0, 0, .42);
}
.payment-progress-hover:hover .payment-count-popover,
.payment-progress-hover:focus-within .payment-count-popover {
  display: grid;
  gap: 2px;
}
.payment-count-popover strong {
  display: block;
  padding: 5px 7px 4px;
  color: var(--ew-accent);
  font-size: 12px;
}
.payment-count-popover-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 10px;
  align-items: center;
  min-height: 38px;
  padding: 7px 8px;
  border-radius: 6px;
  color: var(--ew-text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.payment-count-popover-item:hover,
.payment-count-popover-item:focus-visible {
  background: #263858;
  outline: none;
  text-decoration: none;
}
.payment-count-popover-item span,
.payment-count-popover-item em,
.payment-count-popover-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.payment-count-popover-item em,
.payment-count-popover-item small {
  color: var(--ew-muted);
  font-style: normal;
  font-variant-numeric: tabular-nums;
}
.payment-count-popover-item small {
  grid-column: 1 / -1;
}
.payment-count-popover p {
  margin: 0;
  padding: 7px;
  color: var(--ew-muted);
  font-size: 12px;
}
.attachment-cell {
  overflow: visible;
}
.attachment-hover {
  position: relative;
  display: inline-flex;
}
.attachment-count {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 4px 7px;
  border: 1px solid var(--ew-line);
  border-radius: 999px;
  background: #17191c;
  color: var(--ew-muted);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.attachment-count .icon {
  width: 15px;
  height: 15px;
}
.attachment-count:hover,
.attachment-hover:focus-within .attachment-count {
  border-color: var(--ew-accent);
  color: var(--ew-text);
}
.attachment-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  display: none;
  min-width: 220px;
  max-width: 300px;
  padding: 6px;
  border: 1px solid var(--ew-line);
  border-radius: 8px;
  background: #191c21;
  box-shadow: 0 18px 38px rgba(0, 0, 0, .42);
}
.attachment-hover:hover .attachment-popover,
.attachment-hover:focus-within .attachment-popover {
  display: grid;
  gap: 2px;
}
.attachment-popover-item,
.attachment-card {
  border: 0;
  color: var(--ew-text);
  text-align: left;
  cursor: pointer;
}
.attachment-popover-item {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 32px;
  padding: 7px 8px;
  border-radius: 6px;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}
.attachment-popover-item:hover,
.attachment-popover-item:focus-visible {
  background: #263858;
  outline: none;
}
.attachment-popover-item .icon {
  width: 16px;
  height: 16px;
  color: var(--ew-muted);
}
.attachment-popover-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-none {
  color: var(--ew-muted);
  font-size: 12px;
}
.contract-actions {
  position: relative;
  display: flex;
  justify-content: flex-end;
  overflow: visible;
}
.row-action-menu {
  position: relative;
}
.row-action-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--ew-line);
  border-radius: 8px;
  background: #17191c;
  color: var(--ew-muted);
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, color .16s ease;
}
.row-action-trigger:hover,
.row-action-trigger:focus-visible,
.row-action-menu.is-open .row-action-trigger {
  border-color: var(--ew-accent);
  background: #202a3c;
  color: var(--ew-text);
  outline: none;
}
.row-action-trigger .icon {
  width: 17px;
  height: 17px;
}
.row-action-panel {
  position: absolute;
  top: calc(100% + 6px) !important;
  right: 0;
  left: auto !important;
  z-index: 100;
  display: none;
  min-width: 164px;
  padding: 7px;
  border: 1px solid var(--ew-line);
  border-radius: 8px;
  background: #191c21;
  box-shadow: 0 18px 38px rgba(0, 0, 0, .42);
}
.row-action-menu.is-open .row-action-panel {
  display: grid;
  gap: 2px;
}
.row-menu-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  min-height: 34px;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ew-text);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}
.row-menu-item:hover {
  background: #263858;
  text-decoration: none;
}
.row-menu-item .icon {
  width: 16px;
  height: 16px;
  color: var(--ew-muted);
}
.row-upload-form {
  margin: 0;
  width: 100%;
  justify-self: stretch;
}
.contract-file-field input[type="file"] {
  padding: 8px;
  background: #101214;
}
.invoice-file-field input[type="file"] {
  padding: 8px;
  background: #101214;
}
.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.attachment-section {
  margin-bottom: 18px;
}
.contract-service-section {
  margin-bottom: 18px;
}
.contract-service-content {
  min-height: 44px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #15181c;
  color: var(--ink-soft);
  line-height: 1.7;
}
.attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.attachment-upload-form {
  margin: 0;
}
.attachment-upload-button {
  cursor: pointer;
}
.invoice-attachment-section {
  margin-top: 12px;
}
.invoice-attachment-list {
  display: grid;
  gap: 10px;
}
.invoice-attachment-record {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #15181c;
}
.invoice-attachment-record > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-soft);
}
.invoice-attachment-record > div:first-child span {
  color: var(--muted);
  font-size: 13px;
}
.attachment-card {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 4px 10px;
  align-items: center;
  min-height: 62px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #15181c;
}
.attachment-card-with-action {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.attachment-card-link {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 4px 10px;
  align-items: center;
  min-width: 0;
  color: var(--ink);
}
.attachment-card-link:hover {
  text-decoration: none;
}
.attachment-delete-form {
  margin: 0;
}
.attachment-delete-form .icon-button {
  width: 32px;
  min-height: 32px;
}
.attachment-card:hover,
.attachment-card:focus-visible {
  border-color: var(--primary);
  background: #20242a;
  outline: none;
}
.attachment-card-link .icon {
  grid-row: span 2;
  color: var(--primary-strong);
}
.attachment-card-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}
.attachment-card-link small {
  color: var(--muted);
}
.attachment-empty {
  padding: 18px;
}
.compact-detail-card .contract-service-content {
  max-height: 132px;
  overflow: auto;
}
.compact-detail-card .attachment-grid {
  grid-template-columns: 1fr;
  max-height: 230px;
  overflow: auto;
  padding-right: 2px;
}
.compact-detail-card .attachment-card {
  min-height: 48px;
  padding: 9px 10px;
}
.compact-detail-card .attachment-empty {
  padding: 14px;
}
.compact-info-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.compact-info-list div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #15181c;
}
.compact-info-list span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.compact-info-list strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compact-related-list {
  display: grid;
  gap: 8px;
  max-height: 210px;
  overflow: auto;
}
.compact-related-list a {
  display: grid;
  grid-template-columns: minmax(88px, .7fr) minmax(0, 1fr) minmax(80px, .6fr);
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #15181c;
  color: var(--ink);
}
.compact-related-list a:hover {
  border-color: var(--primary-strong);
  background: #20242a;
  text-decoration: none;
}
.compact-related-list span {
  color: var(--primary-strong);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}
.compact-related-list strong,
.compact-related-list em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compact-related-list em {
  color: var(--muted);
  font-style: normal;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.attachment-modal {
  width: min(980px, calc(100vw - 48px));
  height: min(760px, calc(100vh - 48px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #15181c;
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .55);
}
.attachment-modal::backdrop {
  background: rgba(0, 0, 0, .58);
}
.attachment-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.attachment-preview {
  height: calc(100% - 55px);
  background: #0d0f11;
}
.attachment-preview iframe,
.attachment-preview img {
  width: 100%;
  height: 100%;
  border: 0;
}
.attachment-preview img {
  object-fit: contain;
  padding: 14px;
}
.attachment-file-fallback {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  height: 100%;
  padding: 24px;
  text-align: center;
}
.attachment-file-fallback .icon {
  width: 44px;
  height: 44px;
  color: var(--primary-strong);
}
.asset-empty {
  border: 1px dashed var(--ew-line);
  background: transparent;
  color: var(--ew-muted);
}

@media (max-width: 760px) {
  .eagle-workspace {
    grid-template-columns: 1fr;
  }
  .contract-ledger {
    padding-inline: 12px;
  }
  .customer-select-row {
    grid-template-columns: 1fr;
  }
  .compact-add-button {
    width: 100%;
  }
}

/* ==========================================
   Slate Obsidian Redesign Enhancement Layer 
   ========================================== */

/* Precision Typography Alignment for Financial Data */
.num, 
.contract-money, 
.payment-money, 
.record-main strong, 
.payment-amounts strong, 
.asset-code,
.card-fields em {
  font-variant-numeric: tabular-nums !important;
  letter-spacing: -0.015em !important;
}

/* Sophisticated Soft Semantic Pill Styling */
.status-pill {
  font-weight: 600 !important;
  transition: all 0.2s ease !important;
}

.status-pill.success, 
.status-pill.paid, 
.status-pill.已结清, 
.status-pill.已付款, 
.status-pill.已收款 {
  border-color: rgba(16, 185, 129, 0.24) !important;
  background: rgba(16, 185, 129, 0.11) !important;
  color: #10b981 !important;
}

.status-pill.warning, 
.status-pill.pending, 
.status-pill.待处理, 
.status-pill.未付款, 
.status-pill.部分收款, 
.status-pill.未收款 {
  border-color: rgba(217, 119, 6, 0.24) !important;
  background: rgba(217, 119, 6, 0.09) !important;
  color: #f59e0b !important;
}

/* Smooth Table Row Animations & Steady Elevations */
.contract-row, 
.payment-row, 
.customer-row {
  transition: background-color 0.22s, border-color 0.22s !important;
}

.workbench-record,
.workspace-card {
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.22s, border-color 0.22s, box-shadow 0.22s !important;
}

.contract-row:not(.contract-row-head):hover,
.payment-row:not(.payment-row-head):hover,
.customer-row:not(.customer-row-head):hover {
  border-color: var(--line-strong) !important;
  background: var(--surface) !important;
}

.workbench-record:hover,
.workspace-card:hover {
  border-color: var(--line-strong) !important;
  background: var(--surface) !important;
  transform: translateY(-1.5px);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.42) !important;
}

/* Frosted Glassmorphism for Contextual Popovers */
.service-preview-popover, 
.payment-count-popover, 
.attachment-popover, 
.invoice-profile-popover {
  border: 1px solid var(--line-strong) !important;
  background: rgba(18, 21, 27, 0.95) !important;
  backdrop-filter: blur(12px) !important;
  box-shadow: var(--shadow) !important;
  border-radius: var(--radius) !important;
}

/* Seamless Invisible Hover Bridges attached to parents to eliminate gaps and keep popovers open */
.payment-progress-hover::after,
.attachment-hover::after,
.invoice-profile-hover::after,
.service-preview::after {
  content: "";
  position: absolute;
  bottom: -16px;
  left: -20px;
  right: -20px;
  height: 18px;
  background: transparent;
  z-index: 5;
  pointer-events: auto;
}

.payment-progress-hover::after {
  left: -220px;
  right: -24px;
  height: 22px;
}

/* Elite Frosted Backdrop and Dialogue Panel redressed */
.confirm-dialog-backdrop, 
.inline-customer-backdrop {
  background: rgba(4, 5, 6, 0.78) !important;
  backdrop-filter: blur(5px) !important;
}

.confirm-dialog-panel, 
.inline-customer-panel {
  background: #0f1217 !important;
  border: 1px solid var(--line-strong) !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.58) !important;
  border-radius: var(--radius) !important;
}

/* Elegant Form Focus and Action Transitions */
input, select, textarea {
  transition: border-color 0.2s, box-shadow 0.2s !important;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary-strong) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
}

.button, button {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.button.primary, button.primary {
  border-color: var(--primary) !important;
  background: var(--primary) !important;
}

.button.primary:hover, button.primary:hover {
  background: var(--primary-strong) !important;
  border-color: var(--primary-strong) !important;
}

/* ==========================================
   Semantic Financial Amount Coloring Layers
   ========================================== */

/* 1. Contract & Payment List: Primary, Received, and Unreceived distinctions */
.contract-row .contract-cell.contract-money:not(div div),
.payment-row .payment-cell.payment-money:not(div div) {
  color: var(--ink) !important;
  font-weight: 700 !important;
}

.contract-row .contract-cell.contract-money span:nth-child(1),
.payment-row .payment-cell.payment-money span:nth-child(1) {
  color: var(--success) !important;
  font-weight: 600 !important;
}

.contract-row .contract-cell.contract-money span:nth-child(2),
.payment-row .payment-cell.payment-money span:nth-child(2) {
  color: var(--warning) !important;
  font-weight: 600 !important;
}

/* 2. Contract Detail Metrics Rail: Semantic highlight */
.detail-metrics-rail .detail-metric:nth-child(1) strong {
  color: var(--ink) !important;
}
.detail-metrics-rail .detail-metric:nth-child(2) strong {
  color: var(--success) !important;
}
.detail-metrics-rail .detail-metric:nth-child(3) strong {
  color: var(--warning) !important;
}
.detail-metrics-rail .detail-metric:nth-child(4) strong {
  color: var(--primary-strong) !important;
}

/* 3. Payment Detail Metrics Rail: Semantic highlight */
.compact-payment-metrics .detail-metric:nth-child(1) strong {
  color: var(--ink) !important;
}
.compact-payment-metrics .detail-metric:nth-child(2) strong {
  color: var(--success) !important;
}
.compact-payment-metrics .detail-metric:nth-child(3) strong {
  color: var(--warning) !important;
}
.compact-payment-metrics .detail-metric:nth-child(4) strong {
  color: var(--primary-strong) !important;
}

/* 4. Payment Schedule Table inside Contract Detail Page: Color columns */
.payment-schedule-table tbody tr td:nth-child(2) strong {
  color: var(--ink) !important;
}
.payment-schedule-table tbody tr td:nth-child(3) {
  color: var(--success) !important;
  font-weight: 600 !important;
}
.payment-schedule-table tbody tr td:nth-child(4) {
  color: var(--warning) !important;
  font-weight: 600 !important;
}

/* 5. Workbench payment collection record: Safe Emerald highlight */
.workbench-record .record-main strong {
  color: var(--success) !important;
  font-weight: 700 !important;
}
.workbench-record.invoice-record-card .record-main strong {
  color: var(--ink-soft) !important;
}

/* 6. Typography Overflow Safeguards - Prevent metric cards and layout slots from blowing up */
.payment-amount-stack strong,
.record-main strong,
.workbench-record strong,
.asset-code {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-metric {
  min-width: 0;
}


/* ==========================================
   Premium Drag & Drop Upload Zone Styling 
   ========================================== */
.premium-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 120px;
  padding: 18px;
  background: #13171f !important;
  border: 1.5px dashed var(--line-strong) !important;
  border-radius: var(--radius) !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.premium-dropzone:hover,
.premium-dropzone.is-dragover {
  border-color: var(--primary-strong) !important;
  background: #191e28 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  transition: opacity 0.2s ease;
}

.dropzone-icon {
  width: 32px !important;
  height: 32px !important;
  color: var(--muted) !important;
  transition: transform 0.25s ease, color 0.25s ease;
}

.premium-dropzone:hover .dropzone-icon {
  transform: translateY(-2px);
  color: var(--primary-strong) !important;
}

.dropzone-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.dropzone-subtext {
  font-size: 11px;
  color: var(--muted);
}

/* Local Upload Previews */
.dropzone-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  animation: fadeIn 0.3s ease;
}

.dropzone-preview-image {
  max-width: 180px;
  max-height: 90px;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  border: 1px solid var(--line-strong);
}

.dropzone-preview-filename {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--success);
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropzone-preview-pdf-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 4px;
  color: #ef4444;
  font-size: 12px;
  font-weight: 600;
}

.dropzone-preview-pdf-badge .icon {
  width: 16px;
  height: 16px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   Premium Receipt/Attachment Thumbnail Card Grid
   ========================================== */
.receipt-thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  width: 100%;
  margin-top: 8px;
}

.receipt-thumbnail-card {
  display: flex;
  flex-direction: column;
  height: 140px;
  background: #11141b !important;
  border: 1px solid var(--line) !important;
  border-radius: 4px !important;
  overflow: hidden;
  position: relative;
  transition: all 0.22s ease !important;
}

.receipt-thumbnail-card:hover {
  border-color: var(--line-strong) !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4) !important;
  transform: translateY(-1px);
}

.receipt-thumbnail-link {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #090b0e;
  position: relative;
}

.receipt-thumbnail-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.receipt-thumbnail-card:hover .receipt-thumbnail-img {
  transform: scale(1.05);
}

.pdf-icon-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 100%;
}

.pdf-svg {
  width: 32px !important;
  height: 32px !important;
  color: #ef4444 !important;
}

.pdf-label {
  font-size: 10px;
  font-weight: 700;
  color: #ef4444;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.receipt-thumbnail-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px;
  background: #161a23;
  border-top: 1px solid var(--line);
  height: 32px;
  box-sizing: border-box;
}

.receipt-thumbnail-meta .filename {
  font-size: 10px;
  color: var(--ink-soft);
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
}

.receipt-thumbnail-meta .attachment-delete-form {
  margin: 0;
  display: flex;
}

.receipt-thumbnail-meta .danger-icon {
  width: 20px !important;
  height: 20px !important;
  padding: 2px !important;
}

/* ==========================================
   Fluid Lightbox Overlay
   ========================================== */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 7, 10, 0.85) !important;
  backdrop-filter: blur(12px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox-overlay.is-active {
  opacity: 1;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.9);
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.lightbox-overlay.is-active .lightbox-img {
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10001;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  transform: scale(1.05);
}

.lightbox-close .icon {
  width: 20px !important;
  height: 20px !important;
}

/* =========================================================================
   Wide Layout and Maximized Preview Frame for Contract Creation/Editing
   ========================================================================= */
.form-panel:has(.contract-preview-only-side) {
  width: min(100%, 1800px) !important;
}

.form-panel:has(.contract-preview-only-side) .contract-entry-layout {
  grid-template-columns: 440px minmax(0, 1fr) !important;
  gap: 16px !important;
  max-width: 100% !important;
}

.form-panel:has(.contract-preview-only-side) .contract-preview-panel {
  min-height: calc(100vh - 200px) !important;
  height: calc(100vh - 200px) !important;
  padding: 0 !important;
  border-color: var(--line-strong) !important;
}

.form-panel:has(.contract-preview-only-side) .contract-preview-surface {
  min-height: 100% !important;
  height: 100% !important;
  border: none !important;
  border-radius: var(--radius) !important;
}

/* Ensure empty/fallback elements fill 100% of height nicely */
.form-panel:has(.contract-preview-only-side) .contract-preview-empty,
.form-panel:has(.contract-preview-only-side) .contract-preview-fallback {
  height: 100% !important;
  min-height: 100% !important;
}

/* Fallback message description padding adjustment */
.form-panel:has(.contract-preview-only-side) .contract-preview-empty span,
.form-panel:has(.contract-preview-only-side) .contract-preview-fallback span {
  font-size: 13px !important;
  max-width: 320px;
  line-height: 1.6;
}

.form-panel:has(.contract-preview-only-side) .contract-preview-empty .icon {
  width: 48px !important;
  height: 48px !important;
  color: var(--muted) !important;
  margin-bottom: 6px;
}
