/* ==========================================================================
   Locksmith CRM — demo
   Estilo de producto (app), no de web de marketing: el cliente tiene que ver
   una herramienta, no una landing.
   ========================================================================== */

:root {
  --brand: #1f6feb;
  --brand-dark: #1858c4;
  --ink: #0f1720;
  --ink-soft: #35404e;
  --slate: #6b7684;
  --line: #e2e6ec;
  --bg: #f4f6f9;
  --card: #ffffff;
  --ok: #12855a;
  --ok-bg: #e6f6ef;
  --err: #c0392b;
  --err-bg: #fdecea;
  --urgent: #d94f2b;

  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 32, .06);
  --shadow: 0 4px 16px rgba(15, 23, 32, .08);
  --shadow-lg: 0 12px 40px rgba(15, 23, 32, .12);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  /* Nada debe desplazar la página en horizontal en el móvil. Es el cinturón;
     los tirantes son los min-width:0 de más abajo, que atacan la causa. */
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0 0 1rem; }

/* ── Chrome de la app ────────────────────────────────────────────────────── */
.app-bar {
  background: var(--ink);
  color: #fff;
  padding: .85rem 0;
  box-shadow: var(--shadow-sm);
}
/* flex-wrap:nowrap + min-width:0 es lo que impide que esta barra ensanche la
   página. Por defecto un item flex no encoge por debajo de su min-content, así
   que "Locksmith CRM" + los dos enlaces sumaban más que un móvil estrecho y
   desbordaban el body (que es lo que dejaba scroll lateral). */
.app-bar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: nowrap;
  min-width: 0;
}
.logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 700;
  font-size: 1.02rem;
  /* Si no cabe, que se recorte la marca antes que romper el layout. */
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.logo .mark {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  flex: none;
}
/* flex:none — la navegación no se comprime; lo que cede es la marca. */
.app-bar nav { display: flex; gap: .4rem; flex: none; }
.app-bar nav a {
  color: rgba(255,255,255,.72);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 600;
  padding: .4rem .8rem;
  border-radius: 7px;
  white-space: nowrap;          /* nunca partir "Log a job" en dos líneas */
}
.app-bar nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.app-bar nav a.active { background: var(--brand); color: #fff; }

/* En móvil se aprieta todo. Con 4 items en el nav, ocultamos el TEXTO del logo
   (se queda el icono) para que quepan Log a job · Jobs · Dashboard · Log out
   sin desbordar. font-size:0 esconde el texto; el icono tiene tamaño propio. */
@media (max-width: 560px) {
  .app-bar .wrap { gap: .5rem; }
  .logo { font-size: 0; gap: 0; flex: none; }
  .logo .mark { width: 30px; height: 30px; }
  .app-bar nav { gap: .2rem; }
  .app-bar nav a { padding: .4rem .5rem; font-size: .82rem; }
  .nav-logout { padding: .4rem .5rem; font-size: .82rem; }
}

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 20px; }

/* ── Cabecera de página ──────────────────────────────────────────────────── */
.page-head { padding: 2.4rem 0 1.4rem; }
.page-head h1 { font-size: 1.6rem; }
.page-head p { color: var(--slate); margin: 0; font-size: .96rem; }

/* ── Tarjeta / formulario ────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.8rem;
  margin-bottom: 2.5rem;
}

fieldset { border: 0; margin: 0 0 1.6rem; padding: 0; }
fieldset:last-of-type { margin-bottom: 1rem; }
legend {
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--slate);
  padding: 0 0 .8rem;
  width: 100%;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.1rem;
}

/* minmax(0, 1fr) en vez de 1fr: por defecto una pista de grid no baja de su
   min-content, y el <select> de servicios mide lo que su opción más larga
   ("Car key replacement / programming"). Eso empujaba la página a lo ancho. */
