:root {
  --ink: #17211f;
  --muted: #66736f;
  --line: #ded8ca;
  --soft-line: #ece7dc;
  --bg: #f6f3ec;
  --surface: #fffdf8;
  --surface-2: #f9fbf7;
  --nav: #071514;
  --gold: #c4a86a;
  --sage: #84a98c;
  --mint: #66cbbf;
  --blue: #87bdd8;
  --rose: #e88cae;
  --amber: #f0b35d;
  --coral: #d66b5f;
  --danger: #b94b4b;
  --ok: #2f7d61;
  --shadow: 0 18px 48px rgba(23, 33, 31, 0.12);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Modo oscuro: preferencia de dispositivo, ver applyTheme() en app.js. */
body.dark-theme {
  --ink: #eef2ef;
  --muted: #9aa7a2;
  --line: #3a4642;
  --soft-line: #2c3733;
  --bg: #121917;
  --surface: #1a2320;
  --surface-2: #212b27;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

body.dark-theme input,
body.dark-theme select,
body.dark-theme textarea {
  background: #1e2823;
  color: var(--ink);
  border-color: var(--line);
}

body.dark-theme .data-table th {
  background: var(--surface-2);
}

body.dark-theme .metric-card,
body.dark-theme .panel,
body.dark-theme .table-wrap,
body.dark-theme .pipeline-column,
body.dark-theme .quote-preview,
body.dark-theme .list-row,
body.dark-theme .summary-item,
body.dark-theme .modal-card {
  background: var(--surface);
  border-color: var(--soft-line);
}

body.dark-theme .topbar {
  background: rgba(18, 25, 23, 0.92);
}

body.dark-theme .week-appt {
  background: #23342e;
  color: #8fd6c4;
}

/* Botones y tarjetas que en modo claro usan un blanco fijo (#fff): sin este
   bloque, el texto (que si cambia de color con el tema) queda ilegible
   sobre ese fondo blanco que nunca cambiaba. */
body.dark-theme .secondary-button,
body.dark-theme .tiny-button,
body.dark-theme .status-button,
body.dark-theme .icon-button,
body.dark-theme .chip,
body.dark-theme .brand-preview,
body.dark-theme .client-card,
body.dark-theme .quote-meta div,
body.dark-theme .photo-card,
body.dark-theme .photo-thumb,
body.dark-theme .compare-item,
body.dark-theme .flag,
body.dark-theme .privacy-note,
body.dark-theme .appointment-actions a,
body.dark-theme .appointment-actions button {
  background: var(--surface-2);
}

body.dark-theme .appointment-actions a:hover,
body.dark-theme .appointment-actions button:hover {
  background: var(--soft-line);
}

.global-search {
  min-width: 200px;
}

.trend-chart-wrap {
  width: 100%;
}

.trend-chart {
  width: 100%;
  height: 180px;
  display: block;
}

.trend-chart-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.74rem;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  letter-spacing: 0;
}

body.session-locked .app-shell {
  display: none;
}

body:not(.session-locked) .login-screen {
  display: none;
}

/* La pantalla de activacion manda sobre login y app: si la licencia no es
   valida, no importa si hay sesion o no, se muestra solo esa pantalla. */
#activation-screen {
  display: none;
}

body.license-locked #activation-screen {
  display: grid;
}

body.license-locked .app-shell,
body.license-locked #login-screen {
  display: none;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(132, 169, 140, 0.18), transparent 34%),
    linear-gradient(225deg, rgba(196, 168, 106, 0.22), transparent 40%),
    var(--bg);
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card img {
  width: 82px;
  height: 82px;
  object-fit: contain;
  border-radius: 14px;
  background: transparent;
}

.login-card h1 {
  margin: 2px 0 0;
  font-size: 1.45rem;
}

.login-error {
  min-height: 22px;
  margin: 0;
  color: var(--danger);
  font-size: 0.9rem;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

img,
svg {
  display: block;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  color: #f8f6ef;
  background: var(--nav);
  overflow-y: auto;
}

.brand,
.booking-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  min-height: 64px;
  padding: 6px 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand img,
.booking-brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 10px;
  /* El emblema ya trae su propio fondo; un color aqui deja halo en las esquinas. */
  background: transparent;
}

.brand strong,
.booking-brand strong {
  display: block;
  font-size: 1.08rem;
}

.brand span,
.booking-brand span {
  display: block;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.84rem;
}

.nav-list {
  display: grid;
  gap: 6px;
  margin-top: 18px;
}

.nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  color: rgba(255, 255, 255, 0.76);
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  text-align: left;
}

.nav-item svg,
.icon-button svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.nav-item.active {
  color: #071514;
  background: #f5faee;
  border-color: rgba(196, 168, 106, 0.5);
}

.nav-badge {
  position: absolute;
  top: 5px;
  right: 7px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  color: #fff;
  background: var(--danger);
  border: 2px solid var(--nav);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
}

.nav-item.active .nav-badge {
  border-color: #f5faee;
}

.nav-item:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  min-height: 82px;
  padding: 16px 24px;
  background: rgba(255, 253, 248, 0.92);
  border-bottom: 1px solid var(--soft-line);
  backdrop-filter: blur(16px);
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: 1.42rem;
  line-height: 1.2;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.view {
  min-width: 0;
  padding: 22px 24px 40px;
}

.view-grid {
  display: grid;
  gap: 16px;
}

/* Evita que un bloque ancho (pipeline CRM, tablas) empuje la pagina completa. */
.view-grid > *,
.two-col > *,
.quote-layout > * {
  min-width: 0;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(420px, 1.5fr);
  gap: 16px;
  align-items: start;
}

.three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.panel,
.metric-card,
.table-wrap,
.pipeline-column,
.quote-preview {
  background: var(--surface);
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(23, 33, 31, 0.06);
}

.panel {
  padding: 16px;
}

.panel-header,
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.panel h2,
.panel h3,
.table-wrap h2,
.quote-preview h2 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.panel p,
.empty {
  color: var(--muted);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  min-height: 112px;
  padding: 16px;
  display: grid;
  align-content: space-between;
}

.metric-card small {
  color: var(--muted);
}

.metric-card strong {
  font-size: 1.7rem;
  line-height: 1.1;
}

.metric-card span {
  color: var(--muted);
  font-size: 0.86rem;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--muted);
  font-size: 0.78rem;
}

.field.compact {
  min-width: 174px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(102, 203, 191, 0.35);
  border-color: var(--mint);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid .wide,
.wide {
  grid-column: 1 / -1;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.tiny-button,
.status-button,
.icon-button {
  border-radius: 8px;
  border: 1px solid transparent;
  min-height: 40px;
  padding: 9px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary-button {
  color: #071514;
  background: var(--gold);
  border-color: #b69856;
  font-weight: 700;
}

.secondary-button {
  color: var(--ink);
  background: #f5faee;
  border-color: var(--line);
}

.ghost-button {
  color: var(--ink);
  background: transparent;
  border-color: var(--line);
}

.danger-button {
  color: #fff;
  background: var(--danger);
}

.tiny-button,
.status-button {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 0.82rem;
  background: #fff;
  border-color: var(--line);
}

.icon-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.button-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.brand-preview {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
}

.brand-preview img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  background: #f5faee;
}

.brand-preview strong,
.brand-preview span {
  display: block;
}

.brand-preview span {
  color: var(--muted);
}

.check-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  color: var(--ink);
}

.check-row input {
  min-height: 18px;
  margin-top: 2px;
}

.table-wrap {
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.data-table th,
.data-table td {
  padding: 11px 12px;
  text-align: left;
  border-bottom: 1px solid var(--soft-line);
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  background: var(--surface-2);
  font-size: 0.78rem;
  font-weight: 700;
}

.table-scroll {
  overflow-x: auto;
}

.pill,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef8f5;
  color: #24675d;
  font-size: 0.78rem;
  white-space: nowrap;
}

.perm-tag {
  gap: 5px;
}

.perm-edit {
  width: 13px;
  min-height: 13px;
  height: 13px;
  margin-left: 2px;
  accent-color: var(--gold);
}

.pill.warn {
  background: #fff3d9;
  color: #8a5a00;
}

.pill.bad {
  background: #fde7e4;
  color: #9a3f36;
}

.pill.ok {
  background: #e7f6ec;
  color: #226b44;
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: var(--soft-line);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--sage);
}

.progress-fill.ok {
  background: var(--ok);
}

.progress-fill.warn {
  background: var(--amber);
}

.stack-list {
  display: grid;
  gap: 10px;
}

.list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
}

.list-row strong,
.client-card strong,
.appointment-card strong {
  display: block;
}

.list-row span,
.client-card span,
.appointment-card span {
  color: var(--muted);
  font-size: 0.86rem;
}

.schedule-scroll {
  overflow: auto;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: var(--surface);
}

