/* ═══════════════════════════════════════════════════════════════════
   Club Erandeni · Admin — design tokens, sidebar shell, light/dark.
   Single stylesheet, no framework. Keep it boring but modern.
   ═══════════════════════════════════════════════════════════════════ */

:root {
  color-scheme: light;
  /* ── Type scale ── */
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 15px;
  --fs-md: 16px;
  --fs-lg: 20px;
  --fs-h1: 28px;
  --fs-kpi: 32px;

  /* ── Surfaces & neutrals (light) ── */
  --bg: #F6F8FB;
  --surface: #FFFFFF;
  --surface-2: #F1F4F8;
  --border: #E4E8EF;
  --text: #101828;
  --muted: #667085;
  --tertiary: #98A2B3;

  /* ── Brand / interactive ── */
  --brand: #16386F;
  --brand-hover: #0F2A57;
  --brand-soft: rgba(22, 56, 111, 0.08);
  --accent: #E0912B;
  --green: #1E6B3A;
  --danger: #C2333A;
  --danger-hover: #9F2831;
  --focus: var(--brand);

  /* ── Sidebar (stays dark navy in light mode) ── */
  --sidebar-bg: #16386F;
  --sidebar-text: rgba(255, 255, 255, 0.72);
  --sidebar-text-active: #FFFFFF;
  --sidebar-active-bg: rgba(255, 255, 255, 0.13);
  --sidebar-hover-bg: rgba(255, 255, 255, 0.07);
  --sidebar-section: rgba(255, 255, 255, 0.42);
  --sidebar-border: rgba(255, 255, 255, 0.10);

  /* ── Soft tints (pills, flashes) ── */
  --tint-blue-bg: rgba(22, 56, 111, 0.10);   --tint-blue-fg: #16386F;
  --tint-green-bg: rgba(30, 107, 58, 0.12);  --tint-green-fg: #1E6B3A;
  --tint-amber-bg: rgba(224, 145, 43, 0.16); --tint-amber-fg: #9A6213;
  --tint-cyan-bg: rgba(46, 142, 196, 0.16);  --tint-cyan-fg: #1F5F86;
  --tint-neutral-bg: rgba(16, 24, 40, 0.07); --tint-neutral-fg: #667085;
  --tint-danger-bg: rgba(194, 51, 58, 0.10); --tint-danger-fg: #C2333A;

  /* ── Shadows ── */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 6px 20px rgba(16, 24, 40, 0.10);

  /* ── Legacy aliases (existing rules/templates still reference these) ── */
  --brand-blue: var(--brand);
  --brand-blue-soft: var(--brand-soft);
  --brand-green: var(--green);
  --separator: var(--border);
}

/* ── Dark mode: auto (unless user forced light) + manual override.
      Both selectors share the SAME declarations — keep them in sync. ── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0E1420;
    --surface: #161D2B;
    --surface-2: #1E2636;
    --border: #263041;
    --text: #E7ECF3;
    --muted: #94A0B4;
    --tertiary: #6B7688;

    --brand: #5B8DEF;
    --brand-hover: #7BA4F2;
    --brand-soft: rgba(91, 141, 239, 0.14);
    --accent: #E7A94A;
    --green: #3FA968;
    --danger: #E5646E;
    --danger-hover: #EF7A83;

    --sidebar-bg: #0B1018;
    --sidebar-active-bg: rgba(255, 255, 255, 0.10);
    --sidebar-hover-bg: rgba(255, 255, 255, 0.05);

    --tint-blue-bg: rgba(91, 141, 239, 0.16);  --tint-blue-fg: #9DBBF5;
    --tint-green-bg: rgba(63, 169, 104, 0.18); --tint-green-fg: #7FD3A0;
    --tint-amber-bg: rgba(231, 169, 74, 0.18); --tint-amber-fg: #E7B972;
    --tint-cyan-bg: rgba(88, 180, 230, 0.18);  --tint-cyan-fg: #8FCDEF;
    --tint-neutral-bg: rgba(255, 255, 255, 0.08); --tint-neutral-fg: #94A0B4;
    --tint-danger-bg: rgba(229, 100, 110, 0.15);  --tint-danger-fg: #F0A0A6;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E1420;
  --surface: #161D2B;
  --surface-2: #1E2636;
  --border: #263041;
  --text: #E7ECF3;
  --muted: #94A0B4;
  --tertiary: #6B7688;

  --brand: #5B8DEF;
  --brand-hover: #7BA4F2;
  --brand-soft: rgba(91, 141, 239, 0.14);
  --accent: #E7A94A;
  --green: #3FA968;
  --danger: #E5646E;
  --danger-hover: #EF7A83;

  --sidebar-bg: #0B1018;
  --sidebar-active-bg: rgba(255, 255, 255, 0.10);
  --sidebar-hover-bg: rgba(255, 255, 255, 0.05);

  --tint-blue-bg: rgba(91, 141, 239, 0.16);  --tint-blue-fg: #9DBBF5;
  --tint-green-bg: rgba(63, 169, 104, 0.18); --tint-green-fg: #7FD3A0;
  --tint-amber-bg: rgba(231, 169, 74, 0.18); --tint-amber-fg: #E7B972;
  --tint-cyan-bg: rgba(88, 180, 230, 0.18);  --tint-cyan-fg: #8FCDEF;
  --tint-neutral-bg: rgba(255, 255, 255, 0.08); --tint-neutral-fg: #94A0B4;
  --tint-danger-bg: rgba(229, 100, 110, 0.15);  --tint-danger-fg: #F0A0A6;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html { color-scheme: light dark; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ═══════════ App shell (sidebar + content) ═══════════ */
