:root {
  --bg: #eef6fb;
  --surface: #f7fbfe;
  --surface-alt: #edf6fc;
  --surface-strong: #ffffff;
  --ink: #16324a;
  --muted: #6a8194;
  --line: #d0dfeb;
  --line-strong: #bdd0df;
  --brand: #1581d0;
  --brand-deep: #0c5d96;
  --brand-navy: #0b5f8d;
  --brand-soft: #e4f2fb;
  --accent: #2aa7df;
  --danger: #8f2d1f;
  --label: #27465c;
  --field-bg: #ffffff;
  --field-border: #c4d6e3;
  --field-border-hover: #9fc3da;
  --field-focus: rgba(21, 129, 208, 0.18);
  --shadow-sm: 0 1px 2px rgba(15, 35, 52, 0.04);
  --shadow-md: 0 10px 26px rgba(15, 35, 52, 0.06);
}

html {
  font-size: 14px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, #d9edf8 0, #eef6fb 140px, #eef6fb 100%);
}

body.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.login-shell {
  width: min(100%, 420px);
}

.login-panel {
  padding: 1.35rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-md);
}

.login-panel h1 {
  margin: 0 0 1rem;
  font-size: 1.6rem;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.login-logo {
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
}

.login-brand h1 {
  margin: 0;
}

.login-panel .eyebrow {
  color: var(--brand-deep);
}

.login-form {
  display: grid;
  gap: 0.9rem;
}

.login-form button {
  justify-self: start;
}

.login-error,
.subtle.is-error {
  margin: 0;
  color: var(--danger);
}

.subtle.is-success {
  color: #247a4b;
}

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

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

button {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.68rem 0.95rem;
  background: var(--surface);
  color: var(--brand-deep);
  cursor: pointer;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition:
    background-color 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

button:hover:not(:disabled) {
  border-color: #9fc8e1;
  background: #e7f4fc;
  color: var(--brand-deep);
  box-shadow: 0 5px 14px rgba(15, 35, 52, 0.1);
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  box-shadow: var(--shadow-sm);
  transform: translateY(0);
}

.button-icon {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-only-button {
  justify-content: center;
  width: 42px;
  padding-inline: 0;
}

.icon-label-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.icon-label-button > span,
.table-action-buttons button > span {
  white-space: nowrap;
}

button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

button.primary:hover:not(:disabled) {
  border-color: var(--brand-deep);
  background: var(--brand-deep);
  color: #fff;
}

button.ghost-danger {
  background: #cf3f32;
  border-color: #cf3f32;
  color: #fff;
}

button.ghost-danger:hover:not(:disabled) {
  border-color: #aa2f26;
  background: #aa2f26;
  color: #fff;
}

button.ghost-danger.icon-only-button {
  border-color: transparent;
  background: transparent;
  color: #b42318;
  box-shadow: none;
  opacity: 0.7;
}

button.ghost-danger.icon-only-button:hover:not(:disabled),
button.ghost-danger.icon-only-button:focus-visible {
  border-color: #f1bbb3;
  background: #fff2f0;
  color: #b42318;
  box-shadow: none;
  opacity: 1;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  box-shadow: none;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 68px;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid rgba(208, 223, 235, 0.8);
  background: rgba(247, 251, 254, 0.96);
  color: var(--ink);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 22px rgba(15, 35, 52, 0.08);
}

.app-layout {
  min-height: calc(100vh - 68px);
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  background: linear-gradient(
    90deg,
    rgba(242, 248, 252, 0.98) 0,
    rgba(242, 248, 252, 0.98) 247px,
    rgba(189, 208, 223, 0.72) 247px,
    rgba(189, 208, 223, 0.72) 248px,
    transparent 248px
  );
}

.sidebar {
  position: sticky;
  top: 68px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: calc(100vh - 68px);
  padding: 1.1rem 1rem;
  border-right: 1px solid rgba(189, 208, 223, 0.72);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(242, 248, 252, 0.98));
  color: var(--ink);
  box-shadow: 8px 0 22px rgba(15, 35, 52, 0.07);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
}

.eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-deep);
}

.topbar-brand h1,
.panel-header h2,
.card h3 {
  margin: 0;
}

.topbar-brand h1 {
  font-family: "Inter", "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.topbar-brand-copy {
  min-width: 0;
}

.product-logo {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
}

.topbar-brand-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.topbar-product-links {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-left: 0.65rem;
  border-left: 1px solid var(--line);
}

.topbar-home-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--brand-deep);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}

.topbar-product-logo {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  object-fit: contain;
}

.topbar-home-link:hover,
.topbar-home-link:focus-visible {
  color: var(--brand);
  text-decoration: underline;
}

.topbar-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  min-width: 0;
}

.company-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.company-switcher span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.company-switcher select {
  width: min(32vw, 280px);
  min-width: 180px;
  height: 38px;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

#add-company {
  min-height: 38px;
  padding-block: 0.5rem;
}

.topbar-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-color: var(--line);
  border-radius: 10px;
  background: var(--surface-strong);
  color: var(--brand-deep);
}

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

.topbar-icon-button:hover:not(:disabled) {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.topbar-nav,
.topbar-actions,
.section-heading,
.actions,
.inline-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.topbar-nav {
  flex: 0 0 auto;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: flex-start;
  justify-self: stretch;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-family: "Manrope", "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  overflow: visible;
}

.mobile-view-switcher {
  display: none;
}

.nav-group {
  display: grid;
  gap: 0.15rem;
}

.nav-group + .nav-group {
  margin-top: 0.2rem;
}

.nav-tab {
  width: 100%;
  min-height: 36px;
  padding: 0.5rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.68rem;
  background: transparent;
  color: #496576;
  border: 0;
  box-shadow: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.002em;
  line-height: 1.2;
  text-align: left;
}

.nav-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.82;
}

.nav-tab:hover {
  background: #e8f4fb;
  color: var(--brand-deep);
}

.nav-tab.is-active {
  color: #083f64;
  background: linear-gradient(90deg, #e3f2fb 0%, #f7fbfe 100%);
  box-shadow: inset 3px 0 0 var(--brand), 0 1px 2px rgba(15, 35, 52, 0.08);
}

.nav-tab.is-active .nav-icon {
  opacity: 1;
}

.nav-section-label {
  padding: 0.6rem 0.7rem 0.2rem;
  color: #7991a3;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-actions {
  flex: 0 0 auto;
  flex-direction: column;
  align-items: stretch;
  align-self: end;
  gap: 0.15rem;
  width: 100%;
  margin-top: auto;
  font-family: "Manrope", "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
}

.topbar-actions button {
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
  color: #496576;
  text-align: left;
}

.topbar-actions button:hover {
  background: #e8f4fb;
  color: var(--brand-deep);
}

.topbar-actions .nav-tab.is-active {
  color: #083f64;
  background: linear-gradient(90deg, #e3f2fb 0%, #f7fbfe 100%);
  box-shadow: inset 3px 0 0 var(--brand), 0 1px 2px rgba(15, 35, 52, 0.08);
}

.panel {
  min-width: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 1.5rem 1.5rem 3rem;
}

.workspace {
  display: none;
}

.workspace.is-active {
  display: block;
}

.workspace[data-view="quotes"].is-active,
.workspace[data-view="purchase-orders"].is-active,
.workspace[data-view="invoices"].is-active,
.workspace[data-view="expense-reimbursements"].is-active {
  display: block;
}

.panel-header {
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-header h2 {
  font-size: 1.45rem;
  font-weight: 700;
}

.form-stack {
  display: grid;
  gap: 1.1rem;
}

.card {
  min-width: 0;
  padding: 1rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
  box-shadow: var(--shadow-md);
}

.card > h3 {
  margin-bottom: 0.8rem;
}

.card > .section-heading {
  margin-bottom: 0.8rem;
}

.saved-records-card {
  margin-bottom: 1rem;
}

.invoice-shell,
.quote-shell {
  display: grid;
  gap: 1rem;
  width: 100%;
}

.invoice-page-header,
.quote-page-header {
  display: grid;
  gap: 0.85rem;
}

.invoice-breadcrumb {
  margin: 0;
  color: var(--brand);
  font-size: 0.94rem;
}

.invoice-header-row {
  margin-bottom: 0;
}

.invoice-toolbar,
.invoice-toolbar-group,
.invoice-status-tabs,
.invoice-list-toolbar,
.invoice-table-footer,
.invoice-pagination-controls,
.invoice-page-count {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.invoice-toolbar {
  width: 100%;
  justify-content: space-between;
}

.quote-autosave-status,
.purchase-autosave-status {
  min-height: 1.25rem;
  margin: 0;
  white-space: nowrap;
}

.invoice-toolbar-group {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  flex-wrap: wrap;
}

.document-actions-menu {
  position: relative;
  display: inline-flex;
}

.document-actions-trigger .button-icon {
  width: 20px;
  height: 20px;
}

.document-actions-trigger .button-icon circle {
  fill: currentColor;
  stroke: none;
}

.document-actions-popover {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  z-index: 35;
  display: grid;
  gap: 0.15rem;
  min-width: 210px;
  padding: 0.35rem;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-strong);
  box-shadow: 0 14px 32px rgba(15, 35, 52, 0.16);
}

.document-actions-popover[hidden] {
  display: none;
}

.document-actions-popover button {
  width: 100%;
  min-height: 38px;
  justify-content: flex-start;
  gap: 0.55rem;
  padding: 0.55rem 0.65rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  font-weight: 600;
  text-align: left;
}

.document-actions-popover button:hover:not(:disabled),
.document-actions-popover button:focus-visible {
  background: var(--brand-soft);
  box-shadow: none;
  color: var(--brand-deep);
  transform: none;
}

.document-actions-divider {
  height: 1px;
  margin: 0.3rem 0;
  background: var(--line);
}

.invoice-toolbar button,
.toolbar-file-button span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  line-height: 1.15;
  white-space: nowrap;
}

.toolbar-file-button {
  display: inline-flex;
  align-items: center;
  position: relative;
  margin: 0;
}

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

.toolbar-file-button span {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0.68rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--brand-deep);
  cursor: pointer;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.invoice-reminder-pill {
  border-radius: 999px;
}

.invoice-pagination-controls label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.invoice-pagination-controls label span {
  margin: 0;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #57b881;
  display: inline-block;
}

.invoice-list-card {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.invoice-status-tabs {
  width: 100%;
  gap: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: #f6fbfe;
}

.invoice-status-tab {
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: #3383bf;
  padding: 1rem 1.35rem;
  box-shadow: none;
  font-weight: 500;
}

.invoice-status-tab.is-active {
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.document-editor-tabs {
  align-items: stretch;
  max-width: 100%;
  margin-top: 0.25rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

.document-selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
  padding: 0.8rem 0.95rem;
  border: 1px solid #b8d5e7;
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.document-selection-identity {
  display: grid;
  flex: 0 0 auto;
  gap: 0.12rem;
  min-width: 150px;
}

.document-selection-identity > span,
.document-selection-details small,
.document-selection-section small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0;
}

.document-selection-identity > span {
  text-transform: uppercase;
}

.document-selection-identity > strong {
  color: var(--ink);
  font-size: 1.05rem;
}

.document-selection-details {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  min-width: 0;
}

.document-selection-details > span {
  display: grid;
  gap: 0.08rem;
  min-width: 0;
}

.document-selection-details strong {
  max-width: 260px;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-selection-empty {
  color: var(--muted);
  font-size: 0.8rem;
}

.document-selection-state {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem;
}

.document-selection-status {
  padding: 0.3rem 0.48rem;
  border-radius: 4px;
  background: #edf6fb;
  color: #315d78;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.document-selection-status.status-paid,
.document-selection-status.status-accepted,
.document-selection-status.status-approved,
.document-selection-status.status-received,
.document-selection-status.status-reconciled,
.document-selection-status.status-reimbursed {
  background: #e8f5ed;
  color: #267347;
}

.document-selection-status.status-overdue,
.document-selection-status.status-rejected,
.document-selection-status.status-void {
  background: #faece9;
  color: #a33a2b;
}

.document-selection-section {
  display: grid;
  gap: 0.08rem;
  min-width: 110px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
}

.document-editor-tab {
  min-width: 150px;
  flex: 1 1 0;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 0.7rem;
  padding: 0.78rem 0.95rem;
  white-space: normal;
  text-align: left;
}

.document-editor-tab:last-child {
  border-right: 0;
}

.document-editor-tab:hover:not(:disabled) {
  border-color: var(--line);
  background: #eef7fc;
  box-shadow: none;
  transform: none;
}

.document-editor-tab.is-active {
  box-shadow: inset 0 -3px 0 var(--brand);
}

.document-editor-tab-step {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #b7cfdf;
  border-radius: 999px;
  background: #fff;
  color: #557287;
  font-size: 0.74rem;
  font-weight: 800;
}

.document-editor-tab.is-active .document-editor-tab-step {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.document-editor-tab-copy {
  min-width: 0;
  display: grid;
  gap: 0.14rem;
}

.document-editor-tab-copy strong,
.document-editor-tab-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
}

.document-editor-tab-copy strong {
  color: inherit;
  font-size: 0.82rem;
  line-height: 1.2;
}

.document-editor-tab-copy small {
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 500;
  line-height: 1.25;
}

.document-editor-panel[hidden] {
  display: none;
}

.document-editor-panel.is-active {
  display: block;
}

.taxes-tab-panel.document-editor-panel.is-active {
  display: grid;
  gap: 1rem;
}

.invoice-list-toolbar,
.invoice-table-footer {
  width: 100%;
  justify-content: space-between;
  padding: 0.85rem 1rem;
}

.table-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--line);
  background: var(--surface-strong);
}

.table-action-bar[hidden] {
  display: none;
}

.table-action-label {
  min-width: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.table-action-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.table-action-select {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.table-action-select span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  white-space: nowrap;
}

.table-action-select select {
  width: min(38vw, 220px);
  min-width: 150px;
  min-height: 36px;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

.table-action-buttons button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

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

.invoice-list-search input {
  background: #fff;
}

.invoice-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1080px;
  background: #fff;
}

.customer-table {
  min-width: 900px;
}

.purchase-table {
  min-width: 1220px;
}

.customer-related-card .section-heading {
  align-items: flex-start;
}

.customer-related-card .section-heading .subtle {
  margin: 0.25rem 0 0;
}

.customer-related-count {
  flex: 0 0 auto;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7fafc;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.customer-related-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.customer-related-table {
  min-width: 900px;
  border: 0;
}

.customer-related-table th,
.customer-related-table td {
  padding: 0.65rem 0.7rem;
}

.customer-related-type,
.customer-related-status {
  color: #4d6d82;
  font-size: 0.75rem;
  font-weight: 700;
}

.customer-related-type {
  display: inline-block;
  padding: 0.24rem 0.42rem;
  border-radius: 4px;
  background: #edf6fb;
}

.customer-related-link {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--brand);
  font-size: inherit;
  font-weight: 700;
  text-align: left;
}

.customer-related-link:hover:not(:disabled),
.customer-related-link:active:not(:disabled) {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--brand-deep);
  text-decoration: underline;
  transform: none;
}

.bill-pdf-column,
.bill-pdf-cell {
  width: 42px;
  padding-inline: 0.4rem !important;
  text-align: center;
}

.bill-pdf-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--brand);
  border-radius: 4px;
}

.bill-pdf-link:hover,
.bill-pdf-link:focus-visible {
  background: #e6f4fb;
  color: var(--brand-deep);
}

.bill-pdf-icon {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bill-banking-activity-cell {
  min-width: 220px;
  max-width: 320px;
  white-space: normal !important;
}

.bill-banking-activity {
  display: grid;
  gap: 0.35rem;
}

.bill-banking-activity span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  min-width: 0;
  color: #35546a;
  overflow-wrap: anywhere;
}

.bill-banking-activity strong {
  flex: 0 0 auto;
  color: #1d3345;
  font-size: 0.82rem;
  font-weight: 650;
}

.personal-income-table {
  min-width: 1580px;
}

.personal-annual-income-card {
  display: grid;
  gap: 1rem;
}

.personal-annual-income-card > .section-heading {
  align-items: flex-start;
}

.personal-annual-income-card > .section-heading h3,
.personal-annual-income-card > .section-heading p,
.personal-annual-income-note {
  margin: 0;
}

.personal-annual-income-card > .section-heading p {
  margin-top: 0.25rem;
}

.personal-annual-income-table {
  min-width: 1380px;
}

.personal-annual-income-table tbody tr.is-current {
  background: #f3f9fd;
}

.personal-annual-income-table tbody tr.is-forecast {
  background: #f2f9f5;
}

.personal-annual-income-table tbody tr.is-current:hover,
.personal-annual-income-table tbody tr.is-forecast:hover {
  background: #e9f5fb;
}

.personal-annual-income-table tbody th {
  color: var(--ink);
  font-weight: 750;
  text-align: left;
}

.personal-annual-income-gross {
  color: var(--brand-deep);
  font-weight: 750;
}

.personal-annual-income-status {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border: 1px solid #ccdae3;
  border-radius: 999px;
  background: #f5f8fa;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  white-space: nowrap;
}

.personal-annual-income-status.is-current {
  border-color: #a8cfe6;
  background: #e9f5fb;
  color: var(--brand-deep);
}

.personal-annual-income-status.is-forecast {
  border-color: #a9d5b9;
  background: #eaf7ef;
  color: #22633c;
}

.personal-annual-income-change.is-positive {
  color: #22633c;
  font-weight: 700;
}

.personal-annual-income-change.is-negative {
  color: var(--danger);
  font-weight: 700;
}

.personal-primary-tabs {
  margin-bottom: 1rem;
}

.personal-primary-tabs .document-editor-tab {
  min-width: 150px;
  display: block;
  padding: 0.85rem 1.2rem;
  text-align: center;
}

.personal-primary-panel[hidden] {
  display: none;
}

.personal-primary-panel.is-active {
  display: block;
}

.personal-balance-card {
  display: grid;
  gap: 1rem;
}

.personal-balance-card > .section-heading {
  align-items: flex-start;
}

.personal-balance-card > .section-heading h3,
.personal-balance-card > .section-heading p {
  margin: 0;
}

.personal-balance-card > .section-heading p {
  margin-top: 0.25rem;
}

.personal-balance-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.personal-balance-summary-card {
  display: grid;
  gap: 0.3rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fcff;
}

.personal-balance-summary-card span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.personal-balance-summary-card strong {
  color: var(--brand-deep);
  font-size: 1.08rem;
}

.personal-balance-summary-card.is-negative strong {
  color: var(--danger);
}

.personal-balance-list {
  min-width: 0;
}

.personal-balance-table {
  min-width: 1080px;
}

.personal-liabilities-table {
  min-width: 1520px;
}

.personal-balance-table th {
  white-space: nowrap;
}

.personal-balance-table td {
  padding: 0.45rem;
  vertical-align: middle;
}

.personal-balance-table input,
.personal-balance-table select {
  width: 100%;
  min-width: 110px;
  padding: 0.55rem 0.6rem;
  border: 1px solid #c7d9e4;
  border-radius: 6px;
  background: #fff;
}

.personal-balance-table input:focus,
.personal-balance-table select:focus {
  border-color: var(--brand);
  outline: 2px solid color-mix(in srgb, var(--brand) 18%, transparent);
  outline-offset: 0;
}

.personal-balance-table .personal-balance-money-input {
  text-align: right;
}

.personal-balance-table .personal-balance-actions {
  width: 1%;
  white-space: nowrap;
}

.personal-balance-table .invoice-empty-state {
  padding: 1.5rem;
  color: var(--muted);
  text-align: center;
}

.personal-balance-table .invoice-empty-state strong {
  color: var(--ink);
}

@media (max-width: 820px) {
  .personal-balance-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .personal-balance-summary {
    grid-template-columns: 1fr;
  }
}

.purchase-account-summary,
.personal-income-summary {
  display: grid;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--line);
  background: #fbfdff;
}

.account-summary-heading {
  color: #43637a;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.account-summary-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.55rem;
}

.account-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.68rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #1d3345;
}