.schedule-board {
  --hour-height: 116px;
  --work-hours: 12;
  display: grid;
  grid-template-columns: 68px repeat(var(--cols), minmax(210px, 1fr));
  min-width: 860px;
}

.time-rail {
  display: grid;
  grid-template-rows: 72px repeat(var(--work-hours), var(--hour-height));
  border-right: 1px solid var(--soft-line);
  background: #fbfaf5;
}

.time-cell {
  display: flex;
  align-items: start;
  justify-content: flex-end;
  padding: 8px 10px 0 0;
  color: var(--muted);
  border-top: 1px solid var(--soft-line);
  font-size: 0.82rem;
}

.employee-lane {
  border-right: 1px solid var(--soft-line);
  min-width: 0;
  overflow: visible;
}

.lane-head {
  height: 72px;
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 8px;
  text-align: center;
  background: #fff;
  border-bottom: 1px solid var(--soft-line);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #071514;
  font-weight: 800;
  border: 3px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 2px var(--lane-color, var(--mint));
}

.lane-head small {
  color: var(--muted);
}

.lane-body {
  position: relative;
  min-height: calc(var(--hour-height) * var(--work-hours));
  overflow: visible;
  background:
    repeating-linear-gradient(
      to bottom,
      #fff 0,
      #fff calc(var(--hour-height) - 1px),
      var(--soft-line) calc(var(--hour-height) - 1px),
      var(--soft-line) var(--hour-height)
    );
}

.appointment-card {
  position: absolute;
  left: 6px;
  right: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 9px 9px;
  border-radius: 8px;
  background: var(--lane-color, var(--mint));
  border: 1px solid rgba(23, 33, 31, 0.08);
  box-shadow: 0 8px 20px rgba(23, 33, 31, 0.1);
  z-index: 1;
}

.appointment-card.movible {
  cursor: grab;
  touch-action: none;
}

.appointment-card.arrastrando {
  cursor: grabbing;
  z-index: 30;
  opacity: 0.94;
  box-shadow: 0 16px 34px rgba(23, 33, 31, 0.28);
  transform: scale(1.02);
  /* Sin esto la propia tarjeta tapa el carril de destino bajo el cursor. */
  pointer-events: none;
}

.lane-body.destino-arrastre {
  background-color: rgba(196, 168, 106, 0.16);
  background-blend-mode: multiply;
}

body.arrastrando-cita {
  cursor: grabbing;
  user-select: none;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.card-time {
  color: rgba(23, 33, 31, 0.72);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.card-grip {
  color: rgba(23, 33, 31, 0.4);
  font-size: 0.72rem;
  letter-spacing: -2px;
}

.card-client {
  font-size: 0.92rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.card-line {
  color: rgba(23, 33, 31, 0.68);
  font-size: 0.78rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.appointment-card.status-Solicitada {
  border-style: dashed;
  background: #f7d78b;
}

.appointment-card.status-Completada {
  background: #b8d8c0;
}

.appointment-card.status-Cancelada {
  opacity: 0.52;
  background: #e2e2e2;
}

.appointment-actions {
  display: flex;
  gap: 4px;
  margin-top: auto;
  padding-top: 6px;
  flex-wrap: wrap;
}

.appointment-actions a,
.appointment-actions button {
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid rgba(23, 33, 31, 0.14);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 0.72rem;
  line-height: 1.1;
  white-space: nowrap;
}

.appointment-actions button:hover,
.appointment-actions a:hover {
  background: #fff;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(5, minmax(220px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.pipeline-column {
  min-height: 420px;
  padding: 12px;
  background: #fbfaf5;
}

.pipeline-column h2 {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  font-size: 0.94rem;
}

.client-card {
  display: grid;
  gap: 8px;
  padding: 11px;
  margin-top: 10px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
}

.quote-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(420px, 1.4fr);
  gap: 16px;
}

.quote-preview {
  padding: 18px;
}

/* El documento de cotizacion se adapta al ancho disponible en pantalla. */
.quote-preview .data-table {
  min-width: 0;
}

.quote-document {
  max-width: 860px;
  margin: 0 auto;
}

.quote-brand {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  gap: 16px;
  align-items: start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--soft-line);
}

.quote-brand img {
  width: 78px;
  height: 78px;
  object-fit: contain;
}

.quote-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.quote-meta div {
  padding: 10px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
}

.quote-meta span,
.quote-contact span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.quote-contact {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0 16px;
}

.quote-preview .total-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--soft-line);
  padding-top: 12px;
  margin-top: 12px;
  font-size: 1.15rem;
  font-weight: 800;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.summary-item {
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
}

.summary-item strong {
  display: block;
  margin-top: 4px;
  font-size: 1.25rem;
}

.integration-list {
  margin-top: 12px;
}

.license-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-color: #e5b65f;
  background: #fff8e8;
}