.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}
.app-shell.no-nav { grid-template-columns: 1fr; }

/* ── Sidebar ── */
.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  z-index: 50;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 16px;
  text-decoration: none;
  color: var(--sidebar-text-active);
}
.sidebar-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.14);
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 700;
  font-size: var(--fs-md);
}
.sidebar-brand-text small {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--sidebar-section);
}
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 4px 0;
}
.nav-section {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--sidebar-section);
  padding: 14px 10px 6px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 9px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: 500;
  position: relative;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-link:hover { background: var(--sidebar-hover-bg); color: var(--sidebar-text-active); }
.nav-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-active);
  font-weight: 600;
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: -14px; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.9; }

.sidebar-foot {
  border-top: 1px solid var(--sidebar-border);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar-user { display: flex; align-items: center; gap: 9px; padding: 0 4px; flex-wrap: wrap; }
.sidebar-user .user-clave { color: var(--sidebar-text-active); font-size: var(--fs-sm); }
/* Role pill sits on the dark sidebar — force a legible translucent-white chip. */
.sidebar-user .role-pill { background: rgba(255, 255, 255, 0.16); color: var(--sidebar-text-active); }
.sidebar-foot .logout-form { display: block; }
.sidebar-foot .logout-form button {
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--sidebar-border);
  color: var(--sidebar-text);
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: 9px 11px;
  border-radius: 9px;
}
.sidebar-foot .logout-form button:hover { background: var(--sidebar-hover-bg); color: var(--sidebar-text-active); }

/* ── Content column + top bar ── */
.content { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-spacer { flex: 1; }
.topbar-brand {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 700;
  font-size: var(--fs-md);
  color: var(--brand);
  text-decoration: none;
  display: none;
}
.no-nav .topbar-brand { display: block; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }
.nav-toggle { display: none; }
.nav-backdrop { display: none; }

main { padding: 28px 32px; max-width: 1180px; margin: 0 auto; width: 100%; }

/* ═══════════ Responsive: sidebar → drawer ═══════════ */
@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 268px;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-md);
  }
  .app-shell.nav-open .sidebar { transform: translateX(0); }
  .app-shell:not(.no-nav) .nav-toggle { display: inline-flex; }
  .app-shell:not(.no-nav) .topbar-brand { display: block; }
  .app-shell.nav-open .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.42);
    z-index: 40;
  }
  main { padding: 22px 18px; }
}

/* ═══════════ Flash / page head ═══════════ */
.flash {
  padding: 11px 15px;
  background: var(--tint-green-bg);
  color: var(--tint-green-fg);
  border-radius: 9px;
  font-size: var(--fs-sm);
  margin-bottom: 18px;
  font-weight: 500;
}
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
h1 {
  margin: 0;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: var(--fs-h1);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}
.subtitle { color: var(--muted); font-size: var(--fs-sm); margin: 4px 0 18px; }

/* ═══════════ Tables ═══════════ */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
thead th {
  background: var(--brand);
  color: #fff;
  text-align: left;
  padding: 11px 14px;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: none; }
.cell-title strong { font-size: var(--fs-base); color: var(--text); }
.cell-title .muted { color: var(--muted); font-size: var(--fs-xs); margin-top: 2px; line-height: 1.45; }
.muted { color: var(--muted); }
.empty { text-align: center; padding: 32px; color: var(--muted); }
.row-actions { white-space: nowrap; }
/* Suben la especificidad para ganarle a `button[type=submit]`, que las
   pintaba a las tres como botón sólido y dejaba «Rechazar» en rojo sobre
   azul (1.02:1, ilegible). */
.row-actions button[type="submit"],
.row-actions .btn-link {
  background: none; color: var(--brand); border: 1px solid var(--border);
  min-height: 40px; padding: 8px 14px; border-radius: 8px;
}
.row-actions button[type="submit"]:hover { border-color: var(--brand); }
.row-actions .btn-link.danger { color: var(--danger); }
.row-actions .btn-link.danger:hover { border-color: var(--danger); }
.row-actions a, .row-actions button {
  display: inline-block;
  margin-right: 6px;
  font-size: var(--fs-md);
  font-weight: 600;
  text-decoration: none;
  color: var(--brand);
  background: none;
  border: none;
  padding: 6px 8px;
  border-radius: 7px;
  cursor: pointer;
}
.row-actions a:hover, .row-actions button:hover { text-decoration: none; background: var(--brand-soft); }
.row-actions .link-danger:hover { background: var(--tint-danger-bg); }
.row-actions form { display: inline; }
.link-danger { color: var(--danger) !important; }
.link-danger:hover { text-decoration: underline; }
table code { font-family: 'SF Mono', Menlo, monospace; font-size: var(--fs-xs); }
.user-clave { font-family: 'SF Mono', Menlo, monospace; }

