/* ══════════════════════════════════════════════════════════
   AUTO / Scraper Page — Estilo versión manual
   ══════════════════════════════════════════════════════════ */

/* Reutiliza las variables CSS de styles.css */
:root {
  --ink: #172026;
  --muted: #65717a;
  --line: #dce3e8;
  --soft: #f4f7f9;
  --paper: #ffffff;
  --blue: #1f6feb;
  --blue-soft: #e8f1ff;
  --green: #087f5b;
  --green-soft: #e6fcf5;
  --red: #c92a2a;
  --red-soft: #fff0f0;
  --amber: #b7791f;
  --amber-soft: #fff4e6;
  --violet: #6741d9;
  --violet-soft: #f0ebff;
}

/* ── Layout ── */
.auto-container {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Body override for auto page ── */
body {
  background:
    linear-gradient(180deg, rgba(31, 111, 235, .10), rgba(8, 127, 91, .06) 280px, transparent 520px),
    #eef3f6;
}

/* ── Header / Toolbar ── */
.auto-header {
  background: rgba(255, 255, 255, .78);
  border: 1px solid rgba(220, 227, 232, .9);
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(23, 32, 38, .06);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 18px;
  margin: 20px auto 0;
  width: min(1440px, calc(100% - 32px));
}

.auto-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auto-logo-icon {
  font-size: 28px;
  line-height: 1;
}

.auto-title {
  font-size: 30px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}

.auto-subtitle {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  margin: 0;
  text-transform: uppercase;
}

.auto-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.auto-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: #27313a;
  text-decoration: none;
  transition: opacity .2s;
}

.auto-nav-link:hover {
  opacity: .85;
}

.auto-nav-link.active {
  background: var(--blue);
}

.action-btn-light {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}

.action-btn-light:hover {
  background: var(--soft);
  opacity: 1;
}

/* Dashboard introduction */
.dashboard-intro {
  align-items: flex-end;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  padding: 4px 2px 0;
}

.eyebrow {
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  margin: 0 0 4px;
  text-transform: uppercase;
}

.dashboard-intro h2 {
  color: var(--ink);
  font-size: 24px;
  margin: 0;
}

.dashboard-intro p:not(.eyebrow) {
  color: var(--muted);
  font-size: 14px;
  margin: 5px 0 0;
}

.dashboard-status {
  align-items: center;
  background: var(--green-soft);
  border: 1px solid #b2f2dd;
  border-radius: 999px;
  color: var(--green);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  gap: 7px;
  padding: 7px 10px;
}

.dashboard-status span {
  background: var(--green);
  border-radius: 50%;
  height: 7px;
  width: 7px;
}

/* ── Shared card style ── */
.auto-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(23, 32, 38, .05);
}

/* ── Badge ── */
.badge-beta {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--amber-soft);
  color: var(--amber);
  border: 1px solid #ffd8a8;
  white-space: nowrap;
}

/* ── Scraper Card ── */
.scraper-card {
  position: relative;
}

.scraper-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 20px 0;
  gap: 16px;
}

.scraper-card-title {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.scraper-card-icon {
  font-size: 22px;
  line-height: 1.3;
}

.scraper-card-title h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}

.scraper-card-title p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 4px 0 0;
}

/* ── Scraper Form ── */
.scraper-form {
  padding: 16px 20px 14px;
}

.scraper-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.scraper-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.scraper-field label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.scraper-field .input {
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  transition: border-color .2s;
  min-height: 42px;
}

.scraper-field .input:focus {
  border-color: var(--blue);
  outline: 2px solid rgba(31, 111, 235, .20);
  outline-offset: -1px;
}

/* ── Password Wrapper ── */
.password-wrapper {
  display: flex;
  gap: 6px;
}

.password-wrapper .input {
  flex: 1;
  min-width: 0;
}

.toggle-password {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
}

.toggle-password:hover {
  background: #e2e8f0;
  border-color: #b0b8c0;
}

/* ── Scraper Footer ── */
.scraper-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.scraper-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  transition: opacity .2s, transform .15s;
  min-width: 200px;
  justify-content: center;
}

