/* Agenda de Citas — estilos base, pensados primero para el teléfono */
:root {
  --bg: #f5f6f8; --surface: #fff; --text: #1b1f24; --muted: #5b6470;
  --border: #d9dee5; --primary: #1f5fbf; --primary-text: #fff;
  --error-bg: #fdecea; --error-text: #8a1c13; --warn-bg: #fff4d6; --warn-text: #6b4a00;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171b; --surface: #1d2127; --text: #e8ebef; --muted: #9aa4b1;
    --border: #323943; --primary: #7aa7ff; --primary-text: #0a1a33;
    --error-bg: #46201c; --error-text: #ffc9c2; --warn-bg: #43360f; --warn-text: #ffe29a;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--primary); }
h1 { font-size: 1.5rem; margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.container { max-width: 1100px; margin: 0 auto; padding: 16px; }

.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--text); }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav a { padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); white-space: nowrap; }
.nav a.active { color: var(--text); background: var(--bg); font-weight: 600; }
.logout { display: flex; align-items: center; gap: 8px; margin: 0; }
.who { color: var(--muted); font-size: .9rem; }

.btn { font: inherit; min-height: 44px; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); font-weight: 600; }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; margin-top: 16px; }

label { display: block; margin: 12px 0 4px; font-weight: 600; font-size: .95rem; }
input[type=text], input[type=password], input[type=number], select {
  width: 100%; min-height: 44px; padding: 8px 12px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
input:focus, select:focus, .btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.alert { padding: 10px 14px; border-radius: 8px; margin: 12px 0; }
.alert-error { background: var(--error-bg); color: var(--error-text); }
.alert-warn { background: var(--warn-bg); color: var(--warn-text); }

.login-card { max-width: 380px; margin: 8vh auto 0; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.login-card h1 { margin-bottom: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 16px 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.card .num { font-size: 1.6rem; font-weight: 700; }
.card .label { color: var(--muted); font-size: .9rem; }

/* --- Paso 2: importador y productos --- */
:root { --ok-bg: #e2f5ec; --ok-text: #0b4f3c; }
@media (prefers-color-scheme: dark) { :root { --ok-bg: #12382d; --ok-text: #b6ecd9; } }
h2 { font-size: 1.15rem; margin: 20px 0 8px; }
h3 { font-size: 1rem; margin: 0; }
.small { font-size: .85rem; }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.alert-ok { background: var(--ok-bg); color: var(--ok-text); }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
a.btn-block { display: flex; margin-top: 8px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin: 12px 0; }
.panel h2 { margin-top: 0; }
input[type=file] { width: 100%; padding: 10px; border: 1px dashed var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }
.row-form, .filters { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; }
.row-form > div, .filters > div { flex: 1 1 180px; min-width: 0; }
.filters .grow { flex: 2 1 260px; }
.row-form label, .filters label { margin-top: 0; }
.check { display: flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 400; margin: 0; }
.check input { width: 20px; height: 20px; }
ul.plain { margin: 0; padding-left: 18px; }
ul.plain li { margin: 4px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.table .num { text-align: right; font-size: inherit; font-weight: inherit; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .8rem; background: var(--bg); border: 1px solid var(--border); color: var(--muted); }
.tag-warn { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.tag-error, .tag-error { background: var(--error-bg); color: var(--error-text); border-color: transparent; }
.tag-terminado { background: var(--ok-bg); color: var(--ok-text); border-color: transparent; }
.tag-en_proceso { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }

.map-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.map-item { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.map-empty { opacity: .6; }
.map-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.col-letter { flex: none; min-width: 28px; text-align: center; padding: 2px 6px; border-radius: 6px; background: var(--primary); color: var(--primary-text); font-weight: 700; font-size: .85rem; }
.col-title { font-weight: 600; overflow-wrap: anywhere; }
.map-samples { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 3.2em; }
.sample { font-size: .85rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.product-list { display: flex; flex-direction: column; gap: 8px; }
.product { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: flex; flex-wrap: wrap; gap: 8px 16px; }
.product-off { opacity: .7; }
.product-main { flex: 1 1 300px; min-width: 0; }
.product-main p { margin: 4px 0 0; }
.product-main h3 { overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.note { font-size: .9rem; background: var(--warn-bg); color: var(--warn-text); padding: 4px 8px; border-radius: 6px; }
.product-nums { display: grid; grid-template-columns: repeat(4, minmax(60px, auto)); gap: 4px 16px; margin: 0; align-content: start; }
.product-nums dt { font-size: .75rem; color: var(--muted); }
.product-nums dd { margin: 0; font-weight: 600; white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px 0; flex-wrap: wrap; }

/* Teléfono: el menú pasa a su propia fila para que no se corte */
@media (max-width: 640px) {
  .logout { margin-left: auto; }
  .nav { order: 3; flex: 1 0 100%; }
  .filters > div { flex: 1 1 130px; }
  .filters .grow { flex: 1 0 100%; }
}


/* --- Agenda de citas --- */
:root { --danger: #b3261e; --sel: #1f5fbf; --open-bg: #e6efff; --open-text: #123c80; }
@media (prefers-color-scheme: dark) { :root { --danger: #ff8a80; --open-bg: #1c2d4d; --open-text: #cfe0ff; } }
.narrow { max-width: 640px; }
input[type=email], input[type=tel], input[type=date], input[type=time], textarea {
  width: 100%; min-height: 44px; padding: 8px 12px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
textarea { font-family: inherit; font-size: 1rem; }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.login-card.wide { max-width: 460px; margin-top: 4vh; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.hero { text-align: center; padding: 6vh 8px 16px; }
.hero h1 { font-size: 2rem; line-height: 1.2; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 640px; margin: 0 auto 16px; }
.center-row { justify-content: center; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin: 24px 0; }
.features h3 { margin-bottom: 6px; }
.features p { margin: 0; }

.biz-head { padding: 8px 0 4px; }
.biz-name { font-size: 1.3rem; font-weight: 700; color: var(--text); text-decoration: none; }
.biz-desc { white-space: pre-line; }
.service-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.service { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--text); text-decoration: none; }
a.service:hover { border-color: var(--primary); }
.service p { margin: 4px 0 0; }
.service-side { display: flex; align-items: center; gap: 12px; }
.service-off { opacity: .65; }

.cal-head { display: flex; align-items: center; justify-content: space-between; }
.cal-head h2 { margin: 0; text-transform: capitalize; }
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; margin-top: 8px; }
.cal th { font-size: .8rem; color: var(--muted); font-weight: 600; padding: 4px 0; }
.cal td { padding: 3px; text-align: center; }
.day { display: flex; align-items: center; justify-content: center; height: 44px; border-radius: 10px; text-decoration: none; font-weight: 600; }
.day-open { background: var(--open-bg); color: var(--open-text); }
.day-open:hover { outline: 2px solid var(--primary); }
.day-sel { background: var(--sel); color: #fff; }
.day-off { color: var(--muted); opacity: .45; font-weight: 400; }
.day-today { outline: 1px dashed var(--border); opacity: .8; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.slot { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; border: 1px solid var(--primary); border-radius: 10px; color: var(--primary); text-decoration: none; font-weight: 600; background: var(--surface); cursor: pointer; }
a.slot:hover, .slot-radio:has(input:checked) { background: var(--primary); color: var(--primary-text); }
.slot-radio { margin: 0; font-size: .95rem; }
.slot-pick { border: 0; padding: 0; margin: 0; }
.slot-pick legend { font-weight: 600; margin-bottom: 8px; }
.otra-hora { display: none; }
.slot-pick:has(input[value=otra]:checked) .otra-hora { display: block; }
.summary { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); margin: 12px 0; font-size: 1.05rem; }
.big-ok { font-size: 1.1rem; font-weight: 600; }
.big-ok .small { font-weight: 400; margin-top: 4px; }

.tag-pendiente { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.tag-confirmada { background: var(--ok-bg); color: var(--ok-text); border-color: transparent; }
.tag-cancelada { background: var(--error-bg); color: var(--error-text); border-color: transparent; }
.tag-completada { background: var(--open-bg); color: var(--open-text); border-color: transparent; }

.share .copy-row { display: flex; gap: 8px; }
.share .copy-row input { flex: 1; min-width: 0; }
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { margin: 6px 0; }
.steps li a { color: var(--text); text-decoration: none; }
.steps li.done a { color: var(--muted); text-decoration: line-through; }
.day-label { margin: 12px 0 4px; text-transform: capitalize; }
.appt { display: flex; gap: 12px; flex-wrap: wrap; padding: 12px; margin: 6px 0; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 10px; }
.appt-pendiente { border-left-color: #c98a00; }
.appt-cancelada, .appt-no_asistio { border-left-color: var(--border); opacity: .6; }
.appt-completada { border-left-color: var(--pos); }
.appt-time { display: flex; flex-direction: column; min-width: 80px; }
.appt-main { flex: 1 1 220px; min-width: 0; }
.appt-main h3 { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.appt .contact { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; }
.appt .note { margin-top: 6px; }
.appt-actions { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; }
.appt-actions form { margin: 0; }
.week-nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.week-nav input { width: auto; }
.day-block { margin: 16px 0; }
.day-block h2 { margin: 0; }
.is-today { color: var(--primary); }

.week { display: flex; flex-direction: column; gap: 6px; }
.week-day { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.day-name { min-width: 130px; font-weight: 600; }
.turnos { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.turno { display: inline-flex; align-items: center; gap: 6px; }
.turno input { width: 120px; }
.closed-label { display: none; }
.week-day.closed .turno { display: none; }
.week-day.closed .closed-label { display: inline; }
.block-hours { margin-top: 4px; }
.block-list { list-style: none; padding: 0; margin: 16px 0 0; }
.block-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); }
.block-list form { margin: 0; }
.prefix-input { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.prefix-input input { flex: 1 1 160px; }

@media (max-width: 640px) {
  .hero h1 { font-size: 1.5rem; }
  .day { height: 40px; }
  .appt-actions { width: 100%; }
}
