@import "../invoice-document.css";

#dashboard-toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 12px);
  opacity: 0;
  pointer-events: none;
  border: 1px solid hsl(var(--border));
  border-radius: 10px;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  padding: 10px 14px;
  box-shadow: 0 8px 28px #00000014;
  transition: opacity 140ms ease, transform 140ms ease;
  font-size: 13px;
}

#dashboard-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

#dashboard-dialogs:empty { display: none; }

.customer-picker-results { max-height: 220px; overflow-y: auto; }
.customer-picker-results button { overflow-wrap: anywhere; }

.invoice-address-editor { display: grid; gap: 16px; width: 100%; min-width: 0; container-type: inline-size; }
.invoice-address-field { min-width: 0; }
.invoice-address-location { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 12px; min-width: 0; }
.invoice-address-field input { min-width: 0; }

.invoice-date-popover {
  position: fixed;
  z-index: 10000;
  box-sizing: border-box;
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  padding: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 36px #0000001f;
  color: #303030;
}
.invoice-calendar-header { display: grid; grid-template-columns: 36px minmax(0,1fr) 36px; align-items: center; gap: 8px; }
.invoice-calendar-month-button { height: 34px; border: 1px solid #eceef1; border-radius: 8px; background: #fff; color: #42474e; font-size: 23px; line-height: 1; }
.invoice-calendar-month-button:hover, .invoice-calendar-day:hover { background: #f5f8ff; }
.invoice-calendar-month-label { margin: 0; text-align: center; font-size: 14px; font-weight: 600; }
.invoice-calendar-grid { margin-top: 12px; }
.invoice-calendar-weekdays, .invoice-calendar-days { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); text-align: center; }
.invoice-calendar-weekdays { margin-bottom: 4px; color: #858b94; font-size: 11px; font-weight: 500; }
.invoice-calendar-weekdays > span { padding-block: 7px; }
.invoice-calendar-day { justify-self: center; width: 36px; height: 36px; border: 0; border-radius: 9px; background: transparent; color: #30343a; font-size: 13px; }
.invoice-calendar-day.outside-month { color: #b8bdc4; }
.invoice-calendar-day.today:not(.selected) { box-shadow: inset 0 0 0 1px #246bfe; color: #246bfe; }
.invoice-calendar-day.selected { background: #246bfe; color: #fff; font-weight: 600; }
.invoice-calendar-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #eceef1; }
.invoice-calendar-selected { min-width: 0; overflow-wrap: anywhere; color: #737a83; font-size: 11px; }
.invoice-calendar-today { border: 0; background: transparent; color: #246bfe; font-size: 12px; font-weight: 600; }
.invoice-calendar-day:focus-visible, .invoice-calendar-month-button:focus-visible, .invoice-calendar-today:focus-visible { outline: 2px solid #246bfe; outline-offset: 2px; }

.invoice-permanent-delete-dialog { width: min(440px, calc(100vw - 32px)); padding: 24px; border: 1px solid #e5e7eb; border-radius: 14px; color: #303030; box-shadow: 0 18px 60px #0003; }
.invoice-permanent-delete-dialog::backdrop { background: #0006; }
.invoice-permanent-delete-dialog h2 { margin: 0 0 10px; font-size: 18px; font-weight: 600; }
.invoice-permanent-delete-dialog > p:not(.invoice-permanent-delete-error) { margin: 0; color: #636a73; font-size: 14px; line-height: 1.55; }
.invoice-permanent-delete-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.invoice-permanent-delete-error { margin: 12px 0 0; color: #b42318; font-size: 13px; }
.invoice-delete-confirm { border-color: #b42318; background: #b42318; color: #fff; }
.invoice-delete-confirm:hover { background: #912018; }
.invoice-review-locale { display: grid; gap: 8px; color: #555c65; font-size: 12px; font-weight: 500; }
.invoice-review-locale-select { box-sizing: border-box; width: 100%; height: 40px; padding: 0 12px; border: 1px solid #e8e9ec; border-radius: 8px; background: #fff; color: #30343a; font-size: 14px; }
.invoice-review-locale-select:focus-visible { outline: 2px solid #246bfe; outline-offset: 2px; }

.invoice-preview-title { margin: 0 0 18px; color: #303030; font-size: 22px; line-height: 1.25; font-weight: 600; overflow-wrap: anywhere; }


@container (max-width: 380px) {
  .invoice-address-location { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .invoice-address-location > .invoice-address-field:first-child { grid-column: 1 / -1; }
}

/* The captured drawer disabled native touch scrolling for a drag handler
   that is not part of this application. */
#dashboard-dialogs .ios-drawer { touch-action: auto; }
#dashboard-dialogs .ios-drawer-content-wrapper { flex: 1; min-height: 0; height: auto; }
#dashboard-dialogs .ios-drawer-content { min-height: 0; padding: 0; }
#dashboard-dialogs .ios-drawer-buttons { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
#dashboard-dialogs .ios-drawer-buttons [data-invoice-download-pdf] { width: 100%; min-height: 40px; }
#dashboard-dialogs [data-test-id="new-invoice-form"] { min-height: 0; }

@media (max-width: 767px) {
  #dashboard-dialogs > [role="dialog"][data-template] {
    inset: 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: 100dvh;
  }
  #dashboard-dialogs input,
  #dashboard-dialogs textarea,
  #dashboard-dialogs select { font-size: 16px; }
  #dashboard-dialogs .ios-drawer-buttons > div { min-width: 0; width: 100%; }
  #dashboard-dialogs .ios-drawer-buttons { gap: 8px; padding-inline: 16px; }
  #dashboard-dialogs .invoice-mobile-footer { flex-direction: column; align-items: stretch; min-width: 0; box-sizing: border-box; }
  #dashboard-dialogs .invoice-mobile-footer > .invoice-mobile-status-row { width: 100%; min-width: 0; box-sizing: border-box; }
  #dashboard-dialogs .invoice-mobile-status-row .invoice-draft-save-status { min-width: 0; overflow-wrap: anywhere; }
  #dashboard-dialogs .invoice-mobile-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; width: 100%; min-width: 0; box-sizing: border-box; }
  #dashboard-dialogs .invoice-mobile-actions > button { flex: 0 0 auto; width: auto; min-width: 0; max-width: 100%; white-space: nowrap; }
  #dashboard-dialogs .grid-cols-line-item { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  #dashboard-dialogs .grid-cols-line-item > :first-child { grid-column: 1 / -1; }
  #dashboard-dialogs [data-local-payout-picker] { max-height: 240px; overflow-y: auto; }
  .contacts-table thead { display: none; }
  .contacts-table, .contacts-table tbody, .contacts-table tr, .contacts-table td { display: block; width: 100%; height: auto; }
  .contacts-table tr { padding: 16px; }
  .contacts-table td { padding: 4px 0; overflow-wrap: anywhere; }
  .contacts-table td::before { content: attr(data-label); display: block; margin-bottom: 2px; color: #667085; font-size: 11px; font-weight: 600; }
  .contacts-table td:empty { display: none; }
}

@media (max-width: 399px) {
  #dashboard-dialogs [data-template="invoice-terms"] .grid-cols-2 { grid-template-columns: minmax(0, 1fr); }
}

#dashboard-dialogs > [role="dialog"]:not([data-state="open"]) {
  display: none;
}

@media (max-width: 640px) {
  #dashboard-toast { width: calc(100% - 32px); text-align: center; }
}

/* Reference geometry: 1312px content, 60px rows, 38px table headings,
   540px side panels. Existing captured form controls remain the source styles. */
:root { --invoice-accent: #246bfe; --dashboard-ink: #303030; --dashboard-muted: #858585; --dashboard-line: #ededed; }
#dashboard-root button.bg-gray-950,
#dashboard-dialogs button.bg-gray-950,
#dashboard-dialogs button[class*="bg-[#246BFE]"] { background: var(--invoice-accent); background-image: none; color: #fff; }
#dashboard-root button.bg-gray-950:hover,
#dashboard-dialogs button.bg-gray-950:hover,
#dashboard-dialogs button[class*="bg-[#246BFE]"]:hover { background: #1d5fde; }
#dashboard-root :is(button,a):focus-visible,
#dashboard-dialogs :is(button,a,input,select):focus-visible,
.dashboard-detail-overlay :is(button,input,a):focus-visible { outline: 2px solid var(--invoice-accent); outline-offset: 3px; }
.dashboard-page { width: 100%; max-width: 1312px; margin-inline: auto; padding-bottom: 48px; color: var(--dashboard-ink); }
.dashboard-page-header { position: static; gap: 24px; }
.dashboard-page-header h1 { margin: 34px 0; font-size: 32px; line-height: 40px; font-weight: 500; letter-spacing: -.96px; }
.dashboard-page-header > :last-child { flex-shrink: 0; }
.dashboard-page-header button { white-space: nowrap; }
.dashboard-section { margin-top: 24px; }
.dashboard-section + .dashboard-section { margin-top: 32px; }
.dashboard-section > h2 { margin: 0 0 16px; font-size: 20px; line-height: 28px; font-weight: 500; letter-spacing: -.3px; }
.dashboard-table-wrap { width: 100%; }
.dashboard-table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: 14px; text-align: left; }
.dashboard-table th { height: 38px; padding: 8px 12px; background: #fafafa; border-block: 1px solid var(--dashboard-line); font-size: 12px; line-height: 20px; font-weight: 500; color: #737373; text-align: left; }
.dashboard-table th:first-child { border-left: 1px solid var(--dashboard-line); border-radius: 9px 0 0 9px; }
.dashboard-table th:last-child { border-right: 1px solid var(--dashboard-line); border-radius: 0 9px 9px 0; }
.dashboard-table td { height: 60px; padding: 10px 12px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; line-height: 20px; overflow-wrap: anywhere; }
.dashboard-table tbody tr:hover { background: #fcfcfc; }
.dashboard-table .dashboard-empty { height: auto; padding: 40px 16px; text-align: center; color: var(--dashboard-muted); font-size: 14px; font-weight: 400; }
.contacts-table th:first-child { width: 35%; }
.contacts-table th:last-child { width: 80px; }
.invoice-table th:first-child { width: 25%; }
.invoice-table th:nth-child(2) { width: 17%; }
.invoice-table th:nth-child(3) { width: 13%; }
.invoice-table th:nth-child(4) { width: 15%; }
.invoice-table th:nth-child(5) { width: 16%; }
.invoice-table th:last-child { width: 150px; }
.dashboard-identity-button { display: block; width: 100%; text-align: left; border: 0; padding: 0; background: transparent; cursor: pointer; }
.dashboard-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dashboard-avatar { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%; background: #f1f0f7; color: #777080; font-size: 11px; font-weight: 500; }
.dashboard-avatar img { width: 32px; height: 32px; object-fit: contain; border-radius: 4px; background: white; }
.dashboard-identity-copy { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.dashboard-name { font-weight: 500; color: #303030; overflow-wrap: anywhere; line-height: 18px; }
.dashboard-secondary { display: block; font-size: 12px; line-height: 18px; color: #929292; overflow-wrap: anywhere; }
.dashboard-muted, .dashboard-description { color: #777; }
.dashboard-item-count { margin-left: 4px; color: #929292; white-space: nowrap; }
.dashboard-numeric { font-variant-numeric: tabular-nums; }
.dashboard-row-actions { text-align: right; }
.dashboard-action-group { display: inline-flex; align-items: center; }
.dashboard-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 5px 10px; border: 1px solid #e7e7eb; border-radius: 7px; background: #fff; color: #636674; font-family: inherit; font-size: 13px; line-height: 20px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.dashboard-button:hover { background: #f9f9fa; color: #303030; }
.dashboard-button.primary { background: var(--invoice-accent); border-color: #1d5fde; color: #fff; box-shadow: 0 1px 2px #12398022, inset 0 1px 1px #ffffff30; }
.dashboard-button.primary:hover { background: #1d5fde; }
.dashboard-button.quiet { border-color: transparent; background: transparent; box-shadow: none; }
.dashboard-button.danger { color: #e5484d; margin-right: auto; }
.dashboard-button:disabled { opacity: .45; cursor: not-allowed; }
.invoice-actions-trigger { width: 34px; height: 32px; display: inline-grid; place-items: center; border: 1px solid #e7e7eb; border-radius: 7px; background: white; color: #707580; font-size: 20px; line-height: 1; }
.dashboard-action-group .dashboard-button { border-radius: 7px 0 0 7px; }
.dashboard-action-group .invoice-actions-trigger { border-radius: 0 7px 7px 0; margin-left: -1px; }
.invoice-actions-trigger:hover { background: #f8f8f8; }
.invoice-status-tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--dashboard-line); margin: 10px 0 12px; }
.invoice-status-tabs a { display: inline-flex; align-items: center; gap: 7px; min-height: 42px; margin-bottom: -1px; padding: 10px 0; border-bottom: 1px solid transparent; color: #858585; font-size: 14px; text-decoration: none; white-space: nowrap; }
.invoice-status-tabs a.active { border-bottom-color: var(--invoice-accent); color: #303030; }
.invoice-tab-count { display: inline-flex; justify-content: center; align-items: center; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 20px; background: #f1f1f1; color: #666; font-size: 10px; font-weight: 600; }
.invoice-status-tabs .active .invoice-tab-count { background: var(--invoice-accent); color: white; }
.invoice-status-badge { display: inline-flex; border-radius: 20px; padding: 3px 9px; background: #f4f4f5; color: #777; font-size: 12px; white-space: nowrap; }
.invoice-status-badge.unpaid { background: #fff6e9; color: #97622c; }
.invoice-status-badge.paid { background: #edf8f1; color: #418459; }
.invoice-status-badge.void { background: #fff0f0; color: #b35656; }
.invoice-action-menu { position: fixed; z-index: 120; width: min(220px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 4px; border: 1px solid #ededed; border-radius: 8px; background: #fff; box-shadow: 0 3px 10px #00000014, 0 1px 3px #0000000d; }
.invoice-action-item { display: block; width: 100%; min-height: 36px; border: 0; border-radius: 5px; background: #fff; padding: 7px 9px; color: #444; text-align: left; font-size: 13px; }
.invoice-action-item:hover, .invoice-action-item:focus-visible { background: #f6f6f6; }
.invoice-action-item.danger { color: #d94b4b; }
.dashboard-filter-bar { display: flex; align-items: center; position: relative; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; z-index: 4; }
.dashboard-filter-trigger { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; border: 1px dashed #dedede; border-radius: 20px; background: white; padding: 4px 10px; font-size: 13px; line-height: 20px; color: #6e6e6e; }
.dashboard-filter-icon { width: 13px; height: 13px; border: 1px solid #999; clip-path: polygon(0 0,100% 0,65% 55%,65% 100%,35% 85%,35% 55%); background: #999; }
.dashboard-filter-chip { max-width: 100%; border: 1px solid #e7e7e7; border-radius: 6px; padding: 4px 8px; background: #fafafa; font-size: 12px; overflow-wrap: anywhere; text-align: left; }
.dashboard-filter-popover { position: absolute; top: calc(100% + 4px); left: 0; display: grid; grid-template-columns: 178px 240px; padding: 4px; border: 1px solid #ededed; border-radius: 8px; background: white; box-shadow: 0 3px 10px #00000014; z-index: 20; }
.dashboard-filter-choices { display: flex; flex-direction: column; padding-right: 4px; border-right: 1px solid #efefef; }
.dashboard-filter-choices button { min-height: 34px; border: 0; border-radius: 4px; padding: 6px 10px; text-align: left; font-size: 13px; background: white; color: #50535d; }
.dashboard-filter-choices button::after { content: '›'; float: right; color: #8b8b8b; }
.dashboard-filter-choices button[aria-pressed="true"], .dashboard-filter-choices button:hover { background: #f6f6f6; }
.dashboard-filter-editor { min-width: 0; padding: 10px; }
.dashboard-field-label { display: block; margin-bottom: 6px; font-size: 12px; color: #858585; }
.dashboard-input { display: block; width: 100%; min-width: 0; height: 38px; padding: 0 10px; border: 1px solid #e9e9e9; border-radius: 7px; color: #444; background: white; font-size: 13px; }
.dashboard-input:focus-visible { outline: 2px solid var(--invoice-accent); outline-offset: 2px; }
.dashboard-filter-actions { display: flex; justify-content: flex-end; gap: 4px; margin-top: 14px; }
.dashboard-payment-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 312px)); gap: 16px; }
.dashboard-payment-card { min-width: 0; padding: 16px; border: 1px solid #efedef; border-radius: 18px; background: linear-gradient(white,white) padding-box, linear-gradient(115deg,#eedcff,#f2ede9) border-box; border-color: transparent; }
.dashboard-payment-card h3 { font-size: 14px; line-height: 20px; font-weight: 500; margin: 0; overflow-wrap: anywhere; }
.dashboard-payment-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.dashboard-payment-symbol { display: inline-flex; gap: 6px; align-items: center; color: #777; font-size: 12px; }
.dashboard-payment-symbol img { width: 30px; height: 30px; }
.dashboard-method-choice { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; width: 100%; padding: 18px; margin-bottom: 12px; border: 1px solid #eaeaea; border-radius: 12px; background: white; text-align: left; }
.dashboard-method-choice:hover { background: #fafafa; border-color: #d4d4d4; }
.dashboard-method-choice strong { font-size: 14px; font-weight: 500; }
.dashboard-backdrop, .dashboard-detail-overlay { position: fixed; inset: 0; background: #0000002e; backdrop-filter: blur(3px); }
.dashboard-backdrop { z-index: 49; }
.dashboard-detail-overlay { z-index: 110; }
.dashboard-detail-panel { position: absolute; top: 20px; right: 20px; bottom: 0; display: flex; flex-direction: column; width: min(540px, calc(100% - 40px)); background: #fff; border: 1px solid #ebebeb; border-bottom: 0; border-radius: 16px 16px 0 0; box-shadow: 0 6px 24px #0000000a; overflow: hidden; color: #3b3b3b; }
.dashboard-detail-header { display: flex; align-items: center; justify-content: space-between; min-height: 72px; padding: 20px 24px; border-bottom: 1px solid var(--dashboard-line); }
.dashboard-detail-header h2 { font-size: 16px; font-weight: 500; margin: 0; }
.dashboard-icon-button { display: grid; place-items: center; flex-shrink: 0; width: 28px; height: 28px; border: 0; background: transparent; color: #929292; font-size: 24px; line-height: 1; }
.dashboard-detail-body { flex: 1; min-height: 0; padding: 24px; overflow-y: auto; }
.dashboard-detail-footer { display: flex; justify-content: flex-end; gap: 12px; flex-shrink: 0; padding: 20px 24px; border-top: 1px solid var(--dashboard-line); }
.dashboard-detail-footer:empty { display: none; }
.dashboard-detail-list { display: grid; gap: 24px; margin-top: 28px; }
.dashboard-detail-list dt { margin-bottom: 6px; color: #8c8c8c; font-size: 12px; }
.dashboard-detail-list dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.dashboard-invoice-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dashboard-invoice-total { font-size: 28px; line-height: 36px; font-weight: 500; letter-spacing: -.7px; }
.dashboard-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 28px 0; font-size: 14px; overflow-wrap: anywhere; }
.dashboard-parties h3 { font-size: 11px; font-weight: 500; color: #929292; margin-bottom: 8px; }
.dashboard-detail-items { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
.dashboard-detail-items th { color: #929292; font-weight: 500; text-align: left; }
.dashboard-detail-items th:first-child { width: 44%; }
.dashboard-detail-items th:nth-child(2) { width: 12%; }
.dashboard-detail-items td, .dashboard-detail-items th { padding: 10px 4px; border-bottom: 1px solid #ededed; overflow-wrap: anywhere; }
.dashboard-detail-items td:last-child, .dashboard-detail-items th:last-child { text-align: right; }
.dashboard-detail-totals { margin: 20px 0 0 auto; width: 65%; font-size: 13px; }
.dashboard-detail-totals > div { display: flex; justify-content: space-between; gap: 16px; padding: 5px 0; }
.dashboard-detail-totals > div:last-child { font-weight: 600; border-top: 1px solid #eee; margin-top: 6px; padding-top: 12px; }
.dashboard-invoice-note { font-size: 13px; color: #888; margin: 24px 0; overflow-wrap: anywhere; }
.dashboard-payment-instructions { margin-top: 28px; padding: 16px; border: 1px solid #eee; border-radius: 12px; background: #fafafa; overflow-wrap: anywhere; font-size: 13px; }
.dashboard-payment-instructions h3 { margin-bottom: 12px; font-size: 14px; font-weight: 500; }
#dashboard-dialogs > .dashboard-sheet { width: min(540px, calc(100% - 40px)); max-width: 540px; top: 20px; bottom: 0; right: 20px; left: auto; height: calc(100dvh - 20px); max-height: none; margin: 0; border-radius: 16px 16px 0 0; }
#dashboard-dialogs .dashboard-sheet input, #dashboard-dialogs .dashboard-sheet select { min-width: 0; }
.dashboard-payment-fields { display: grid; gap: 16px; padding: 0 24px 24px; }
.dashboard-payment-fields label { display: grid; gap: 8px; color: #8c8c8c; font-size: 12px; font-weight: 500; }
.dashboard-payment-fields input, .dashboard-payment-fields select { width: 100%; height: 40px; border: 1px solid #ebebeb; border-radius: 8px; background: #fff; padding: 0 12px; color: #555; font-size: 14px; font-weight: 400; }
.dashboard-payment-fields > p { font-size: 12px; color: #939393; }
.invoice-draft-save-status { min-height: 18px; }
@media (max-width: 1100px) and (min-width: 768px) {
  .dashboard-table { font-size: 13px; }
  .dashboard-table td, .dashboard-table th { padding-inline: 8px; }
  .invoice-table th:nth-child(2) { width: 14%; }
  .invoice-table th:nth-child(4) { width: 14%; }
  .invoice-table th:last-child { width: 126px; }
  .dashboard-action-group .dashboard-button { padding-inline: 7px; font-size: 12px; }
}
@media (max-width: 767px) {
  .dashboard-page-header h1 { font-size: 27px; line-height: 36px; margin: 22px 0; }
  .dashboard-page-header { gap: 12px; }
  .dashboard-page-header button { font-size: 12px; padding-inline: 10px; }
  .dashboard-page { padding-bottom: 24px; }
  .dashboard-table, .dashboard-table tbody, .dashboard-table tr, .dashboard-table td { display: block; width: 100%; height: auto; }
  .dashboard-table thead { display: none; }
  .dashboard-table tr { padding: 16px 0; border-bottom: 1px solid #ededed; }
  .dashboard-table td { padding: 4px 0; border: 0; }
  .dashboard-table td:not(:first-child):not(.dashboard-row-actions):not(.dashboard-empty) { display: grid; grid-template-columns: 100px minmax(0,1fr); gap: 12px; }
  .dashboard-table td::before { display: none; }
  .dashboard-table td:not(:first-child):not(.dashboard-row-actions):not(.dashboard-empty)::before { content: attr(data-label); display: block; color: #999; font-size: 12px; }
  .dashboard-table td:first-child { margin-bottom: 12px; }
  .dashboard-table .dashboard-row-actions { margin-top: 12px; text-align: right; }
  .dashboard-table .dashboard-empty { margin: 0; padding: 28px 0; text-align: left; }
  .dashboard-section { margin-top: 16px; }
  .dashboard-payment-grid { grid-template-columns: minmax(0,1fr); }
  .dashboard-payment-card { max-width: none; }
  .dashboard-filter-popover { width: min(420px, calc(100vw - 40px)); grid-template-columns: 118px minmax(0,1fr); }
  .dashboard-filter-choices button { padding-inline: 8px; }
  .invoice-status-tabs { gap: 16px; }
  .invoice-status-tabs a { font-size: 13px; gap: 5px; }
  .dashboard-detail-panel, #dashboard-dialogs > .dashboard-sheet { inset: 0; width: 100%; max-width: none; height: 100dvh; border: 0; border-radius: 0; }
  .dashboard-detail-body { padding: 20px; }
  .dashboard-detail-footer { padding-bottom: max(20px,env(safe-area-inset-bottom)); }
}

#dashboard-root [hidden], #dashboard-dialogs [hidden] { display: none !important; }
#dashboard-dialogs .dashboard-sheet [role="tab"][aria-selected="true"] { border-color: var(--invoice-accent); }
#dashboard-dialogs .dashboard-sheet [role="tab"][aria-selected="true"] svg { color: var(--invoice-accent); }

.dashboard-payment-fields.inset { padding: 0; }
#dashboard-dialogs button.bg-gray-950:disabled, #dashboard-root button.bg-gray-950:disabled { background: #f1f1f1; color: #aaa; box-shadow: none; }

/* Invoice editor: keep its two columns within the dashboard's usable content width. */
@media (min-width: 768px) {
  #dashboard-dialogs [data-test-id="new-invoice-form"] {
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 540px) minmax(0, 1fr);
  }
  #dashboard-dialogs [data-test-id="new-invoice-form"] > * { min-width: 0; }
  #dashboard-dialogs [data-test-id="new-invoice-form"] > .rounded-r-xl { min-width: 0; overflow-x: hidden; }
}
#dashboard-dialogs #container {
  width: min(612.25px, 100%) !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

/* Captured fields draw focus on their rounded wrapper. An outline on the
   inner input is clipped by overflow:hidden into two blue vertical bars. */
:is(#dashboard-root, #dashboard-dialogs) .group.relative.flex > [class~="group/input-wrapper"] > input:focus {
  outline: none !important;
  box-shadow: none !important;
}

/* Keep the title field's focus treatment consistent with adjacent form fields. */
#dashboard-dialogs .invoice-title-input:focus-visible {
  outline: none !important;
  box-shadow: none !important;
  --tw-ring-offset-shadow: 0 0 #0000;
  --tw-ring-shadow: 0 0 #0000;
}
#dashboard-dialogs .invoice-title-input:focus { outline: none !important; box-shadow: none !important; }
#dashboard-dialogs .invoice-title-field:focus-within { box-shadow: none !important; }
#dashboard-dialogs .invoice-title-field:focus-within::before { --tw-ring-color: var(--invoice-accent) !important; }

/* Keep each captured line item and its remove action together on one row. */
#dashboard-dialogs .invoice-item-list {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  margin: 0 !important;
  padding: 0 !important;
}
#dashboard-dialogs .invoice-item-list > .invoice-item-entry {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: start;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 0 0 12px;
  border-bottom: 1px solid #e5e7eb;
}
#dashboard-dialogs .invoice-item-entry > fieldset { width: 100%; min-width: 0; }
#dashboard-dialogs .invoice-item-entry .grid-cols-line-item {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 56px 108px;
  align-items: start;
  gap: 8px;
  width: 100%;
  min-width: 0;
}
#dashboard-dialogs .invoice-item-remove-wrap { display: flex; justify-content: center; height: 40px; margin-top: 32px; }
#dashboard-dialogs .invoice-item-remove-wrap button { width: 32px; height: 32px; padding: 4px; }
@media (max-width: 767px) {
  #dashboard-dialogs .invoice-item-entry .grid-cols-line-item {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  #dashboard-dialogs .invoice-item-entry .grid-cols-line-item > :first-child { grid-column: 1 / -1 !important; }
}

.invoice-mail-header { box-sizing: border-box; width: 100%; max-width: 560px; margin: 0 auto 12px; padding: 14px 20px; border: 1px solid #e5e7eb; border-radius: 12px; background: #fff; font-size: 12px; }
.invoice-mail-header > span { display: block; margin-bottom: 12px; color: #90949a; text-align: center; }
.invoice-mail-header dl { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 6px 12px; margin: 0; }
.invoice-mail-header dt { color: #90949a; }
.invoice-mail-header dd { margin: 0; overflow-wrap: anywhere; }

.dashboard-detail-panel:has(.invoice-detail-paper-frame) { width: min(700px, calc(100% - 40px)); }
.dashboard-invoice-detail:has(.invoice-detail-paper-frame) { background: #f7f8fa; padding: 24px; }
.invoice-detail-paper-frame { position: relative; width: 100%; margin: 0; }
.invoice-detail-paper-frame #container { position: relative; margin: 0 !important; left: 0 !important; transform-origin: top left !important; translate: none !important; scale: none !important; }
.invoice-detail-paper-frame #container::before { display: none; }
.invoice-detail-paper-frame .invoice-focus-frame { display: none; }
.invoice-detail-paper-frame #container > :first-child { height: 56px; min-height: 56px; flex-shrink: 0; }
@media (max-width: 767px) {
  .dashboard-detail-panel:has(.invoice-detail-paper-frame) { width: 100%; }
  .dashboard-invoice-detail:has(.invoice-detail-paper-frame) { padding: 12px; }
}

.dashboard-loading { max-width: 480px; margin: 15vh auto; padding: 24px; color: var(--dashboard-ink); }
.dashboard-loading h1 { font-size: 24px; margin-bottom: 12px; }
.dashboard-loading p { margin-bottom: 20px; }
@media (max-width: 640px) {
  #dashboard-root form:has([name="billingProfileLabel"]) .grid-cols-2 { grid-template-columns: minmax(0, 1fr); }
}

.invoice-item-suggestions { position: absolute; z-index: 80; top: 100%; left: 0; width: min(100%, 480px); max-height: 240px; overflow-y: auto; margin-top: 4px; padding: 4px; border: 1px solid #ebebeb; border-radius: 8px; background: #fff; box-shadow: 0 4px 16px #00000014; }
.invoice-item-suggestions button { display: block; width: 100%; padding: 10px 12px; border-radius: 5px; text-align: left; font-size: 14px; overflow-wrap: anywhere; }
.invoice-item-suggestions button:hover, .invoice-item-suggestions button[aria-selected="true"] { background: #f5f5f5; }

.gmail-settings { margin-top: 32px; display: grid; gap: 16px; }
.gmail-settings h2 { font-size: 20px; font-weight: 500; }
.gmail-account { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 0; overflow-wrap: anywhere; }
.gmail-field { display: grid; gap: 8px; margin: 20px 0; }

.billing-profiles { margin: 24px 0; }
.billing-profiles-header, .billing-profile-card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.billing-profiles-header { margin-bottom: 12px; }
.billing-profiles-header h4 { font-size: 14px; font-weight: 500; color: #303030; }
.billing-profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 12px; }
.billing-profile-card { display: flex; flex-direction: column; min-width: 0; padding: 20px; border: 1px solid #e9e9e9; border-radius: 12px; background: #fff; }
.billing-profile-card.selected { border-color: #737373; }
.billing-profile-card-header { margin-bottom: 12px; }
.billing-profile-card h5 { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.billing-profile-badge { flex-shrink: 0; border-radius: 12px; padding: 3px 8px; background: #f3f3f3; font-size: 11px; color: #666; }
.billing-profile-name { font-size: 14px; color: #444; overflow-wrap: anywhere; }
.billing-profile-email, .billing-profile-address { margin-top: 4px; font-size: 13px; color: #888; overflow-wrap: anywhere; }
.billing-profile-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 20px; }
.billing-profile-delete { color: #c43d3d; margin-left: auto; }
.billing-profile-actions button:disabled { opacity: .45; cursor: not-allowed; }
