/* ============================================================
   styles.css — Sistema de diseño Liaopastel Auditorías
   En Apps Script: renombrar a styles.html y envolver en <style>
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:            #F5F2EE;
  --surface:       #FFFFFF;
  --surface2:      #F0EDE8;
  --border:        #E2DDD6;
  --border-strong: #C8C1B8;
  --text:          #1A1714;
  --text-2:        #6B6560;
  --text-3:        #9C958E;
  --accent:        #C84B2F;
  --accent-light:  #F5E8E4;
  --accent-dark:   #9A3420;
  --green:         #2A7A4B;
  --green-light:   #E3F2EA;
  --amber:         #B86E00;
  --amber-light:   #FDF3E0;
  --red:           #C0392B;
  --red-light:     #FDECEA;
  --blue:          #2563A8;
  --blue-light:    #E8F0FB;
  --purple:        #6B3FA0;
  --purple-light:  #F0EAF8;
  --radius:        16px;
  --radius-sm:     8px;
  --shadow:        0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:     0 4px 12px rgba(0,0,0,.08);
}

/* ── Reset y base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }
a { color: inherit; text-decoration: none; }

/* ── Tipografía ────────────────────────────────────────────── */
.mono { font-family: 'DM Mono', monospace; }

h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.5px; }
h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.3px; }
h3 { font-size: 15px; font-weight: 600; }

/* ── Layout ────────────────────────────────────────────────── */
#app { min-height: 100vh; display: flex; flex-direction: column; }

.page { flex: 1; padding: 24px 16px; max-width: 1200px; margin: 0 auto; width: 100%; }

@media (min-width: 768px)  { .page { padding: 32px 24px; } }
@media (min-width: 1024px) { .page { padding: 40px 32px; } }

/* ── Nav ───────────────────────────────────────────────────── */
.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-logo {
  font-weight: 600;
  font-size: 15px;
  color: var(--accent);
  flex-shrink: 0;
  margin-right: 8px;
}
.nav-logo span { color: var(--text-3); font-weight: 400; }

.nav-links { display: flex; gap: 2px; flex: 1; }
.nav-link {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.nav-link:hover  { background: var(--surface2); color: var(--text); }
.nav-link.active { background: var(--accent-light); color: var(--accent); }

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
.nav-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--purple-light);
  color: var(--purple);
  font-size: 12px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.nav-name { font-size: 13px; font-weight: 500; color: var(--text-2); }

@media (max-width: 767px) {
  .nav-links { display: none; }
  .nav-name  { display: none; }
}

/* ── Bottom Tab Bar (mobile) ───────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-inner { display: flex; }
.bottom-nav-btn {
  flex: 1;
  padding: 10px 4px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  transition: color .15s;
}
.bottom-nav-btn.active { color: var(--accent); }
.bottom-nav-icon { font-size: 20px; line-height: 1; }

@media (max-width: 767px) {
  .bottom-nav { display: block; }
  .page { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-body { padding: 20px; }
.card-body-sm { padding: 16px; }

/* ── Metric Cards ──────────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
@media (min-width: 768px) {
  .metrics-grid { grid-template-columns: repeat(4, 1fr); }
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.metric-label { font-size: 12px; font-weight: 500; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.metric-value { font-size: 32px; font-weight: 600; font-family: 'DM Mono', monospace; letter-spacing: -1px; line-height: 1; }
.metric-sub   { font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* ── Nota Badges ───────────────────────────────────────────── */
.nota-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.nota-badge.green  { background: var(--green-light);  color: var(--green);  }
.nota-badge.amber  { background: var(--amber-light);  color: var(--amber);  }
.nota-badge.red    { background: var(--red-light);    color: var(--red);    }
.nota-badge.empty  { background: var(--surface2);     color: var(--text-3); }

/* ── Alert Strip ───────────────────────────────────────────── */
.alert-strip {
  background: var(--red-light);
  border: 1px solid #f5c6c6;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
}
.alert-strip-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-strip-content { flex: 1; }
.alert-strip-title { font-weight: 600; font-size: 13px; color: var(--red); }
.alert-strip-list  { font-size: 12px; color: var(--text-2); margin-top: 4px; }

/* ── Ranking Table ─────────────────────────────────────────── */
.ranking-table { width: 100%; border-collapse: collapse; }
.ranking-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-3);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.ranking-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.ranking-table tr:last-child td { border-bottom: none; }
.ranking-table tr:hover td { background: var(--surface2); }