/* ═══════════ Pills / role pills ═══════════ */
.role-pill, .pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.role-pill { letter-spacing: 0.6px; }
.role-admin  { background: var(--tint-blue-bg);    color: var(--tint-blue-fg); }
.role-staff  { background: var(--tint-green-bg);   color: var(--tint-green-fg); }
.role-member { background: var(--tint-amber-bg);   color: var(--tint-amber-fg); }
.role-system,
.role-gate   { background: var(--tint-neutral-bg); color: var(--tint-neutral-fg); }

.pill-high        { background: var(--tint-amber-bg);   color: var(--tint-amber-fg); }
.pill-normal      { background: var(--tint-blue-bg);    color: var(--tint-blue-fg); }
.pill-low         { background: var(--tint-neutral-bg); color: var(--tint-neutral-fg); }
.pill-featured    { background: var(--accent); color: #fff; margin-left: 8px; vertical-align: middle; }
.pill-read        { background: var(--tint-cyan-bg);    color: var(--tint-cyan-fg); }
.pill-type-aviso  { background: var(--tint-amber-bg);   color: var(--tint-amber-fg); }
.pill-type-evento { background: var(--tint-cyan-bg);    color: var(--tint-cyan-fg); }
.pill-type-noticia{ background: var(--tint-blue-bg);    color: var(--tint-blue-fg); }
.pill-event-date  { background: var(--tint-neutral-bg); color: var(--tint-neutral-fg); margin-left: 8px; vertical-align: middle; text-transform: none; letter-spacing: 0; }

/* ═══════════ Forms & inputs ═══════════ */
.radio-group {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 6px 0 14px;
}
.radio-group legend {
  padding: 0 6px;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
}
.radio-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
  cursor: pointer;
}
.radio-row input[type=radio] { margin-top: 3px; }

.row-click { cursor: pointer; }
.row-click:hover { background: var(--surface-2); }

.event-summary {
  background: var(--surface);
  border-radius: 12px;
  padding: 16px 20px;
  margin: 8px 0 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  font-size: var(--fs-sm);
  border: 1px solid var(--border);
}
.event-summary > div { display: flex; flex-direction: column; }
.event-summary span.muted { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; color: var(--tertiary); }

.search-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}
.search-row input[type=text] { flex: 1; min-width: 0; }
.search-row .checkbox-row { flex-direction: row; align-items: center; gap: 6px; white-space: nowrap; }
.search-row .checkbox-row input[type=checkbox] { width: 16px; height: 16px; }

dl.metadata { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 8px 0 18px; }
dl.metadata dt { color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 1px; }
dl.metadata dd { margin: 0; font-size: var(--fs-base); }

.btn-primary {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 12px 22px;
  border-radius: 10px;
  font-size: var(--fs-md);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary:hover { background: var(--brand-hover); }
.btn-link {
  color: var(--muted);
  text-decoration: none;
  font-size: var(--fs-md);
  padding: 12px 14px;
}
.btn-link:hover { color: var(--text); text-decoration: underline; }

.login-card, .form-card {
  max-width: 460px;
  margin: 40px auto;
  background: var(--surface);
  padding: 28px 28px 24px;
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.login-card h1, .form-card h1 { margin-bottom: 6px; }
.login-card form, .form-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); letter-spacing: 0.6px; text-transform: uppercase; }
/* Un solo vocabulario de control para TODO input textual — search, month,
   number, date, email y tel incluidos. Sin esto, los tipos nuevos caen al
   default del navegador y desentonan junto a los botones de marca. */
input[type=text], input[type=password], input[type=search], input[type=email],
input[type=tel], input[type=number], input[type=month], input[type=date],
textarea, select {
  font-size: var(--fs-base);
  font-family: inherit;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 150ms ease-out, box-shadow 150ms ease-out;
}
/* select conserva su flecha nativa (appearance:none la borraría). */
select { appearance: auto; -webkit-appearance: auto; }
/* month/date sí conservan el icono del picker. */
input[type=month], input[type=date] { -webkit-appearance: auto; appearance: auto; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input[type=search]::-webkit-search-decoration { -webkit-appearance: none; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
input:hover:not(:focus), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: var(--tertiary); }
textarea { resize: vertical; min-height: 80px; }
button[type=submit] {
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 13px 20px;
  border-radius: 10px;
  font-size: var(--fs-md);
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
}
button[type=submit]:hover { background: var(--brand-hover); }

.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 6px; }

.form-error {
  background: var(--tint-danger-bg);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: var(--fs-sm);
  margin-bottom: 4px;
}
.form-error ul { margin: 0; padding-left: 20px; }

.checkbox-row {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-sm);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
}
.checkbox-row input[type=checkbox] {
  width: 18px;
  height: 18px;
  margin: 0;
}
.top-gap { margin-top: 6px; }

.image-preview {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  background: var(--surface-2);
  border-radius: 10px;
}
.image-preview img {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}
small.muted { font-size: var(--fs-xs); color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
input[type=file] {
  font-size: var(--fs-sm);
  font-family: inherit;
  padding: 8px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
}

.thumb {
  width: 60px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
}
.thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--tertiary);
  font-size: 18px;
  font-weight: 400;
}