.account-summary-row {
  align-items: center;
}

.account-summary-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.account-summary-row strong {
  flex: 0 0 auto;
}

.purchase-csv-card {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
}

.purchase-csv-panel {
  width: min(980px, 100%);
}

.purchase-csv-upload-row {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(0, 1fr);
  gap: 0.85rem;
  align-items: end;
}

.purchase-csv-upload-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 42px;
  padding: 0.68rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--brand-deep);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font-weight: 600;
  transition:
    background-color 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.purchase-csv-upload-button:hover {
  border-color: #9fc8e1;
  background: #e7f4fc;
  color: var(--brand-deep);
  box-shadow: 0 5px 14px rgba(15, 35, 52, 0.1);
  transform: translateY(-1px);
}

.purchase-csv-upload-button:active {
  box-shadow: var(--shadow-sm);
  transform: translateY(0);
}

.purchase-csv-upload-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.purchase-csv-upload-button span {
  color: inherit;
  font-size: 0.86rem;
  font-weight: 650;
  letter-spacing: 0;
}

.purchase-csv-notes-field {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.purchase-csv-notes-field textarea {
  min-height: 42px;
  resize: vertical;
}

.purchase-csv-upload-status {
  min-height: 1.15rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.purchase-csv-upload-status:empty {
  display: none;
}

.purchase-csv-upload-status.is-error {
  color: var(--danger);
}

.purchase-csv-upload-status.is-success {
  color: #247a4b;
}

.purchase-csv-uploads {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.purchase-csv-uploads > .subtle {
  margin: 0;
  padding: 0.85rem 0.95rem;
}

.purchase-csv-upload-item {
  display: grid;
  gap: 0.65rem;
  padding: 0.9rem 0.95rem;
  border-top: 1px solid var(--line);
}

.purchase-csv-upload-item:first-child {
  border-top: 0;
}

.purchase-csv-upload-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
}

.purchase-csv-upload-title {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.purchase-csv-upload-title strong,
.purchase-csv-upload-title span,
.purchase-csv-notes {
  min-width: 0;
  overflow-wrap: anywhere;
}

.purchase-csv-upload-title strong {
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 650;
}

.purchase-csv-upload-title span,
.purchase-csv-notes {
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.35;
}

.purchase-csv-notes {
  margin: 0;
}

.purchase-csv-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.purchase-csv-download {
  min-height: 38px;
  padding: 0.58rem 0.78rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--brand-deep);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition:
    background-color 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.purchase-csv-download:hover {
  border-color: #9fc8e1;
  background: #e7f4fc;
  color: var(--brand-deep);
  box-shadow: 0 5px 14px rgba(15, 35, 52, 0.1);
  transform: translateY(-1px);
}

.purchase-csv-preview {
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.purchase-csv-preview table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  font-size: 0.8rem;
}

.purchase-csv-preview td {
  max-width: 260px;
  padding: 0.45rem 0.55rem;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  color: #263f52;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-csv-preview tr:first-child td {
  border-top: 0;
  background: #f2f8fc;
  color: var(--ink);
  font-weight: 650;
}

.purchase-csv-preview td:last-child {
  border-right: 0;
}

.bank-connections-card,
.banking-import-card {
  display: grid;
  gap: 0.9rem;
  margin-top: 1rem;
}

.bank-connections-card .section-heading {
  align-items: flex-start;
}

.bank-connections-intro {
  max-width: 720px;
  margin: 0.32rem 0 0;
}

.bank-read-only-badge,
.bank-connection-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0.28rem 0.65rem;
  border: 1px solid #b9d9c8;
  border-radius: 999px;
  background: #edf8f2;
  color: #17623e;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.025em;
  white-space: nowrap;
}

.bank-connections-list {
  display: grid;
  gap: 0.8rem;
}

.bank-connection-empty,
.bank-connection-item {
  border: 1px solid #cbdbe6;
  border-radius: 10px;
  background:
    radial-gradient(circle at 100% 0, rgba(51, 119, 165, 0.09), transparent 34%),
    linear-gradient(145deg, #fff 0%, #f8fbfd 100%);
}

.bank-connection-empty {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem;
}

.bank-connection-empty strong {
  display: block;
  color: var(--ink);
  font-size: 0.92rem;
}

.bank-connection-empty p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.bank-connection-empty .bank-connection-config {
  color: #8a4b17;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.72rem;
}

.bank-connection-mark {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 12px;
  background: linear-gradient(145deg, #173f6e 0%, #1e6790 52%, #b21f37 100%);
  box-shadow: 0 7px 18px rgba(21, 68, 105, 0.2);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.bank-connection-item {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
}

.bank-connection-heading,
.bank-connection-footer,
.bank-connection-identity {
  display: flex;
  align-items: center;
}

.bank-connection-heading,
.bank-connection-footer {
  justify-content: space-between;
  gap: 1rem;
}

.bank-connection-identity {
  gap: 0.78rem;
}

.bank-connection-identity strong,
.bank-connection-identity span {
  display: block;
}

.bank-connection-identity strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.bank-connection-identity span,
.bank-connection-meta {
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.73rem;
}

.bank-connection-status.needs-attention {
  border-color: #edc69f;
  background: #fff6eb;
  color: #8a4b17;
}

.bank-account-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.bank-account-chip {
  display: grid;
  gap: 0.08rem;
  min-width: 165px;
  padding: 0.58rem 0.7rem;
  border: 1px solid #d6e2ea;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.bank-account-chip span {
  color: #263f52;
  font-size: 0.78rem;
  font-weight: 700;
}

.bank-account-chip small {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: capitalize;
}

.bank-connection-warning {
  margin: 0;
  padding: 0.62rem 0.72rem;
  border-left: 3px solid #d37a28;
  border-radius: 4px;
  background: #fff7ed;
  color: #784112;
  font-size: 0.76rem;
  line-height: 1.45;
}

.bank-connection-footer {
  padding-top: 0.8rem;
  border-top: 1px solid #dfE8ee;
}

.banking-column-mapping {
  display: grid;
  gap: 0.9rem;
}

.banking-mapping-grid {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.banking-import-preview {
  max-height: 280px;
}

.banking-transactions-card {
  margin-top: 1rem;
}

.chart-of-accounts-shell {
  display: grid;
  gap: 1rem;
}

.chart-of-accounts-shell .invoice-page-header {
  margin-bottom: 0;
}

.chart-of-accounts-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.chart-of-accounts-summary > div {
  display: grid;
  gap: 0.28rem;
  min-width: 0;
  padding: 0.9rem 1rem;
  border-right: 1px solid var(--line);
}

.chart-of-accounts-summary > div:last-child {
  border-right: 0;
}

.chart-of-accounts-summary span {
  color: #587487;
  font-size: 0.78rem;
  font-weight: 650;
}

.chart-of-accounts-summary strong {
  color: #17344c;
  font-size: 1.28rem;
  font-weight: 700;
}

.chart-of-accounts-table {
  min-width: 1050px;
}

.chart-account-name {
  font-weight: 650;
  color: #17344c;
}

.chart-account-status {
  color: #728797;
  font-weight: 600;
}

.chart-account-status.is-active {
  color: #26834d;
}

.financial-statements-shell {
  display: grid;
  gap: 1rem;
}

.financial-statements-header {
  margin-bottom: 0;
}

.financial-statements-header .panel-header {
  margin-bottom: 0.35rem;
}

.financial-statements-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: flex-end;
  gap: 0.75rem;
}

.financial-statements-controls label {
  display: grid;
  gap: 0.35rem;
  min-width: 160px;
}

.financial-statements-controls label > span {
  color: var(--label);
  font-size: 0.76rem;
  font-weight: 650;
}

.financial-statement-tabs {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.financial-statement-tab {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.financial-statement-sheet {
  min-width: 0;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.financial-statement-sheet[hidden] {
  display: none;
}

.financial-statement-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #dce8ef;
}

.financial-statement-title h3 {
  margin: 0 0 0.25rem;
  color: #17344c;
  font-size: 1.18rem;
}

.financial-statement-title p {
  margin: 0;
  color: #668095;
  font-size: 0.82rem;
}

.financial-statement-title > p {
  padding-top: 0.15rem;
  white-space: nowrap;
}

.financial-statement-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.financial-statement-table {
  width: 100%;
  border-collapse: collapse;
  color: #24445b;
  font-variant-numeric: tabular-nums;
}

.financial-statement-table th,
.financial-statement-table td {
  padding: 0.72rem 0.75rem;
  border-bottom: 1px solid #e1ebf1;
  text-align: left;
}

.financial-statement-table .num {
  width: 190px;
  text-align: right;
  white-space: nowrap;
}

.financial-statement-table thead th {
  color: #607b8e;
  font-size: 0.76rem;
  font-weight: 650;
}

.financial-statement-section-row th {
  padding-top: 1.1rem;
  border-bottom-color: #cadce7;
  color: #17344c;
  font-size: 0.86rem;
  font-weight: 750;
}

.financial-statement-total-row th {
  border-top: 1px solid #afc6d5;
  color: #17344c;
  font-weight: 750;
}

.financial-statement-total-row.is-grand-total th,
.financial-statement-total-row.is-net-total th {
  border-top: 2px solid #7897aa;
  border-bottom: 2px solid #7897aa;
}

.financial-statement-total-row.is-net-total th {
  background: #edf7fd;
  color: #0d527f;
}

.financial-statement-table .is-negative {
  color: #a83a2c;
}

.financial-statement-empty-row td {
  color: #7a8f9e;
  font-style: italic;
}

.markets-shell {
  display: grid;
  gap: 1rem;
}

.markets-page-header {
  margin-bottom: 0;
}

.markets-page-header .panel-header {
  margin-bottom: 0.35rem;
}

.markets-tabs {
  margin: 0;
}

.markets-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.45fr);
  grid-auto-rows: auto;
  gap: 1rem;
  align-items: start;
}

.market-panel {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.market-panel .section-heading {
  margin-bottom: 0.85rem;
}

.markets-filings-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: -0.2rem 0 0.8rem;
}

.market-filing-filter {
  min-height: 30px;
  padding: 0.32rem 0.58rem;
  border: 1px solid #b9cfdd;
  border-radius: 999px;
  background: #fff;
  box-shadow: none;
  color: #46697f;
  font-size: 0.74rem;
  font-weight: 700;
}

.market-filing-filter:hover:not(:disabled),
.market-filing-filter:active:not(:disabled) {
  border-color: #7eacc7;
  background: #eef7fc;
  box-shadow: none;
  transform: none;
}

.market-filing-filter.is-selected {
  border-color: #176fa7;
  background: #176fa7;
  color: #fff;
}

.markets-add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
  margin-bottom: 0.7rem;
}

.markets-add-form input {
  min-width: 0;
  text-transform: uppercase;
}

.markets-watchlist {
  display: grid;
  gap: 0.35rem;
}

.markets-watchlist > .subtle,
.markets-alert-list > .subtle,
.markets-chart > .subtle {
  margin: 0;
  padding: 0.7rem 0;
}

.market-watch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 32px;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.55rem;
  border: 1px solid transparent;
  border-radius: 6px;
}

.market-watch-row:hover,
.market-watch-row.is-selected {
  border-color: #bfdaeb;
  background: #edf7fd;
}

.market-watch-select {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  text-align: left;
}

.market-watch-select:hover:not(:disabled),
.market-watch-select:active:not(:disabled) {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  transform: none;
}

.market-watch-symbol {
  color: #153c58;
  font-weight: 750;
}

.market-watch-select small {
  overflow: hidden;
  color: #6b8292;
  font-size: 0.78rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-watch-quote {
  display: grid;
  justify-items: end;
  gap: 0.12rem;
  min-width: 84px;
}

.market-watch-quote strong {
  color: #1d3345;
  font-size: 0.9rem;
}

.market-watch-remove {
  width: 32px;
  height: 32px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: #7890a0;
  box-shadow: none;
}

.market-watch-remove:hover:not(:disabled) {
  border-color: #d5e5ef;
  background: #fff;
  color: var(--danger);
  box-shadow: none;
}

.market-change {
  color: #6f8595;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.market-change.is-positive {
  color: #25834d;
}

.market-change.is-negative {
  color: #bf402e;
}

.markets-chart-panel {
  min-height: 344px;
}

.markets-chart-panel .section-heading {
  align-items: flex-start;
}

.markets-chart-panel .market-change {
  padding-top: 0.2rem;
  font-size: 0.9rem;
}

.markets-chart-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  margin-bottom: 0.65rem;
}

.markets-chart-options {
  display: inline-flex;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
}

.market-chart-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 40px;
  min-height: 34px;
  padding: 0.4rem 0.65rem;
  border: 0;
  border-right: 1px solid var(--line-strong);
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  color: #47677d;
  font-size: 0.78rem;
  font-weight: 700;
}

.market-chart-option:last-child {
  border-right: 0;
}

.market-chart-option:hover:not(:disabled),
.market-chart-option:active:not(:disabled) {
  border-color: var(--line-strong);
  background: #eef6fb;
  box-shadow: none;
  transform: none;
}

.market-chart-option.is-selected {
  background: #173f5b;
  color: #fff;
}

.market-chart-option .button-icon {
  width: 15px;
  height: 15px;
}

.markets-chart-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
  min-height: 38px;
  padding: 0.5rem 0;
  border-top: 1px solid #e0ebf2;
  border-bottom: 1px solid #e0ebf2;
  color: #415f74;
  font-size: 0.76rem;
}

.markets-chart-legend:empty {
  display: none;
}

.markets-chart-legend > span {
  display: inline-flex;
  align-items: baseline;
  gap: 0.28rem;
  white-space: nowrap;
}

.markets-chart-legend .market-chart-session {
  margin-right: auto;
  color: #17344c;
  font-weight: 700;
}

.markets-chart-legend small {
  color: #718898;
  font-size: 0.72rem;
}

.markets-chart-legend strong {
  color: #1d3345;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.markets-chart {
  display: grid;
  min-height: 300px;
  margin-top: 0.35rem;
}

.markets-chart-stage {
  position: relative;
  min-width: 0;
}

.markets-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  touch-action: pan-y;
}

