/* hpescrm project styles. Base design system = ui.css (ported from hpua, keep it as-is).
   Only project-specific additions live here — check both files for an existing class first. */

/* ---- Topbar ---- */
.app-title { font-size: 22px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.app-topbar-right { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.app-lang { display: inline-flex; background: var(--bg-page); border-radius: var(--r-pill); padding: 3px; }
.app-lang-btn { border: 0; background: transparent; font: inherit; font-size: 12px; font-weight: 700;
  color: var(--muted); padding: 4px 10px; border-radius: var(--r-pill); }
.app-lang-btn.is-on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.app-logout { margin: 0; }
.app-link-btn { border: 0; background: none; font: inherit; font-size: 13px; color: var(--muted); padding: 4px; }
.app-link-btn:hover { color: var(--text); }

/* ---- Cards / text ---- */
.app-card { max-width: 720px; }
.app-muted { color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.app-hint { color: var(--faint); font-size: 12px; margin: 6px 0 0; }
.app-btn-block { width: 100%; justify-content: center; margin-top: 18px; }
.app-login-logo { padding: 0 0 8px; }
.app-error-code { font-size: 44px; font-weight: 800; letter-spacing: -.03em; }
.app-alert { margin-top: 10px; border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.app-alert--error { background: var(--danger-bg); border: 1px solid var(--danger-bd); color: var(--danger); }

/* ---- Confirm modal (replaces native confirm/alert) ---- */
.app-modal { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 2000;
  display: flex; align-items: center; justify-content: center; padding: 20px; }
.app-modal[hidden] { display: none; }
.app-modal-card { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-modal);
  max-width: 400px; width: 100%; padding: 22px; }
.app-modal-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.app-modal-msg { font-size: 13.5px; color: var(--text-3); margin-bottom: 18px; line-height: 1.45; }
.app-modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---- Mobile: bottom tab bar instead of the sidebar (ui.css hides the sidebar ≤860px) ---- */
.app-tabbar { display: none; }
@media (max-width: 860px) {
  #hpToast { bottom: calc(76px + env(safe-area-inset-bottom)) !important; }   /* above the tab bar (ui.js sets 24px inline) */
  .hp-topbar { height: 56px; padding: 0 16px; gap: 10px; }
  .app-title { font-size: 18px; }
  .hp-content { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .app-tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .app-tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 4px; border-radius: var(--r-btn); color: var(--muted); font-size: 11px; font-weight: 600; }
  .app-tabbar a.active { color: var(--text); background: var(--bg-page); }
  .app-tabbar svg { width: 22px; height: 22px; }
}

/* ======================= Leads / calls ======================= */
.ov { z-index: 1000; }                 /* above the mobile tab bar (900) and call bar (850) */
.ov[hidden] { display: none; }
.modal { max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal-b { overflow-y: auto; }
.app-h2 { font-size: 15px; font-weight: 700; margin: 0 0 12px; }
.app-empty { text-align: center; color: var(--muted); padding: 32px 16px; }
.app-tag { display: inline-flex; align-items: center; border-radius: 6px; padding: 1px 6px; font-size: 11px;
  font-weight: 700; background: var(--bg-page); color: var(--text-3); border: 1px solid var(--border); white-space: nowrap; }
.app-tag--pbb { background: #fdf2f8; color: #be185d; border-color: #fbcfe8; }
.app-tag--hp { background: var(--bg-page); }
.app-tag--caliente { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-bd); }
.app-tag--tibio { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-bd); }
.app-tag--frio { background: var(--info-bg); color: var(--info); border-color: var(--info-bd); }
.app-tag--paid { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-bg2); }

/* inbox: filters + bulk bar */
.app-filters, .app-bulk { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.app-filters .field, .app-bulk .field { margin-top: 0; height: 38px; }
.app-filters-q { flex: 1 1 240px; max-width: 420px; }
.app-filters-brand, .app-bulk-user { width: auto; min-width: 180px; }
.app-check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text-3); }

/* inbox rows: a table on desktop, stacked cards on phones */
.app-rows { display: flex; flex-direction: column; }
.app-row { display: grid; grid-template-columns: 80px minmax(180px, 2fr) minmax(100px, 1fr) minmax(100px, 1.2fr) 80px minmax(130px, 1fr);
  gap: 12px; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--divider); font-size: 13.5px; }