.rank-num { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text-3); width: 28px; }
.tienda-codigo { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text-3); }
.tienda-nombre { font-weight: 500; }
.tienda-ciudad { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.tendencia { font-size: 14px; }
.tendencia.sube  { color: var(--green); }
.tendencia.baja  { color: var(--red); }
.tendencia.igual { color: var(--text-3); }

.no-auditada { font-size: 12px; color: var(--text-3); font-style: italic; }
.tendencia-negativa { font-size: 10px; background: var(--red-light); color: var(--red); padding: 2px 6px; border-radius: 10px; margin-left: 6px; }

/* ── Dashboard grid ────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr 340px; }
}

.sidebar-section { margin-bottom: 20px; }
.sidebar-section:last-child { margin-bottom: 0; }

.am-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.am-row:last-child { border-bottom: none; }
.am-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--purple-light);
  color: var(--purple);
  font-size: 12px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.am-info { flex: 1; min-width: 0; }
.am-nombre { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-stats  { font-size: 11px; color: var(--text-3); }

/* ── Formulario de auditoría ───────────────────────────────── */
.auditoria-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  min-height: calc(100vh - 56px);
}
@media (min-width: 768px) {
  .auditoria-layout { grid-template-columns: 240px 1fr; }
}
@media (min-width: 1024px) {
  .auditoria-layout { grid-template-columns: 280px 1fr; }
}

/* Sidebar de progreso */
.auditoria-sidebar {
  background: #1A1714;
  color: #fff;
  padding: 24px 20px;
  display: none;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
}
@media (min-width: 768px) { .auditoria-sidebar { display: flex; } }