.markets-chart-grid {
  stroke: #dbe7ee;
  stroke-width: 1;
}

.markets-chart-area {
  fill: rgba(21, 129, 208, 0.1);
}

.markets-chart-line {
  fill: none;
  stroke: #1480c8;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.markets-candle.is-up {
  color: #25834d;
}

.markets-candle.is-down {
  color: #c44838;
}

.markets-candle-wick {
  stroke: currentColor;
  stroke-width: 1;
}

.markets-candle-body {
  fill: currentColor;
}

.markets-volume-bar.is-up {
  fill: #25834d;
  opacity: 0.2;
}

.markets-volume-bar.is-down {
  fill: #c44838;
  opacity: 0.18;
}

.markets-volume-baseline {
  stroke: #cbdbe5;
  stroke-width: 1;
}

.markets-chart-hover-guide {
  stroke: #668398;
  stroke-width: 1;
  stroke-dasharray: 3 3;
  pointer-events: none;
}

.markets-chart-hover-marker {
  fill: #fff;
  stroke: #1480c8;
  stroke-width: 2;
  pointer-events: none;
}

.markets-chart-hit {
  fill: transparent;
  pointer-events: all;
}

.markets-chart-label {
  fill: #6b8292;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.markets-volume-label {
  font-size: 10px;
}

.markets-chart-tooltip {
  position: absolute;
  z-index: 2;
  display: grid;
  gap: 0.18rem;
  min-width: 150px;
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  background: #17344c;
  box-shadow: 0 6px 16px rgba(15, 35, 52, 0.18);
  color: #fff;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.markets-chart-tooltip strong {
  font-size: 0.76rem;
}

.markets-alert-list {
  display: grid;
  gap: 0;
  border-top: 1px solid #e0ebf2;
}

.market-alert-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.7rem;
  min-width: 0;
  padding: 0.75rem 0;
  border-bottom: 1px solid #e0ebf2;
  color: #1d405b;
  text-decoration: none;
}

a.market-alert-row:hover,
a.market-alert-row:focus-visible {
  color: var(--brand-deep);
}

.market-alert-badge {
  min-width: 42px;
  color: #0d5d96;
  font-size: 0.75rem;
  font-weight: 750;
}

