/* Stage 3 customer and finance views. All rules are scoped to these views. */
.customer-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px 20px;
  margin-bottom: 20px;
}
.customer-toolbar > .search-field { flex: 1 1 250px; max-width: 370px; }
.customer-toolbar .search-field input { min-height: 42px; font-size: 13px; }
.customer-toolbar > .customer-period { margin-left: 0; justify-content: flex-start; }
.customer-toolbar > .muted { max-width: 310px; margin-left: auto; color: var(--muted); font-size: 12px; line-height: 1.7; }
.customer-period {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
  margin-left: auto;
}
.customer-period > .field { width: 155px; }
.customer-period label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; font-weight: 400; }
.customer-period input { width: 150px; min-height: 40px; padding: 8px 10px; font-size: 12px; }
.customer-period .btn { min-height: 40px; }
.customer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(270px, 1fr);
  align-items: start;
  gap: 20px;
}
.customer-main, .customer-aside { min-width: 0; }
.customer-main > .panel + .panel,
.customer-aside > .panel + .panel { margin-top: 18px; }
.customer-layout .panel-head h2 { font-size: 14px; }
.customer-layout .panel-head p,
.customer-layout .small,
.customer-layout small { font-size: 12px; }
.customer-layout .muted { line-height: 1.7; }
.customer-statusline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.customer-statusline .pill { font-size: 11px; }
.customer-kpis.metric-strip,
.finance-summary.metric-strip { margin-bottom: 20px; }
.customer-kpis .metric,
.finance-summary .metric { padding-right: 20px; padding-left: 20px; }
.customer-kpis .metric-label,
.finance-summary .metric-label { color: var(--muted); font-size: 12px; line-height: 1.6; }
.customer-kpis .metric-value,
.finance-summary .metric-value { font-size: 25px; line-height: 1.3; white-space: nowrap; }
.customer-kpis .metric .small,
.finance-summary .metric .small { margin-top: 6px; font-size: 12px; line-height: 1.6; }
.customer-kpis a.metric,
.finance-summary a.metric { transition: background 150ms; border-radius: 0; }
.customer-kpis a.metric:hover,
.finance-summary a.metric:hover { background: #f7faf3; }
.customer-contact { min-width: 0; }
.customer-contact + .customer-contact { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 20px; }
.customer-contact .contact-name { color: var(--ink); font-size: 14px; font-weight: 550; line-height: 1.5; }
.customer-contact .contact-role { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.customer-contact .contact-point { display: grid; gap: 3px; min-width: 0; margin-top: 16px; }
.customer-contact .contact-point > :first-child { color: var(--muted); font-size: 12px; font-weight: 400; }
.customer-contact .contact-point > :last-child { color: #536b43; font-size: 13px; overflow-wrap: anywhere; word-break: normal; line-height: 1.7; }
.customer-contact .contact-point a { color: #536b43; text-decoration: underline; text-underline-offset: 3px; }
.customer-contact .contact-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 17px; }
.customer-contact .contact-actions .btn { font-size: 12px; }
.customer-contact .contact-actions + p { margin-top: 12px; }
.customer-contact > p { margin-top: 15px; font-size: 12px; line-height: 1.7; }
.customer-contact > .pill { margin-top: 10px; white-space: normal; font-size: 11px; line-height: 1.7; }
.customer-meta { margin: 0; }
.customer-meta .kv-list { margin: 0; }
.customer-meta .kv-row { font-size: 12px; line-height: 1.7; }
.customer-meta .kv-row dt { flex-basis: 38%; }
.customer-meta .kv-row dd { color: var(--ink); }
.customer-meta .kv-row + .kv-row { margin-top: 10px; }
.customer-layout .kv-row { font-size: 12px; line-height: 1.7; }
.customer-layout .kv-row dd { color: var(--ink); }
.customer-next-step {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding: 15px 18px;
  margin-bottom: 20px;
  background: #edf5e6;
  border: 1px solid #dfe9d5;
  border-radius: 12px;
  color: #5b7549;
}
.customer-next-step > div { flex: 1; min-width: 200px; }
.customer-next-step strong { display: block; color: #526c40; font-size: 13px; line-height: 1.6; }
.customer-next-step p,
.customer-next-step .small,
.customer-next-step .cell-sub { display: block; margin-top: 5px; color: #6d7e5f; font-size: 12px; line-height: 1.6; }
.customer-next-step > .btn { flex-shrink: 0; }
.tabs.customer-tabs { margin-bottom: 18px; }
.tabs.customer-tabs > button { font-size: 13px; }
.tabs.customer-tabs > button:hover,
.tabs.finance-tabs > button:hover { background: #edf2e7; color: #334b2a; }
#customer-contacts:focus { outline: none; }
.invoice-mobile-amounts { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin: 14px 0; }
.invoice-mobile-amounts span { font-size: 11px; color: var(--muted); }
.invoice-mobile-amounts strong { display: block; margin-top: 4px; color: var(--ink); font-size: 14px; overflow-wrap: anywhere; }
.customer-list .data-table { font-size: 13px; }
.customer-list .data-table th { padding-top: 13px; padding-bottom: 13px; font-size: 12px; }
.customer-list .data-table td { padding-top: 18px; padding-bottom: 18px; }
.customer-list .cell-title { margin-bottom: 5px; color: var(--ink); font-size: 13px; }
.customer-list .cell-sub { margin-top: 3px; font-size: 12px; line-height: 1.6; }
.customer-list .data-table .money-amount { display: block; }
.customer-list .data-table .pill { font-size: 11px; }
.customer-list .data-table td:last-child { text-align: right; }
.customer-list > .filters > select { width: 215px; font-size: 12px; }
.customer-mobile-list { gap: 12px; }
.customer-mobile-card { min-width: 0; padding: 16px; border: 1px solid #e2e7dc; border-radius: 13px; background: var(--surface); }
.customer-card-head { display: flex; align-items: flex-start; gap: 10px; }
.customer-card-head > div { min-width: 0; flex: 1; }
.customer-card-head strong { font-size: 14px; line-height: 1.5; }
.customer-card-head > strong { flex: 1; min-width: 0; }
.customer-card-head .pill { flex-shrink: 0; margin-top: 1px; font-size: 10px; }
.customer-card-head .cell-sub { margin-top: 6px; line-height: 1.6; }
.customer-card-money { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 13px 0; margin-top: 13px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.customer-card-money > div { min-width: 0; }
.customer-card-money > span { min-width: 0; font-size: 12px; line-height: 1.7; color: var(--muted); }
.customer-card-money > span > strong { display: block; color: var(--ink); font-size: 16px; line-height: 1.5; font-weight: 550; font-variant-numeric: tabular-nums; margin-top: 5px; }
.customer-card-money .small,
.customer-card-money .metric-label { display: block; font-size: 12px; line-height: 1.6; color: var(--muted); }
.customer-card-money .money-amount { display: block; margin-top: 5px; font-size: 15px; }
.customer-card-next { margin-top: 13px; font-size: 12px; color: #697b5b; line-height: 1.7; }
.customer-card-next .cell-sub { margin-top: 5px; font-size: 12px; }
.customer-card-next strong { display: block; font-weight: 500; }
.customer-mobile-card > .toolbar { margin-top: 14px; }
.customer-mobile-card > p { margin-top: 11px; font-size: 13px; line-height: 1.8; color: var(--ink); overflow-wrap: anywhere; word-break: normal; }
.customer-mobile-card > p.muted { font-size: 12px; color: var(--muted); margin-top: 6px; }
.customer-money-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.customer-money-grid > div { min-width: 0; }
.customer-money-grid .metric-label { font-size: 12px; line-height: 1.6; }
.customer-money-grid .money-amount { display: block; margin-top: 7px; font-size: 19px; line-height: 1.4; }
.customer-mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.customer-mini-stats > div { min-width: 0; padding-right: 14px; border-right: 1px solid var(--line); }
.customer-mini-stats > div:last-child { border: 0; padding-right: 0; }
.customer-mini-stats strong,
.customer-mini-stats .money-amount { display: block; font-size: 19px; line-height: 1.4; letter-spacing: -.35px; }
.customer-mini-stats span,
.customer-mini-stats .metric-label { display: block; margin-top: 6px; font-size: 12px; line-height: 1.6; color: var(--muted); }
.customer-sale { padding: 17px 0; border-bottom: 1px solid var(--line); }
.customer-sale:first-child { padding-top: 0; }
.customer-sale:last-child { padding-bottom: 0; border-bottom: 0; }
.customer-sale-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.customer-sale-head > div { min-width: 0; }
.customer-sale-head h3,
.customer-sale-head strong { color: var(--ink); font-size: 13px; line-height: 1.6; }
.customer-sale-amount { color: var(--ink); font-size: 15px; font-weight: 550; white-space: nowrap; font-variant-numeric: tabular-nums; }
.customer-sale-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 12px; margin-top: 9px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.customer-sale-meta .pill { font-size: 11px; }
.customer-sale p { margin-top: 10px; font-size: 12px; line-height: 1.75; color: var(--muted); }
.customer-sale .toolbar { margin-top: 12px; }
.customer-sale > .contact-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 13px; }
.customer-activity .timeline-item { padding-bottom: 22px; }
.customer-activity .timeline-item:last-child { padding-bottom: 0; }
.customer-activity .timeline-content { font-size: 12px; line-height: 1.7; }
.customer-activity .timeline-content h3 { font-size: 13px; line-height: 1.6; }
.customer-activity .timeline-content p { margin-top: 7px; font-size: 12px; line-height: 1.75; }
.customer-activity .timeline-meta { margin-top: 5px; font-size: 12px; line-height: 1.6; }
.customer-activity .timeline-dot { margin-top: 5px; }
.customer-activity .timeline-item:not(:last-child)::before { top: 18px; }
.finance-toolbar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 14px 18px; margin-bottom: 20px; }
.finance-toolbar > .field { flex: 1 1 170px; max-width: 260px; }
.finance-toolbar .field input,
.finance-toolbar .field select { font-size: 12px; min-height: 40px; }
.finance-toolbar .customer-period { margin-left: auto; }
.tabs.finance-tabs > button { font-size: 13px; }
.tabs.finance-tabs { margin-bottom: 19px; }
.finance-note { padding: 12px 14px; border: 1px solid #e6e9df; border-radius: 10px; background: #f2f4ed; color: var(--muted); font-size: 12px; line-height: 1.75; margin-bottom: 18px; }
.finance-note strong { color: #57674a; font-weight: 500; }
.finance-note p + p { margin-top: 8px; }
p.finance-note { margin-top: 18px; }
.money-amount { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 500; }
.money-positive { color: #4d773d; }
.money-negative { color: #a86450; }
.invoice-breakdown { min-width: 0; }
.data-table.invoice-breakdown { font-size: 12px; }
.data-table.invoice-breakdown th { font-size: 12px; }
.data-table.invoice-breakdown .cell-title { color: var(--ink); font-size: 13px; }
.data-table.invoice-breakdown .cell-sub { margin-top: 4px; font-size: 12px; }
.data-table.invoice-breakdown .pill { font-size: 11px; }
.invoice-payment { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: start; gap: 8px 13px; border-bottom: 1px solid var(--line); padding: 14px 0; font-size: 12px; line-height: 1.7; }
.invoice-payment:first-child { padding-top: 0; }
.invoice-payment:last-child { padding-bottom: 0; border-bottom: 0; }
.invoice-payment > :first-child { color: var(--muted); }
.invoice-payment > :first-child strong { color: var(--ink); font-size: 12px; }
.invoice-payment .cell-sub { font-size: 12px; line-height: 1.7; margin-top: 4px; }
.invoice-payment > :last-child { text-align: right; }
.invoice-payment .pill { font-size: 10px; }
.invoice-payment .money-amount { font-size: 13px; }
.customer-empty { padding: 35px 18px; text-align: center; color: var(--muted); }
.customer-empty h3 { color: #586b4b; font-size: 14px; }
.customer-empty p { max-width: 46ch; margin: 9px auto 0; font-size: 12px; line-height: 1.75; }
.customer-empty .btn { margin-top: 17px; }
.customer-evidence { border: 1px solid #e6ebdf; border-radius: 10px; padding: 13px 14px; background: #f8faf4; }
.customer-evidence + .customer-evidence { margin-top: 10px; }
.customer-evidence summary { cursor: pointer; color: #627953; font-size: 12px; font-weight: 500; line-height: 1.6; }
.customer-evidence p { color: var(--muted); font-size: 12px; line-height: 1.8; margin-top: 12px; overflow-wrap: anywhere; }
.customer-evidence .cell-sub { margin-top: 9px; font-size: 12px; line-height: 1.7; }

@media (max-width: 1180px) {
  .customer-layout { gap: 16px; grid-template-columns: minmax(0, 1.5fr) minmax(255px, 1fr); }
  .customer-kpis .metric, .finance-summary .metric { padding: 0 16px; }
  .customer-kpis .metric-value, .finance-summary .metric-value { font-size: 22px; }
  .customer-kpis .metric-label, .finance-summary .metric-label { font-size: 12px; }
  .customer-mini-stats { gap: 11px; }
  .customer-mini-stats > div { padding-right: 10px; }
  .customer-mini-stats strong, .customer-mini-stats .money-amount { font-size: 17px; }
  .customer-money-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
}
@media (max-width: 980px) and (min-width: 761px) {
  .customer-layout { grid-template-columns: 1fr; }
  .customer-aside { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
  .customer-aside > .panel + .panel { margin-top: 0; }
  .customer-toolbar { align-items: stretch; }
  .customer-toolbar > .search-field { flex-basis: 100%; max-width: none; }
  .customer-period { margin-left: 0; justify-content: flex-start; }
  .customer-period input { width: 145px; }
  .customer-kpis.metric-strip, .finance-summary.metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 20px; }
  .customer-kpis .metric:nth-child(2), .finance-summary .metric:nth-child(2) { border-right: 0; }
}
@media (max-width: 760px) {
  .customer-toolbar { display: block; margin-bottom: 18px; }
  .customer-toolbar > .muted { max-width: none; margin: 12px 0 0; font-size: 12px; }
  .customer-toolbar > .search-field { max-width: none; width: 100%; }
  .customer-toolbar .search-field input { min-height: 44px; font-size: 14px; }
  .customer-period { width: 100%; justify-content: flex-start; margin: 14px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .customer-period > .field { width: auto; }
  .customer-period label { font-size: 12px; margin-bottom: 6px; }
  .customer-period input { width: 100%; min-height: 44px; padding: 10px; font-size: 14px; }
  .customer-period > .btn { grid-column: 1 / -1; min-height: 42px; }
  .customer-period > p, .customer-period > .hint { grid-column: 1 / -1; font-size: 12px; }
  .customer-layout { grid-template-columns: 1fr; gap: 18px; }
  .customer-main > .panel + .panel, .customer-aside > .panel + .panel { margin-top: 16px; }
  .customer-layout .panel-head h2 { font-size: 15px; }
  .customer-layout .panel-head .inline-link { font-size: 12px; }
  .customer-statusline .pill { font-size: 11px; }
  .customer-kpis.metric-strip, .finance-summary.metric-strip { grid-template-columns: 1fr 1fr; gap: 23px 0; padding: 20px 0; }
  .customer-kpis .metric, .finance-summary .metric { padding: 0 15px; }
  .customer-kpis .metric-value, .finance-summary .metric-value { margin-top: 7px; font-size: 21px; }
  .customer-kpis .metric-label, .finance-summary .metric-label { font-size: 12px; }
  .customer-kpis .metric .small, .finance-summary .metric .small { font-size: 11px; }
  .customer-kpis .metric:nth-child(2), .finance-summary .metric:nth-child(2) { border-right: 0; }
  .customer-contact .contact-name { font-size: 15px; }
  .customer-contact .contact-role { font-size: 13px; }
  .customer-contact .contact-point > :first-child { font-size: 12px; }
  .customer-contact .contact-point > :last-child { font-size: 14px; }
  .customer-contact .contact-actions .btn { min-height: 42px; font-size: 12px; flex: 1; }
  .customer-meta .kv-row { font-size: 13px; }
  .customer-layout .kv-row { font-size: 13px; }
  .customer-meta .kv-row dt { flex-basis: 39%; }
  .customer-next-step { padding: 15px 16px; gap: 12px; margin-bottom: 18px; }
  .customer-next-step > div { min-width: 0; flex-basis: 100%; }
  .customer-next-step strong { font-size: 14px; }
  .customer-next-step p, .customer-next-step .small, .customer-next-step .cell-sub { font-size: 12px; }
  .customer-next-step > .btn { width: 100%; }
  .tabs.customer-tabs > button { font-size: 13px; }
  .customer-mobile-list.mobile-only { display: grid !important; padding: 0 12px 12px; }
  .customer-list > .filters > select { width: 100%; grid-column: 1 / -1; font-size: 14px; }
  .customer-mobile-card { padding: 15px; }
  .customer-card-head strong { font-size: 14px; }
  .customer-card-head .cell-sub { font-size: 12px; }
  .customer-mobile-card > p { font-size: 14px; }
  .customer-card-money .money-amount { font-size: 16px; }
  .customer-card-next { font-size: 14px; }
  .customer-card-next .cell-sub { font-size: 12px; }
  .customer-mobile-card > .toolbar > .btn { width: 100%; }
  .customer-money-grid { grid-template-columns: 1fr 1fr; gap: 19px 16px; }
  .customer-money-grid .money-amount { font-size: 19px; }
  .customer-mini-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .customer-mini-stats > div { padding-right: 8px; }
  .customer-mini-stats strong, .customer-mini-stats .money-amount { font-size: 17px; }
  .customer-mini-stats span, .customer-mini-stats .metric-label { font-size: 12px; }
  .customer-sale-head { gap: 10px; flex-wrap: wrap; }
  .customer-sale-head > div { flex: 1 1 180px; }
  .customer-sale-head h3, .customer-sale-head strong { font-size: 14px; }
  .customer-sale-amount { font-size: 16px; }
  .customer-sale-meta { font-size: 12px; line-height: 1.8; }
  .customer-sale p { font-size: 14px; }
  .customer-sale .toolbar .btn { min-height: 42px; flex: 1; }
  .customer-activity .timeline-content, .customer-activity .timeline-content p { font-size: 14px; }
  .customer-activity .timeline-content h3 { font-size: 14px; }
  .customer-activity .timeline-meta { font-size: 12px; }
  .finance-toolbar { display: block; margin-bottom: 18px; }
  .finance-toolbar > .field { max-width: none; margin-bottom: 12px; }
  .finance-toolbar .field input, .finance-toolbar .field select { font-size: 14px; min-height: 44px; }
  .finance-toolbar .customer-period { margin: 0; }
  .tabs.finance-tabs > button { font-size: 13px; }
  .finance-note { padding: 13px 14px; font-size: 12px; }
  .data-table.invoice-breakdown { min-width: 580px; }
  .data-table.invoice-breakdown th, .data-table.invoice-breakdown td { font-size: 12px; }
  .invoice-payment { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 15px 0; font-size: 14px; }
  .invoice-payment > :first-child { grid-column: 1 / -1; font-size: 12px; }
  .invoice-payment > :first-child strong { font-size: 14px; }
  .invoice-payment > .money-amount { grid-column: 1; }
  .invoice-payment > .pill { grid-column: 2; justify-self: end; }
  .invoice-payment .money-amount { font-size: 14px; }
  .customer-empty { padding: 30px 16px; }
  .customer-empty h3 { font-size: 15px; }
  .customer-empty p { font-size: 14px; }
  .customer-evidence summary { font-size: 13px; }
  .customer-evidence p { font-size: 14px; }
  .customer-evidence .cell-sub { font-size: 12px; }
}