.scraper-btn:hover {
  opacity: .88;
  transform: translateY(-1px);
}

.scraper-btn:active {
  transform: translateY(0);
}

.scraper-btn-icon {
  font-size: 18px;
  line-height: 1;
}

.scraper-schedule {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Toggle Switch ── */
.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: relative;
  width: 36px;
  height: 20px;
  background: #cbd5e1;
  border-radius: 10px;
  transition: background .25s ease;
  flex-shrink: 0;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform .25s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

.toggle-switch input:checked + .toggle-track {
  background: var(--blue);
}

.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(16px);
}

.toggle-switch input:focus-visible + .toggle-track {
  box-shadow: 0 0 0 3px rgba(31, 111, 235, .25);
}

.toggle-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.schedule-time {
  display: flex;
  align-items: center;
  gap: 6px;
}

.schedule-time label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.schedule-range-hint {
  color: var(--blue);
  flex-basis: 100%;
  font-size: 12px;
  line-height: 1.4;
  margin: 0;
  text-align: right;
}

.scraper-field .input:disabled {
  background: var(--soft);
  color: var(--muted);
  cursor: not-allowed;
}

.input-sm {
  width: 100px;
  text-align: center;
  font-size: 14px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

/* ── Data Actions Bar ── */
.auto-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.auto-actions-left,
.auto-actions-right {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity .2s;
  color: #fff;
  white-space: nowrap;
}

.action-btn:hover {
  opacity: .85;
}

.action-btn-primary {
  background: var(--blue);
}

.action-btn-danger {
  background: var(--red);
}

.action-btn-secondary {
  background: #27313a;
}

.action-btn.action-btn-light {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}

/* Configuration modal */
.modal-open {
  overflow: hidden;
}

.settings-overlay {
  align-items: center;
  padding: 20px;
  z-index: 1050;
}

#authModal,
#confirmModal {
  z-index: 1200;
}

.settings-modal {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(23, 32, 38, .24);
  display: flex;
  flex-direction: column;
  max-height: min(860px, calc(100vh - 40px));
  max-width: 900px;
  overflow: hidden;
  width: 100%;
}

.settings-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 20px;
  justify-content: space-between;
  padding: 20px 22px;
}

.settings-header h2 {
  color: var(--ink);
  font-size: 24px;
  margin: 0;
}

.settings-header p:not(.eyebrow) {
  color: var(--muted);
  font-size: 14px;
  margin: 5px 0 0;
}

.icon-button {
  align-items: center;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 24px;
  height: 38px;
  justify-content: center;
  line-height: 1;
  width: 38px;
}

.icon-button:hover {
  background: #e7edf1;
  color: var(--ink);
}

.settings-content {
  background: #f7f9fb;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 18px 22px;
}

.settings-section {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.settings-section-heading {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: auto 1fr auto;
  padding: 17px 18px;
}

.settings-section-heading h3,
.maintenance-section h3 {
  color: var(--ink);
  font-size: 17px;
  margin: 0;
}

.settings-section-heading p,
.maintenance-section p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin: 3px 0 0;
}

.settings-section-icon {
  font-size: 18px;
  line-height: 1.3;
}

.settings-section .scraper-form {
  padding: 18px;
}

.scraper-credentials-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.maintenance-section {
  align-items: center;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  padding: 17px 18px;
}

.settings-footer {
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  padding: 14px 22px;
}

.history-modal {
  max-width: 980px;
}

.history-modal-content {
  background: #f7f9fb;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 18px 22px;
}

.history-toolbar {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  color: var(--ink);
  display: flex;
  font-size: 14px;
  font-weight: 700;
  justify-content: space-between;
  padding: 12px 14px;
}

.history-modal .history-list {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  flex: 1 1 auto;
  max-height: min(520px, calc(100vh - 280px));
  min-height: 220px;
}

