/* Ficha de placa / cuenta: a drawer from the right over any view. */
.pf { position: fixed; inset: 0; z-index: 80; }
.pf[hidden] { display: none; }
.pf-backdrop { position: absolute; inset: 0; border: 0; background: rgba(16, 32, 26, 0.38); cursor: default; }
.pf-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(720px, 100%);
  overflow-y: auto;
  background: #f7f7f4;
  box-shadow: -12px 0 40px rgba(16, 32, 26, 0.14);
  color: #10201a;
}
.pf-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px 14px;
  border-bottom: 1px solid #ecede9;
  background: #fff;
}
.pf-kicker { margin: 0 0 2px; color: #8b958f; font-size: 12px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }
.pf-head h2 { margin: 0; padding: 0; font-family: var(--font-sans); font-size: 26px; font-weight: 600; letter-spacing: -0.01em; }
.pf-head h2.is-plate { font-family: var(--font-mono); letter-spacing: 0.03em; }
.pf-head h2 .pf-label { font-family: var(--font-sans); font-weight: 500; letter-spacing: 0; color: #5f6b64; }
.pf-sub { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; color: #5f6b64; font-size: 13.5px; }
.pf-chip { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; border-radius: 999px; background: #f0f1ee; color: #3d4a43; font-size: 12.5px; font-weight: 550; white-space: nowrap; }
.pf-chip[data-tone="client"] { background: #e9eff6; color: #2f5a85; }
.pf-chip[data-tone="permit"] { background: #efe9f6; color: #5b3f85; }
.pf-chip[data-tone="ok"] { background: #e6efe8; color: #2f7a52; }
.pf-chip[data-tone="owed"] { background: #f9ead0; color: #8a4f0e; }
.pf-chip[data-tone="closed"] { background: #f6e7e1; color: #9a4a2c; }
.pf-note { margin: 14px 24px 0; padding: 10px 14px; border-radius: 10px; background: #e6efe8; color: #2f7a52; font-size: 14px; font-weight: 500; }
.pf-note[hidden] { display: none; }
.pf-panel > .error { margin: 14px 24px 0; }
.pf-link { display: flex; gap: 8px; margin: 10px 24px 0; }
.dash .pf-link .control { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 12px; }
.pf-body { display: flex; flex-direction: column; gap: 14px; padding: 16px 24px 48px; }

.pf-section { padding: 16px 18px; border: 1px solid rgba(16, 32, 26, 0.06); border-radius: 16px; background: #fff; box-shadow: 0 1px 2px rgba(16, 32, 26, 0.03); }
.pf-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.pf-section h3 { margin: 0; font-size: 15px; font-weight: 600; }
.pf-hint { color: #8b958f; font-size: 12px; }
.pf-empty { margin: 0; color: #8b958f; font-size: 13px; }
.pf-meta { margin: 4px 0 0; color: #7b867f; font-size: 12.5px; line-height: 1.45; }
.pf-warn { margin-top: 12px; padding: 8px 10px; border-radius: 8px; background: #fbf6ef; color: #8a5a1c; }
.pf-tag { padding: 2px 8px; border-radius: 6px; background: #f3f4f1; color: #5f6b64; font-size: 12px; font-weight: 500; white-space: nowrap; }
.pf-tag.is-closed { background: #f6e7e1; color: #9a4a2c; }

/* Ahora: the visit inside (or the last one), its photos and what to do. */
.pf-now { padding: 18px; }
.pf-now-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.pf-now-where { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.pf-now h3 { font-size: 17px; }
.pf-now[data-state="inside"] h3 { color: #143d2b; }
.pf-now-lot { color: #7b867f; font-size: 12.5px; }
.pf-now-plate { padding: 3px 8px; border-radius: 7px; background: #f3f4f1; font-family: var(--font-mono); font-size: 13px; font-weight: 600; letter-spacing: 0.04em; }
.pf-now-head .pf-pill { font-size: 13px; }
.pf-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 1px; margin-bottom: 14px; overflow: hidden; border: 1px solid #ecede9; border-radius: 12px; background: #ecede9; }
.pf-fact { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; background: #fff; }
.pf-fact-label { color: #8b958f; font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.pf-fact-value { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-fact.is-money .pf-fact-value { font-size: 20px; line-height: 1.1; }
.pf-now[data-state="inside"] .pf-fact.is-money .pf-fact-value { color: #143d2b; }

.pf-shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pf-shots > p { grid-column: 1 / -1; padding: 12px; border-radius: 12px; background: #f7f7f4; text-align: center; }
.pf-shot { position: relative; display: block; overflow: hidden; aspect-ratio: 4 / 3; border-radius: 12px; background: #eef0ec; color: #fff; text-decoration: none; }
.pf-shot img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s ease; }
.pf-shot:hover img { transform: scale(1.02); }
.pf-shot-cap { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 6px; padding: 18px 10px 8px; background: linear-gradient(transparent, rgba(8, 16, 12, 0.72)); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.pf-shot-cap .pf-photo-read { margin-left: auto; padding: 1px 6px; border-radius: 5px; background: rgba(255, 255, 255, 0.92); color: #10201a; }
.pf-shot.is-empty { display: flex; align-items: center; justify-content: center; border: 1.5px dashed #d9ddd7; background: #fafaf8; color: #8b958f; font-size: 13px; font-weight: 500; }
.pf-shot.is-loading { border-style: solid; border-color: transparent; background: linear-gradient(90deg, #f0f1ee, #f7f7f4, #f0f1ee); background-size: 200% 100%; animation: pf-shimmer 1.2s linear infinite; }
@keyframes pf-shimmer { to { background-position: -200% 0; } }
.dash .pf .pf-more-photos { margin-top: 8px; }
.pf-now > .pf-photos { margin-top: 10px; }
.pf-now > .pf-photos[hidden] { display: none; }

/* What to do with a visit: real buttons for charging and Corregir placa, quiet links for the rest. */
.pf-do { display: flex; flex-direction: column; gap: 10px; }
.pf-do[hidden] { display: none; }
.pf-now > .pf-do, .pf-now > .pf-confirm { margin-top: 14px; padding-top: 14px; border-top: 1px solid #f0f1ee; }
.pf-now > .pf-confirm { padding: 14px; border-top: 0; }
.pf-do-main { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-do-quiet { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.pf-now .pf-do-main > button { flex: 1 1 220px; }
.dash .pf .cta-line.pf-replate { border-color: rgba(20, 61, 43, 0.32); color: #143d2b; }
/* Borrar visita sits alone at the far end, away from the everyday actions. */
.dash .pf .pf-quiet.pf-delete { margin-left: auto; }

.pf-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pf-actions[hidden] { display: none; }
.dash .pf .cta-line,
.dash .pf .cta { width: auto; height: 40px; min-height: 40px; margin: 0; padding: 0 16px; border-radius: 10px; font-size: 13.5px; font-weight: 600; }
.dash .pf .cta-line { border: 1px solid rgba(16, 32, 26, 0.14); background: #fff; color: #10201a; }
.dash .pf .cta-line:hover:not(:disabled) { border-color: rgba(20, 61, 43, 0.4); background: #fafaf8; }
.dash .pf .cta.pf-primary,
.dash .pf .cta.pf-go { border-color: #1f5c40; background: #1f5c40; color: #fff; }
.dash .pf .cta.pf-primary:hover:not(:disabled),
.dash .pf .cta.pf-go:hover:not(:disabled) { background: #174a33; }
.dash .pf .cta.is-danger { border-color: #b9603f; background: #b9603f; color: #fff; }
.dash .pf .cta.is-danger:hover:not(:disabled) { background: #a3532f; }
.dash .pf .cta:disabled { border-color: transparent; background: #e6e8e4; color: rgba(16, 32, 26, 0.38); }
.dash .pf .pf-quiet { height: auto; min-height: 0; padding: 4px 0; border: 0; background: none; color: #5f6b64; font-size: 13px; font-weight: 550; text-decoration: underline; text-decoration-color: rgba(95, 107, 100, 0.4); text-underline-offset: 3px; cursor: pointer; }
.dash .pf .pf-quiet:hover { color: #10201a; text-decoration-color: currentColor; }
.dash .pf .pf-quiet.is-danger { color: #a3532f; text-decoration-color: rgba(163, 83, 47, 0.4); }
.dash .pf .pf-quiet.is-danger:hover { color: #8a3f1f; }

/* A confirm: the question in bold, what happens, then yes / cancel. */
.pf-confirm { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border: 1px solid #efe1cc; border-radius: 12px; background: #fdf8f1; }
.pf-confirm:has(.pf-go:not(.is-danger)) { border-color: #cfe0d6; background: #f1f7f3; }
.pf-confirm.pf-input { flex-direction: row; flex-wrap: wrap; align-items: center; border-color: #ecede9; background: #f7f7f4; }
.pf-ask { display: flex; flex-direction: column; gap: 3px; color: #4a3d2c; font-size: 13px; line-height: 1.45; }
.pf-confirm:has(.pf-go:not(.is-danger)) .pf-ask { color: #24382e; }
.pf-ask strong { color: #10201a; font-size: 14.5px; font-weight: 650; }
.pf-input > .pf-ask { flex: 1 1 100%; }
.pf-confirm-go { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-confirm label { display: flex; flex: 1 1 100%; flex-direction: column; gap: 6px; color: #5f4a2f; font-size: 12.5px; line-height: 1.45; }
.dash .pf-confirm .control { width: auto; flex: 1 1 180px; height: 40px; min-height: 40px; font-size: 14px; }
.dash .pf-confirm .pf-plate-input { flex: 0 1 170px; font-family: var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; }
.dash .pf-confirm .pf-last4 { flex: none; width: 110px; font-family: var(--font-mono); letter-spacing: 0.2em; text-align: center; }
.pf-confirm:has(.pf-last4) { flex-direction: row; flex-wrap: wrap; align-items: center; }

/* Deuda: only when it owes. */
.pf-debt { border-color: #efd9b4; background: #fdf7ec; }
.pf-debt-head { margin-bottom: 8px; }
.pf-debt-words { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.pf-debt-label { color: #9a5b12; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.pf-debt-total { color: #8a4f0e; font-size: 26px; font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pf-debt-why { color: #7a5a35; font-size: 13px; }
.pf-owed { display: flex; flex-direction: column; margin: 0 0 12px; padding: 0; list-style: none; border-top: 1px solid #f1e3c9; }
.pf-owed li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 8px 0; border-bottom: 1px solid #f1e3c9; }
.pf-owed li > .pf-confirm { flex: 1 1 100%; }
.pf-owed-what { display: flex; flex: 1 1 160px; flex-direction: column; gap: 1px; min-width: 0; font-size: 13.5px; }
.pf-owed-what small { color: #9a5b12; font-size: 12px; }
.pf-owed-cents { font-size: 14px; font-variant-numeric: tabular-nums; }

/* Cuenta: label on the left, what it has on the right. */
.pf-user + .pf-user { margin-top: 16px; padding-top: 16px; border-top: 1px solid #f0f1ee; }
.pf-user-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.pf-who { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.pf-who strong { font-size: 15px; font-weight: 600; }
.pf-who span { color: #7b867f; font-size: 12.5px; font-family: var(--font-mono); }
.pf-kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-top: 1px solid #f3f4f1; font-size: 13.5px; }
.pf-kv-label { color: #8b958f; font-size: 12.5px; padding-top: 2px; }
.pf-kv-value { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pf-kv-value > .pf-actions { gap: 4px 12px; }
.pf-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pf-more { margin-top: 8px; padding-top: 10px; border-top: 1px solid #f3f4f1; }
.pf-more > summary { display: flex; align-items: center; color: #5f6b64; font-size: 13px; font-weight: 550; list-style: none; cursor: pointer; }
.pf-more > summary::-webkit-details-marker { display: none; }
.pf-more > summary::after { content: ""; flex: none; width: 6px; height: 6px; margin-left: auto; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform 0.15s ease; }
.pf-more[open] > summary::after { transform: rotate(45deg); }
.pf-more > .pf-actions, .pf-more > .pf-confirm { margin-top: 10px; }

.pf-plate { padding: 3px 8px; border: 1px solid rgba(16, 32, 26, 0.08); border-radius: 7px; background: #f3f4f1; color: #10201a; font-family: var(--font-mono); font-size: 12.5px; font-weight: 550; letter-spacing: 0.04em; white-space: nowrap; cursor: pointer; }
.pf-plate:hover:not(:disabled) { border-color: rgba(20, 61, 43, 0.35); }
.pf-plate:disabled { cursor: default; }

/* Pagos: one line per payment; an app payment not refunded gets Reembolsar. */
.pf-pays { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.pf-pay { display: grid; grid-template-columns: 110px 64px minmax(0, 1fr) auto auto; align-items: center; gap: 4px 10px; padding: 8px 4px; border-top: 1px solid #f3f4f1; font-size: 13px; font-variant-numeric: tabular-nums; }
.pf-pay:first-child { border-top: 0; }
.pf-pay-when { white-space: nowrap; }
.pf-pay-amount { font-weight: 600; text-align: right; }
.pf-pay-how { color: #5f6b64; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-pay-back { color: #3f6c9a; font-size: 12px; white-space: nowrap; }
.pf-pay > .pf-actions { justify-self: end; }
.dash .pf .pf-pay .cta-line { height: 32px; min-height: 32px; padding: 0 12px; font-size: 12.5px; }
.pf-pay > .pf-confirm { grid-column: 1 / -1; }
.pf-pays-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.dash .pf .pf-pays-head .cta-line { height: 32px; min-height: 32px; padding: 0 12px; font-size: 12.5px; }

/* Historial: one line per visit; it opens to its photos, details and actions. */
.pf-visits { display: flex; flex-direction: column; margin: 0 -8px; }
.pf-visit { border-top: 1px solid #f3f4f1; }
.pf-visit:first-child { border-top: 0; }
.pf-visit-main {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  padding: 10px 30px 10px 8px;
  border-radius: 10px;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  list-style: none;
  cursor: pointer;
}
.pf-visit-main::-webkit-details-marker { display: none; }
.pf-visit-main::after { content: ""; position: absolute; right: 12px; top: 50%; width: 6px; height: 6px; margin-top: -4px; border-right: 1.6px solid #8b958f; border-bottom: 1.6px solid #8b958f; transform: rotate(-45deg); transition: transform 0.15s ease; }
.pf-visit[open] > .pf-visit-main::after { transform: rotate(45deg); }
.pf-visit-main:hover, .pf-visit[open] > .pf-visit-main { background: #f7f7f4; }
.pf-visit-what { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.pf-when { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-visit-sub { color: #7b867f; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-visit-end { display: flex; flex: none; align-items: center; gap: 10px; }
.pf-amount { min-width: 48px; font-weight: 600; text-align: right; white-space: nowrap; }
/* A visit's state is a label, not a control: colored text after a dot. */
.pf-pill { display: inline-flex; align-items: center; gap: 6px; color: #5f6b64; font-size: 12.5px; font-weight: 550; white-space: nowrap; }
.pf-pill::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.pf-visit-end .pf-pill { min-width: 104px; }
.pf-pill:is([data-state="paid"], [data-state="cash"], [data-state="inside"]) { color: #2f7a52; }
.pf-pill[data-state="owed"], .pf-pill[data-state="pending"] { color: #8a5a1c; }
.pf-pill:is([data-state="forgiven"], [data-state="refunded"]) { color: #3f6c9a; }
.pf-visit-body { display: flex; flex-direction: column; gap: 10px; padding: 8px 8px 14px; }
.pf-visit-body > .pf-photos:empty { display: none; }
.pf-visit-lines .pf-meta:first-child { margin-top: 0; }
.pf-visit-body .pf-do-main > button { flex: 0 1 auto; }
.pf-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pf-photos > p { grid-column: 1 / -1; margin: 0; }
.pf-photo { display: flex; flex-direction: column; gap: 4px; color: #5f6b64; font-size: 12px; text-decoration: none; }
.pf-photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border: 1px solid #ecede9; border-radius: 8px; background: #f3f4f1; }
.pf-photo:hover img { border-color: rgba(20, 61, 43, 0.35); }
.pf-photo-cap { display: flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.pf-photo-cap strong { color: #3d4a43; font-weight: 600; }
.pf-photo-cap .pf-photo-read { margin-left: auto; }
.pf-photo-read { color: #10201a; font-family: var(--font-mono); letter-spacing: 0.03em; }
.dash .pf .pf-rest { width: 100%; margin-top: 10px; }

/* Folded at the end. */
.pf-fold > summary { display: flex; align-items: center; font-size: 14px; font-weight: 600; list-style: none; cursor: pointer; }
.pf-fold > summary::-webkit-details-marker { display: none; }
.pf-fold > summary::after { content: ""; flex: none; width: 6px; height: 6px; margin-left: auto; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform 0.15s ease; }
.pf-fold[open] > summary { margin-bottom: 10px; }
.pf-fold[open] > summary::after { transform: rotate(45deg); }
.pf-rows { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; color: #5f6b64; font-size: 12.5px; }
.pf-log { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 10px; }
.pf-log-when, .pf-log-who { color: #8b958f; white-space: nowrap; }
.pf-log-who { font-family: var(--font-mono); }

/* Visitas: the plate opens its Ficha. */
button.visit-plate { cursor: pointer; }
button.visit-plate:hover { border-color: rgba(20, 61, 43, 0.35); background: #eef0ec; }

@media (max-width: 760px) {
  .pf-head { padding: 14px 16px 12px; }
  .pf-head h2 { font-size: 23px; }
  .pf-body { gap: 12px; padding: 12px 12px 40px; }
  .pf-note, .pf-panel > .error, .pf-link { margin-inline: 12px; }
  .pf-section, .pf-now { padding: 14px; }
  .pf-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pf-now[data-state="inside"] .pf-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pf-fact { padding: 9px 10px; }
  .pf-fact-value { font-size: 15px; }
  .pf-fact.is-money .pf-fact-value { font-size: 18px; }
  .pf-shots { gap: 8px; }
  .pf-shot-cap { flex-wrap: wrap; gap: 2px 6px; padding: 16px 8px 6px; font-size: 12px; }
  .dash .pf .cta-line,
  .dash .pf .cta { height: 48px; min-height: 48px; font-size: 15px; }
  .pf-now .pf-do-main > button, .pf-confirm-go > button { flex: 1 1 100%; }
  .dash .pf .pf-quiet { padding: 8px 0; font-size: 14px; }
  .pf-kv { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .pf-visits { margin: 0 -6px; }
  .pf-visit-main { padding: 10px 26px 10px 6px; }
  .pf-visit-end { flex-direction: column; align-items: flex-end; gap: 3px; }
  .pf-visit-end .pf-pill { min-width: 0; }
  .pf-visit-body .pf-do-main > button { flex: 1 1 100%; }
  .pf-photos { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .pf-photo-cap { flex-wrap: wrap; gap: 0 4px; font-size: 11.5px; }
  .pf-photo-cap .pf-photo-read { margin-left: 0; }
  .pf-pay { grid-template-columns: minmax(0, 1fr) auto; }
  .pf-pay-how, .pf-pay-back { grid-column: 1; }
  .pf-pay > .pf-actions { grid-column: 2; grid-row: 1 / span 2; }
  .pf-log { grid-template-columns: minmax(0, 1fr) auto; }
  .pf-log-when { grid-column: 1 / -1; }
}