/* ═══════════ Tabs + inline action forms ═══════════ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin: 0 0 18px;
}
.tab {
  display: inline-block;
  padding: 10px 14px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.inline-form { display: inline-block; margin: 0; }
.inline-form button {
  padding: 8px 14px;
  font-size: var(--fs-sm);
  font-family: inherit;
  font-weight: 600;
}

/* ═══════════ Barra de filtros (pagos, agua, lecturas) ═══════════ */
/* Fila única: chip de toggle + búsqueda + período, alturas alineadas con
   los inputs (los botones de filtro NO usan el tamaño hero del submit de
   formularios largos). */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
}
.filters .search-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filters input { padding: 9px 12px; }
.filters button[type=submit] {
  margin-top: 0;
  padding: 9px 16px;
  font-size: var(--fs-sm);
}
.filters .btn-link { padding: 9px 10px; font-size: var(--fs-sm); }

/* Chip: filtro de toggle ("Hoy") y etiqueta de tipo en tablas. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 150ms ease-out, color 150ms ease-out, border-color 150ms ease-out;
}
a.chip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.chip-on {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
a.chip-on:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
/* En celdas de tabla el chip es etiqueta, no acción: más compacto. */
td .chip { padding: 4px 10px; font-size: var(--fs-xs); }
.btn-link.danger { color: var(--danger); }
.btn-link.danger:hover { color: var(--danger); }

td.num { font-variant-numeric: tabular-nums; }

/* ═══════════ Member sessions (socio detail) ═══════════ */
.session-list { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.session-main { min-width: 0; }
.session-label { font-size: var(--fs-base); font-weight: 600; color: var(--text); }
.session-meta { font-size: var(--fs-xs); margin-top: 3px; line-height: 1.5; }

button.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 9px;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  margin-top: 0;
  white-space: nowrap;
}
button.btn-danger:hover { background: var(--danger-hover); }
button.btn-danger-outline {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 9px 16px;
  border-radius: 10px;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  margin-top: 0;
}
button.btn-danger-outline:hover { background: var(--tint-danger-bg); }

/* ═══════════ Dashboard (KPIs + charts) ═══════════ */
.dash-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin: 4px 0 18px; }
.dash-head h1 { margin: 0; }
.dash-head .dash-sub { color: var(--muted); font-size: var(--fs-sm); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.kpi-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--kpi-accent, var(--brand));
}
.kpi-label { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--muted); }
.kpi-value { font-size: var(--fs-kpi); font-weight: 800; letter-spacing: -0.5px; color: var(--text); line-height: 1.1; margin-top: 6px; }
.kpi-value small { font-size: var(--fs-md); font-weight: 600; color: var(--muted); }
.kpi-note { font-size: var(--fs-xs); color: var(--tertiary); margin-top: 4px; }
.kpi-accent-blue   { --kpi-accent: var(--brand); }
.kpi-accent-green  { --kpi-accent: var(--green); }
.kpi-accent-amber  { --kpi-accent: var(--accent); }
.kpi-accent-danger { --kpi-accent: var(--danger); }

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 22px;
}
@media (max-width: 780px) { .dash-grid { grid-template-columns: 1fr; } }
.chart-card, .panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.chart-card h2, .panel-card h2 { font-size: var(--fs-md); margin: 0 0 4px; }
.chart-card .chart-sub, .panel-card .panel-sub { font-size: var(--fs-xs); color: var(--muted); margin: 0 0 12px; }
.chart-wrap { position: relative; height: 220px; }

.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-item {
  display: flex; align-items: baseline; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm);
}
.activity-item:last-child { border-bottom: none; }
.activity-when { color: var(--tertiary); font-size: 11px; white-space: nowrap; min-width: 74px; }
.activity-text { color: var(--text); }
.activity-text .muted { color: var(--muted); }

.dash-quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.dash-quick a {
  text-decoration: none; font-size: var(--fs-sm); font-weight: 600;
  color: var(--brand); background: var(--brand-soft);
  padding: 8px 14px; border-radius: 10px;
}
.dash-quick a:hover { background: var(--surface-2); }

/* ═══════════ Caseta booth surface ═══════════
   Shares this sheet but uses a simple top-bar header (no sidebar). */
header {
  background: var(--surface);
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
header .brand {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--brand);
  letter-spacing: -0.3px;
  text-decoration: none;
}
.userbar { display: flex; align-items: center; gap: 12px; font-size: var(--fs-xs); color: var(--muted); flex-wrap: wrap; }
.header-link {
  font-size: var(--fs-xs);
  color: var(--muted);
  text-decoration: none;
  padding: 5px 9px;
  border-radius: 7px;
}
.header-link:hover { background: var(--brand-soft); color: var(--brand); }
header .logout-form { display: inline; }
header .logout-form button, .userbar .logout-form button {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--fs-xs);
  padding: 5px 9px;
  border-radius: 7px;
}
header .logout-form button:hover, .userbar .logout-form button:hover { background: var(--brand-soft); color: var(--brand); }