/* ── KPI Section ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.kpi-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}

.kpi-card:nth-child(1) { background: var(--blue-soft); border-color: #bfdbfe; }
.kpi-card:nth-child(2) { background: var(--violet-soft); border-color: #d0bfff; }
.kpi-card:nth-child(3) { background: var(--red-soft); border-color: #ffc9c9; }
.kpi-card:nth-child(4) { background: var(--amber-soft); border-color: #ffd8a8; }
.kpi-card:nth-child(5) { background: #eef2ff; border-color: #c7d2fe; }

.kpi-card:hover,
.kpi-card.active {
  border-color: currentColor;
  box-shadow: 0 8px 24px rgba(23, 32, 38, .14);
}

.kpi-card.active {
  transform: translateY(-1px);
}

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

.kpi-value {
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 700;
  line-height: 1.05;
  color: var(--ink);
  display: block;
}

.kpi-card:nth-child(2) .kpi-value { color: var(--violet); }
.kpi-card:nth-child(3) .kpi-value { color: var(--red); }
.kpi-card:nth-child(4) .kpi-value { color: var(--amber); }

.kpi-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  display: block;
}

/* ── Period/Filters Bar ── */
.period-panel {
  align-items: end;
  background: rgba(255, 255, 255, .86);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(23, 32, 38, .05);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(170px, 220px) minmax(210px, 260px) minmax(220px, 1fr) auto;
  margin-bottom: 0;
  padding: 14px;
}

.period-panel label,
.period-range-label {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 7px;
  text-transform: uppercase;
}

.period-panel select,
.period-panel input[type="month"] {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: 15px;
  min-height: 42px;
  padding: 9px 11px;
  width: 100%;
}

.period-range {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  padding: 10px 12px;
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
}

.period-actions {
  display: flex;
  align-items: end;
  gap: 6px;
}

.btn-filter-pill {
  background: var(--amber-soft);
  border: 1px solid #ffd8a8;
  border-radius: 999px;
  color: var(--amber);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
  white-space: nowrap;
  transition: opacity .2s;
}

.btn-filter-pill:hover {
  opacity: .8;
}

/* ── Split View ── */
.split-view {
  display: grid;
  grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
  gap: 12px;
}

.split-left,
.split-right {
  min-height: 520px;
  padding: 18px;
}

.split-left {
  background: linear-gradient(180deg, #ffffff, #f8fbfd);
}

.split-right {
  background: linear-gradient(180deg, #ffffff, #fbfcfd);
}

.split-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 8px;
  display: block;
  text-transform: uppercase;
}

/* ── Search / People ── */
.search-field {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 16px;
  padding: 12px;
  margin-bottom: 10px;
}

.search-field:focus {
  border-color: var(--blue);
  outline: 2px solid rgba(31, 111, 235, .20);
  outline-offset: -1px;
}

.people-list {
  max-height: 610px;
  overflow: auto;
}

.people-loading {
  color: var(--muted);
  padding: 20px;
  text-align: center;
  font-size: 14px;
}

.person-row {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: block;
  padding: 12px 10px;
  text-align: left;
  width: 100%;
  transition: background .15s;
}

.person-row:hover,
.person-row.active {
  background: var(--soft);
}

.person-row strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--ink);
}

.person-row span {
  font-size: 13px;
  color: var(--muted);
}

/* ── Person Empty ── */
.person-empty {
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 420px;
  text-align: center;
}

.person-empty-icon {
  font-size: 32px;
  opacity: .5;
}

.person-empty p {
  font-size: 14px;
  color: var(--muted);
}

/* ── Person Detail ── */
.person-header {
  align-items: start;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.person-name {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}

.person-id {
  color: var(--muted);
  font-size: 14px;
  margin: 4px 0 0;
  font-family: monospace;
}

.person-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.summary-item {
  background: linear-gradient(180deg, var(--soft), #ffffff);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  display: block;
}

.summary-item strong {
  display: block;
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1.05;
  font-weight: 700;
  color: var(--ink);
}

.summary-alert-item strong {
  color: var(--red);
}

/* ── Table ── */
.table-wrapper {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  width: 100%;
}

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

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

.data-table th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  position: sticky;
  top: 0;
  text-transform: uppercase;
  z-index: 1;
}

.data-table tbody tr:nth-child(even) {
  background: #fbfdfe;
}

.data-table tbody tr:hover td {
  background: var(--soft);
}

.data-table td {
  color: var(--ink);
}

.chip {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
}

.chip.day {
  background: var(--green-soft);
  color: var(--green);
}

.chip.night {
  background: var(--blue-soft);
  color: var(--blue);
}

.chip.na {
  background: #edf0f2;
  color: var(--muted);
}

.chip.movement {
  background: #eef2ff;
  color: #4f46e5;
}

.alert-text {
  color: var(--red);
  font-weight: 700;
  font-size: 13px;
}

.ok-text {
  color: var(--green);
  font-weight: 700;
  font-size: 13px;
}

/* ── History Section ── */
.history-section {
  margin-top: 4px;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  gap: 8px;
}

.history-header h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

.reload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 700;
  background: #27313a;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity .2s;
  white-space: nowrap;
}

