:root {
  font-family: Arial, Helvetica, sans-serif;
  color: #111827;
  background: #fff;
  font-size: 14px;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: #f9fafb; }
.login-card { width: 100%; max-width: 390px; background: white; padding: 28px; }
.login-card h1 span { color: #6b7280; font-size: 16px; font-weight: normal; }
.login-card .field { margin-bottom: 16px; }
.login-card .button { width: 100%; }
.reception-content { padding-top: 0; }
.reception-client-field { display: flex; align-items: end; gap: 10px; margin-bottom: 18px; }
.reception-client-field > .field { flex: 1; }
.reception-content .toolbar .field { flex: 1; }
.reception-payment { margin-top: 18px; display: grid; gap: 16px; }
.reception-procedure + .reception-procedure { margin-top: 8px; }
button,
input,
select,
textarea {
  font: inherit;
}
button,
a {
  touch-action: manipulation;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 22px;
  line-height: 1.3;
  margin-bottom: 3px;
}
h2 {
  font-size: 18px;
  margin-bottom: 0;
}
h3 {
  font-size: 15px;
  margin: 0 0 12px;
}
p {
  line-height: 1.55;
}
small {
  display: block;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.5;
}
.app {
  max-width: 1800px;
  padding: 16px;
  margin: auto;
}
.app-header {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0 17px;
  border-bottom: 1px solid #e5e7eb;
}
.app-header h1 span {
  font-size: 16px;
  color: #6b7280;
  font-weight: 400;
  margin-left: 8px;
}
.app-header p {
  font-size: 12px;
  color: #6b7280;
  margin: 0;
}
.header-actions,
.actions,
.inline-actions {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}
.button {
  padding: 7px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  min-height: 33px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.button:hover {
  background: #263245;
}
.button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.button.outline {
  background: #fff;
  color: #111827;
  border-color: #d1d5db;
}
.button.outline:hover {
  background: #f3f4f6;
}
.button.danger {
  background: #fff;
  color: #b91c1c;
  border-color: #fecaca;
}
.button.small {
  min-height: 28px;
  padding: 5px 8px;
  font-size: 12px;
}
.tabs {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  padding: 15px 0;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 18px;
}
.tabs .button {
  padding: 8px 13px;
}
.page-heading,
.section-heading {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.page-heading p {
  margin: 5px 0 0;
  font-size: 12px;
  color: #6b7280;
}
.muted {
  color: #6b7280;
  font-size: 12px;
  line-height: 1.5;
}
.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  border: 1px solid #e5e7eb;
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 16px;
}
.toolbar .field {
  min-width: 145px;
}
.toolbar .grow {
  flex: 1;
  min-width: 200px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  font-size: 12px;
  color: #4b5563;
  margin: 0;
}
.field > span {
  line-height: 1.4;
}
.field input,
.field select,
.field textarea {
  min-height: 35px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 14px;
  background: #fff;
  color: #111827;
  max-width: 100%;
  width: 100%;
}
.field textarea {
  min-height: 65px;
  resize: vertical;
}
.field.wide {
  grid-column: 1/-1;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 16px;
}
.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.panel {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px;
  margin: 16px 0;
}
.table-wrap {
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  max-width: 100%;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
  line-height: 1.4;
}
th {
  background: #f3f4f6;
  font-size: 11px;
  font-weight: 600;
  color: #374151;
  padding: 10px;
  white-space: nowrap;
}
td {
  padding: 10px;
  border-top: 1px solid #e5e7eb;
  vertical-align: middle;
  min-width: 65px;
}
tbody tr:hover {
  background: #fafbfc;
}
tfoot td {
  background: #f3f4f6;
  font-weight: bold;
  border-top: 2px solid #d1d5db;
}
.numeric {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.actions {
  min-width: 100px;
}
.text-button {
  color: #1d4ed8;
  cursor: pointer;
  border: 0;
  padding: 0;
  background: none;
  font-weight: 600;
  text-align: left;
  font-size: inherit;
  line-height: 1.5;
}
.text-button:hover {
  text-decoration: underline;
}
a {
  color: #1d4ed8;
}
.empty {
  padding: 32px 20px;
  color: #6b7280;
  text-align: center;
  line-height: 1.7;
}
.empty strong {
  color: #374151;
  display: block;
  font-size: 15px;
  font-weight: 500;
}
.empty .button {
  margin-top: 13px;
}
.badge {
  display: inline-block;
  padding: 4px 7px;
  border-radius: 5px;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 11px;
  white-space: nowrap;
}
.badge.green {
  background: #ecfdf5;
  color: #047857;
}
.badge.amber {
  background: #fffbeb;
  color: #92400e;
}
.badge.red {
  background: #fef2f2;
  color: #b91c1c;
}
.badge.blue {
  background: #eff6ff;
  color: #1d4ed8;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.payment-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.metric {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 15px;
  min-width: 0;
}
.metric-label {
  color: #6b7280;
  font-size: 12px;
  margin-bottom: 9px;
}
.metric-value {
  font-size: clamp(18px, 2vw, 26px);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}
.metric small {
  margin-top: 7px;
}
.metric.featured {
  background: #f8fafc;
  border-color: #cbd5e1;
}
.metric.positive .metric-value {
  color: #047857;
}
.metric.negative .metric-value {
  color: #b91c1c;
}
.two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.two-columns .panel {
  margin-top: 0;
}
.professional-value {
  font-size: 15px;
  font-weight: bold;
  color: #166534;
  background: #f0fdf4;
}
.totals-strip {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px;
  margin-top: 14px;
  background: #fafbfc;
}
.totals-strip > div {
  flex: 1;
  min-width: 135px;
}
.totals-strip strong {
  display: block;
  font-size: 18px;
  margin-top: 5px;
  font-variant-numeric: tabular-nums;
}
.subtabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  border-bottom: 1px solid #e5e7eb;
  margin: 14px 0;
  padding-bottom: 12px;
}
.note {
  padding: 11px 13px;
  border-radius: 7px;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 12px;
  line-height: 1.6;
  margin: 12px 0;
}
.error {
  padding: 11px 13px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
  border-radius: 7px;
  line-height: 1.5;
  margin: 12px 0;
}
.error:empty {
  display: none;
}
.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid #e5e7eb;
  color: #9ca3af;
  font-size: 11px;
  padding-top: 14px;
  margin-top: 28px;
}
dialog {
  border: 1px solid #d1d5db;
  padding: 0;
  border-radius: 12px;
  width: min(620px, calc(100vw - 24px));
  max-height: calc(100dvh - 36px);
  color: #111827;
  box-shadow: 0 20px 60px #11182725;
}
dialog.wide-dialog {
  width: min(1140px, calc(100vw - 24px));
}
dialog::backdrop {
  background: #11182765;
}
.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 17px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 2;
}
.dialog-header h2 {
  font-size: 18px;
}
.dialog-body {
  padding: 18px 20px;
}
.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid #e5e7eb;
  padding: 14px 20px;
  background: #fff;
  position: sticky;
  bottom: 0;
  z-index: 2;
}
.procedure-card {
  padding: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 9px;
  margin: 12px 0;
}
.procedure-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.procedure-grid {
  display: grid;
  grid-template-columns: 1.5fr 1.3fr 1fr 1fr 1fr;
  gap: 10px;
}
.procedure-result {
  display: flex;
  gap: 20px;
  margin-top: 14px;
  padding-top: 11px;
  border-top: 1px solid #e5e7eb;
  font-size: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.procedure-result strong {
  font-size: 16px;
  margin-left: 5px;
}
.procedure-result .professional-amount {
  color: #166534;
}
.sale-totals {
  padding: 14px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  margin-top: 16px;
}
.sale-totals .totals-strip {
  padding: 0;
  border: 0;
  margin: 0;
  background: none;
}
.sale-totals small {
  margin-top: 9px;
}
.summary-lines {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 20px;
  font-size: 13px;
}
.summary-lines > :nth-child(even) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.summary-lines .final {
  border-top: 1px solid #e5e7eb;
  padding-top: 10px;
  font-weight: bold;
}
.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 10;
  padding: 13px 18px;
  border-radius: 8px;
  box-shadow: 0 4px 20px #11182720;
  max-width: min(480px, calc(100vw - 32px));
  background: #111827;
  color: white;
  line-height: 1.5;
}
.toast.failed {
  background: #991b1b;
}
[hidden] {
  display: none !important;
}
.nowrap {
  white-space: nowrap;
}
.history-entry {
  padding: 12px 0;
  border-bottom: 1px solid #e5e7eb;
}
.preview-wrap {
  max-height: 220px;
  overflow: auto;
}
.preview-wrap th {
  position: sticky;
  top: 0;
}
.inline-client {
  display: flex;
  align-items: flex-end;
  gap: 7px;
}
.inline-client .field {
  flex: 1;
}
.summary-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.check-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin: 12px 0;
  font-size: 13px;
}
.check-field > span {
  order: 2;
}
.check-field input[type="checkbox"],
input.invoice-checkbox {
  width: 18px;
  height: 18px;
  min-height: 18px;
  flex: 0 0 18px;
  cursor: pointer;
  margin: 0;
  accent-color: #111827;
}
.check-field input {
  order: 1;
}
.material-paid {
  grid-column: 1/-1;
  margin: 0;
}
.reimbursement-note {
  color: #166534;
}
.panel-footnote {
  margin: 12px 0 0;
}
.client-picker {
  position: relative;
  flex: 1;
  min-width: 0;
}
.client-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 10;
  max-height: 230px;
  overflow: auto;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: white;
  box-shadow: 0 8px 20px #11182716;
  padding: 4px;
}
.client-results button {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 5px;
  text-align: left;
  background: white;
  padding: 10px;
  cursor: pointer;
  color: #111827;
}
.client-results button:hover,
.client-results button[aria-selected="true"] {
  background: #eff6ff;
}
.client-no-results {
  padding: 12px;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.5;
}
.material-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr 0.8fr auto;
  gap: 10px;
  align-items: end;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
  margin-bottom: 8px;
}
.material-detail {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 7px 0;
  font-size: 13px;
}
.owner-note {
  align-self: end;
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
  padding: 7px 9px;
  border-radius: 6px;
  font-size: 12px;
}
.expense-chart {
  margin: 0 0 16px;
}
.expense-chart h3 {
  margin-bottom: 4px;
}
.expense-chart p {
  margin-bottom: 0;
}
.expense-chart-content {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  align-items: center;
  gap: 24px;
}
.expense-pie {
  display: block;
  width: 100%;
  max-width: 250px;
  justify-self: center;
}
.expense-chart-legend {
  list-style: none;
  padding: 0;
  margin: 0;
}
.expense-chart-legend li {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto 54px;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
}
.category-swatch {
  width: 12px;
  height: 12px;
}
.category-name {
  overflow-wrap: anywhere;
}
.category-percentage,
.chart-total {
  text-align: right;
}
.category-percentage {
  color: #6b7280;
  font-size: 12px;
}
.chart-total strong {
  font-size: 18px;
}
@media (max-width: 650px) {
  .expense-chart-content {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .expense-chart-legend li {
    grid-template-columns: 12px minmax(0, 1fr) auto 44px;
    gap: 8px;
    font-size: 12px;
  }
}
@media (max-width: 1000px) {
  .summary-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 650px) {
  .material-row {
    grid-template-columns: 1fr 1fr;
  }
  .material-row > :first-child {
    grid-column: 1 / -1;
  }
  .material-row .button {
    justify-self: start;
  }
}
@media (max-width: 1000px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .procedure-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 650px) {
  .app {
    padding: 10px;
  }
  .app-header,
  .page-heading {
    align-items: flex-start;
  }
  .app-header {
    gap: 10px;
  }
  .app-header p {
    max-width: 210px;
  }
  .header-actions {
    justify-content: flex-end;
  }
  .tabs {
    gap: 5px;
  }
  .tabs .button {
    padding: 7px 9px;
    font-size: 12px;
  }
  .toolbar .field {
    flex: 1;
    min-width: 125px;
  }
  .two-columns,
  .form-grid.three {
    grid-template-columns: 1fr;
  }
  .metrics {
    gap: 8px;
  }
  .metric {
    padding: 12px;
  }
  .procedure-grid,
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .procedure-grid > :first-child {
    grid-column: 1 / -1;
  }
  .dialog-body {
    padding: 14px;
  }
  .dialog-header,
  .dialog-footer {
    padding: 13px 14px;
  }
  .app-footer {
    flex-direction: column;
  }
  .totals-strip {
    gap: 15px;
  }
  .totals-strip strong {
    font-size: 16px;
  }
}