.license-banner.expired {
  border-color: #d76a59;
  background: #fff0ed;
}

.license-admin .panel-header {
  align-items: flex-start;
}

/* ---------- Componentes 0.2.7: cabinas, anticipos, paquetes, fotos y reportes ---------- */

.field-hint {
  display: block;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
  white-space: pre-line;
}

.inline-note {
  margin: 0 0 10px;
  padding: 9px 11px;
  border: 1px solid #e5b65f;
  border-radius: 8px;
  background: #fff8e8;
  color: #8a5a00;
  font-size: 0.86rem;
}

.inline-note.bad {
  border-color: #d76a59;
  background: #fff0ed;
  color: #9a3f36;
}

.week-board th,
.week-board td {
  min-width: 130px;
}

.week-cell {
  display: grid;
  gap: 3px;
  align-content: start;
  cursor: pointer;
}

.week-cell:hover {
  background: var(--surface-2);
}

.week-appt {
  display: block;
  padding: 2px 6px;
  border-radius: 6px;
  background: #eef8f5;
  color: #24675d;
  font-size: 0.76rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.week-cell.cerrado {
  background: #fde7e4;
  color: #9a3f36;
  font-size: 0.82rem;
  text-align: center;
}

.week-cell.descanso {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.muted {
  color: var(--muted);
}

.meter {
  height: 7px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--soft-line);
  overflow: hidden;
}

.meter i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--gold);
}

.card-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.flag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(23, 33, 31, 0.14);
  color: var(--ink);
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.flag.warn {
  background: #fff3d9;
  border-color: #e5b65f;
  color: #8a5a00;
}

.flag.ok {
  background: #e7f6ec;
  border-color: #9fcfb2;
  color: #226b44;
}

.flag.bad {
  background: #fde7e4;
  border-color: #e0a49c;
  color: #9a3f36;
}

.chip-row {
  gap: 6px;
}

/* Tarjetas que abren su modulo con doble clic */
.metric-card.clickable,
.summary-item.clickable {
  cursor: pointer;
  position: relative;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.metric-card.clickable:hover,
.summary-item.clickable:hover,
.metric-card.clickable:focus-visible,
.summary-item.clickable:focus-visible {
  transform: translateY(-2px);
  border-color: var(--gold);
  box-shadow: 0 12px 26px rgba(23, 33, 31, 0.14);
  outline: none;
}

.card-go {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.metric-card.clickable:hover .card-go,
.metric-card.clickable:focus-visible .card-go {
  opacity: 1;
  color: #8a6d1f;
}

/* Constructor de lineas de servicio en paquetes */
.line-builder {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.line-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px 46px;
  gap: 10px;
  align-items: end;
}

.add-button {
  width: 46px;
  min-width: 46px;
  height: 40px;
  padding: 0;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
}

.line-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.line-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef8f5;
  color: #24675d;
  font-size: 0.76rem;
  white-space: nowrap;
}

.counter-list {
  display: grid;
  gap: 3px;
  min-width: 190px;
}

.counter-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
}

.counter-row span {
  color: var(--muted);
}

.counter-row.total {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--soft-line);
  font-weight: 700;
}

.counter-row.total span {
  color: var(--ink);
}

/* Resalta el expediente cuando se llega desde el boton Editar */
.panel.destacado {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(196, 168, 106, 0.28), var(--shadow);
  animation: aparece-expediente 0.5s ease;
}

@keyframes aparece-expediente {
  from {
    transform: translateY(-6px);
    box-shadow: 0 0 0 8px rgba(196, 168, 106, 0);
  }
  to {
    transform: translateY(0);
    box-shadow: 0 0 0 3px rgba(196, 168, 106, 0.28), var(--shadow);
  }
}

.chip {
  min-height: 34px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 0.88rem;
}

.chip.active {
  color: #071514;
  background: var(--gold);
  border-color: #b69856;
  font-weight: 700;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.check-field {
  align-items: start;
}

.check-field input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
}

.privacy-note {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-color: #d9c79a;
  background: #fffaf0;
}