.sidebar-nota-label { font-size: 11px; color: rgba(255,255,255,.4); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 2px; }
.sidebar-nota-value { font-family: 'DM Mono', monospace; font-size: 40px; font-weight: 500; color: #fff; line-height: 1; margin-bottom: 4px; }
.sidebar-nota-pts   { font-size: 12px; color: rgba(255,255,255,.4); margin-bottom: 24px; }

.sidebar-bloque {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-bloque:hover    { background: rgba(255,255,255,.06); }
.sidebar-bloque.active   { background: rgba(255,255,255,.1); }
.sidebar-bloque.done .sb-status   { color: var(--green); }
.sidebar-bloque.partial .sb-status { color: var(--amber); }

.sb-status { font-size: 14px; flex-shrink: 0; }
.sb-text   { flex: 1; }
.sb-nombre { font-size: 13px; font-weight: 500; color: rgba(255,255,255,.9); }
.sb-pts    { font-size: 11px; color: rgba(255,255,255,.4); margin-top: 1px; }

/* Área de formulario */
.auditoria-content { overflow-y: auto; }

.auditoria-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 20px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.auditoria-header-fields { display: flex; flex-wrap: wrap; gap: 12px; flex: 1; }

/* Nota flotante mobile */
.nota-flotante {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1A1714;
  color: #fff;
  padding: 10px 16px;
  font-size: 13px;
}
.nota-flotante .nota-val { font-family: 'DM Mono', monospace; font-size: 20px; font-weight: 500; margin-left: 4px; }
@media (min-width: 768px) { .nota-flotante { display: none; } }

/* Bloques del formulario */
.bloque-section {
  padding: 24px;
  border-bottom: 1px solid var(--border);
}
.bloque-section:last-child { border-bottom: none; }

.bloque-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.bloque-badge {
  width: 28px; height: 28px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.bloque-badge.b1 { background: var(--purple-light); color: var(--purple); }
.bloque-badge.b2 { background: var(--blue-light);   color: var(--blue); }
.bloque-badge.b3 { background: var(--green-light);  color: var(--green); }
.bloque-badge.b4 { background: var(--amber-light);  color: var(--amber); }
.bloque-badge.b5 { background: var(--red-light);    color: var(--red); }
.bloque-badge.b6 { background: var(--surface2);     color: var(--text-2); }
.bloque-badge.b7 { background: var(--accent-light); color: var(--accent); }

.bloque-pts-display { margin-left: auto; font-family: 'DM Mono', monospace; font-size: 13px; color: var(--text-3); }

/* Preguntas */
.pregunta-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.pregunta-row:last-child { border-bottom: none; }
.pregunta-texto { flex: 1; font-size: 13px; color: var(--text); padding-top: 4px; }
.pregunta-control { flex-shrink: 0; }

/* Controles: Si/No toggle */
.toggle-group { display: flex; gap: 4px; }
.toggle-btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  transition: all .15s;
}
.toggle-btn:hover { background: var(--surface2); border-color: var(--border-strong); }
.toggle-btn.selected-yes { background: var(--green-light); border-color: var(--green); color: var(--green); }
.toggle-btn.selected-no  { background: var(--red-light);   border-color: var(--red);   color: var(--red); }

/* Controles: Valoración */
.val-group { display: flex; gap: 3px; }
.val-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  transition: all .15s;
  display: flex; align-items: center; justify-content: center;
}
.val-btn:hover   { background: var(--surface2); }
.val-btn.selected { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Controles: Número */
.num-input-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.num-input {
  width: 80px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  font-family: 'DM Mono', monospace;
  font-size: 15px;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s;
}
.num-input:focus  { outline: none; border-color: var(--accent); }
.num-score-preview {
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
}
.num-score-preview.pos  { background: var(--green-light); color: var(--green); }
.num-score-preview.neg  { background: var(--red-light);   color: var(--red); }
.num-score-preview.zero { background: var(--surface2);    color: var(--text-3); }
.num-score-preview.warn { background: var(--amber-light); color: var(--amber); }

/* Textarea */
.text-input {
  width: 200px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  resize: vertical;
  min-height: 60px;
}
.text-input:focus { outline: none; border-color: var(--accent); }

/* Botones de acción */
.auditoria-footer {
  padding: 20px 24px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.btn { padding: 9px 20px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; transition: all .15s; display: inline-flex; align-items: center; gap: 6px; }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover  { background: var(--accent-dark); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--red-light); color: var(--red); border: 1px solid #f5c6c6; }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* Hora input */
.hora-input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Mono', monospace;
  font-size: 16px;
  width: 110px;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s;
}
.hora-input:focus { outline: none; border-color: var(--accent); }
.hora-input.invalid { border-color: var(--red); background: var(--red-light); }

/* Selects */
.select-field {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%239C958E' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  min-width: 180px;
}
.select-field:focus { outline: none; border-color: var(--accent); }

.field-group { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-3); }

/* ── Panel de Administración ───────────────────────────────── */
.admin-tabs { display: flex; gap: 2px; margin-bottom: 24px; flex-wrap: wrap; }
.admin-tab {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all .15s;
}
.admin-tab:hover  { background: var(--surface2); }
.admin-tab.active { background: var(--accent-light); color: var(--accent); border-color: transparent; }

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-3);
  padding: 10px 14px;
  border-bottom: 2px solid var(--border);
  background: var(--surface);
}
.admin-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
.admin-table tr:hover td { background: var(--surface2); }
.admin-table tr:last-child td { border-bottom: none; }

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.status-pill.activo   { background: var(--green-light);  color: var(--green); }
.status-pill.inactivo { background: var(--surface2);     color: var(--text-3); }

/* ── Histórico ─────────────────────────────────────────────── */
.historico-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: flex-end;
}

/* ── Modal / Dialog ────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-body   { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.modal-close  { font-size: 20px; color: var(--text-3); cursor: pointer; background: none; border: none; padding: 0; line-height: 1; }

/* Form rows en modal */
.form-row { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.form-input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
}
.form-input:focus { outline: none; border-color: var(--accent); }
.form-select {
  padding: 8px 28px 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%239C958E' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E") no-repeat right 10px center;
  color: var(--text);
  appearance: none;
  width: 100%;
}
.form-select:focus { outline: none; border-color: var(--accent); }

/* ── Pantalla de carga / error ─────────────────────────────── */
.splash {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px;
  text-align: center;
}
.splash-logo  { font-size: 20px; font-weight: 600; color: var(--accent); }
.splash-sub   { color: var(--text-3); font-size: 14px; }
.splash-error { color: var(--red); font-size: 13px; background: var(--red-light); padding: 12px 16px; border-radius: var(--radius-sm); max-width: 400px; }

.spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Notificación toast ────────────────────────────────────── */
.toast-container { position: fixed; top: 16px; right: 16px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--text);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: slideIn .2s ease;
  max-width: 320px;
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Utilidades ────────────────────────────────────────────── */
.hidden  { display: none !important; }
.flex    { display: flex; }
.gap-8   { gap: 8px; }
.gap-12  { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-3  { color: var(--text-3); }
.text-sm { font-size: 12px; }
.fw-500  { font-weight: 500; }
.fw-600  { font-weight: 600; }
.mb-4    { margin-bottom: 4px; }
.mb-8    { margin-bottom: 8px; }
.mb-16   { margin-bottom: 16px; }
.mb-24   { margin-bottom: 24px; }
.w-full  { width: 100%; }
.overflow-auto { overflow: auto; }

/* ── Result screen (post-envío) ────────────────────────────── */
.result-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  gap: 16px;
  padding: 32px;
}
.result-nota {
  font-family: 'DM Mono', monospace;
  font-size: 72px;
  font-weight: 500;
  line-height: 1;
}
.result-nota.green { color: var(--green); }
.result-nota.amber { color: var(--amber); }
.result-nota.red   { color: var(--red); }

/* ── Login screen ───────────────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px 16px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 40px 32px;
  width: 100%;
  max-width: 400px;
}

.login-logo {
  font-size: 20px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 28px;
  text-align: center;
}
.login-logo span { color: var(--text-3); font-weight: 400; }

.login-form { display: flex; flex-direction: column; gap: 16px; }

.login-error {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid #f5c6c2;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
}

.btn-login {
  width: 100%;
  margin-top: 4px;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
}

/* Logout button in nav */
.btn-logout {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  background: var(--surface2);
  transition: background .15s, color .15s;
}
.btn-logout:hover {
  background: var(--red-light);
  border-color: var(--red);
  color: var(--red);
}

/* ── Tipo selector auditoría ────────────────────────────────── */
.tipo-auditoria-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.tipo-btn {
  flex: 1;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--surface2);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  text-align: center;
}
.tipo-btn:hover { border-color: var(--accent); color: var(--text); }
.tipo-btn.active {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

/* ── Pregunta de cumplimiento ────────────────────────────────── */
.cumplimiento-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.cum-btn {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  background: var(--surface2);
  color: var(--text-2);
}
.cum-btn.cum-cumple   { border-color: var(--green);  color: var(--green); }
.cum-btn.cum-mejorar  { border-color: var(--amber);  color: var(--amber); }
.cum-btn.cum-nocumple { border-color: var(--red);    color: var(--red); }
.cum-btn.selected.cum-cumple   { background: var(--green-light); font-weight: 700; }
.cum-btn.selected.cum-mejorar  { background: var(--amber-light); font-weight: 700; }
.cum-btn.selected.cum-nocumple { background: var(--red-light);   font-weight: 700; }

/* ── Sidebar cumplimiento ────────────────────────────────────── */
.cum-sidebar-stat { font-size: 13px; font-weight: 500; padding: 3px 0; }
.cum-sidebar-stat.green { color: var(--green); }
.cum-sidebar-stat.amber { color: var(--amber); }
.cum-sidebar-stat.red   { color: var(--red); }

/* ── Resultado cumplimiento ─────────────────────────────────── */
.cum-result-grid {
  display: flex;
  gap: 12px;
  margin: 20px 0;
  flex-wrap: wrap;
  justify-content: center;
}
.cum-result-card {
  flex: 1;
  min-width: 110px;
  max-width: 160px;
  padding: 20px 12px;
  border-radius: var(--radius);
  text-align: center;
  border: 2px solid transparent;
}
.cum-result-card.green { background: var(--green-light); border-color: var(--green); }
.cum-result-card.amber { background: var(--amber-light); border-color: var(--amber); }
.cum-result-card.red   { background: var(--red-light);   border-color: var(--red); }
.cum-result-num   { font-size: 40px; font-weight: 700; font-family: 'DM Mono', monospace; }
.cum-result-label { font-size: 13px; font-weight: 600; margin: 4px 0 2px; }
.cum-result-msg   { font-size: 11px; color: var(--text-3); }
.cum-result-list {
  max-width: 480px;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border-left: 4px solid;
  margin: 6px 0;
  background: var(--surface2);
  font-size: 13px;
}
.cum-result-list.red-border   { border-color: var(--red); }
.cum-result-list.amber-border { border-color: var(--amber); }
.cum-result-list ul { margin: 6px 0 0 16px; }
.cum-result-list li { margin-bottom: 3px; }

/* ── Admin tabs agrupados ────────────────────────────────────── */
.admin-tabs-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.admin-tab-group { display: flex; gap: 2px; }
.admin-tab-group-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-3);
  padding: 0 8px;
  border-left: 1px solid var(--border);
  margin-left: 4px;
  align-self: center;
}