/* Error flash (booth login) — was previously unstyled and rendered as success green. */
.flash-error { background: var(--tint-danger-bg); color: var(--danger); }

/* ═══════════ Banner de aviso (cola de lecturas: valida antes del corte) ═══════════ */
.banner {
  padding: 11px 15px;
  background: var(--tint-blue-bg, var(--surface-alt));
  color: var(--text);
  border-radius: 9px;
  font-size: var(--fs-sm);
  margin-bottom: 14px;
}
.banner-warn {
  background: var(--tint-danger-bg);
  color: var(--danger);
  font-weight: 500;
}

/* ═══════════ Alertas agrupadas (domiciliación) ═══════════
   Una tarjeta por TIPO de falla, no una por socio: la causa y el arreglo se
   escriben una vez y abajo va la lista de a quién le pasó. */
.alert-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.alert-group > header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--tint-neutral-bg);
  border-bottom: 1px solid var(--border);
}
.alert-group.sev-danger > header { background: var(--tint-danger-bg); }
.alert-group.sev-amber  > header { background: var(--tint-amber-bg); }
.alert-group > header h2 {
  margin: 0;
  font-family: inherit;
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text);
}
.alert-group .alert-count {
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
}
.alert-group .alert-why {
  padding: 11px 16px;
  font-size: var(--fs-sm);
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.alert-group .alert-fix {
  padding: 10px 16px;
  font-size: var(--fs-sm);
  color: var(--muted);
  background: var(--tint-neutral-bg);
  border-bottom: 1px solid var(--border);
}
.alert-group .alert-fix code {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: var(--fs-xs);
  background: var(--tint-neutral-bg);
  padding: 2px 6px;
  border-radius: 5px;
}
.alert-group ul { list-style: none; margin: 0; padding: 0; }
.alert-group li {
  padding: 10px 16px;
  font-size: var(--fs-sm);
  display: flex;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
}
.alert-group li + li { border-top: 1px solid var(--border); }
.alert-group li .who { font-weight: 600; }
.alert-group li .what { color: var(--muted); flex: 1 1 320px; }
.alert-group li a { white-space: nowrap; }

.alert-clear {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--tint-green-bg);
  color: var(--tint-green-fg);
  font-size: var(--fs-sm);
  font-weight: 500;
  margin-bottom: 18px;
}
tfoot td { font-weight: 700; border-top: 2px solid var(--border); }

/* Título de sección dentro de una página (mismo aire que h1, un peldaño abajo). */
.section-title {
  margin: 26px 0 6px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text);
}

/* Tabla ancha: scrollea sola en lugar de empujar la página entera. */
.table-scroll { overflow-x: auto; }
.table-scroll table { min-width: 720px; }

/* En un comando para copiar, `--clave` NO debe leerse como una raya larga: en
   monoespaciada los guiones dobles se pegan. Sin ligaduras y con un pelo de
   tracking se distinguen los dos guiones. */
code, .alert-fix code, table code {
  font-variant-ligatures: none;
  letter-spacing: 0.03em;
}

/* Fila apagada (lecturista de baja): visible pero claramente inactiva. Si
   desapareciera de la lista, nadie podría reactivarla ni entender por qué se
   fue. */
.row-off td { opacity: 0.55; }
.row-off td:last-child { opacity: 1; }
.rename-form input {
  min-width: 180px;
  padding: 6px 9px;
  font-size: var(--fs-sm);
}

/* Tabla con tope de alto: scrollea dentro de su tarjeta en vez de empujar la
   página. Pensada para listas que crecen solas (una fila por versión de la
   app): con el encabezado pegado, se sabe qué columna es aunque se scrollee. */
.table-cap {
  max-height: 246px;   /* ~4 filas y media: se ve que hay más abajo */
  overflow-y: auto;
}
.table-cap table { box-shadow: none; border: none; border-radius: 0; }
.table-cap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* ── Lecturas de agua: anterior → actual ──────────────────────────────────
   La lectura anterior iba como texto gris bajo el OCR y la fecha de la toma
   no se mostraba, así que revisar una lectura obligaba a abrir otra pantalla
   para saber contra qué comparar. Aquí el par se lee de corrido, que es como
   se revisa un medidor. */