.privacy-note h2 {
  margin-bottom: 6px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.photo-card {
  display: grid;
  grid-template-rows: 168px auto;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.photo-card img {
  width: 100%;
  height: 168px;
  object-fit: cover;
  background: #f1efe8;
}

.photo-body {
  display: grid;
  gap: 4px;
  padding: 10px;
}

.photo-body strong {
  font-size: 0.95rem;
}

.photo-body span,
.photo-body p {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0;
}

.photo-body .button-row {
  margin-top: 6px;
}

.photo-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.photo-thumb {
  display: grid;
  gap: 4px;
  min-width: 128px;
  padding: 6px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.photo-thumb img {
  width: 116px;
  height: 88px;
  object-fit: cover;
  border-radius: 6px;
  background: #f1efe8;
}

.photo-thumb span {
  color: var(--muted);
  font-size: 0.74rem;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.compare-item {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
  justify-items: start;
}

.compare-item img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 8px;
  background: #f1efe8;
}

.compare-item figcaption {
  color: var(--muted);
  font-size: 0.82rem;
}

.photo-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 220px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 0.86rem;
}

.photo-full {
  max-height: 60vh;
  overflow: auto;
  margin-bottom: 12px;
  border-radius: 8px;
  background: #f1efe8;
}

.photo-full img {
  width: 100%;
  height: auto;
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-root[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 21, 20, 0.52);
  backdrop-filter: blur(3px);
}

.modal-card {
  position: relative;
  width: min(620px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  padding: 18px;
  border: 1px solid var(--soft-line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-head h2 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.modal-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.modal-actions {
  margin-top: 4px;
}

body.modal-open {
  overflow: hidden;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  color: #071514;
  background: #f5faee;
  border: 1px solid var(--gold);
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.booking-body {
  background:
    linear-gradient(135deg, rgba(132, 169, 140, 0.16), transparent 36%),
    linear-gradient(225deg, rgba(196, 168, 106, 0.2), transparent 42%),
    var(--bg);
}

.booking-page {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.booking-hero {
  min-height: 245px;
  display: grid;
  align-content: center;
  gap: 14px;
}

.booking-hero .booking-brand span {
  color: var(--muted);
}

.booking-hero h1 {
  margin: 0;
  font-size: 2.4rem;
  line-height: 1.05;
}

.booking-hero p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
}

.booking-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1fr);
  gap: 16px;
  align-items: start;
}

.booking-policy {
  margin-top: 16px;
}

.service-cards {
  display: grid;
  gap: 10px;
}

.service-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
}

.booking-result {
  margin-top: 16px;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--gold);
  background: #fffdf8;
}

.locked {
  min-height: 360px;
  display: grid;
  place-items: center;
  text-align: center;
}

@media (max-width: 1180px) {
  .kpi-grid,
  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compare-grid,
  .privacy-note {
    grid-template-columns: 1fr;
  }

  .two-col,
  .quote-layout,
  .booking-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 12px;
  }

  .brand {
    min-height: 54px;
    padding-bottom: 12px;
  }

  .nav-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 3px;
  }

  .nav-item {
    min-width: 132px;
  }

  .topbar {
    position: static;
    align-items: flex-start;
    padding: 14px;
  }

  .view {
    padding: 14px;
  }

  .form-grid,
  .three-col,
  .kpi-grid,
  .summary-strip,
  .license-banner,
  .brand-preview {
    grid-template-columns: 1fr;
  }

  .line-row {
    grid-template-columns: 1fr;
  }

  .add-button {
    width: 100%;
  }
}

@media print {
  .sidebar,
  .topbar,
  .no-print,
  .login-screen,
  .panel:not(.print-keep),
  .table-wrap:not(.print-keep),
  .toast {
    display: none !important;
  }

  .app-shell,
  .workspace {
    display: block;
  }

  .view {
    padding: 0;
  }

  .quote-preview {
    box-shadow: none;
    border: none;
    padding: 0;
    background: #fff;
  }

  .quote-layout {
    display: block;
  }

  .quote-meta,
  .quote-contact {
    break-inside: avoid;
  }

  .data-table {
    min-width: 0;
  }

  .data-table th,
  .data-table td {
    padding: 9px 8px;
  }
}

/* Nota: el ticket termico (58/80mm) no usa este archivo. printThermalReceipt()
   en app.js abre su propia ventana con estilos e @page independientes, para
   que el tamano de pagina de 80mm nunca afecte la impresion de cotizaciones
   o del directorio de clientes, que si usan este styles.css. */