.reload-btn:hover {
  opacity: .85;
}

.reload-icon {
  display: inline-block;
}

.reload-btn.spinning .reload-icon {
  animation: spin .6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.history-list {
  max-height: 340px;
  overflow-y: auto;
}

.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 32px 16px;
  color: var(--muted);
  font-size: 14px;
}

.history-empty-icon {
  font-size: 28px;
  opacity: .5;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  transition: background .15s;
  gap: 14px;
}

.history-item:hover {
  background: var(--soft);
}

.history-item:last-child {
  border-bottom: none;
}

.history-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.history-dates {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-meta {
  font-size: 12px;
  color: var(--muted);
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.history-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.history-status.pending { background: #fef3c7; color: #92400e; }
.history-status.running { background: #dbeafe; color: #1e40af; animation: pulse 1.5s ease-in-out infinite; }
.history-status.completed { background: #d1fae5; color: #065f46; }
.history-status.failed { background: #fee2e2; color: #991b1b; }
.history-status.scheduled { background: #e0e7ff; color: #3730a3; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .6; }
}

.btn-history-view {
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  background: var(--blue-soft);
  color: var(--blue);
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
}

.btn-history-view:hover {
  background: #dbeafe;
}

.btn-history-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  font-size: 13px;
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid #ffc9c9;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
}

.btn-history-delete:hover {
  background: #fee2e2;
}

/* ── Modal overrides for auto page ── */
.modal-title {
  font-size: 20px;
  margin: 0 0 8px;
  font-weight: 700;
  color: var(--ink);
}

.modal-field {
  margin-bottom: 16px;
}

.modal-field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}

.modal-field .input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 16px;
  padding: 12px;
}

.modal-field .input:focus {
  border-color: var(--blue);
  outline: 2px solid rgba(31, 111, 235, .20);
  outline-offset: -1px;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .2s;
  color: #fff;
}

.btn:hover { opacity: .85; }

.btn-primary { background: var(--blue); }
.btn-secondary { background: #27313a; }
.btn-danger { background: var(--red); }

.btn-sm {
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  cursor: pointer;
  transition: background .15s;
}

.btn-sm:hover {
  background: #e2e8f0;
}

/* ── Responsive ── */
@media (max-width: 960px) {
  .auto-header {
    align-items: stretch;
    flex-direction: column;
  }

  .auto-header-actions {
    justify-content: stretch;
  }

  .auto-header-actions .action-btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .kpi-grid,
  .period-panel,
  .split-view {
    grid-template-columns: 1fr;
  }

  .period-panel {
    grid-template-columns: 1fr;
  }

  .auto-header {
    margin-top: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .auto-container {
    width: calc(100% - 20px);
    padding: 14px 0 20px;
  }

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

  .scraper-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .schedule-range-hint {
    text-align: left;
  }

  .scraper-btn {
    width: 100%;
    min-width: unset;
  }

  .person-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-intro {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

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

@media (max-width: 640px) {
  .auto-header {
    padding: 14px;
  }

  .auto-title {
    font-size: 23px;
  }

  .auto-logo-icon {
    font-size: 24px;
  }

  .auto-header-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .auto-header-actions .action-btn {
    justify-content: center;
    min-width: 0;
    padding: 10px 8px;
  }

  .settings-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .settings-modal {
    border-radius: 8px 8px 0 0;
    max-height: calc(100vh - 20px);
  }

  .settings-header,
  .settings-content,
  .history-modal-content,
  .settings-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .maintenance-section {
    align-items: stretch;
    flex-direction: column;
  }

  .maintenance-section .action-btn {
    justify-content: center;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-card,
  .summary-item {
    padding: 13px;
  }

  .kpi-label,
  .summary-label {
    font-size: 12px;
  }

  .person-summary {
    grid-template-columns: 1fr;
  }

  .people-list {
    max-height: 320px;
  }

  .data-table th,
  .data-table td {
    font-size: 13px;
    padding: 10px 8px;
  }

  .history-header h2 {
    font-size: 18px;
  }
}

@media (max-width: 390px) {
  .settings-section-heading {
    grid-template-columns: auto 1fr;
  }

  .settings-section-heading .badge-beta {
    grid-column: 2;
    justify-self: start;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Impresión: solo datos del empleado y sus horas de ponche ── */
@media print {
  body {
    background: #fff !important;
  }

  /* Ocultar todo lo que no es el detalle del empleado */
  .auto-header,
  .dashboard-intro,
  .toast-container,
  .loading-overlay,
  .modal-overlay,
  #dashboard > .auto-card,
  .split-left,
  .person-empty {
    display: none !important;
  }

  .auto-container {
    width: 100%;
    margin: 0;
    padding: 0;
    gap: 0;
  }

  .split-view {
    display: block;
  }

  .split-right {
    background: #fff;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    min-height: 0;
    padding: 0;
  }

  .person-header {
    margin-bottom: 10px;
  }

  .person-summary {
    margin-bottom: 10px;
  }

  .summary-item {
    padding: 10px;
  }

  .table-wrapper {
    border: 0;
    overflow: visible;
  }

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

  .data-table th {
    position: static;
  }

  .data-table th,
  .data-table td {
    font-size: 12px;
    padding: 6px;
  }

  /* Conservar colores de chips, alertas y tarjetas al imprimir */
  .summary-item,
  .chip,
  .alert-text,
  .ok-text {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ══════════════════════════════════════════════════════════
   PASTE MODAL
   ══════════════════════════════════════════════════════════ */

.paste-modal {
  max-width: 720px;
  width: 90vw;
}

.paste-modal p {
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.paste-textarea {
  width: 100%;
  min-height: 280px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8125rem;
  line-height: 1.5;
  resize: vertical;
  white-space: pre;
  overflow-x: auto;
}
\n\n

/* ══════════════════════════════════════════════════════════
   AUDITORÍA DE MOVIMIENTOS — VISTA LIMPIA
   ══════════════════════════════════════════════════════════ */

.movement-eye-cell {
  text-align: center !important;
  white-space: nowrap;
}

.movement-eye-empty {
  color: #c5cdd4;
  display: inline-flex;
  justify-content: center;
  min-width: 38px;
}

.movement-eye-btn {
  align-items: center;
  background: #f4f8ff;
  border: 1px solid #c7d7f4;
  border-radius: 8px;
  color: #2459a9;
  cursor: pointer;
  display: inline-flex;
  font-size: 15px;
  height: 32px;
  justify-content: center;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .15s;
  width: 38px;
}

.movement-eye-btn:hover {
  background: #e8f1ff;
  border-color: #7fa7e8;
  box-shadow: 0 4px 12px rgba(31, 111, 235, .12);
  transform: translateY(-1px);
}

.movements-modal {
  max-width: 700px;
  overflow: hidden;
  padding: 0;
  width: min(700px, calc(100vw - 32px));
}

.movements-modal-header {
  align-items: flex-start;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 20px 22px 17px;
}

.movements-modal-header .modal-title {
  font-size: 21px;
  line-height: 1.2;
  margin: 0;
}

.movements-modal-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin: 6px 0 0;
}

.movements-modal-body {
  background: #f6f8fb;
  max-height: min(650px, calc(100vh - 170px));
  overflow-y: auto;
  padding: 18px 20px 22px;
}

.movement-help {
  align-items: flex-start;
  background: #eef6ff;
  border: 1px solid #cfe3fb;
  border-radius: 9px;
  color: #365b7d;
  display: flex;
  gap: 11px;
  margin-bottom: 14px;
  padding: 12px 14px;
}

.movement-help-icon {
  align-items: center;
  background: #dbeafe;
  border-radius: 50%;
  color: #1d4ed8;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 800;
  height: 24px;
  justify-content: center;
  margin-top: 1px;
  width: 24px;
}

.movement-help strong {
  color: #23476a;
  display: block;
  font-size: 13px;
  margin-bottom: 3px;
}

.movement-help p {
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
}

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

.movement-summary-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  min-width: 0;
  padding: 11px 12px;
}

.movement-summary-start {
  border-top: 3px solid #20a36a;
}

.movement-summary-end {
  border-top: 3px solid #dc4c4c;
}

.movement-summary-label {
  color: var(--muted);
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.movement-summary-card strong {
  color: var(--ink);
  display: block;
  font-size: 17px;
  line-height: 1.1;
}

.movement-summary-card small {
  color: var(--muted);
  display: block;
  font-size: 10px;
  margin-top: 5px;
}

.movement-section-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin: 2px 2px 9px;
}

.movement-section-heading > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.movement-section-heading strong {
  color: var(--ink);
  font-size: 14px;
}

.movement-section-kicker {
  color: var(--blue);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.movement-record-count {
  background: #eef2f6;
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  padding: 5px 8px;
}

.movement-timeline {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.movement-timeline-row {
  align-items: center;
  border-bottom: 1px solid #e8edf1;
  display: grid;
  gap: 12px;
  grid-template-columns: 34px 1fr auto;
  min-height: 66px;
  padding: 10px 13px;
  position: relative;
}

.movement-timeline-row:last-child {
  border-bottom: 0;
}

.movement-timeline-marker {
  align-items: center;
  border-radius: 50%;
  display: inline-flex;
  font-size: 15px;
  font-weight: 900;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.movement-marker-in {
  background: #e8f8f0;
  color: #087f5b;
}

.movement-marker-out {
  background: #fff0f0;
  color: #c92a2a;
}

.movement-timeline-main {
  min-width: 0;
}

.movement-timeline-top {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 4px;
}

.movement-event-type,
.movement-event-role {
  border-radius: 999px;
  display: inline-flex;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .03em;
  padding: 4px 7px;
}

.movement-event-in {
  background: var(--green-soft);
  color: var(--green);
}

.movement-event-out {
  background: var(--red-soft);
  color: var(--red);
}

.movement-role-start {
  background: #e8f1ff;
  color: #1f6feb;
}

.movement-role-end {
  background: #f3e8ff;
  color: #7e22ce;
}

.movement-role-intermediate {
  background: #f1f3f5;
  color: #65717a;
}

.movement-timeline-time {
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
}

.movement-timeline-time span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  margin-left: 7px;
}

.movement-sequence-number {
  align-items: center;
  background: #f4f6f8;
  border-radius: 6px;
  color: #7a8791;
  display: inline-flex;
  font-size: 10px;
  font-weight: 800;
  height: 26px;
  justify-content: center;
  min-width: 26px;
  padding: 0 6px;
}

.movement-empty-card {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  padding: 30px 20px;
  text-align: center;
}

.movement-empty-icon {
  align-items: center;
  background: var(--green-soft);
  border-radius: 50%;
  color: var(--green);
  display: inline-flex;
  font-size: 18px;
  font-weight: 800;
  height: 42px;
  justify-content: center;
  margin-bottom: 9px;
  width: 42px;
}

.movement-empty-card strong {
  color: var(--ink);
  font-size: 14px;
}

.movement-empty-card p {
  color: var(--muted);
  font-size: 12px;
  margin: 5px 0 0;
}

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

  .movements-modal-body {
    padding: 14px;
  }
}

@media (max-width: 440px) {
  .movement-summary-grid {
    grid-template-columns: 1fr;
  }

  .movement-timeline-row {
    grid-template-columns: 30px 1fr;
  }

  .movement-sequence-number {
    display: none;
  }
}