.lectura-flow {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.lectura-ant {
  color: var(--muted, #5b6b86);
  font-size: var(--fs-sm);
}
.lectura-arrow { color: var(--muted, #5b6b86); font-size: var(--fs-sm); }
.lectura-act { font-weight: 700; font-size: 1.05em; }
.fecha-cell { white-space: nowrap; }

/* ── Historial del socio ─────────────────────────────────────────────────── */
/* El historial es un expediente con tablas, no un formulario: la tarjeta
   angosta de 460px obligaba a scrollear cada tabla dentro de su bloque.
   Aquí se ensancha hasta donde da la página. */
.form-card.form-card--wide { max-width: 900px; }

.hist-grid {
  display: grid;
  /* 180px da exactamente las cuatro columnas en la tarjeta ancha, y baja a
     dos en pantallas chicas. Con menos, auto-fit abría seis huecos y las
     cuatro cifras se estiraban hasta perder relación entre sí. */
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.hist-stat {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--card, #fff);
}
.hist-stat .v {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.hist-stat .l {
  font-size: var(--fs-sm);
  color: var(--muted, #5b6b86);
  margin-top: 2px;
}
.hist-stat.warn .v { color: var(--danger, #b3261e); }
.hist-stat.ok .v { color: var(--ok, #1e6b3a); }

/* Cada bloque del historial va plegado salvo el primero: el expediente
   completo de un socio son cinco tablas y abrirlas todas de golpe obliga a
   scrollear mucho para encontrar una sola cosa. */
.hist-section { margin-bottom: 14px; }
.hist-section > summary {
  cursor: pointer;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--wash, #f5f8fd);
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hist-section > summary::-webkit-details-marker { display: none; }
.hist-section > summary::before {
  content: "▸";
  color: var(--muted, #5b6b86);
  transition: transform .15s ease;
}
.hist-section[open] > summary::before { transform: rotate(90deg); }
.hist-section > summary .count {
  margin-left: auto;
  font-weight: 400;
  color: var(--muted, #5b6b86);
  font-size: var(--fs-sm);
}
.hist-section[open] > summary {
  border-radius: 10px 10px 0 0;
  border-bottom: none;
}
.hist-body {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 10px 10px;
  padding: 4px 14px 14px;
}
/* La tabla scrollea DENTRO de su bloque. Sin esto se desbordaba de la
   tarjeta y las últimas columnas quedaban fuera de la página, sin forma de
   alcanzarlas. */
.hist-body { overflow-x: auto; }
.hist-body table {
  box-shadow: none;
  min-width: 420px;   /* por debajo de esto las columnas se encabalgan */
}
@media (prefers-reduced-motion: reduce) {
  .hist-section > summary::before { transition: none; }
}

/* Lectura sin foto: se dice, no se deja una imagen rota. Pasa en todas las
   cargadas del control del club, que es hoy la mayoría. */
.sin-foto {
  display: inline-block;
  padding: 5px 10px;
  border: 1px dashed var(--border, #dce4f0);
  border-radius: 6px;
  color: var(--muted, #5b6b86);
  font-size: var(--fs-xs);
  white-space: nowrap;
}

/* Accesos directos por mes en la cola de lecturas. El <input type="month">
   seguía disponible para cualquier mes viejo, pero la consulta real —"todas
   las de julio"— tenía que ser un solo toque. */
/* Paso de mes: solo las flechas. El desplegable vive dentro de .filters,
   junto al buscador de socio, para que los dos se lean como un solo filtro. */
.mes-nav { display: flex; align-items: center; gap: 6px; flex: none; }
.mes-paso {
  display: grid; place-items: center;
  /* 44×44: es el mínimo táctil, y esta es una pantalla que se usa en
     tableta en el mostrador. */
  width: 44px; height: 44px; flex: none;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 1.15rem; line-height: 1; text-decoration: none; color: inherit;
  background: var(--surface);
}
.mes-paso:hover { border-color: var(--brand); }
/* El extremo del historial se apaga pero no se quita: si desapareciera, las
   flechas cambiarían de lugar en cada mes. */
.mes-paso.off { opacity: .38; cursor: default; }
.search-form select {
  font: inherit; padding: 9px 12px; border-radius: 8px;
  /* Estaba en #fff fijo con color heredado: en modo oscuro eso daba texto
     casi blanco sobre blanco, 1.19:1. */
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  max-width: 22rem;
}


/* Resumen del filtro vigente: sin esto, una cuenta filtrada se lee como si
   fuera de todo el club. */
.filtro-activo {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin: 0 0 12px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  font-size: var(--fs-sm);
}
.filtro-activo b { color: var(--text); }
/* Salidas del estado vacío: el vacío tiene que ofrecer el siguiente paso,
   no solo constatar que no hay nada. */
.empty-salidas { display: flex; gap: 14px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }

/* El domicilio bajo el nombre: es lo que hace verificable una búsqueda por
   calle. Va entre el nombre y la clave porque en el mostrador se confirma
   por dirección antes que por número de socio. */
.domicilio { font-size: var(--fs-sm); color: var(--text); font-weight: 600; letter-spacing: .01em; }

/* Nueve columnas en el ancho disponible dejaban "CARLOS ANDRES DOMINGUEZ
   CABRERA" en cuatro renglones. Con 300 filas eso es mucho scroll vertical
   a cambio de nada, así que la tabla pide su ancho y .table-scroll se
   encarga de que la página no se vaya de lado. */
.table-scroll table.tabla-lecturas { min-width: 960px; }
/* 210 px caben "CARLOS ANDRES" / "DOMINGUEZ CABRERA" en dos renglones, que
   es lo que hace la fila baja sin empujar ACCIÓN fuera de la pantalla. */
.tabla-lecturas th:first-child,
.tabla-lecturas td:first-child { width: 210px; }
/* Quién capturó cabe en una palabra; el detalle vive en el title. */
.tabla-lecturas td:nth-last-child(2) { white-space: nowrap; }

/* ── Barra de filtros de lecturas ──────────────────────────────────────
   El buscador ocupaba un ancho fijo y dejaba media pantalla vacía a la
   derecha, con el marcador cortado a media palabra. Aquí el formulario se
   estira y las flechas de mes se van al extremo, que es donde se esperan. */
.filters:has(.mes-nav) { flex-wrap: nowrap; align-items: stretch; }
.filters:has(.mes-nav) .search-form { flex: 1 1 auto; flex-wrap: nowrap; min-width: 0; }
/* El campo se come el sobrante; el resto conserva su tamaño natural. */
.filters .search-form input[type="search"] { flex: 1 1 auto; min-width: 0; }
.filters .search-form select { flex: 0 0 auto; }
.filters .search-form button[type="submit"],
.filters .search-form .btn-link { flex: 0 0 auto; white-space: nowrap; }
.filters:has(.mes-nav) .mes-nav { margin-left: auto; }

/* Debajo de 900 px el renglón único deja de caber: primero se van las
   flechas a su propia línea, y en teléfono cada control ocupa el ancho
   completo, que es lo único que se puede tocar con el pulgar. */
@media (max-width: 900px) {
  .filters:has(.mes-nav) { flex-wrap: wrap; }
  .filters:has(.mes-nav) .search-form { flex: 1 1 100%; }
  .filters:has(.mes-nav) .mes-nav { margin-left: 0; }
}
@media (max-width: 620px) {
  .filters:has(.mes-nav) .search-form { flex-wrap: wrap; }
  .filters .search-form input[type="search"],
  .filters .search-form select {
    flex: 1 1 100%;
    /* El tope de 22rem le impedía ocupar el renglón, así que el botón se
       le acomodaba al lado y se salía de la pantalla. */
    max-width: none;
  }
  .filters .search-form button[type="submit"] { flex: 1 1 auto; }
  .filters .search-form .btn-link { flex: 0 0 auto; }
}
/* El resumen del filtro y el aviso de tope se apilan en pantallas chicas
   en vez de apretar el texto contra el enlace. */
@media (max-width: 620px) {
  .filtro-activo { flex-direction: column; align-items: flex-start; gap: 6px; }
}

/* El nombre del socio abre su historial de lecturas. Se ve como enlace
   pero conserva el peso del nombre: sigue siendo el título de la fila. */
.socio-link { color: var(--brand); font-weight: 700; text-decoration: none; }
.socio-link:hover { text-decoration: underline; }
/* Paginación: anterior · en dónde voy · siguiente. Una barra con sesenta
   números no la usa nadie. */
.paginacion {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 0 0 14px; padding: 8px 2px;
  font-size: var(--fs-sm); flex-wrap: wrap;
}
.paginacion .btn-link { padding: 8px 12px; }

/* La nota del lecturista al pedir revisión: es el porqué, y sin ella
   gerencia solo ve "revísala" sin saber qué mirar. */
.nota-lecturista { margin-top: 4px; font-style: italic; max-width: 26ch; }

/* ─────────────────────────────────────────────────────────────────────
   Cola de lecturas — densidad
   ─────────────────────────────────────────────────────────────────────
   Eran nueve columnas y las acciones se salían de la pantalla: confirmar
   una lectura obligaba a desplazarse a la derecha en cada fila. Quedaron
   seis. Lo que se fue no desapareció, se metió donde ya se estaba mirando:
   fecha y quién capturó viven bajo el nombre, y el cargo bajo el consumo.
   ───────────────────────────────────────────────────────────────────── */

/* El nombre en una sola línea: envolver "MA. DEL SAGRADO CORAZON SUAREZ DE
   ROMERO" en cuatro renglones estiraba la fila entera y volvía ilegible la
   columna más ancha. Completo en el title y en el expediente. */
.tabla-lecturas .col-socio { min-width: 15rem; max-width: 20rem; }
.tabla-lecturas .col-socio .socio-link {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tabla-lecturas .domicilio { font-weight: 600; }

/* Clave, hora y quién capturó: el renglón de contexto. Se consulta cuando
   algo no cuadra, no en cada fila, así que va en el tamaño más chico. */
.tabla-lecturas .fila-meta {
  margin-top: 2px; font-size: var(--fs-xs, .75rem); color: var(--muted);
}
.tabla-lecturas .fila-meta a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.tabla-lecturas .fila-meta a:hover { color: var(--brand); }

.tabla-lecturas .col-consumo { white-space: nowrap; }
.tabla-lecturas .col-revisar { max-width: 18rem; }

/* El encabezado se queda mientras se recorren 137 filas; sin esto, a la
   mitad de la lista ya no se sabe qué columna es cuál. */
.tabla-lecturas thead th {
  position: sticky; top: 0; z-index: 1;
}

/* Las acciones no se parten: confirmar y corregir tienen que caber sin
   scroll horizontal, que era el defecto que hacía la tabla inusable. */
.tabla-lecturas .col-accion { white-space: nowrap; }
.tabla-lecturas .row-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

/* ── Foto: miniatura que abre el diálogo ── */
.foto-btn {
  padding: 0; border: 1px solid var(--border); border-radius: 8px;
  background: none; cursor: zoom-in; line-height: 0; overflow: hidden;
  transition: border-color 120ms ease-out, transform 120ms ease-out;
}
.foto-btn:hover { border-color: var(--brand); transform: scale(1.03); }
.foto-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.foto-btn img { width: 96px; height: 72px; object-fit: cover; display: block; }

.foto-modal {
  width: min(92vw, 720px); max-height: 90vh; padding: 0;
  border: none; border-radius: 14px; background: var(--surface, #fff);
  color: inherit; box-shadow: 0 24px 60px rgb(0 0 0 / .35);
}
.foto-modal::backdrop { background: rgb(0 0 0 / .6); }
.foto-modal header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.foto-modal img {
  display: block; width: 100%; max-height: 58vh; object-fit: contain;
  background: #111;
}
/* El número capturado contra el que leyó la foto, lado a lado: es
   literalmente la comparación que se viene a hacer. */
.foto-modal .foto-cmp {
  display: flex; gap: 28px; padding: 12px 16px; border-top: 1px solid var(--border);
}
.foto-modal .foto-cmp span { display: block; font-size: var(--fs-xs, .75rem); }
.foto-modal .foto-cmp b { font-size: 1.15rem; }
.foto-modal footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border);
}
.foto-cerrar {
  border: none; background: none; font-size: 1.6rem; line-height: 1;
  cursor: pointer; color: var(--muted); padding: 0 4px;
}
.foto-cerrar:hover { color: inherit; }

@media (prefers-reduced-motion: reduce) {
  .foto-btn { transition: none; }
  .foto-btn:hover { transform: none; }
}

/* La bandera es una etiqueta de una línea. El motivo completo va en el
   title: la frase entera envolvía dentro del globo y estiraba la fila. */
.tabla-lecturas .bandera { white-space: nowrap; }

/* Corregir y rechazar, plegados. Confirmar es el 90% de los casos; los
   dos campos de la corrección no tienen por qué ocupar sitio en las 137
   filas para usarse en tres. */
.mas-acciones > summary {
  cursor: pointer; font-size: var(--fs-sm); color: var(--muted);
  list-style: none; padding: 2px 0; width: max-content;
}
.mas-acciones > summary::-webkit-details-marker { display: none; }
.mas-acciones > summary::after { content: ' ▾'; }
.mas-acciones[open] > summary::after { content: ' ▴'; }
.mas-acciones > summary:hover { color: var(--brand); }
.mas-acciones-cuerpo {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 8px;
}
.mas-acciones-cuerpo .inline-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.mas-acciones-cuerpo input[type="number"] { width: 7rem; }
.mas-acciones-cuerpo input[type="text"] { width: 10rem; }
/* La lectura del OCR en una línea, alineada con el número que acompaña. */
.tabla-lecturas .linea-foto { white-space: nowrap; font-size: var(--fs-sm); }

/* ── Selección múltiple ── */
.tabla-lecturas .col-sel { width: 2.5rem; text-align: center; }
.tabla-lecturas .col-sel input { width: 1.05rem; height: 1.05rem; cursor: pointer; }

/* Aparece al marcar la primera y se queda a la vista mientras se recorre:
   marcar diez filas y perder el botón al hacer scroll es el defecto obvio. */
.sel-barra {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 14px;
  margin: 0 0 12px; padding: 10px 14px;
  border: 1px solid var(--brand); border-radius: 10px;
  background: var(--surface, #fff);
  box-shadow: 0 6px 18px rgb(0 0 0 / .08);
}
.sel-barra .sel-cuenta { font-size: 1.1rem; }
.sel-barra button { margin: 0; }

/* ── Navegación entre fotos dentro del diálogo ── */
.foto-nav { display: flex; align-items: center; gap: 6px; }
.foto-nav button[data-paso] {
  border: 1px solid var(--border); background: none; border-radius: 6px;
  width: 2rem; height: 2rem; font-size: 1.1rem; line-height: 1; cursor: pointer;
  color: inherit;
}
.foto-nav button[data-paso]:hover { border-color: var(--brand); color: var(--brand); }
#foto-pos { font-size: var(--fs-sm); min-width: 5.5rem; text-align: center; }

/* Marcar mientras se mira la foto: es la misma casilla de la fila. */
.foto-marcar { display: flex; align-items: center; gap: 8px; margin-left: auto; cursor: pointer; }
.foto-marcar input { width: 1.05rem; height: 1.05rem; cursor: pointer; }

/* El atributo `hidden` no basta: `display:flex` de la regla de arriba le
   gana a la hoja del navegador, así que la barra se veía con "0
   seleccionadas". Ocultar explícitamente es la única forma con un display
   declarado. */
.sel-barra[hidden] { display: none; }

/* La lectura del OCR va PEGADA al número con el que se compara: la fila de
   números se alinea a la derecha y esta línea quedaba a la izquierda, tan
   lejos que se leía como si fuera de la columna siguiente. Alineada debajo,
   la comparación se hace de arriba abajo, que es como se mira. */
.tabla-lecturas .linea-foto { text-align: right; }

/* Separador de grupo en los resultados de búsqueda de lecturas: dice si lo
   de abajo coincidió por acción, por nombre o por domicilio. */
.group-row td {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 12px;
  border-top: 1px solid var(--border);
}