.market-alert-copy {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.market-alert-copy strong {
  display: -webkit-box;
  overflow: hidden;
  color: inherit;
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.market-alert-copy small,
.market-alert-row time {
  color: #708697;
  font-size: 0.76rem;
}

.market-alert-row time {
  padding-top: 0.1rem;
  white-space: nowrap;
}

.market-news-row {
  grid-template-columns: minmax(0, 1fr);
}

.market-financials-panel {
  display: grid;
  gap: 1rem;
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.market-financials-panel[hidden] {
  display: none;
}

.market-financials-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.market-financials-header h3,
.market-financial-statement h4 {
  margin: 0;
}

.market-financials-header .subtle {
  margin: 0.25rem 0 0;
}

.market-financials-content {
  display: grid;
  gap: 1.25rem;
  min-width: 0;
}

.market-financial-statement {
  min-width: 0;
}

.market-financial-statement h4 {
  margin-bottom: 0.55rem;
  color: #1d405b;
  font-size: 0.92rem;
}

.market-financial-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.market-financial-table {
  min-width: 760px;
  border: 0;
}

.market-financial-table th,
.market-financial-table td {
  padding: 0.58rem 0.7rem;
}

.market-financial-table thead th:first-child {
  min-width: 220px;
  text-align: left;
}

.market-financial-table thead th:not(:first-child) {
  min-width: 112px;
}

.market-financial-table thead span,
.market-financial-table thead small {
  display: block;
}

.market-financial-table thead small {
  margin-top: 0.16rem;
  color: #6f8595;
  font-size: 0.68rem;
  font-weight: 600;
}

.market-financial-key-row th,
.market-financial-key-row td {
  background: #f2f8fb;
  font-weight: 700;
}

.market-financials-source {
  margin: 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.banking-bill-cell {
  min-width: 250px;
}

.banking-account-cell {
  min-width: 210px;
}

.banking-account-select {
  width: 100%;
  min-width: 210px;
}

.banking-bill-match {
  width: 100%;
  min-width: 230px;
}

.banking-bill-search {
  display: grid;
  gap: 0.4rem;
  min-width: 230px;
}

.banking-bill-search input,
.banking-bill-search select {
  width: 100%;
}

.document-pdf-list {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.document-pdf-list > .subtle {
  margin: 0;
  padding: 0.85rem 0.95rem;
}

.document-pdf-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.9rem 0.95rem;
  border-top: 1px solid var(--line);
}

.document-pdf-item:first-child {
  border-top: 0;
}

.document-pdf-title {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.document-pdf-title strong,
.document-pdf-title span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.document-pdf-title strong {
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 650;
}

.document-pdf-title span {
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.35;
}

.document-pdf-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.document-pdf-link {
  min-height: 38px;
  padding: 0.58rem 0.78rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--brand-deep);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition:
    background-color 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.document-pdf-link:hover {
  border-color: #9fc8e1;
  background: #e7f4fc;
  color: var(--brand-deep);
  box-shadow: 0 5px 14px rgba(15, 35, 52, 0.1);
  transform: translateY(-1px);
}

.personal-income-summary-row {
  align-items: flex-start;
  flex-wrap: wrap;
}

.personal-income-summary-row strong {
  flex: 1 1 220px;
  text-align: right;
  white-space: normal;
}

.tax-settings-grid {
  align-items: end;
}

.checkbox-field {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 0.55rem;
  padding: 0.72rem 0;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.checkbox-field span {
  margin: 0;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 650;
}

.tax-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.tax-summary-card {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.tax-summary-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 650;
}

.tax-summary-card dl {
  display: grid;
  gap: 0.45rem;
  margin: 0;
}

.tax-summary-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
  padding-top: 0.45rem;
  border-top: 1px solid #e7eef4;
}

.tax-summary-card dt,
.tax-summary-card dd {
  margin: 0;
  min-width: 0;
  font-size: 0.9rem;
}

.tax-summary-card dt {
  color: var(--muted);
}

.tax-summary-card dd {
  color: var(--ink);
  font-weight: 700;
  text-align: right;
  overflow-wrap: anywhere;
}

.tax-table {
  min-width: 760px;
}

.tax-unpaid-table {
  min-width: 1080px;
}

.tax-underpayment-table {
  min-width: 1180px;
}

.tax-personal-table {
  min-width: 1220px;
}

.invoice-table th,
.invoice-table td {
  padding: 0.95rem 0.6rem;
  border-bottom: 1px solid #d9e4ed;
  text-align: left;
  font-size: 0.95rem;
  white-space: nowrap;
}

.invoice-table th {
  font-weight: 700;
  color: #43637a;
  background: #fbfdff;
}

.invoice-table th.select-column,
.invoice-table td.select-cell {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  padding-inline: 0.5rem;
  text-align: center;
}

.invoice-table th.select-column input,
.invoice-table td.select-cell input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.table-sort-button {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  box-shadow: none;
  font: inherit;
  font-weight: inherit;
  text-align: inherit;
}

.table-sort-button:hover:not(:disabled),
.table-sort-button:active:not(:disabled) {
  border-color: transparent;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  transform: none;
}

.invoice-table th.num .table-sort-button {
  justify-content: flex-end;
}

.sort-indicator {
  width: 0.75rem;
  min-width: 0.75rem;
  color: var(--brand-deep);
  font-size: 0.82rem;
  line-height: 1;
  text-align: center;
}

.invoice-table tfoot th,
.invoice-table tfoot td {
  border-bottom: 0;
  border-top: 1px solid #c7d7e3;
  background: #f6f9fc;
  color: #1d3345;
  font-weight: 650;
}

.invoice-table-total-row th {
  text-align: right;
}

.invoice-table tbody tr {
  cursor: pointer;
}

.invoice-table tbody tr:hover {
  background: #f4fbff;
}

.invoice-table tbody tr.is-selected {
  background: #e9f5fd;
}

.invoice-table tbody tr.is-batch-selected {
  background: #edf7f2;
}

.invoice-table td.num,
.invoice-table th.num {
  text-align: right;
}

.invoice-linkish {
  color: #2580c2;
}

.invoice-status-cell {
  font-weight: 500;
}

.invoice-status-cell.status-paid {
  color: #24834b;
}

.invoice-status-cell.status-awaiting-payment {
  color: #7f5e00;
}

.invoice-status-cell.status-partially-paid {
  color: #9a4f08;
}

.invoice-status-cell.status-draft,
.invoice-status-cell.status-awaiting-approval,
.invoice-status-cell.status-repeating {
  color: #5c6c7a;
}

.invoice-sent-cell.sent-viewed,
.invoice-sent-cell.sent-sent {
  color: #4d9423;
}

.invoice-empty-state {
  padding: 1.2rem 1rem;
  color: var(--muted);
}

.invoice-quote-summary {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.85rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.invoice-source-quote-actions {
  margin-top: 0.9rem;
}

.invoice-quote-summary-title {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  flex-wrap: wrap;
}

.invoice-quote-summary-title strong {
  color: var(--ink);
}

.invoice-quote-summary-title span {
  color: var(--muted);
  font-size: 0.9rem;
}

.invoice-quote-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.invoice-quote-summary-metric {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
}

.invoice-quote-summary-metric span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.invoice-quote-summary-metric strong {
  color: var(--ink);
  font-size: 1rem;
}

.invoice-quote-summary-metric.is-over {
  border-color: #e0a39a;
  background: #fff4f2;
}

.invoice-quote-summary-metric.is-over strong {
  color: var(--danger);
}

.invoice-editor-stack,
.quote-editor-stack,
.expense-editor-stack {
  margin-top: 0.25rem;
  width: 100%;
}

.saved-records-list,
.list-editor,
.line-items {
  display: grid;
  gap: 0.8rem;
  margin-top: 0.75rem;
}

.invoice-payment-fields {
  margin-top: 1rem;
}

.field-button-label button {
  width: 100%;
}

.list-editor {
  overflow-x: auto;
}

.quote-work-list {
  display: grid;
  gap: 0.45rem;
}

.quote-list-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.55rem;
  padding: 0.42rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background-color 0.16s ease;
}

.quote-list-row:hover,
.quote-list-row:focus-within {
  border-color: #b9d5e8;
  background: #fbfdff;
  box-shadow: 0 2px 6px rgba(15, 35, 52, 0.045);
}

.quote-list-order {
  display: inline-flex;
  align-items: center;
  gap: 0.24rem;
  min-height: 42px;
}

.quote-list-order .drag-handle {
  width: 1.65rem;
  height: 1.65rem;
  min-height: 1.65rem;
  border-color: transparent;
  background: transparent;
  color: #89a4b7;
  opacity: 0.55;
}

.quote-list-row:hover .drag-handle,
.quote-list-row:focus-within .drag-handle,
.quote-list-order .drag-handle:focus-visible {
  border-color: #c7dfef;
  background: #edf7fd;
  color: var(--brand-deep);
  opacity: 1;
}

.quote-list-order .list-line-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2rem;
  color: #567389;
  font-size: 0.78rem;
  font-weight: 700;
}

.quote-list-row .list-description-cell {
  min-width: 0;
}

.quote-list-row .list-description-cell textarea {
  display: block;
  width: 100%;
  min-height: 42px;
  margin: 0;
  padding: 0.64rem 0.7rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  line-height: 1.35;
  resize: none;
}

.quote-list-row .list-description-cell textarea:hover {
  background: #f7fbfe;
}

.quote-list-row .list-description-cell textarea:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px var(--field-focus);
}

.quote-list-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  min-height: 42px;
}

.quote-list-actions .list-reorder-controls {
  gap: 0.15rem;
}

.quote-list-actions .move-list-item,
.quote-list-actions .ghost-danger {
  width: 1.8rem;
  height: 1.8rem;
  min-height: 1.8rem;
  padding: 0;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  opacity: 0.6;
}

.quote-list-actions .ghost-danger {
  color: #b42318;
}

.quote-list-row:hover .quote-list-actions button:not(:disabled),
.quote-list-row:focus-within .quote-list-actions button:not(:disabled),
.quote-list-actions button:focus-visible {
  opacity: 1;
}

.quote-list-actions .move-list-item:hover:not(:disabled),
.quote-list-actions .move-list-item:focus-visible {
  border-color: #c7dfef;
  background: #edf7fd;
}

.quote-list-actions .ghost-danger:hover,
.quote-list-actions .ghost-danger:focus-visible {
  border-color: #f1bbb3;
  background: #fff2f0;
}

.quote-list-row.is-drop-target {
  border-color: var(--brand);
  background: var(--brand-soft);
}

@media (max-width: 640px) {
  .quote-list-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .quote-list-actions {
    grid-column: 2;
    justify-content: flex-end;
    min-height: 1.8rem;
    margin-top: -0.15rem;
  }
}

.supply-items,
#revision-items {
  overflow-x: auto;
}

.saved-record-item {
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-alt);
  text-align: left;
  box-shadow: none;
}

.saved-record-item strong,
.saved-record-item span {
  display: block;
}

.saved-record-item strong {
  color: var(--ink);
  font-size: 0.98rem;
}

.saved-record-item span,
.subtle {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.saved-record-item:hover {
  border-color: var(--brand);
  background: #e7f4fc;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

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

.quote-dynamics-section {
  background: var(--surface);
}

.quote-dynamics-section > h3,
.quote-dynamics-section > .section-heading {
  margin-bottom: 0.75rem;
}

.dynamics-field-grid {
  gap: 0.75rem 1rem;
  overflow: visible;
  border: 0;
  background: transparent;
}

.dynamics-field-grid.single-field-grid {
  grid-template-columns: 1fr;
}

.dynamics-field-grid.quote-layout-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.dynamics-field-grid label {
  gap: 0.28rem;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.field-grid:not(.dynamics-field-grid) > label:not(.checkbox-field) {
  gap: 0.28rem;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.field-grid:not(.dynamics-field-grid) > .receipt-upload-field,
.field-grid:not(.dynamics-field-grid) > .purchase-csv-notes-field {
  gap: 0.28rem;
  min-width: 0;
  padding: 0.7rem;
  border: 1px solid #d7e4ee;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 1px 2px rgba(15, 35, 52, 0.025);
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background-color 0.16s ease;
}

.line-item-editor:not(.expense-line-item-editor) > label {
  gap: 0.28rem;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.dynamics-field-grid label:focus-within {
  border-color: transparent;
  box-shadow: none;
}

.field-grid:not(.dynamics-field-grid) > label:not(.checkbox-field):focus-within {
  border-color: transparent;
  box-shadow: none;
}

.field-grid:not(.dynamics-field-grid) > .receipt-upload-field:focus-within,
.field-grid:not(.dynamics-field-grid) > .purchase-csv-notes-field:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--field-focus);
}

.line-item-editor:not(.expense-line-item-editor) > label:focus-within {
  border-color: transparent;
  box-shadow: none;
}

.dynamics-field-grid label span {
  display: block;
  padding: 0 0.05rem;
  border-bottom: 0;
  background: transparent;
  color: var(--label);
  line-height: 1.25;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.field-grid:not(.dynamics-field-grid) > label:not(.checkbox-field) > span,
.field-grid:not(.dynamics-field-grid) > .receipt-upload-field > span,
.field-grid:not(.dynamics-field-grid) > .purchase-csv-notes-field > span,
.line-item-editor > label > span,
.line-item-editor > .receipt-upload-field > span {
  display: block;
  padding: 0 0.05rem;
  border-bottom: 0;
  background: transparent;
  color: var(--label);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: normal;
  text-transform: none;
}

.quote-layout-grid > label {
  position: relative;
  grid-column: span var(--quote-field-span, 6);
}

.dynamics-field-grid label > span.quote-field-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 1rem;
  gap: 0.5rem;
}

.dynamics-field-grid label span.quote-field-layout-controls {
  display: inline-flex;
  margin-left: auto;
  padding: 0;
  border: 0;
  background: transparent;
  text-transform: none;
  visibility: hidden;
  opacity: 0;
  transition:
    opacity 0.16s ease,
    visibility 0.16s ease;
}

.quote-field-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  min-height: 18px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #7f98aa;
  line-height: 1;
  box-shadow: none;
  cursor: grab;
  opacity: 0.7;
  transition:
    background-color 0.16s ease,
    color 0.16s ease,
    opacity 0.16s ease;
}

.quote-field-drag-handle::before {
  content: "";
  width: 12px;
  height: 14px;
  background-image: radial-gradient(currentColor 1.1px, transparent 1.1px);
  background-position: 0 0;
  background-repeat: repeat;
  background-size: 5px 5px;
}

.dynamics-field-grid label:hover .quote-field-drag-handle,
.dynamics-field-grid label:focus-within .quote-field-drag-handle,
.quote-field-drag-handle:hover {
  background: rgba(21, 129, 208, 0.1);
  color: var(--brand-deep);
  opacity: 1;
}

.dynamics-field-grid label:hover .quote-field-layout-controls,
.dynamics-field-grid label:focus-within .quote-field-layout-controls {
  visibility: visible;
  opacity: 1;
}

.quote-field-resize-handle {
  position: absolute;
  top: 1rem;
  right: -0.5rem;
  bottom: 0;
  z-index: 2;
  width: 1rem;
  cursor: col-resize;
  touch-action: none;
}

.quote-field-resize-handle::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 4px;
  left: 7px;
  width: 2px;
  border-radius: 999px;
  background: transparent;
}

.quote-layout-grid > label:hover .quote-field-resize-handle::after,
.quote-layout-grid > label.is-resizing .quote-field-resize-handle::after {
  background: var(--brand);
}

.quote-layout-grid > label.is-dragging {
  opacity: 0.55;
}

.quote-layout-grid > label.is-resizing {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.quote-layout-grid > label.is-drop-target {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

body.is-resizing-quote-field {
  cursor: col-resize;
  user-select: none;
}

.dynamics-field-grid input,
.dynamics-field-grid select,
.dynamics-field-grid textarea {
  padding: 0.58rem 0.72rem;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  background: var(--field-bg);
  box-shadow: inset 0 1px 1px rgba(15, 35, 52, 0.025);
}

.dynamics-field-grid input:hover,
.dynamics-field-grid select:hover,
.dynamics-field-grid textarea:hover {
  border-color: var(--field-border-hover);
}

.dynamics-field-grid input[readonly],
.dynamics-field-grid textarea[readonly] {
  color: var(--ink);
  font-weight: 700;
  background: color-mix(in srgb, var(--field-bg) 82%, var(--surface-muted));
  cursor: default;
}

.company-details-source {
  margin: -0.25rem 0 1rem;
}

label,
.line-item-editor {
  display: grid;
  gap: 0.35rem;
}

.dynamics-list-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  table-layout: fixed;
}

.dynamics-list-table th {
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-align: left;
  text-transform: uppercase;
}

.dynamics-list-table td {
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.dynamics-list-table tbody tr:last-child td {
  border-bottom: 0;
}

.dynamics-list-table tbody tr:hover {
  background: #f2f8fc;
}

.dynamics-list-table .supply-group-row td {
  background: #e7f1f8;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.dynamics-list-table .supply-group-row input {
  font-weight: 700;
  color: var(--ink);
}

.table-row-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.table-row-actions button {
  padding: 0.42rem 0.52rem;
  font-size: 0.76rem;
  line-height: 1.1;
  box-shadow: none;
}

.table-row-actions .ghost-danger.icon-only-button,
.list-actions-cell .ghost-danger.icon-only-button,
.line-item-editor > .ghost-danger.icon-only-button,
.receipt-preview .ghost-danger.icon-only-button {
  width: 2.4rem;
  min-width: 2.4rem;
  min-height: 2.4rem;
  padding: 0;
}

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

.quote-pricing-total {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
  font-size: 1rem;
  color: var(--ink);
}

.quote-pricing-total span {
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(10, 24, 32, 0.42);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  width: min(920px, 100%);
  max-height: min(760px, calc(100vh - 3rem));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.2rem;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.quote-pdf-revision-panel .dynamics-list-table {
  margin-top: 0.8rem;
}

.quote-pdf-layout-option {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.85rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
}

.quote-pdf-layout-option input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--brand);
}

.modal-actions {
  position: static;
  justify-content: flex-end;
  padding-top: 1rem;
  background: transparent;
}

.bill-invoice-pdf-panel {
  width: min(780px, 100%);
}

.bill-invoice-pdf-upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 0.85rem;
}

.bill-invoice-pdf-upload-mode {
  display: grid;
  gap: 0.65rem;
  min-width: 0;
}

.bill-invoice-pdf-upload-mode h4 {
  margin: 0;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 650;
}

.bill-invoice-pdf-dropzone {
  position: relative;
  display: grid;
  min-height: 8rem;
  place-items: center;
  gap: 0.6rem;
  padding: 1rem;
  border: 1px dashed #9fc8e1;
  border-radius: 8px;
  background: #f8fbfd;
  color: var(--brand-deep);
  cursor: pointer;
  text-align: center;
  transition:
    background-color 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.bill-invoice-pdf-dropzone:hover,
.bill-invoice-pdf-dropzone.is-drop-target {
  border-color: var(--brand);
  background: #e7f4fc;
  box-shadow: 0 5px 14px rgba(15, 35, 52, 0.1);
  transform: translateY(-1px);
}

.bill-invoice-pdf-dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.bill-invoice-pdf-dropzone .button-icon {
  width: 1.6rem;
  height: 1.6rem;
}

.bill-invoice-pdf-dropzone span {
  color: inherit;
  font-size: 0.9rem;
  font-weight: 650;
}

.bill-invoice-pdf-progress {
  display: grid;
  gap: 0.45rem;
  margin-top: 1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.bill-invoice-pdf-progress[hidden] {
  display: none;
}

.bill-invoice-pdf-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 650;
}

.bill-invoice-pdf-progress-header span:last-child {
  color: var(--muted);
  font-weight: 600;
}

.bill-invoice-pdf-progress progress {
  width: 100%;
  height: 0.75rem;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--surface-alt);
}

.bill-invoice-pdf-progress progress::-webkit-progress-bar {
  border-radius: 999px;
  background: var(--surface-alt);
}

.bill-invoice-pdf-progress progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--brand);
}