/* Badge tipo cumplimiento en tabla admin */
.cum-badge {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
}

/* Select de bloque inline en tabla de preguntas */
.bloque-inline-select {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  max-width: 120px;
  transition: border-color .15s;
}
.bloque-inline-select:hover  { border-color: var(--accent); }
.bloque-inline-select:focus  { outline: none; border-color: var(--accent); }
.bloque-inline-select:disabled { opacity: .5; cursor: wait; }

/* Inline order input in admin tables */
.orden-inline-input {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  font-weight: 600;
  width: 52px;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text);
  text-align: center;
  cursor: pointer;
  transition: border-color .15s;
  -moz-appearance: textfield;
}
.orden-inline-input::-webkit-outer-spin-button,
.orden-inline-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.orden-inline-input:hover  { border-color: var(--accent); }
.orden-inline-input:focus  { outline: none; border-color: var(--accent); background: var(--surface); }
.orden-inline-input:disabled { opacity: .5; cursor: wait; }

/* Set-password row in AM table */
.set-pw-email-row {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 12px;
}

/* ── Contadores rotativa en tabla dashboard ──────────────── */
.rot-detalle { white-space: nowrap; font-size: 12px; font-weight: 600; }
.rot-cumple  { color: var(--green); }
.rot-mejorar { color: var(--amber); margin-left: 6px; }
.rot-nocumple{ color: var(--red);   margin-left: 6px; }
.rot-total   { color: var(--text-3); font-weight: 400; }

/* ── Métricas Rotativa ───────────────────────────────────── */
.metrics-rot-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.metric-card-rot {
  border-left: 3px solid var(--green);
}
.metric-value-sm {
  font-size: 28px !important;
}

/* ── Selector de semana del dashboard ────────────────────── */
.week-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  width: fit-content;
}
.week-nav-btn {
  font-size: 16px;
  font-weight: 700;
  padding: 2px 10px !important;
  line-height: 1;
  min-width: 32px;
}
.week-nav-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 260px;
  justify-content: center;
}
.week-nav-week {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.week-nav-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 20px;
  padding: 2px 8px;
}

/* ── Pregunta info button & panel ─────────────────────────── */
.btn-pregunta-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  background: transparent;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  cursor: pointer;
  vertical-align: middle;
  flex-shrink: 0;
  opacity: .75;
  transition: opacity .15s, background .15s, color .15s;
}
.btn-pregunta-info:hover {
  opacity: 1;
  background: var(--accent);
  color: #fff;
}
.pregunta-info-panel {
  margin: 6px 0 2px 0;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-2);
  background: var(--surface2);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  animation: fadeIn .15s ease;
}

/* ── No-puntúa questions ──────────────────────────────────── */
.no-puntua-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-3);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  vertical-align: middle;
}
.pregunta-row.no-puntua {
  opacity: .85;
}
.pregunta-row.no-puntua .pregunta-texto {
  color: var(--text-2);
}

/* ── Edit banner (top of audit form when editing) ────────── */
.edit-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  margin-bottom: 18px;
  font-size: 13px;
  font-weight: 500;
  color: #7a4f00;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: var(--radius);
}
@media (prefers-color-scheme: dark) {
  .edit-banner {
    color: #ffd54f;
    background: #2a2200;
    border-color: #5a4500;
  }
}

/* ── Histórico tipo badges ────────────────────────────────── */
.hist-tipo-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-radius: 20px;
  vertical-align: middle;
}
.hist-tipo-badge.larga {
  color: #1565c0;
  background: #e3f2fd;
  border: 1px solid #90caf9;
}
.hist-tipo-badge.rotativa {
  color: #2e7d32;
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
}
@media (prefers-color-scheme: dark) {
  .hist-tipo-badge.larga {
    color: #90caf9;
    background: #0d2137;
    border-color: #1565c0;
  }
  .hist-tipo-badge.rotativa {
    color: #a5d6a7;
    background: #0d1f0e;
    border-color: #2e7d32;
  }
}