.app-row--sel { grid-template-columns: 24px 80px minmax(180px, 2fr) minmax(100px, 1fr) minmax(100px, 1.2fr) 80px minmax(130px, 1fr); }
.app-row:last-child { border-bottom: 0; }
.app-row:not(.app-row--head):hover { background: var(--bg-content); }
.app-row--head { font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; }
.app-row-main { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; min-width: 0; }
.app-row-main strong { font-weight: 600; }
.app-row-sub { display: block; width: 100%; font-size: 12px; color: var(--muted); }
.app-row-services { color: var(--text-3); }
.app-row-when { font-size: 12.5px; }

/* lead card */
.app-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.app-col-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.app-col-side { position: sticky; top: 16px; }
.app-head-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.app-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.app-kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px 18px; margin-top: 14px; }
.app-kv > div > span { display: block; font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
.app-kv b { font-weight: 600; }
.app-kv a { text-decoration: underline; text-underline-offset: 2px; }
.app-kv-wide { grid-column: 1 / -1; }
.app-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.app-quote { margin-top: 12px; background: var(--bg-content); border: 1px solid var(--divider); border-radius: 10px;
  padding: 10px 12px; font-size: 13.5px; line-height: 1.5; }
.app-pre { white-space: pre-wrap; word-break: break-word; }
.app-quote-h { display: block; font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.app-docs { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.app-docs .app-quote-h { width: 100%; }
.app-ta { height: auto; padding: 10px 12px; line-height: 1.45; resize: vertical; font: inherit; font-size: 14px; }
form[data-texts] .btn { margin-top: 10px; }
.app-next { margin: 0 0 10px; font-weight: 600; color: var(--warn); }
.app-calls { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.app-call { border: 1px solid var(--divider); border-radius: 10px; padding: 10px 12px; background: var(--bg-content); }
.app-call-h { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.app-call-q { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.app-call-note { margin-top: 6px; font-size: 13.5px; }
.app-siblings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.app-siblings li { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 13.5px; }
.app-script summary { cursor: pointer; list-style: none; margin: 0; }
.app-script summary::-webkit-details-marker { display: none; }
.app-script[open] summary { margin-bottom: 8px; }
.app-script-body { font-size: 13.5px; line-height: 1.5; }
.app-script-body h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); margin: 14px 0 4px; }
.app-script-body p, .app-script-body ul, .app-script-body ol { margin: 0 0 6px; }
.app-script-body ul, .app-script-body ol { padding-left: 18px; }
.app-banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--warn-bg); border: 1px solid var(--warn-bd); color: var(--warn); border-radius: var(--r-card);
  padding: 12px 14px; margin-bottom: 14px; font-weight: 600; }
.app-callbar { display: none; }

/* call result form: big tap targets */
.app-choice { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.app-choice--grid { display: grid; grid-template-columns: 1fr 1fr; }
.app-choice label { position: relative; cursor: pointer; }
.app-choice input { position: absolute; opacity: 0; pointer-events: none; }
.app-choice span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 42px;
  padding: 8px 14px; border: 1px solid var(--border-strong); border-radius: var(--r-btn); font-size: 13.5px; font-weight: 600;
  background: var(--surface); color: var(--text-2); }
.app-choice input:checked + span { background: var(--dark); color: var(--on-dark); border-color: var(--dark); }
.app-choice input:focus-visible + span { outline: 2px solid var(--info); outline-offset: 2px; }
.app-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.app-result { width: 520px; }

/* my calls */
.app-today { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; }
.app-section-h { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin: 18px 0 8px; }
.app-qlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.app-qitem { display: flex; flex-direction: column; gap: 6px; }
.app-qitem:hover { border-color: var(--border-strong); }
.app-qitem--now { border-left: 3px solid var(--warn-2); }
.app-qitem-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.app-qitem-sub { font-size: 13px; color: var(--text-3); }
.app-qitem-foot { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.app-due { font-size: 12.5px; font-weight: 600; color: var(--text-3); }
.app-due--now { color: var(--warn); }

@media (max-width: 1100px) {
  .app-grid { grid-template-columns: 1fr; }
  .app-col-side { position: static; }
}
@media (max-width: 1100px) {
  /* inbox rows become cards with named areas (no horizontal overflow on laptops/tablets/phones) */
  .app-row--head { display: none; }
  .app-row { grid-template-columns: 1fr auto; grid-template-areas: "main amount" "event stage" "services when";
    gap: 4px 12px; align-items: start; padding: 12px 14px; }
  .app-row--sel { grid-template-columns: 24px 1fr auto; grid-template-areas: "check main amount" "check event stage" "check services when"; }
  .app-row-check { grid-area: check; }
  .app-row-main { grid-area: main; }
  .app-row-amount { grid-area: amount; font-weight: 700; }
  .app-row-event { grid-area: event; font-size: 13px; }
  .app-row-event .app-row-sub { display: inline; width: auto; margin-left: 6px; }
  .app-row-stage { grid-area: stage; justify-self: end; text-align: right; }
  .app-row-services { grid-area: services; font-size: 12.5px; }
  .app-row-when { grid-area: when; justify-self: end; }
}
@media (max-width: 860px) {
  .app-head-top .app-call-btn { display: none; }
  .app-callbar { display: block; position: fixed; left: 0; right: 0; bottom: calc(62px + env(safe-area-inset-bottom)); z-index: 850;
    padding: 8px 16px; background: linear-gradient(to top, var(--bg-content) 70%, transparent); }
  .app-callbar .btn { width: 100%; justify-content: center; height: 48px; font-size: 15px; }
  .app-lead { padding-bottom: 64px; }
  .modal { width: 100%; max-width: 100%; border-radius: 18px 18px 0 0; align-self: end; max-height: 92vh; }
  .ov { place-items: end center; }
  .app-kv { grid-template-columns: 1fr 1fr; }
}

/* ======================= Compensation (panel / team) ======================= */
.app-month { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.app-month strong { font-size: 16px; min-width: 150px; text-align: center; text-transform: capitalize; }
.app-month .btn { width: 38px; justify-content: center; padding: 0; }
.app-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 10px; }
.app-kpi, .app-money > div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.app-kpi span, .app-money span { display: block; font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; }
.app-kpi b, .app-money b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; }
.app-kpi small, .app-money small { color: var(--muted); font-size: 12px; }
.app-money { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.app-money-balance { background: var(--dark) !important; border-color: var(--dark) !important; }
.app-money-balance span { color: #a3a3a3; }
.app-money-balance b { color: var(--on-dark); }
.app-rate-line { margin: 0 0 14px; }
.app-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.app-block { margin-bottom: 16px; }
.app-person-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.app-person-head .app-actions { margin-top: 0; }
.app-h3 { font-size: 13px; font-weight: 700; margin: 6px 0 8px; color: var(--text-3); }
.app-ledger { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; }
.app-ledger-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 9px 0;
  border-bottom: 1px solid var(--divider); font-size: 13.5px; }
.app-ledger-row:last-child { border-bottom: 0; }
.app-ledger-amt { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.app-ledger--rechazado, .app-ledger--anulado { opacity: .55; }
.app-ledger--anulado b { text-decoration: line-through; }
.app-status { font-size: 11px; font-weight: 700; border-radius: var(--r-pill); padding: 2px 8px; background: var(--bg-page); color: var(--text-3); }
.app-status--pendiente { background: var(--warn-bg); color: var(--warn); }
.app-status--aprobado { background: var(--ok-bg); color: var(--ok); }
.app-amt { width: 90px; height: 34px; margin-top: 0; text-align: right; }
.app-check span { color: var(--text); }
@media (max-width: 860px) {
  .app-two { grid-template-columns: 1fr; }
  .app-kpis { grid-template-columns: repeat(2, 1fr); }
  .app-money { grid-template-columns: repeat(2, 1fr); }
  .app-kpi b, .app-money b { font-size: 18px; }
}

/* ======================= Profile / users ======================= */
.app-narrow { max-width: 640px; }
.app-me { display: none; width: 30px; height: 30px; border-radius: 50%; background: var(--dark); color: #fff;
  font-size: 11px; font-weight: 700; align-items: center; justify-content: center; }
.app-copy { display: flex; gap: 8px; }
.app-copy .field { margin-top: 0; }
.app-users .app-ledger-row { padding: 12px 16px; }
a.hp-user:hover { background: var(--bg-page); }
@media (max-width: 860px) { .app-me { display: inline-flex; } }