.bill-invoice-pdf-progress progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--brand);
}

.bill-invoice-pdf-import-results {
  display: grid;
  gap: 0.5rem;
  margin-top: 1rem;
}

.bill-invoice-pdf-import-results:empty {
  display: none;
}

.bill-invoice-pdf-import-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
}

.bill-invoice-pdf-import-row:first-child {
  border-top: 0;
}

.bill-invoice-pdf-import-row strong,
.bill-invoice-pdf-import-row span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bill-invoice-pdf-import-row strong {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 650;
}

.bill-invoice-pdf-import-row span {
  color: var(--muted);
  font-size: 0.82rem;
}

.bill-invoice-pdf-import-status {
  color: var(--brand-deep);
  font-size: 0.82rem;
  font-weight: 650;
}

.bill-invoice-pdf-import-status.is-error {
  color: #b42318;
}

.bill-invoice-pdf-import-status.is-success {
  color: #0f6b4f;
}

.quote-review-workspace {
  display: grid;
  gap: 0.8rem;
}

.quote-review-workspace > .section-heading {
  margin-bottom: 0;
}

.quote-context-items {
  min-width: 0;
}

.quote-context-empty-state {
  display: grid;
  gap: 0.22rem;
  padding: 0.85rem 0.95rem;
  border: 1px dashed #bdd7e8;
  border-radius: 8px;
  background: #f8fcff;
}

.quote-context-empty-state strong {
  color: var(--ink);
  font-size: 0.88rem;
}

.quote-context-empty-state span,
.quote-context-meta,
.quote-context-extract p {
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.4;
}

.quote-context-document-list {
  display: grid;
  gap: 0.5rem;
}

.quote-context-document {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.65rem 0.9rem;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.quote-context-document-heading {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.quote-context-document-heading > div {
  display: grid;
  min-width: 0;
  gap: 0.1rem;
}

.quote-context-document-heading strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
}

.quote-context-document-heading .ghost-danger,
.quote-revision-row .ghost-danger {
  width: 2rem;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: #b42318;
  box-shadow: none;
  opacity: 0.7;
}

.quote-context-document-heading .ghost-danger:hover,
.quote-context-document-heading .ghost-danger:focus-visible,
.quote-revision-row .ghost-danger:hover,
.quote-revision-row .ghost-danger:focus-visible {
  border-color: #f1bbb3;
  background: #fff2f0;
  color: #b42318;
  opacity: 1;
}

.quote-context-description,
.quote-context-extract {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
}

.quote-context-description > span,
.quote-context-extract > span {
  color: var(--label);
  font-size: 0.72rem;
  font-weight: 600;
}

.quote-context-description textarea {
  min-height: 72px;
  margin: 0;
  padding: 0.58rem 0.68rem;
  border-radius: 6px;
}

.quote-context-extract {
  padding: 0.58rem 0.68rem;
  border: 1px solid #e0eaf1;
  border-radius: 6px;
  background: #f8fbfd;
}

.quote-context-extract p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.quote-ai-review-composer {
  display: grid;
  gap: 0.7rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.quote-ai-review-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.quote-ai-review-heading h4,
.quote-ai-review-heading p {
  margin: 0;
}

.quote-ai-review-heading h4 {
  font-size: 0.92rem;
}

.quote-ai-review-heading p {
  margin-top: 0.15rem;
}

.quote-ai-review-heading .primary {
  flex: 0 0 auto;
}

.quote-ai-review-fields {
  gap: 0.65rem 1rem;
}

.quote-ai-review-feedback {
  display: grid;
  gap: 0.45rem;
}

.quote-ai-review-feedback > p {
  margin: 0;
}

.quote-ai-review-feedback > p:empty,
.quote-ai-check-results:empty {
  display: none;
}

.quote-review-stream {
  max-height: 18rem;
  margin: 0;
  padding: 0.8rem;
  overflow: auto;
  border: 1px solid var(--line);
  background: #102838;
  color: #e7f6ff;
  font: 0.86rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.quote-ai-check-results {
  display: grid;
  gap: 0.7rem;
}

#revision-items {
  overflow: visible;
}

.quote-revision-list {
  display: grid;
  gap: 0.5rem;
}

.quote-revision-row {
  display: grid;
  grid-template-columns: minmax(86px, 0.36fr) minmax(142px, 0.6fr) minmax(0, 2fr) auto;
  align-items: end;
  gap: 0.6rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.quote-revision-row > label {
  display: grid;
  min-width: 0;
  gap: 0.28rem;
}

.quote-revision-row > label > span {
  color: var(--label);
  font-size: 0.72rem;
  font-weight: 600;
}

.quote-revision-row input {
  min-height: 40px;
  padding: 0.55rem 0.68rem;
  border-radius: 6px;
  background: #fff;
}

.quote-revisions-empty {
  margin: 0;
  padding: 0.85rem 0.95rem;
  border: 1px dashed #bdd7e8;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

@media (max-width: 640px) {
  .quote-context-document {
    grid-template-columns: 1fr;
  }

  .quote-context-document-heading {
    grid-column: auto;
  }

  .quote-ai-review-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .quote-ai-review-heading .primary {
    width: 100%;
  }

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

  .quote-revision-row .quote-revision-description {
    grid-column: 1 / -1;
  }

  .quote-revision-row .ghost-danger {
    grid-column: 1 / -1;
    justify-self: end;
  }
}

.quote-ai-check-summary {
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-left: 4px solid #168b5b;
  border-radius: 6px;
  background: #f2fbf7;
  color: var(--ink);
  line-height: 1.45;
}

.quote-ai-check-summary.needs-attention {
  border-left-color: #d97706;
  background: #fff8eb;
}

.quote-ai-check-issue {
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-left: 4px solid #d97706;
  border-radius: 6px;
  background: var(--surface-strong);
}

.quote-ai-check-issue.severity-high {
  border-left-color: #b42318;
}

.quote-ai-check-issue.severity-low {
  border-left-color: #3383bf;
}

.quote-ai-check-issue-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.quote-ai-check-issue-header strong {
  min-width: 0;
}

.quote-ai-check-severity {
  flex: 0 0 auto;
  padding: 0.18rem 0.45rem;
  border-radius: 4px;
  background: #fff0ee;
  color: #b42318;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.severity-medium .quote-ai-check-severity {
  background: #fff4dc;
  color: #9a5a00;
}

.severity-low .quote-ai-check-severity {
  background: #eaf5ff;
  color: #17699f;
}

.quote-ai-check-issue p {
  margin: 0.4rem 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.quote-ai-check-recommendation {
  color: var(--ink) !important;
}

.dynamics-list-table input,
.dynamics-list-table select,
.dynamics-list-table textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
}

.dynamics-list-table input:focus,
.dynamics-list-table select:focus,
.dynamics-list-table textarea:focus {
  border-color: #6ec1f4;
  background: #fff;
}

.dynamics-list-table .list-drag-heading,
.dynamics-list-table .list-drag-cell {
  width: 2.8rem;
}

.dynamics-list-table .list-number-heading,
.dynamics-list-table .list-line-number {
  width: 4rem;
}

.dynamics-list-table .list-move-heading,
.dynamics-list-table .list-move-cell {
  width: 4.8rem;
}

.dynamics-list-table .list-actions-heading,
.dynamics-list-table .list-actions-cell {
  width: 6.5rem;
}

.list-line-number {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.list-item.is-dragging {
  opacity: 0.55;
}

.list-item.is-drop-target td {
  border-top: 2px solid var(--brand);
  background: var(--brand-soft);
}

.list-description-cell textarea {
  min-width: 0;
  padding: 0.55rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
}

.list-description-cell textarea:focus {
  border-color: #6ec1f4;
  background: #fff;
}

.drag-handle,
.move-list-item {
  width: 1.8rem;
  height: 1.8rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--brand-deep);
  box-shadow: none;
}

.list-drag-cell[hidden],
.list-move-cell[hidden] {
  display: none;
}

.drag-handle {
  cursor: grab;
  color: var(--muted);
}

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

.list-reorder-controls {
  display: flex;
  flex-direction: row;
  gap: 0.25rem;
}

.move-list-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.list-actions-cell .ghost-danger,
.supply-editor-table .ghost-danger,
.revision-editor-table .ghost-danger,
.line-item-editor .ghost-danger {
  width: auto;
  justify-self: start;
  align-self: center;
  white-space: nowrap;
}

label span {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--label);
}

.receipt-upload-field {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.receipt-upload-field > span {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--label);
}

.receipt-upload-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  padding: 0.68rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--brand-deep);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition:
    background-color 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.receipt-upload-button:hover {
  border-color: #9fc8e1;
  background: #e7f4fc;
  color: var(--brand-deep);
  box-shadow: 0 5px 14px rgba(15, 35, 52, 0.1);
  transform: translateY(-1px);
}

.receipt-upload-button:active {
  box-shadow: var(--shadow-sm);
  transform: translateY(0);
}

.receipt-upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.receipt-upload-button span {
  color: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
}

.receipt-preview {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
}

.receipt-preview-link {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 0.5rem;
  align-items: center;
  color: var(--brand-deep);
  text-decoration: none;
}

.receipt-preview-image {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface-strong);
}

.receipt-file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 600;
}

.receipt-upload-status {
  margin: 0;
  font-size: 0.78rem;
}

.receipt-upload-status:empty {
  display: none;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.64rem 0.72rem;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  background: var(--field-bg);
  color: var(--ink);
  box-shadow: inset 0 1px 1px rgba(15, 35, 52, 0.025);
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background-color 0.16s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--field-border-hover);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px var(--field-focus);
}

textarea {
  resize: vertical;
}

.line-item-editor {
  grid-template-columns: 1.4fr 2fr 0.9fr auto;
  align-items: end;
}

.line-item-editor:not(.expense-line-item-editor) {
  gap: 0.6rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background-color 0.16s ease;
}

.line-item-editor:not(.expense-line-item-editor):hover,
.line-item-editor:not(.expense-line-item-editor):focus-within {
  border-color: #b9d5e8;
  background: #fbfdff;
  box-shadow: 0 2px 6px rgba(15, 35, 52, 0.045);
}

.line-item-editor:not(.expense-line-item-editor) input,
.line-item-editor:not(.expense-line-item-editor) select {
  min-height: 40px;
  padding: 0.55rem 0.68rem;
  border-radius: 6px;
  background: #fff;
}

.line-item-editor:not(.expense-line-item-editor) > .ghost-danger.icon-only-button {
  width: 2rem;
  min-width: 2rem;
  min-height: 2rem;
  align-self: end;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: #b42318;
  box-shadow: none;
  opacity: 0.65;
}

.line-item-editor:not(.expense-line-item-editor):hover > .ghost-danger.icon-only-button,
.line-item-editor:not(.expense-line-item-editor):focus-within > .ghost-danger.icon-only-button,
.line-item-editor:not(.expense-line-item-editor) > .ghost-danger.icon-only-button:focus-visible {
  opacity: 1;
}

.line-item-editor:not(.expense-line-item-editor) > .ghost-danger.icon-only-button:hover,
.line-item-editor:not(.expense-line-item-editor) > .ghost-danger.icon-only-button:focus-visible {
  border-color: #f1bbb3;
  background: #fff2f0;
  color: #b42318;
}

.line-item-editor.document-line-item-editor {
  gap: 0.6rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background-color 0.16s ease;
}

.line-item-editor.document-line-item-editor:hover,
.line-item-editor.document-line-item-editor:focus-within {
  border-color: #b9d5e8;
  background: #fbfdff;
  box-shadow: 0 2px 6px rgba(15, 35, 52, 0.045);
}

.line-item-editor.document-line-item-editor > label {
  gap: 0.28rem;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.line-item-editor.document-line-item-editor > label:focus-within {
  border-color: transparent;
  box-shadow: none;
}

.line-item-editor.document-line-item-editor > label > span {
  padding: 0 0.05rem;
  color: var(--label);
  font-size: 0.72rem;
  line-height: 1.25;
}

.line-item-editor.document-line-item-editor input,
.line-item-editor.document-line-item-editor select {
  min-height: 40px;
  padding: 0.55rem 0.68rem;
  border-radius: 6px;
  background: #fff;
}

.line-item-editor.document-line-item-editor > .ghost-danger.icon-only-button {
  width: 2rem;
  min-width: 2rem;
  min-height: 2rem;
  align-self: end;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: #b42318;
  box-shadow: none;
  opacity: 0.65;
}

.line-item-editor.document-line-item-editor:hover > .ghost-danger.icon-only-button,
.line-item-editor.document-line-item-editor:focus-within > .ghost-danger.icon-only-button,
.line-item-editor.document-line-item-editor > .ghost-danger.icon-only-button:focus-visible {
  opacity: 1;
}

.line-item-editor.document-line-item-editor > .ghost-danger.icon-only-button:hover,
.line-item-editor.document-line-item-editor > .ghost-danger.icon-only-button:focus-visible {
  border-color: #f1bbb3;
  background: #fff2f0;
  color: #b42318;
}

.revision-item-editor {
  grid-template-columns: 0.8fr 1fr 2.2fr auto;
}

.invoice-line-item-editor {
  grid-template-columns: 1.2fr 1.7fr 0.7fr 0.8fr auto;
}

.po-line-item-editor {
  grid-template-columns: 1.2fr 1.7fr 0.65fr 0.65fr 0.85fr 0.7fr auto;
}

.bill-line-item-editor {
  grid-template-columns: 1.15fr 1.7fr 0.6fr 0.6fr 0.8fr 0.8fr auto;
}

.bill-payment-editor {
  grid-template-columns: 0.8fr 0.75fr 0.9fr 1fr 1.4fr auto;
}

.bill-payment-summary {
  margin-bottom: 0.85rem;
}

.billage-hours-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.billage-hours-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  table-layout: fixed;
}

