/* Clients: list, card and its tabs (views/clients). */

.client-search { flex: 1; max-width: 420px; min-width: 200px; }
.client-search .input { height: 38px; }
.client-search .input::placeholder { color: var(--muted); font-weight: 400; }
.ok-ink { color: var(--ok-ink); }
.small { font-size: 12.5px; }
.tag.role-1 { background: #EFE7FB; color: #4B2A86; }
.tag.role-2, .tag.role-4 { background: #EEF0F2; color: var(--ink-2); }
.bell { color: var(--warn-ink); display: inline-flex; }

.clients-table .client-name { color: var(--ink); font-weight: 500; flex: 0 1 auto; }
.clients-table .client-name:hover { color: var(--blue); }
.clients-table .desc { flex: 1 1 0; min-width: 0; font-size: 12.5px; }
.client-cards .ocard-top b.ell { min-width: 0; }

.reminders ul { list-style: none; margin: 0; padding: 6px 16px 10px; display: flex; flex-direction: column; }
.reminders li { display: flex; gap: 10px; align-items: baseline; padding: 5px 0; border-bottom: 1px dashed var(--line-soft); min-width: 0; }
.reminders li:last-child { border-bottom: 0; }
.reminders li .grow { flex: 1; min-width: 0; }
.reminders li.done { color: var(--faint); text-decoration: line-through; }
.reminders li.late .num { color: var(--alert); font-weight: 600; }
.reminders .panel-head svg { color: var(--warn-ink); }

.pager { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 4px 0; flex-wrap: wrap; }
.pager > a:not(.icon-btn) {
  min-width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0 8px;
  border-radius: 8px; color: var(--ink); font-variant-numeric: tabular-nums;
}
.pager > a:not(.icon-btn):hover { background: #fff; }
.pager > a.on { background: var(--ink); color: #fff; }

/* card */
.client-head h1 { min-width: 0; max-width: min(720px, 100%); }
.client-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cs-item { display: flex; flex-direction: column; gap: 3px; padding: 12px 16px; min-width: 0; border-right: 1px solid var(--line-soft); color: var(--ink); }
.cs-item:last-child { border-right: 0; }
.cs-item > span:first-child { font-size: 12px; color: var(--muted); }
.cs-item b { font-weight: 600; font-size: 15px; }
.cs-item b.big { font-size: 22px; }
.cs-item svg { vertical-align: -2px; }
.cs-phones { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.cs-phones a { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
a.cs-balance:hover { background: var(--sunk); color: var(--ink); }
.client-note { background: var(--sunk); color: var(--ink); white-space: normal; }
.client-tabs { height: 38px; }
.client-tabs > * { font-size: 14px; padding: 0 14px; }

.client-orders { display: flex; flex-direction: column; gap: 10px; }

.client-form { display: flex; flex-direction: column; gap: 12px; max-width: 980px; }
.client-form details > summary { cursor: pointer; list-style: none; }
.client-form details > summary::-webkit-details-marker { display: none; }
.client-form details > summary svg { transition: transform .15s; }
.client-form details[open] > summary svg { transform: rotate(180deg); }
.client-form details:not([open]) > summary { border-bottom: 0; }
.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.form-actions .grow { flex: 1; }
.btn-danger-ghost { color: var(--alert); border-color: transparent; background: none; }
.btn-danger-ghost:hover { background: var(--alert-soft); color: var(--alert-ink); }
.dup-list { margin: 6px 0 0; padding-left: 18px; }
.client-history .hc { display: block; }
.client-history li { align-items: flex-start; }

/* finance */
.fin-span { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fin-span .seg { height: 34px; }
.fin-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.fin-card { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; min-width: 0; }
.fin-card > span { font-size: 12px; color: var(--muted); }
.fin-card b { font-size: 20px; font-weight: 600; }
.fin-card.warn { background: #FFF6D6; border-color: #F2DE9B; }
.fin-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.pay-list { display: flex; flex-direction: column; }
.pay-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 9px 16px; border-bottom: 1px solid var(--line-soft); }
.pay-item:last-child { border-bottom: 0; }
.pay-sign { width: 28px; height: 28px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-weight: 700; background: var(--sunk); color: var(--ink-2); }
.pay-sign.in { background: var(--ok-soft); color: var(--ok-ink); }
.pay-sign.out { background: var(--alert-soft); color: var(--alert-ink); }
.pay-main, .pay-meta { display: flex; flex-direction: column; min-width: 0; }
.pay-meta { align-items: flex-end; text-align: right; max-width: 150px; }
.pay-links { display: flex; align-items: center; gap: 6px; }
.table-scroll { overflow-x: auto; }
.dt.months { table-layout: auto; }
.dt.months td { height: 36px; }
.months-more { display: block; margin: 8px auto 12px; }
.pay-type { align-self: flex-start; }
.pay-type > button { padding: 0 18px; font-size: 14px; }
.big-in { font-size: 20px; font-weight: 600; }

/* tasks */
.tasks-grid { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 12px; align-items: start; }
.quick-dates { display: flex; flex-wrap: wrap; gap: 6px; }
.quick-dates .chip { height: 28px; font-size: 12.5px; }
.task-list { list-style: none; margin: 0; padding: 4px 16px 8px; }
.task-list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.task-list li:last-child { border-bottom: 0; }
.task-list li .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.task-list li.done .task-text { color: var(--faint); text-decoration: line-through; }
.task-list li.late .task-text { font-weight: 500; }
.task-check {
  flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: 6px; border: 2px solid var(--field); background: #fff;
  display: inline-flex; align-items: center; justify-content: center; color: #fff; cursor: pointer; padding: 0;
}
.task-list li.done .task-check { background: var(--ok); border-color: var(--ok); }
.task-check:hover { border-color: var(--ok); }

/* dealer */
.dealer-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 12px; align-items: start; }
.dealer-form { display: flex; flex-direction: column; gap: 12px; }
.dealer-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
.dealer-check { align-items: flex-start; }
.dealer-check .cbx { margin-top: 3px; }
.dealer-check span { display: flex; flex-direction: column; gap: 2px; }
.dealer-side { display: flex; flex-direction: column; gap: 12px; }
.dealer-side .of-body > .btn { justify-content: flex-start; }
.invite { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.combo { position: relative; }
.combo-pop {
  position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; right: 0; background: #fff; border-radius: 10px;
  box-shadow: var(--shadow-pop); padding: 6px; max-height: 300px; overflow: auto;
}
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--ground) 30%); padding: 14px 0 6px; z-index: 3; }

@media (max-width: 1100px) {
  .fin-grid, .dealer-grid, .tasks-grid { grid-template-columns: minmax(0, 1fr); }
  .client-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cs-item:nth-child(2) { border-right: 0; }
  .cs-item:nth-child(-n+2) { border-bottom: 1px solid var(--line-soft); }
}
@media (max-width: 760px) {
  .client-search { max-width: none; order: 5; flex-basis: 100%; }
  .client-head { gap: 8px; }
  .client-head h1 { font-size: 19px; order: 2; flex: 1 1 calc(100% - 110px); white-space: normal; line-height: 1.2; }
  .client-head > .tag, .client-head > .st { order: 5; }
  .client-head > .grow { display: none; }
  .client-head > .btn-primary { order: 3; }
  .client-head .btn-primary span { display: none; }
  .client-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cs-item { padding: 10px 12px; font-size: 13.5px; }
  .cs-item b { font-size: 14px; }
  .cs-item b.big { font-size: 18px; }
  .cs-item .muted.ell:not(:first-child) { display: none; }
  .dealer-fields { grid-template-columns: minmax(0, 1fr); }
  .fin-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .fin-card { padding: 10px 12px; }
  .fin-card b { font-size: 16px; }
  .fin-cards .fin-card:first-child { display: none; }
  .fin-card.warn { grid-column: 1 / -1; }
  .pay-item { grid-template-columns: 28px minmax(0, 1fr) auto; }
  .pay-links { grid-column: 2 / -1; }
  .sticky-actions { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
}
.warn-ink { color: var(--warn-ink); }

/* payment links (.paylink-box; .pay-links above is the payments list) */
.link-list { list-style: none; margin: 0; padding: 4px 16px 10px; }
.link-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.link-list li:last-child { border-bottom: 0; }
.link-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.link-actions { display: flex; align-items: center; gap: 8px; white-space: nowrap; }

/* monthly reconciliation */
.act-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.act-row .field { max-width: 170px; }
.act-list { list-style: none; margin: 10px 0 0; padding: 0; }
.act-list li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px dashed var(--line-soft); font-size: 13px; }
.act-list li .grow { flex: 1; min-width: 0; }

/* Requests from the sites (views/requests/index.php). */
.req-list { display: flex; flex-direction: column; gap: 8px; }
.req-row { display: flex; gap: 16px; padding: 12px 16px; align-items: flex-start; }
.req-row.req-new { box-shadow: inset 4px 0 0 var(--signal); }
.req-row.req-done { opacity: .55; }
.req-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.req-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.req-text { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.req-who { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.req-phone { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.req-order { display: flex; align-items: center; gap: 6px; color: var(--ok-ink); }
.req-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; min-width: 150px; }
@media (max-width: 760px) {
  .req-row { flex-direction: column; }
  .req-actions { flex-direction: row; flex-wrap: wrap; min-width: 0; width: 100%; }
}