.row { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 621px) {
  .row.cols-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

.field { margin-bottom: 1rem; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: .35rem;
}
.field .opt { color: var(--slate); font-weight: 400; }
.field select { text-overflow: ellipsis; }

.field input, .field select, .field textarea {
  width: 100%;
  /* Sin esto, input y select imponen su ancho intrínseco (el select, el de su
     opción más larga) y desbordan el contenedor en pantallas estrechas. */
  min-width: 0;
  max-width: 100%;
  min-height: 46px;
  padding: .6rem .8rem;
  border: 1px solid #ccd3dd;
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { min-height: 92px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, .16);
}
.field.invalid input, .field.invalid select { border-color: var(--err); background: #fff8f7; }
.field .err { display: none; font-size: .8rem; color: var(--err); margin-top: .3rem; }
.field.invalid .err { display: block; }
.field .hint { font-size: .8rem; color: var(--slate); margin-top: .3rem; }

/* Selector de urgencia — botones de radio con pinta de segmented control */
/* position:relative es CLAVE: los radios van con position:absolute+opacity:0;
   sin un ancestro posicionado "flotan" arriba del contenedor y, al enfocarlos
   (dentro de un modal con scroll), el navegador salta al inicio. Anclándolos
   aquí se quedan en su sitio y no hay salto. */
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 46px;
  margin: 0;
  padding: .5rem .4rem;
  border: 1px solid #ccd3dd;
  border-radius: var(--radius);
  background: #fff;
  font-size: .88rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-align: center;
  cursor: pointer;
  transition: all .15s ease;
}
.seg label:hover { border-color: var(--brand); }
.seg input:checked + label { background: var(--brand); border-color: var(--brand); color: #fff; }
.seg input:checked + label.is-urgent { background: var(--urgent); border-color: var(--urgent); }
.seg input:focus-visible + label { box-shadow: 0 0 0 3px rgba(31, 111, 235, .3); }

/* Importe cobrado — el $ va dentro del campo, no en el label, para que se lea
   como una cifra de dinero y no como un texto cualquiera. */
.money-input { position: relative; }
.money-sign {
  position: absolute;
  left: .85rem; top: 50%;
  transform: translateY(-50%);
  color: var(--slate);
  font-size: 1.05rem;
  font-weight: 600;
  pointer-events: none;
}
.money-input input {
  padding-left: 1.9rem;
  font-size: 1.1rem;
  font-weight: 700;
}

/* Sugerencias de dirección (Google Places) */
.addr-suggest {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 40;
  margin: 4px 0 0;
  padding: 4px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-height: 260px;
  overflow-y: auto;
}
.addr-suggest[hidden] { display: none; }
.addr-item {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  padding: .6rem .6rem;
  border-radius: 7px;
  font-size: .92rem;
  color: var(--ink);
  cursor: pointer;
}
.addr-item svg { flex: none; margin-top: .15rem; color: var(--slate); }
.addr-item.active, .addr-item:hover { background: var(--bg); }
.addr-item.active svg, .addr-item:hover svg { color: var(--brand); }

/* Listado del equipo (Team) */
.team-tip { color: var(--slate); font-size: .85rem; margin: -.4rem 0 1rem; }
.team-rows { display: grid; gap: .6rem; }
.team-item {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  width: 100%; text-align: left; font-family: inherit;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: .8rem 1rem; box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.team-item:hover { border-color: var(--brand); }
.team-who { display: flex; flex-direction: column; min-width: 0; }
.team-who strong { font-size: .96rem; }
.team-who small { color: var(--slate); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#role-hint { display: block; }

/* Panel de usuario */
.user-info { margin: 0; }
.user-info > div { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.user-info dt { color: var(--slate); font-size: .86rem; }
.user-info dd { margin: 0; font-weight: 600; font-size: .92rem; text-align: right; word-break: break-word; }
.um-msg { min-height: 1.1em; margin: .7rem 0 0; font-size: .86rem; }
.um-msg.ok { color: var(--ok); }
.um-msg.err { color: var(--err); }
.um-sep { border: 0; border-top: 1px solid var(--line); margin: 1.6rem 0 1.2rem; }
.um-danger-label { font-size: .86rem; color: var(--slate); margin: 0 0 .7rem; }

.btn-danger { background: var(--err); color: #fff; }
.btn-danger:hover { background: #a3271b; }
.btn-danger.armed { background: #a3271b; }

/* Sugerencias de cliente existente (por teléfono) */
.cust-suggest {
  margin: -.3rem 0 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-alt, #f6f7f9);
  padding: .7rem;
}
.cust-suggest[hidden], .cust-using[hidden] { display: none; }
.cust-suggest-head { margin: 0 0 .5rem; font-size: .82rem; font-weight: 700; color: var(--ink-soft); }
.cust-suggest-foot { margin: .5rem 0 0; font-size: .78rem; color: var(--slate); }
.cust-row {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  width: 100%; text-align: left;
  padding: .6rem .7rem; margin-bottom: .35rem;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; cursor: pointer;
  font-family: inherit;
}
.cust-row:last-of-type { margin-bottom: 0; }
.cust-row:hover { border-color: var(--brand); }
.cust-info { display: flex; flex-direction: column; min-width: 0; }
.cust-info strong { font-size: .92rem; }
.cust-info small { color: var(--slate); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cust-use { flex: none; font-size: .82rem; font-weight: 700; color: var(--brand); }

.cust-using { margin: -.3rem 0 1rem; }
.cust-chip {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .4rem .5rem .4rem .7rem;
  background: var(--ok-bg); color: var(--ok);
  border: 1px solid #b9e5d1; border-radius: 999px;
  font-size: .85rem; font-weight: 600;
}
.cust-chip button {
  display: grid; place-items: center;
  width: 22px; height: 22px; margin-left: .1rem;
  border: 0; border-radius: 50%;
  background: rgba(0,0,0,.06); color: inherit;
  font-size: 1rem; line-height: 1; cursor: pointer;
}
.cust-chip button:hover { background: rgba(0,0,0,.12); }

/* Botón de escanear el carnet */
.scan-btn { margin-bottom: 1.2rem; }
.scan-btn svg { color: var(--brand); }

/* Modal de la cámara (pantalla completa) */
.scan-modal {
  position: fixed; inset: 0; z-index: 300;
  background: #000;
  display: flex; flex-direction: column;
}
.scan-modal[hidden] { display: none; }
.scan-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-overlay {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  pointer-events: none;
}
.scan-frame {
  width: min(86vw, 460px);
  aspect-ratio: 5 / 3;
  border: 3px solid rgba(255, 255, 255, .9);
  border-radius: 14px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45);
}
.scan-top {
  position: relative; z-index: 1;
  padding: calc(env(safe-area-inset-top, 0) + 1.2rem) 1.2rem 0;
  text-align: center;
}
.scan-hint {
  display: inline-block;
  margin: 0;
  padding: .6rem 1rem;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  border-radius: 10px;
  font-size: .92rem;
}
.scan-bottom {
  position: relative; z-index: 1;
  margin-top: auto;
  padding: 1.2rem 1.2rem calc(env(safe-area-inset-bottom, 0) + 1.4rem);
  text-align: center;
}
.scan-status { color: #fff; font-size: .9rem; margin: 0 0 .9rem; min-height: 1.2em; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.scan-bottom .btn { background: #fff; }

/* Honeypot */
/* Honeypot. Nada de left:-9999px: en algunos navegadores móviles eso mismo
   provoca el desplazamiento lateral que estamos intentando quitar. */
.hp {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

/* ── Botones ─────────────────────────────────────────────────────────────── */
.actions { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 46px;
  padding: .65rem 1.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: .96rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s ease, transform .1s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:disabled { background: #9db8e6; cursor: not-allowed; }
.btn-quiet { background: #fff; border-color: #ccd3dd; color: var(--ink-soft); }
.btn-quiet:hover { background: #f7f9fb; }

:focus-visible { outline: 3px solid rgba(31, 111, 235, .5); outline-offset: 2px; }

/* ── Mensajes ────────────────────────────────────────────────────────────── */
.msg {
  display: none;
  align-items: flex-start;
  gap: .7rem;
  margin-top: 1.2rem;
  padding: .9rem 1.1rem;
  border-radius: var(--radius);
  font-size: .93rem;
}
.msg.show { display: flex; }
.msg svg { flex: none; margin-top: .15rem; }
.msg-err { background: var(--err-bg); color: var(--err); border: 1px solid #f3c2bd; }
.msg strong { display: block; }

/* ── Login del formulario ─────────────────────────────────────────────────── */
.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}
.gate[hidden] { display: none; }
.gate-card {
  width: 100%;
  max-width: 340px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 2rem 1.6rem;
  text-align: center;
}
.gate-logo {
  display: grid; place-items: center;
  width: 52px; height: 52px;
  margin: 0 auto 1rem;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
}
.gate-card h1 { font-size: 1.3rem; margin-bottom: .2rem; }
.gate-sub { color: var(--slate); font-size: .9rem; margin-bottom: 1.3rem; }
.gate-card input {
  width: 100%;
  min-height: 48px;
  padding: .7rem .9rem;
  margin-bottom: .8rem;
  border: 1px solid #ccd3dd;
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
}
.gate-card input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,111,235,.16); }
.gate-err { min-height: 1.1em; margin: .7rem 0 0; font-size: .85rem; color: var(--err); }
.gate.busy .gate-card { opacity: .6; pointer-events: none; }

/* Botón de salir, en el nav. Se apaga hasta que hay sesión. */
.nav-logout {
  border: 1px solid rgba(255,255,255,.24);
  background: transparent;
  color: rgba(255,255,255,.72);
  font-family: inherit;
  font-size: .82rem;
  font-weight: 600;
  padding: .35rem .7rem;
  border-radius: 7px;
  cursor: pointer;
}
.nav-logout:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-logout[hidden] { display: none; }

/* ── Pestaña Jobs ─────────────────────────────────────────────────────────── */
/* Solo la cabecera de Jobs es flex (título + botón Refresh). No tocar el
   .page-head global, que en el formulario lleva h1 y p directos. */
.jobs-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: space-between; }
.jobs-loading, .jobs-empty { color: var(--slate); font-size: .95rem; padding: .6rem 0; }

/* Barra de búsqueda por teléfono */
.search-bar {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 1.4rem;
}
.search-bar .search-ico {
  position: absolute;
  left: .85rem;
  color: var(--slate);
  pointer-events: none;
}
.search-bar input {
  width: 100%;
  min-height: 48px;
  padding: .7rem 2.6rem;
  border: 1px solid #ccd3dd;
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
}
.search-bar input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, .16);
}
.search-clear {
  position: absolute;
  right: .5rem;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--slate);
  cursor: pointer;
}
.search-clear:hover { background: var(--bg); color: var(--ink); }
.search-clear[hidden] { display: none; }
.jobs-empty-card { text-align: center; padding: 3rem 1.4rem; }

.jobs-group {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--slate);
  margin: 2rem 0 1rem;
}
.jobs-group:first-child { margin-top: .5rem; }
.jobs-group span {
  display: inline-block;
  margin-left: .4rem;
  padding: .05rem .5rem;
  border-radius: 999px;
  background: var(--line);
  color: var(--ink-soft);
  font-size: .8rem;
}

.jobs-list { display: grid; gap: .7rem; }
@media (min-width: 1100px) { .jobs-list { grid-template-columns: repeat(2, 1fr); } }

.job {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: 10px;
  padding: .85rem .95rem;
  background: #fff;
}
.job-urgent { border-left-color: var(--err); background: var(--err-bg); }
.job-done { border-left-color: var(--ok); opacity: .82; }
.job-top { display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem; }
.job-who { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.job-who strong { font-size: .98rem; line-height: 1.25; word-break: break-word; }
.job-tel {
  display: inline-flex; align-items: center; gap: .3rem;
  color: var(--brand); text-decoration: none;
  font-size: .86rem; font-weight: 600; padding: .15rem 0; min-height: 24px;
}
.job-tel:hover { text-decoration: underline; }
.job-body { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.job-service { font-size: .9rem; font-weight: 600; color: var(--ink-soft); word-break: break-word; }
.job-line {
  display: flex; align-items: flex-start; gap: .35rem;
  font-size: .83rem; color: var(--slate); word-break: break-word;
}
.job-line svg { flex: none; margin-top: .2rem; }
.job-sched { color: var(--brand); font-weight: 600; }
.job-meta {
  display: flex; flex-wrap: wrap; gap: .4rem; align-items: center;
  margin-top: auto; padding-top: .5rem; border-top: 1px solid var(--line);
}
.jm { font-size: .78rem; font-weight: 600; color: var(--ink-soft); background: var(--bg); padding: .12rem .5rem; border-radius: 999px; }
.job-urgent .jm { background: rgba(255,255,255,.7); }
.jm-money { color: var(--ok); }

.tag { display: inline-block; padding: .12rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.tag-blue { background: #e8f0fe; color: var(--brand); }
.tag-green { background: var(--ok-bg); color: var(--ok); }
.tag-red { background: var(--err-bg); color: var(--err); }
.tag-amber { background: #fff4d6; color: #9a6700; }
.tag-grey { background: #eceff3; color: var(--slate); }

/* ── Dashboard (KPIs y barras) ───────────────────────────────────────────── */
.card-title {
  font-size: .76rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--slate); margin-bottom: 1.1rem;
}
/* Cabecera del bloque de día con selector de fecha */
.dash-dayhead {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin: .5rem 0 1rem;
}
.dash-daypick { display: flex; align-items: center; gap: .5rem; }
.day-picker {
  min-height: 40px;
  padding: .4rem .7rem;
  border: 1px solid #ccd3dd;
  border-radius: 9px;
  font-size: .92rem;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
}
.day-picker:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,111,235,.16); }
.daybtn {
  min-height: 40px;
  padding: .4rem .9rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--brand);
  font-weight: 600;
  font-size: .88rem;
  font-family: inherit;
  cursor: pointer;
}
.daybtn:hover { background: var(--bg); }
.dash-range { flex-wrap: wrap; justify-content: flex-end; }
.dash-range .day-picker { flex: 1 1 auto; min-width: 0; }
.range-dash { color: var(--slate); }
/* En móvil el rango puede necesitar su propia línea. */
@media (max-width: 560px) {
  .dash-dayhead { flex-wrap: wrap; }
  .dash-daypick { flex: 1 1 100%; }
}

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: .9rem; margin-bottom: 1.2rem; }
@media (min-width: 760px) { .kpis-4 { grid-template-columns: repeat(4, 1fr); } }
.kpis-2 { grid-template-columns: repeat(2, 1fr); }
.card.kpi { display: flex; flex-direction: column; gap: .15rem; padding: 1.1rem; margin: 0; }
.kpi-value { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.kpis-2 .kpi-value { font-size: 2.1rem; }
.kpi-label { font-size: .78rem; color: var(--slate); font-weight: 600; }
.kpi.blue .kpi-value { color: var(--brand); }
.kpi.red .kpi-value { color: var(--err); }
.kpi.green .kpi-value { color: var(--ok); }

.split { display: grid; gap: 1.2rem; }
@media (min-width: 1100px) { .split { grid-template-columns: 1fr 1fr; } }

.bar-row { display: grid; grid-template-columns: minmax(90px, 1.1fr) 2fr auto; gap: .7rem; align-items: center; margin-bottom: .6rem; }
.bar-label { font-size: .88rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { display: block; height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.bar-money { background: var(--ok); }
.bar-value { font-size: .88rem; font-weight: 700; text-align: right; white-space: nowrap; }
.bar-value small { color: var(--slate); font-weight: 500; margin-left: .35rem; }
@media (max-width: 560px) {
  .bar-row { grid-template-columns: 1fr auto; gap: .2rem .6rem; margin-bottom: .9rem; }
  .bar-label { grid-column: 1; white-space: normal; }
  .bar-value { grid-column: 2; grid-row: 1; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; }
}

/* ── Tarjeta editable + modal ────────────────────────────────────────────── */
.job { cursor: pointer; transition: box-shadow .15s ease, transform .1s ease; }
.job:hover { box-shadow: var(--shadow); }
.job:active { transform: scale(.998); }
/* El teléfono es un enlace: al tocarlo NO se abre el editor (lo para el JS),
   pero visualmente conviene que se note que es su propia acción. */
.job-tel { position: relative; z-index: 1; }

.modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 32, .5); }
.modal-panel {
  position: relative;
  width: 100%; max-width: 540px;
  max-height: 92vh;
  display: flex; flex-direction: column;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.3rem;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.modal-head h2 { margin: 0; font-size: 1.15rem; }
.modal-close {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--slate);
  cursor: pointer;
}
.modal-close:hover { background: var(--bg); color: var(--ink); }
.modal-body { padding: 1.3rem; overflow-y: auto; flex: 1; }
.modal-body fieldset:last-of-type { margin-bottom: .5rem; }
.modal-foot {
  display: flex; gap: .7rem; justify-content: flex-end;
  padding: 1rem 1.3rem;
  border-top: 1px solid var(--line);
  flex: none;
}
.modal-foot .btn { min-width: 96px; }

/* En móvil, el modal ocupa casi toda la pantalla y va pegado abajo. */
@media (max-width: 560px) {
  .modal { padding: 0; align-items: flex-end; }
  .modal-panel { max-width: 100%; max-height: 94vh; border-radius: 16px 16px 0 0; }
}

/* ── Pantalla de "Job saved" ─────────────────────────────────────────────── */
.success-view { padding: 2.5rem 0 3rem; }
.success-view[hidden] { display: none; }

.success-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 2.4rem 1.6rem 2rem;
  text-align: center;
}

.success-check { color: var(--ok); margin-bottom: 1rem; }
.success-check svg { margin: 0 auto; display: block; }

/* El trazo se dibuja solo. Da la sensación de "hecho" sin necesidad de texto. */
.sc-ring { stroke-dasharray: 145; stroke-dashoffset: 145; animation: sc-draw .45s ease-out forwards; }
.sc-tick { stroke-dasharray: 40; stroke-dashoffset: 40; animation: sc-draw .3s .35s ease-out forwards; }
@keyframes sc-draw { to { stroke-dashoffset: 0; } }

.success-card h1 { font-size: 1.6rem; margin-bottom: .2rem; }
.success-sub { color: var(--slate); font-size: .96rem; margin-bottom: 1.6rem; }

/* El importe es el protagonista: es el dato por el que existe el registro. */
.success-amount {
  background: var(--ok-bg);
  border: 1px solid #b9e5d1;
  border-radius: var(--radius);
  padding: 1.1rem;
  margin-bottom: 1.4rem;
}
.success-amount span {
  display: block;
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.1;
  color: var(--ok);
}
.success-amount small {
  display: block;
  margin-top: .2rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ok);
  opacity: .8;
}

.success-summary { margin: 0 0 1.6rem; text-align: left; }
.success-summary > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .65rem 0;
  border-bottom: 1px solid var(--line);
}
.success-summary > div:last-child { border-bottom: 0; }
.success-summary dt { color: var(--slate); font-size: .86rem; flex: none; }
.success-summary dd {
  margin: 0;
  font-weight: 600;
  font-size: .92rem;
  text-align: right;
  min-width: 0;
  word-break: break-word;
}

.success-actions { display: grid; gap: .6rem; }

footer.foot {
  border-top: 1px solid var(--line);
  padding: 1.6rem 0 2.4rem;
  color: var(--slate);
  font-size: .84rem;
  text-align: center;
}