.billage-hours-day-column {
  width: 18%;
}

.billage-hours-value-column {
  width: 10%;
}

.billage-hours-engineer-column {
  width: 21%;
}

.billage-hours-description-column {
  width: auto;
}

.billage-hours-action-column {
  width: 52px;
}

.billage-hours-table th {
  padding: 0.62rem 0.68rem;
  border-bottom: 1px solid #c7d7e3;
  background: #f2f7fb;
  color: #31516a;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  text-align: left;
}

.billage-hours-table td {
  padding: 0.42rem;
  border-bottom: 1px solid #dce6ed;
  vertical-align: middle;
}

.billage-hours-table tbody tr:last-child td {
  border-bottom: 1px solid #dce6ed;
}

.billage-hours-table tbody tr:hover {
  background: #f8fbfd;
}

.billage-hours-table input {
  width: 100%;
  min-width: 0;
  margin: 0;
}

.billage-hour-entry-action {
  text-align: center;
}

.billage-hour-entry-action .remove-line-item {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 8px;
}

.billage-hours-table tfoot td {
  padding: 0.42rem;
  border: 0;
  background: #fbfdff;
}

.billage-hours-add-cell {
  text-align: left;
}

.billage-hours-add-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1;
}

.billage-hours-empty {
  padding: 1.2rem !important;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.related-hours-panel {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
  overflow-x: auto;
}

.related-hours-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.related-hours-summary-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.related-hours-summary {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-self: start;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.related-hours-summary span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.related-hours-summary strong {
  font-size: 1rem;
}

.related-hours-count,
.related-hours-available {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.related-hours-available {
  padding-left: 0.6rem;
  border-left: 1px solid var(--line);
}

.related-hours-table {
  min-width: 1080px;
}

.related-hours-table .related-hours-apply-heading,
.related-hours-table .related-hours-apply-cell {
  width: 112px;
  min-width: 112px;
}

.related-hours-apply-cell input[type="number"] {
  width: 88px;
  min-width: 0;
  margin: 0;
  padding: 0.42rem 0.5rem;
  text-align: right;
}

.related-hours-table tr.is-unavailable td:not(.related-hours-apply-cell) {
  color: var(--muted);
}

.related-hours-allocation-status {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.2;
  text-align: right;
}

@media (max-width: 720px) {
  .related-hours-summary-row {
    align-items: stretch;
    flex-direction: column;
  }

  .related-hours-summary-actions button {
    flex: 1;
  }
}

.expense-editor-stack .field-grid label,
.expense-line-item-editor label,
.expense-line-item-editor .receipt-upload-field {
  display: grid;
  gap: 0.36rem;
  min-width: 0;
}

.expense-editor-stack .field-grid label > span,
.expense-line-item-editor label > span,
.expense-line-item-editor .receipt-upload-field > span {
  color: var(--label);
  font-family: "Manrope", "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: normal;
  text-transform: none;
}

.expense-editor-stack .field-grid input,
.expense-editor-stack .field-grid select,
.expense-editor-stack .field-grid textarea,
.expense-line-item-editor input,
.expense-line-item-editor select,
.expense-line-item-editor textarea {
  border-radius: 8px;
  background: #fff;
}

.expense-line-item-editor {
  grid-template-columns:
    minmax(110px, 0.8fr)
    minmax(150px, 1.15fr)
    minmax(130px, 1fr)
    minmax(100px, 0.75fr)
    minmax(135px, 1fr)
    minmax(112px, auto);
  grid-template-areas:
    "date merchant category amount payment payment"
    "description description description description receipt remove";
  gap: 0.75rem;
  align-items: end;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-sm);
}

.expense-line-item-editor .expense-line-date {
  grid-area: date;
}

.expense-line-item-editor .expense-line-merchant {
  grid-area: merchant;
}

.expense-line-item-editor .expense-line-category {
  grid-area: category;
}

.expense-line-item-editor .expense-line-amount {
  grid-area: amount;
}

.expense-line-item-editor .expense-line-description {
  grid-area: description;
}

.expense-line-item-editor .expense-line-payment {
  grid-area: payment;
}

.expense-line-item-editor .receipt-upload-field {
  grid-area: receipt;
}

.expense-line-item-editor .remove-line-item {
  align-self: end;
  grid-area: remove;
  min-height: 42px;
}

.supply-editor-groups {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.supply-editor-panel {
  display: grid;
  gap: 0.65rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 1px 2px rgba(15, 35, 52, 0.02);
}

.supply-editor-panel > .section-heading {
  gap: 0.65rem;
  margin: 0;
}

.supply-editor-panel .inline-actions {
  gap: 0.45rem;
}

.compact-heading h4 {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
}

.supply-items {
  display: grid;
  gap: 0.55rem;
  min-width: 0;
  margin: 0;
  overflow: visible;
}

.supply-item-editor {
  display: grid;
  grid-template-columns: minmax(4.75rem, 0.5fr) minmax(9rem, 1fr) minmax(12rem, 2fr) auto;
  align-items: end;
  gap: 0.55rem;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background-color 0.16s ease;
}

.supply-item-editor:hover,
.supply-item-editor:focus-within {
  border-color: #b9d5e8;
  background: #fbfdff;
  box-shadow: 0 2px 6px rgba(15, 35, 52, 0.045);
}

.supply-item-editor > label,
.supply-group-row > label {
  display: grid;
  gap: 0.28rem;
  min-width: 0;
}

.supply-item-editor > label > span,
.supply-group-row > label > span {
  display: block;
  padding: 0 0.05rem;
  color: var(--label);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.25;
}

.supply-item-editor input,
.supply-group-row input {
  min-height: 40px;
  padding: 0.55rem 0.68rem;
  border-radius: 6px;
  background: #fff;
}

.supply-item-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-height: 40px;
}

.supply-item-actions button {
  min-height: 2rem;
  padding: 0.36rem 0.54rem;
  font-size: 0.76rem;
  line-height: 1.1;
  box-shadow: none;
}

.supply-item-actions .ghost-danger.icon-only-button {
  width: 2rem;
  min-width: 2rem;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: #b42318;
  box-shadow: none;
  opacity: 0.65;
}

.supply-item-editor:hover .supply-item-actions .ghost-danger.icon-only-button,
.supply-item-editor:focus-within .supply-item-actions .ghost-danger.icon-only-button,
.supply-group-row:hover .supply-item-actions .ghost-danger.icon-only-button,
.supply-group-row:focus-within .supply-item-actions .ghost-danger.icon-only-button,
.supply-item-actions .ghost-danger.icon-only-button:focus-visible {
  opacity: 1;
}

.supply-item-actions .ghost-danger.icon-only-button:hover,
.supply-item-actions .ghost-danger.icon-only-button:focus-visible {
  border-color: #f1bbb3;
  background: #fff2f0;
  color: #b42318;
}

.supply-group-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.55rem;
  padding: 0.55rem;
  border: 1px solid #c8dfef;
  border-radius: 8px;
  background: #edf7fd;
}

.supply-group-row input {
  font-weight: 700;
}

.supply-empty-state {
  display: grid;
  gap: 0.18rem;
  padding: 0.75rem 0.8rem;
  border: 1px dashed #c7ddea;
  border-radius: 8px;
  background: #fbfdff;
  color: var(--muted);
  font-size: 0.84rem;
}

.supply-empty-state strong {
  color: var(--ink);
  font-size: 0.84rem;
}
}

.actions {
  padding-top: 1rem;
}

.quote-editor-stack > .actions,
.invoice-editor-stack > .actions,
.purchase-editor-stack > .actions,
.billage-editor-stack > .actions,
.expense-editor-stack > .actions {
  min-height: 64px;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
}

.section-heading {
  justify-content: space-between;
}

.section-heading h3,
.card h3 {
  font-size: 1.02rem;
  font-weight: 700;
}

.workspace[data-view="settings"].is-active,
.workspace[data-view="dropdowns"].is-active {
  display: grid;
  gap: 1rem;
  max-width: 960px;
}

.workspace[data-view="settings"] .panel-header,
.workspace[data-view="dropdowns"] .panel-header {
  margin-bottom: 0;
}

.settings-tabs {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.settings-tab-panel[hidden] {
  display: none;
}

.settings-tab-panel.is-active {
  display: block;
}

.settings-tab-panel .settings-stack {
  margin: 0;
}

.settings-stack,
.dropdown-settings-stack {
  width: 100%;
  margin-top: 0;
}

.settings-stack .card,
.dropdown-settings-stack .card {
  background: var(--surface-strong);
}

.settings-stack textarea,
.dropdown-settings-stack textarea {
  min-height: 120px;
}

.dropdown-row-list {
  display: grid;
  gap: 0.75rem;
}

.dropdown-company-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.85fr) minmax(180px, 1.1fr) minmax(180px, 1.1fr) minmax(150px, 0.85fr);
  gap: 0.75rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.dropdown-company-row input[readonly] {
  color: var(--muted);
  background: #f1f6fa;
}

.dropdown-company-row .dropdown-company-address {
  grid-column: span 2;
}

.dropdown-company-row textarea {
  min-height: 42px;
}

.dropdown-textarea-grid textarea {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
}

.api-token-list {
  display: grid;
  gap: 0.8rem;
}

.api-token-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(240px, 1.4fr) minmax(120px, 0.5fr);
  gap: 0.75rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.api-token-row label {
  min-width: 0;
}

.api-token-value input {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
}

.api-token-companies {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.api-token-company-option {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 34px;
  padding: 0.4rem 0.6rem;
  border: 1px solid #d5e3ed;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.api-token-company-option input {
  width: 15px;
  height: 15px;
  margin: 0;
}

.api-token-company-option span {
  color: inherit;
  font-size: 0.82rem;
  font-weight: 600;
}

.api-token-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sales-overview-shell {
  width: min(100%, 1560px);
  margin: 0 auto;
}

.sales-overview-header,
.sales-quotes-heading,
.sales-card-heading,
.sales-money-highlights,
.sales-collection-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.sales-overview-header {
  margin: 0 0 1.35rem;
}

.sales-overview-header .eyebrow,
.sales-quotes-heading .eyebrow {
  margin: 0 0 0.25rem;
  color: var(--brand-deep);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sales-overview-header h2,
.sales-quotes-heading h3 {
  margin: 0;
  color: #102f48;
  font-family: "Manrope", "Inter", sans-serif;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: 0;
}

.sales-overview-subtitle {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.sales-overview-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
}

.sales-summary,
.sales-quote-summary {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-sm);
}

.sales-summary {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin-bottom: 1.35rem;
}

.sales-quote-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sales-summary-metric,
.sales-quote-metric {
  min-width: 0;
  min-height: 112px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 0.28rem;
  padding: 1.15rem 1.3rem;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  text-align: left;
}

.sales-summary-metric:last-child,
.sales-quote-metric:last-child {
  border-right: 0;
}

.sales-summary-metric:hover:not(:disabled),
.sales-quote-metric:hover:not(:disabled) {
  background: #f2f9fd;
  box-shadow: none;
  transform: none;
}

.sales-summary-label,
.sales-quote-metric > span {
  color: var(--label);
  font-size: 0.87rem;
  font-weight: 600;
}

.sales-summary-metric strong,
.sales-quote-metric strong {
  max-width: 100%;
  overflow: hidden;
  color: #163b5c;
  font-family: "Manrope", "Inter", sans-serif;
  font-size: clamp(1rem, 1.2vw, 1.6rem);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-summary-metric small,
.sales-quote-metric small {
  color: var(--muted);
  font-size: 0.78rem;
}

.sales-summary-metric.is-overdue .sales-summary-label,
.sales-summary-metric.is-overdue strong,
.sales-quote-metric.is-expired > span,
.sales-quote-metric.is-expired strong {
  color: #b0323d;
}

.sales-summary-metric.is-backlog {
  background: linear-gradient(135deg, #e5f4fc 0%, #f7fbfe 100%);
}

.sales-summary-metric.is-backlog .sales-summary-label,
.sales-summary-metric.is-backlog strong {
  color: #0b5f95;
}

.sales-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(205px, 0.9fr) minmax(300px, 1.35fr) minmax(290px, 1.25fr) minmax(205px, 0.9fr);
  align-items: stretch;
  gap: 1.15rem;
}

.sales-dashboard-card {
  min-width: 0;
  min-height: 322px;
  padding: 1.2rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-sm);
}

.sales-card-heading {
  align-items: flex-start;
  margin-bottom: 1rem;
}

.sales-card-heading h3 {
  margin: 0;
  color: #143652;
  font-family: "Manrope", "Inter", sans-serif;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0;
}

.sales-card-heading p {
  margin: 0.28rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.sales-card-total {
  flex: 0 0 auto;
  color: var(--brand-deep);
  font-size: 0.84rem;
  font-weight: 700;
}

.sales-create-card {
  display: flex;
  flex-direction: column;
}

.sales-create-actions {
  display: grid;
  gap: 0.2rem;
  margin-top: 0.15rem;
}

.sales-create-action {
  min-height: 50px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.2rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #21425d;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
}

.sales-create-action:first-child {
  border-top: 1px solid var(--line);
}

.sales-create-action:hover:not(:disabled) {
  padding-inline: 0.45rem;
  border-color: var(--line);
  background: #f4faff;
  box-shadow: none;
  color: var(--brand-deep);
  transform: none;
}

.sales-create-action svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.sales-action-plus {
  color: var(--brand);
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1;
  text-align: center;
}

.sales-money-card {
  display: flex;
  flex-direction: column;
}

.sales-money-highlights {
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  margin-bottom: 0.7rem;
}

.sales-money-highlights > div {
  flex: 1 1 50%;
  min-width: 0;
  display: grid;
  gap: 0.18rem;
  padding: 0.15rem 0.85rem 0.2rem 0;
}

.sales-money-highlights > div + div {
  padding-left: 0.85rem;
  border-left: 1px solid var(--line);
}

.sales-money-highlights strong {
  overflow: hidden;
  color: #163b5c;
  font-family: "Manrope", "Inter", sans-serif;
  font-size: 1.34rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-money-highlights span {
  color: var(--brand-deep);
  font-size: 0.76rem;
}

.sales-money-chart {
  flex: 1;
  min-height: 175px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 0.5rem;
  padding-top: 0.3rem;
  border-top: 1px solid #e0ebf2;
}

.sales-chart-column {
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(94px, 1fr) auto;
  align-items: end;
  gap: 0.35rem;
}

.sales-chart-value {
  width: 100%;
  overflow: hidden;
  color: #536d82;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-chart-bar-track {
  height: 100%;
  display: flex;
  align-items: end;
  justify-content: center;
  border-bottom: 1px solid #aebfcd;
  background: repeating-linear-gradient(to bottom, transparent 0 33%, rgba(208, 223, 235, 0.65) 33.5% 34%, transparent 34.5% 66%, rgba(208, 223, 235, 0.65) 66.5% 67%, transparent 67.5% 100%);
}

.sales-chart-bar {
  width: min(38px, 72%);
  min-height: 2px;
  height: var(--sales-bar-height);
  border: 1px solid transparent;
  border-radius: 5px 5px 0 0;
  background: #5f768a;
}

.sales-chart-bar-overdue {
  border-color: #df9aa0;
  background: #efb4b8;
}

.sales-chart-bar-this-week {
  border-color: #5ca5d6;
  background: #9fd4f2;
}

.sales-chart-bar-next-week {
  border-color: #2898a5;
  background: #80d1ca;
}

.sales-chart-bar-future {
  border-color: #6f8192;
  background: #bcc7d2;
}

.purchases-chart-bar-older {
  border-color: #8c9aa4;
  background: #c7d1d7;
}

.purchases-chart-bar-previous {
  border-color: #c78a45;
  background: #f0c98f;
}

.purchases-chart-bar-month {
  border-color: #2e9c89;
  background: #8ad5bd;
}

.purchases-chart-bar-recent {
  border-color: #407eb8;
  background: #9bc7ec;
}

.sales-chart-label {
  color: #486378;
  font-size: 0.74rem;
  text-align: center;
}

.sales-text-button {
  flex: 0 0 auto;
  min-height: auto;
  padding: 0.2rem 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #0d71b7;
  font-size: 0.82rem;
  font-weight: 600;
}

.sales-text-button:hover:not(:disabled) {
  background: transparent;
  box-shadow: none;
  color: #075b95;
  text-decoration: underline;
  transform: none;
}

.sales-customer-table {
  min-width: 0;
}

.sales-customer-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(76px, auto) minmax(76px, auto);
  align-items: center;
  gap: 0.6rem;
}

.sales-customer-head {
  padding: 0 0.25rem 0.48rem;
  border-bottom: 1px solid var(--line-strong);
  color: #668095;
  font-size: 0.72rem;
  font-weight: 600;
}

.sales-customer-head span:not(:first-child),
.sales-customer-item > span:not(:first-child) {
  text-align: right;
}

.sales-customer-item {
  min-height: 46px;
  padding: 0.42rem 0.25rem;
  border: 0;
  border-bottom: 1px solid #e1ebf1;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #25445e;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: right;
}

.sales-customer-item:hover:not(:disabled) {
  padding-inline: 0.45rem;
  background: #f4faff;
  box-shadow: none;
  color: var(--brand-deep);
  transform: none;
}

.sales-customer-name {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
  text-align: left;
}

.sales-customer-name > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-customer-avatar {
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  display: inline-grid;
  place-items: center;
  border-radius: 5px;
  color: #193b54;
  font-size: 0.7rem;
  font-weight: 700;
}

.sales-avatar-tone-0 { background: #a9d8f2; }
.sales-avatar-tone-1 { background: #f7c9a7; }
.sales-avatar-tone-2 { background: #bfe5cf; }
.sales-avatar-tone-3 { background: #f0c2d1; }
.sales-avatar-tone-4 { background: #d2c9f3; }

.sales-customer-item .is-overdue {
  color: #b0323d;
}

.sales-empty-state {
  margin: 1.3rem 0;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

.sales-collection-card {
  display: flex;
  flex-direction: column;
}

.sales-collection-rate {
  display: grid;
  gap: 0.18rem;
  margin: 0.5rem 0 1rem;
}

.sales-collection-rate strong {
  color: #126275;
  font-family: "Manrope", "Inter", sans-serif;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0;
}

.sales-collection-rate span {
  color: var(--muted);
  font-size: 0.78rem;
}

.sales-progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 5px;
  background: #dceaf1;
}

.sales-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #26a99b;
  transition: width 0.2s ease;
}

.sales-collection-list {
  display: grid;
  gap: 0;
  margin: auto 0 0;
}

.sales-collection-list > div {
  min-height: 38px;
  border-bottom: 1px solid #e1ebf1;
}

.sales-collection-list > div:last-child {
  border-bottom: 0;
}

.sales-collection-list dt {
  color: #60798e;
  font-size: 0.78rem;
}

.sales-collection-list dd {
  margin: 0;
  color: #24445e;
  font-size: 0.82rem;
  font-weight: 700;
}

.sales-revenue-card {
  min-height: 272px;
  grid-column: 1 / -1;
}

.sales-revenue-breakdown {
  min-height: 192px;
  display: grid;
  grid-template-columns: minmax(190px, 0.7fr) minmax(310px, 1.3fr);
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

.sales-revenue-pie {
  width: min(190px, 100%);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  justify-self: center;
  border-radius: 50%;
  background: var(--sales-revenue-pie, #dceaf1);
  box-shadow: inset 0 0 0 1px rgba(22, 50, 74, 0.1);
}

.sales-revenue-pie-center {
  width: 56%;
  aspect-ratio: 1;
  display: grid;
  place-content: center;
  gap: 0.1rem;
  border-radius: 50%;
  background: var(--surface-strong);
  color: #193c58;
  text-align: center;
}

.sales-revenue-pie-center strong {
  max-width: 90px;
  overflow: hidden;
  font-family: "Manrope", "Inter", sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-revenue-pie-center span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
}

.sales-revenue-legend {
  min-width: 0;
  display: grid;
  align-content: center;
}

.sales-revenue-legend-row {
  width: 100%;
  min-height: 31px;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) minmax(82px, auto) minmax(42px, auto);
  align-items: center;
  gap: 0.55rem;
  padding: 0.32rem 0.2rem;
  border: 0;
  border-bottom: 1px solid #e1ebf1;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #2a475e;
  font-size: 0.8rem;
  text-align: left;
}

button.sales-revenue-legend-row:hover:not(:disabled) {
  padding-inline: 0.45rem;
  background: #f4faff;
  box-shadow: none;
  color: var(--brand-deep);
  transform: none;
}

.sales-revenue-legend-row:last-child {
  border-bottom: 0;
}

.sales-revenue-swatch {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: var(--sales-revenue-color);
}

.sales-revenue-legend-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-revenue-legend-row strong {
  color: #23435d;
  font-size: 0.8rem;
  text-align: right;
}

.sales-revenue-legend-row small {
  color: #688094;
  font-size: 0.72rem;
  text-align: right;
}

.sales-quotes-section {
  margin-top: 1.55rem;
}

.sales-quotes-heading {
  margin: 0 0 0.75rem;
}

.sales-quotes-heading h3 {
  font-size: 1.2rem;
}

.sales-quote-summary {
  box-shadow: none;
}

.sales-quote-metric {
  min-height: 98px;
}

@media (max-width: 1390px) {
  .sales-dashboard-grid {
    grid-template-columns: minmax(250px, 0.9fr) minmax(320px, 1.25fr) minmax(300px, 1.15fr);
  }

  .sales-collection-card {
    min-height: 252px;
    grid-column: 1 / -1;
  }

  .sales-collection-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
  }

  .sales-collection-list > div {
    border-bottom: 0;
  }
}

@media (max-width: 900px) {
  .markets-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .sales-overview-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .sales-overview-actions {
    justify-content: flex-start;
  }

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

  .sales-summary-metric {
    border-bottom: 1px solid var(--line);
  }

  .sales-summary-metric:nth-child(3n),
  .sales-summary-metric:nth-child(7) {
    border-right: 0;
  }

  .sales-summary-metric:nth-child(-n + 6) {
    border-bottom: 1px solid var(--line);
  }

  .sales-summary-metric:nth-child(n + 7) {
    border-bottom: 0;
  }

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

  .sales-money-card,
  .sales-customers-card,
  .sales-collection-card {
    grid-column: auto;
  }

  .sales-collection-list {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .sales-collection-list > div {
    border-bottom: 1px solid #e1ebf1;
  }

  .sales-collection-list > div:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 640px) {
  .financial-statements-controls {
    align-items: stretch;
  }

  .financial-statements-controls label {
    flex: 1 1 140px;
    min-width: 0;
  }

  .financial-statement-sheet {
    padding: 0.9rem;
  }

  .financial-statement-tab {
    flex: 1 1 0;
    min-width: 0;
    padding-inline: 0.5rem;
    white-space: normal;
  }

  .financial-statement-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
  }

  .financial-statement-title > p {
    white-space: normal;
  }

  .financial-statement-table th,
  .financial-statement-table td {
    padding-inline: 0.45rem;
  }

  .financial-statement-table .num {
    width: 125px;
  }

  .market-watch-row {
    grid-template-columns: minmax(0, 1fr) auto 30px;
    gap: 0.35rem;
  }

  .market-watch-quote {
    min-width: 72px;
  }

  .market-alert-row {
    gap: 0.5rem;
  }

  .markets-filings-filters {
    gap: 0.35rem;
  }

  .markets-chart-toolbar {
    align-items: stretch;
  }

  .markets-chart-options {
    flex: 1 1 auto;
  }

  .market-chart-option {
    flex: 1 1 auto;
    min-height: 40px;
  }

  .markets-chart-legend .market-chart-session {
    flex-basis: 100%;
    margin-right: 0;
  }

  .market-financials-header {
    align-items: stretch;
    flex-direction: column;
  }

  .market-financials-header .markets-chart-options {
    align-self: stretch;
  }

  .chart-of-accounts-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-of-accounts-summary > div:nth-child(2) {
    border-right: 0;
  }

  .chart-of-accounts-summary > div:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .sales-overview-header h2 {
    font-size: 1.45rem;
  }

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

  .sales-summary-metric,
  .sales-quote-metric {
    min-height: 102px;
    padding: 1rem;
    border-bottom: 1px solid var(--line);
  }

  .sales-summary-metric:nth-child(even),
  .sales-quote-metric:nth-child(2) {
    border-right: 0;
  }

  .sales-summary-metric:nth-child(odd) {
    border-right: 1px solid var(--line);
  }

  .sales-summary-metric:nth-child(7) {
    border-right: 0;
  }

  .sales-summary-metric:nth-child(-n + 6) {
    border-bottom: 1px solid var(--line);
  }

  .sales-summary-metric:nth-child(n + 7),
  .sales-quote-metric:nth-child(n + 3) {
    border-bottom: 0;
  }

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

  .sales-dashboard-card {
    min-height: 0;
  }

  .sales-create-card {
    min-height: 170px;
  }

  .sales-money-card {
    min-height: 310px;
  }

  .sales-customer-row {
    grid-template-columns: minmax(0, 1fr) minmax(70px, auto) minmax(70px, auto);
    gap: 0.35rem;
  }

  .sales-revenue-breakdown {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .sales-revenue-pie {
    width: 168px;
  }
}

@media (min-width: 980px) {
  .workspace[data-view="quotes"].is-active,
  .workspace[data-view="purchase-orders"].is-active,
  .workspace[data-view="invoices"].is-active,
  .workspace[data-view="billage-hours"].is-active,
  .workspace[data-view="expense-reimbursements"].is-active {
    display: block;
  }
}

@media (max-width: 1100px) {
  .shell {
    grid-template-rows: auto auto 1fr;
  }

  .topbar {
    flex-wrap: wrap;
    min-height: 64px;
    padding: 0.75rem 1rem;
  }

  .topbar-controls {
    flex: 1 1 360px;
  }

  .app-layout {
    min-height: auto;
    grid-template-columns: 1fr;
    background: transparent;
  }

  .sidebar {
    position: sticky;
    top: 64px;
    z-index: 15;
    flex-direction: row;
    align-items: center;
    height: auto;
    padding: 0.75rem 1rem;
    border-right: 0;
    border-bottom: 1px solid rgba(189, 208, 223, 0.72);
    box-shadow: 0 10px 24px rgba(15, 35, 52, 0.08);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
  }

  .topbar-nav {
    flex: 0 0 auto;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-start;
    justify-self: start;
    width: auto;
    min-width: 0;
    overflow: visible;
  }

  .nav-group {
    display: contents;
  }

  .nav-group + .nav-group {
    margin-top: 0;
  }

  .topbar-nav .nav-section-label,
  .topbar-actions .nav-section-label {
    display: none;
  }

  .nav-tab {
    width: auto;
    white-space: nowrap;
  }

  .topbar-actions {
    flex: 0 0 auto;
    flex-direction: row;
    flex-wrap: nowrap;
    align-self: center;
    width: auto;
    margin-left: auto;
    margin-top: 0;
  }

  .topbar-actions button {
    width: auto;
    white-space: nowrap;
  }

  .panel {
    width: 100%;
    margin: 0 auto;
  }

  .field-grid,
  .line-item-editor,
  .invoice-line-item-editor,
  .po-line-item-editor,
  .bill-line-item-editor,
  .bill-payment-editor,
  .expense-line-item-editor,
  .api-token-row,
  .dropdown-company-row,
  .supply-item-editor,
  .revision-item-editor {
    grid-template-columns: 1fr;
  }

  .expense-line-item-editor {
    grid-template-areas:
      "date"
      "merchant"
      "category"
      "amount"
      "payment"
      "description"
      "receipt"
      "remove";
  }

  .expense-line-item-editor > label,
  .expense-line-item-editor .expense-line-date,
  .expense-line-item-editor .expense-line-merchant,
  .expense-line-item-editor .expense-line-category,
  .expense-line-item-editor .expense-line-description,
  .expense-line-item-editor .expense-line-amount,
  .expense-line-item-editor .expense-line-payment,
  .expense-line-item-editor .receipt-upload-field,
  .expense-line-item-editor .remove-line-item {
    grid-column: 1 / -1;
  }

  .dropdown-company-row .dropdown-company-address {
    grid-column: 1 / -1;
  }

  .dynamics-field-grid.quote-layout-grid {
    grid-template-columns: 1fr;
  }

  .quote-layout-grid > label {
    grid-column: 1 / -1;
  }

  .quote-field-resize-handle {
    display: none;
  }

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

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

  .dynamics-field-grid label {
    border-right: 0;
  }

  .supply-item-actions {
    justify-content: flex-start;
  }

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

  .invoice-toolbar,
  .invoice-list-toolbar,
  .invoice-table-footer,
  .purchase-csv-upload-header,
  .table-action-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .invoice-toolbar-group,
  .invoice-pagination-controls,
  .invoice-page-count,
  .table-action-buttons {
    width: 100%;
  }

  .invoice-pagination-controls label {
    width: 100%;
    justify-content: space-between;
  }

  .invoice-list-search {
    min-width: 100%;
  }

  .purchase-csv-upload-row {
    grid-template-columns: 1fr;
  }

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

  .bank-connection-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .bill-invoice-pdf-upload-grid {
    grid-template-columns: 1fr;
  }

  .purchase-csv-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .topbar,
  .app-layout,
  .sidebar,
  .panel {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .topbar-controls,
  .topbar-nav {
    min-width: 0;
    max-width: 100%;
  }

  .sidebar {
    position: static;
    padding: 0.55rem 1rem;
    overflow: visible;
  }

  .banking-mapping-grid {
    grid-template-columns: 1fr;
  }

  .bank-connection-heading,
  .bank-connection-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .bank-connection-footer .inline-actions {
    width: 100%;
  }

  .bank-connection-footer .inline-actions button {
    flex: 1 1 auto;
  }

  .supply-editor-panel > .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .supply-editor-panel .inline-actions,
  .supply-editor-panel > .section-heading > button {
    width: 100%;
  }

  .supply-editor-panel .inline-actions button {
    flex: 1 1 0;
  }

  .topbar {
    align-items: flex-start;
    gap: 0.65rem;
    min-height: 0;
    padding: 0.7rem 1rem;
  }

  .topbar-brand {
    flex: 1 1 100%;
    gap: 0.6rem;
    padding-right: 3.25rem;
  }

  .product-logo {
    width: 38px;
    height: 38px;
  }

  .topbar-brand h1 {
    font-size: 1.15rem;
  }

  .topbar-product-links {
    display: none;
  }

  .topbar-controls {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  #add-company {
    display: none;
  }

  #logout-button {
    position: absolute;
    top: 0.72rem;
    right: 1rem;
  }

  .company-switcher {
    flex: 1 1 100%;
  }

  .company-switcher select {
    width: 100%;
    min-width: 0;
  }

  .mobile-view-switcher {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.65rem;
  }

  .mobile-view-switcher > span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
  }

  .mobile-view-switcher select {
    width: min(250px, 100%);
    min-width: 0;
    margin: 0;
    min-height: 38px;
    padding: 0.25rem 1.8rem 0.25rem 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--ink);
    font-weight: 600;
  }

  .topbar-nav,
  .topbar-actions {
    display: none;
  }

  .quote-page-header .document-actions-menu {
    margin-left: auto;
  }

  .invoice-status-tabs:not(.document-editor-tabs) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
    overflow: visible;
    padding: 0.35rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f6fbfe;
  }

  .invoice-status-tab:not(.document-editor-tab) {
    min-width: 0;
    min-height: 36px;
    padding: 0.46rem 0.5rem;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #4d718a;
    font-size: 0.78rem;
    line-height: 1.2;
    text-align: center;
  }

  .invoice-status-tab:not(.document-editor-tab).is-active {
    border-color: #b8d8eb;
    background: #e7f4fc;
    color: var(--brand-deep);
    box-shadow: inset 0 -2px 0 var(--brand);
  }

  .document-editor-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    padding: 1px;
    border: 0;
    background: var(--line);
    scroll-snap-type: none;
  }

  .document-editor-tab,
  .personal-primary-tabs .document-editor-tab {
    min-width: 0;
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 0.45rem;
    min-height: 52px;
    padding: 0.52rem 0.58rem;
    border: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    text-align: left;
  }

  .document-editor-tab:hover:not(:disabled) {
    border-color: transparent;
    background: #f4faff;
  }

  .document-editor-tab.is-active {
    background: #e7f4fc;
    color: var(--brand-deep);
    box-shadow: inset 0 -2px 0 var(--brand);
  }

  .document-editor-tab-step {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
  }

  .document-editor-tab-copy {
    align-self: center;
  }

  .document-editor-tab-copy strong {
    font-size: 0.76rem;
  }

  .document-editor-tab-copy small {
    display: none;
  }

  .invoice-status-tabs,
  .document-editor-tabs {
    scroll-snap-type: x proximity;
    scroll-padding-inline: 0.35rem;
    overscroll-behavior-x: contain;
  }

  .nav-tab,
  .invoice-status-tab,
  .document-editor-tab {
    scroll-snap-align: start;
  }

  .nav-tab {
    min-height: 40px;
    padding: 0.55rem 0.7rem;
  }

  .invoice-table th.select-column input,
  .invoice-table td.select-cell input {
    width: 22px;
    height: 22px;
  }

  input[type="checkbox"] {
    width: 22px;
    min-width: 22px;
    height: 22px;
    min-height: 22px;
    padding: 0;
  }

  .table-sort-button {
    min-height: 42px;
  }

  .quote-field-drag-handle,
  .quote-field-resize-handle {
    display: none;
  }

  .sales-text-button {
    min-height: 40px;
    padding: 0.45rem 0;
  }

  .sales-revenue-legend-row {
    min-height: 40px;
  }

  .market-watch-row {
    grid-template-columns: minmax(0, 1fr) auto 40px;
    gap: 0.45rem;
  }

  .market-watch-select {
    min-height: 40px;
  }

  .market-watch-remove {
    width: 40px;
    height: 40px;
  }

  .market-filing-filter {
    min-height: 38px;
    padding-block: 0.45rem;
  }

  .invoice-quote-summary-grid {
    grid-template-columns: 1fr;
  }

  .tax-summary-grid {
    grid-template-columns: 1fr;
  }

  .list-reorder-controls {
    flex-direction: row;
  }

  .bill-invoice-pdf-import-row {
    grid-template-columns: 1fr;
  }

  .document-selection-bar {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.7rem;
  }

  .document-selection-identity,
  .document-selection-section {
    min-width: 0;
  }

  .document-selection-details,
  .document-selection-state {
    width: 100%;
  }

  .document-selection-details strong {
    max-width: min(100%, 280px);
  }

  .document-selection-state {
    justify-content: space-between;
  }

  .document-selection-section {
    text-align: right;
  }

  .document-actions-popover {
    right: 0;
    left: auto;
    max-width: calc(100vw - 2rem);
  }
}

.document-editor-tab:not(:has(.document-editor-tab-step)) {
  grid-template-columns: minmax(0, 1fr);
}

/* Keep Save / Preview / Print reachable while scrolling long editors. */
.quote-editor-stack > .actions,
.invoice-editor-stack > .actions,
.purchase-editor-stack > .actions,
.billage-editor-stack > .actions,
.expense-editor-stack > .actions {
  position: sticky;
  bottom: 0.75rem;
  z-index: 20;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-md);
}

/* Status and sent columns render as pills so every document list reads the same way. */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: #eef2f5;
  color: #5c6c7a;
  font-size: 0.74rem;
  font-weight: 650;
  line-height: 1.3;
  white-space: nowrap;
}

.status-pill:empty {
  display: none;
}

.invoice-status-cell.status-paid .status-pill,
.invoice-status-cell.status-accepted .status-pill,
.invoice-status-cell.status-approved .status-pill,
.invoice-status-cell.status-received .status-pill,
.invoice-status-cell.status-reconciled .status-pill,
.invoice-status-cell.status-reimbursed .status-pill,
.invoice-status-cell.status-recorded .status-pill,
.invoice-status-cell.status-invoiced .status-pill,
.invoice-sent-cell.sent-sent .status-pill,
.invoice-sent-cell.sent-viewed .status-pill {
  background: #e8f5ed;
  color: #267347;
}

.invoice-status-cell.status-sent .status-pill,
.invoice-status-cell.status-submitted .status-pill,
.invoice-status-cell.status-awaiting-payment .status-pill,
.invoice-status-cell.status-open .status-pill {
  background: #e6f1fa;
  color: #1d5f8f;
}

.invoice-status-cell.status-partially-paid .status-pill,
.invoice-status-cell.status-awaiting-approval .status-pill {
  background: #fdf3e1;
  color: #8a5a00;
}

.invoice-status-cell.status-overdue .status-pill,
.invoice-status-cell.status-expired .status-pill,
.invoice-status-cell.status-rejected .status-pill,
.invoice-status-cell.status-void .status-pill {
  background: #faece9;
  color: #a33a2b;
}

.quote-number-cell {
  white-space: nowrap;
}

.quote-rev-tag {
  margin-left: 0.45rem;
  padding: 0.08rem 0.38rem;
  border-radius: 4px;
  background: #eef2f5;
  color: #5c6c7a;
  font-size: 0.7rem;
  font-weight: 650;
}

.line-item-editor input[data-key="amount"],
.line-item-editor input[data-key="hours"] {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* The selected-document bar stays pinned under the top bar so the record, total and status are always in view. */
.document-selection-bar {
  position: sticky;
  top: 76px;
  z-index: 15;
  box-shadow: var(--shadow-md);
}

@media (max-width: 1100px) {
  .document-selection-bar {
    position: static;
  }
}

/* Dollar inputs show a $ prefix and right-aligned, grouped digits. */
.money-input {
  padding-left: 1.5rem !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='16'%3E%3Ctext x='0' y='12.5' font-family='Arial' font-size='13' fill='%235c6c7a'%3E$%3C/text%3E%3C/svg%3E");
  background-position: 0.65rem 50%;
  background-repeat: no-repeat;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.personal-page-title {
  margin-bottom: 0.75rem;
}

/* Banking */
.banking-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.banking-summary .sales-summary-metric.is-active {
  background: #e9f5fd;
  box-shadow: inset 0 -3px 0 var(--brand);
}

.banking-transactions-table {
  min-width: 980px;
}

.banking-date-cell {
  white-space: nowrap;
}

.banking-description-cell small {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.banking-debit {
  color: #a33a2b;
}

.banking-credit {
  color: #267347;
}

.banking-bill-match-status:empty {
  display: none;
}

.bank-connection-setup.is-compact {
  padding: 0.75rem 0.9rem;
}

.bank-connection-setup.is-compact p {
  margin: 0.2rem 0 0;
}

.bank-connection-config summary {
  cursor: pointer;
  color: var(--brand-deep);
  font-weight: 600;
}

@media (max-width: 900px) {
  .banking-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Long text cells (descriptions, project names) truncate instead of stretching every list sideways; hover shows the full text. */
.invoice-table td:not(:has(input, select, textarea, button)) {
  max-width: 18rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.banking-transactions-table {
  min-width: 860px;
}

/* Accounting pages */
.accounting-shell {
  display: grid;
  gap: 1rem;
}

.accounting-status:empty,
.accounting-hint:empty {
  display: none;
}

.accounting-status.is-error,
.is-error {
  color: #a33a2b;
}

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

.accounting-tabs {
  margin-bottom: 0;
}

.accounting-lock-banner {
  padding: 0.6rem 0.85rem;
  border: 1px solid #f1d3a8;
  border-radius: 8px;
  background: #fdf3e1;
  color: #8a5a00;
  font-weight: 600;
}

.inline-field {
  display: inline-grid;
  gap: 0.2rem;
}

.ledger-account {
  margin-top: 1rem;
}

.ledger-account-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: baseline;
  padding: 0.5rem 0;
  color: var(--muted);
}

.ledger-account-heading strong {
  color: var(--ink);
}

.journal-lines-table input,
.journal-lines-table select,
.accounting-table td input,
.accounting-table td select {
  width: 100%;
  min-width: 7rem;
}

.account-editor-toolbar {
  margin-bottom: 0.75rem;
}

[data-view="chart-of-accounts"] tbody tr {
  cursor: pointer;
}

@media (min-width: 1101px) {
  .document-line-item-editor:not(.invoice-line-item-editor):not(.po-line-item-editor):has(> .line-item-tax) {
    grid-template-columns: 1.3fr 1.8fr 0.8fr 0.9fr auto;
  }

  .invoice-line-item-editor:has(> .line-item-tax) {
    grid-template-columns: 1.2fr 1.6fr 0.6fr 0.8fr 0.9fr auto;
  }
}

.user-company-list{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(220px, 1fr));
  gap:8px;
  margin-top:10px;
}

.user-company-all{
  font-weight:600;
}
