/* styles.css — Shared styling for admin-web/ (login, register, dashboard).
 *
 * Design goals: clean, professional, framework-free vanilla CSS. Responsive
 * down to mobile via a flexbox/grid layout and a max-width: 768px breakpoint
 * that turns the services table into stacked cards (data-label driven).
 *
 * Color tokens are CSS custom properties so a future dark theme or brand tweak
 * is a one-place edit.
 */

:root {
  --primary: #2c5282;
  --primary-dark: #2a4365;
  --primary-light: #ebf4ff;
  --success: #2f855a;
  --success-light: #f0fff4;
  --danger: #c53030;
  --danger-light: #fff5f5;
  --warning: #c05621;
  --bg: #f7fafc;
  --surface: #ffffff;
  --text: #1a202c;
  --text-muted: #718096;
  --border: #e2e8f0;
  --border-strong: #cbd5e0;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
  --radius: 8px;
  --radius-sm: 4px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }

/* ---- Auth pages (login / register) ------------------------------------- */

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.auth-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
}

.auth-card h1 {
  margin: 0 0 .25rem;
  font-size: 1.5rem;
  text-align: center;
  color: var(--primary-dark);
}

.auth-card .subtitle {
  margin: 0 0 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: .9rem;
}

/* ---- Forms ------------------------------------------------------------- */

.form-group { margin-bottom: 1rem; }

label {
  display: block;
  margin-bottom: .35rem;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
}

input, select, textarea {
  width: 100%;
  padding: .6rem .75rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

textarea { resize: vertical; min-height: 80px; }

input[aria-invalid="true"] {
  border-color: var(--danger);
}

/* ---- Buttons ----------------------------------------------------------- */

.btn {
  display: inline-block;
  padding: .6rem 1.1rem;
  font-size: .95rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
  text-align: center;
}

.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn-secondary {
  background: var(--surface);
  color: var(--primary-dark);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) { background: var(--primary-light); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) { background: #9b2c2c; }

.btn-sm { padding: .3rem .7rem; font-size: .85rem; }

.btn-block { width: 100%; }

/* ---- Alerts / messages ------------------------------------------------ */

.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  margin-bottom: 1rem;
}
.alert-error   { background: var(--danger-light);  color: var(--danger);  border: 1px solid #feb2b2; }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #9ae6b4; }
.alert-info    { background: var(--primary-light); color: var(--primary-dark); border: 1px solid #90cdf4; }

/* ---- Dashboard layout -------------------------------------------------- */

.dashboard {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem;
}

.dashboard-header {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}

.dashboard-header h1 {
  margin: 0;
  font-size: 1.4rem;
  color: var(--primary-dark);
}

.dashboard-header .header-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.section {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.section h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  color: var(--text);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.toolbar .filter-group { display: flex; gap: .5rem; align-items: flex-end; }
.toolbar .filter-group label { margin-bottom: 0; }
.toolbar select { min-width: 220px; }

/* ---- Services table --------------------------------------------------- */

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

table.services {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

table.services th {
  text-align: left;
  padding: .65rem .75rem;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
}

table.services td {
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.services tbody tr:nth-child(even) { background: #f7fafc; }
table.services tbody tr:hover { background: var(--primary-light); }
table.services tr.inactive { opacity: .6; }
table.services .actions-cell { white-space: nowrap; display: flex; gap: .4rem; }

.badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-active   { background: var(--success-light); color: var(--success); }
.badge-inactive { background: var(--danger-light);  color: var(--danger);  }

/* ---- Turnos: estado badges -------------------------------------------- */

:root {
  --estado-pendiente: #d69e2e;
  --estado-pendiente-bg: #fffbeb;
  --estado-confirmado: #3182ce;
  --estado-confirmado-bg: #ebf8ff;
  --estado-curso: #dd6b20;
  --estado-curso-bg: #fffaf0;
  --estado-completado: #2f855a;
  --estado-completado-bg: #f0fff4;
  --estado-cancelado: #c53030;
  --estado-cancelado-bg: #fff5f5;
  --estado-no-asistio: #742a2a;
  --estado-no-asistio-bg: #fed7d7;
  --gray-50: #f7fafc;
  --gray-300: #e2e8f0;
  --gray-600: #718096;
}

.badge-estado { white-space: nowrap; border: 1px solid transparent; }

.badge-pendiente { background: var(--estado-pendiente-bg); color: var(--estado-pendiente); border-color: var(--estado-pendiente); }
.badge-confirmado { background: var(--estado-confirmado-bg); color: var(--estado-confirmado); border-color: var(--estado-confirmado); }
.badge-curso { background: var(--estado-curso-bg); color: var(--estado-curso); border-color: var(--estado-curso); }
.badge-completado { background: var(--estado-completado-bg); color: var(--estado-completado); border-color: var(--estado-completado); }
.badge-cancelado { background: var(--estado-cancelado-bg); color: var(--estado-cancelado); border-color: var(--estado-cancelado); }
.badge-no-asistio { background: var(--estado-no-asistio-bg); color: var(--estado-no-asistio); border-color: var(--estado-no-asistio); }
.badge-default { background: var(--gray-50); color: var(--gray-600); border-color: var(--gray-300); }

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
}

/* ---- Modal ------------------------------------------------------------ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
}

.modal-card h2 {
  margin: 0 0 1rem;
  font-size: 1.2rem;
  color: var(--primary-dark);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  margin-top: 1rem;
}

/* ---- Turnos table ----------------------------------------------------- */

table.turnos-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

table.turnos-table th {
  text-align: left;
  padding: .65rem .75rem;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
}

table.turnos-table td {
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.turnos-table tbody tr:nth-child(even) { background: #f7fafc; }
table.turnos-table tbody tr:hover { background: var(--primary-light); }
table.turnos-table tr.cancelled { opacity: .65; }
table.turnos-table .actions-cell { white-space: nowrap; display: flex; gap: .4rem; }

/* Stacked name/sub layout for Cliente and Vehículo cells. */
.cell-stack { display: flex; flex-direction: column; gap: .1rem; }
.cell-stack .cell-name { font-weight: 600; }
.cell-stack .cell-sub { font-size: .8rem; color: var(--text-muted); }
.cell-muted { color: var(--text-muted); }

/* ---- Finalizar modal info -------------------------------------------- */

.turno-info { margin-bottom: 1.25rem; }
.turno-info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .5rem;
  padding: .75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.turno-info-grid > div {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  font-size: .9rem;
}
.turno-info-grid .info-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}

/* ---- Turnos toolbar --------------------------------------------------- */

.turnos-toolbar .filter-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.turnos-toolbar .filter-group input[type="date"] { min-width: 160px; }

/* ---- Dashboard cards -------------------------------------------------- */

.welcome-section {
  text-align: center;
}

.welcome-section h2 {
  font-size: 1.4rem;
  color: var(--primary-dark);
  margin-bottom: .25rem;
}

.welcome-text {
  margin: 0;
  color: var(--text-muted);
}

.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.dashboard-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.25rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}

.dashboard-card:hover {
  text-decoration: none;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(44, 82, 130, 0.15);
  transform: translateY(-2px);
}

.dashboard-card .card-icon {
  font-size: 2.25rem;
  margin-bottom: .75rem;
  line-height: 1;
}

.dashboard-card .card-title {
  margin: 0 0 .4rem;
  font-size: 1.1rem;
  color: var(--primary-dark);
}

.dashboard-card .card-desc {
  margin: 0;
  font-size: .875rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ---- Metrics dashboard ------------------------------------------------- */

.metrics-hero {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.metric-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.metric-label {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: .35rem;
}

.metric-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: .35rem;
  line-height: 1.2;
}

.metric-sub {
  font-size: .85rem;
  color: var(--text-muted);
}

.metric-compare {
  font-size: .8rem;
  margin-top: .25rem;
}

.compare-up {
  color: var(--success);
  font-weight: 600;
}

.compare-down {
  color: var(--danger);
  font-weight: 600;
}

/* ---- Progress bar ------------------------------------------------------- */

.progress-bar {
  width: 100%;
  height: 10px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: .35rem;
}

.progress-fill {
  height: 100%;
  background: var(--success);
  border-radius: 999px;
  transition: width .4s ease;
  min-width: 0;
}

/* ---- Bar chart ---------------------------------------------------------- */

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  padding: .25rem 0;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.bar-label {
  min-width: 100px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text);
  text-align: right;
}

.bar-track {
  flex: 1;
  height: 22px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width .4s ease;
  min-width: 2px;
}

.bar-count {
  min-width: 40px;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
}

/* ---- Metrics tables (two-column layout) --------------------------------- */

.metrics-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.metrics-tables .section {
  margin-bottom: 0;
}

table.metrics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

table.metrics-table th {
  text-align: left;
  padding: .6rem .75rem;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
}

table.metrics-table td {
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.metrics-table tbody tr:nth-child(even) { background: #f7fafc; }
table.metrics-table tbody tr:hover { background: var(--primary-light); }

/* ---- Metrics responsive ------------------------------------------------- */

@media (max-width: 900px) {
  .metrics-hero {
    grid-template-columns: repeat(2, 1fr);
  }

  .metrics-tables {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 500px) {
  .metrics-hero {
    grid-template-columns: 1fr;
  }

  .bar-label {
    min-width: 75px;
    font-size: .8rem;
  }

  .bar-count {
    min-width: 30px;
    font-size: .8rem;
  }
}

/* ---- Sidebar layout ---------------------------------------------------- */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: #1a1a2e;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  transition: transform .25s ease;
}

.sidebar-logo {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}

.sidebar-logo h2 {
  margin: 0;
  font-size: 1.35rem;
  color: #e94560;
  letter-spacing: .02em;
}

.sidebar-logo p {
  margin: .2rem 0 0;
  font-size: .78rem;
  color: #a0aec0;
}

.sidebar-nav {
  flex: 1;
  padding: .75rem 0;
  overflow-y: auto;
}

.sidebar-nav .nav-item {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .7rem 1.5rem;
  color: #cbd5e0;
  text-decoration: none;
  font-size: .95rem;
  font-weight: 500;
  transition: background .15s, color .15s;
}

.sidebar-nav .nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  text-decoration: none;
}

.sidebar-nav .nav-item.active {
  background: rgba(233, 69, 96, 0.15);
  color: #e94560;
  border-right: 3px solid #e94560;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-footer .btn {
  width: 100%;
}

/* Main content area */
.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 1.5rem;
  max-width: calc(100vw - 240px);
  overflow-x: hidden;
}

.main-content h1 {
  margin: 0 0 1.25rem;
  font-size: 1.4rem;
  color: var(--primary-dark);
}

/* Hamburger toggle for mobile */
.hamburger {
  display: none;
  position: fixed;
  top: .75rem;
  left: .75rem;
  z-index: 60;
  background: #1a1a2e;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  width: 40px;
  height: 40px;
  font-size: 1.3rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sidebar-overlay {
  display: none;
}

/* ---- Notification icons (turnos table) --------------------------------- */

.notif-icon {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  cursor: default;
}
.notif-icon-ok      { color: var(--success); }
.notif-icon-fail    { color: var(--danger); }
.notif-icon-pending { color: var(--warning); }
.notif-icon-none    { color: var(--text-muted); }

/* ---- Calendario semanal (turnos) -------------------------------------- */

.calendario-semanal {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
  padding-bottom: .25rem;
}

.dia-calendario {
  flex: 1;
  min-width: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  padding: .75rem .5rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
  position: relative;
}

.dia-calendario:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
}

.dia-calendario.activo {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(44, 82, 130, 0.25);
}

.dia-calendario.activo .dia-nombre,
.dia-calendario.activo .dia-numero {
  color: #fff;
}

.dia-calendario.hoy:not(.activo) {
  border-color: var(--estado-curso);
  background: var(--estado-curso-bg);
}

.dia-calendario.hoy:not(.activo) .dia-nombre,
.dia-calendario.hoy:not(.activo) .dia-numero {
  color: var(--estado-curso);
}

.dia-calendario .dia-nombre {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}

.dia-calendario .dia-numero {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}

.dia-calendario .turnos-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--estado-confirmado);
  margin-top: .15rem;
}

/* ---- Turnos día header -------------------------------------------------- */

.turnos-dia-header {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--border);
}

/* ---- Tarjetas de turnos ----------------------------------------------- */

.tarjetas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.tarjeta-turno {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow .15s, transform .15s;
  display: flex;
  flex-direction: column;
}

.tarjeta-turno:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

/* Borde izquierdo de color según estado */
.tarjeta-turno--pendiente   { border-left: 4px solid var(--estado-pendiente); }
.tarjeta-turno--confirmado  { border-left: 4px solid var(--estado-confirmado); }
.tarjeta-turno--en_curso    { border-left: 4px solid var(--estado-curso); }
.tarjeta-turno--completado  { border-left: 4px solid var(--estado-completado); }
.tarjeta-turno--cancelado   { border-left: 4px solid var(--estado-cancelado); }
.tarjeta-turno--no_asistio  { border-left: 4px solid var(--estado-no-asistio); }

.tarjeta-turno__header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.tarjeta-turno__hora {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  margin-left: auto;
}

.tarjeta-turno__body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  flex: 1;
}

.tarjeta-turno__cliente,
.tarjeta-turno__vehiculo,
.tarjeta-turno__servicio {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.tarjeta-turno__label {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}

.tarjeta-turno__valor {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
}

.tarjeta-turno__sub {
  font-size: .8rem;
  color: var(--text-muted);
}

.tarjeta-turno__footer {
  display: flex;
  gap: .5rem;
  padding: .75rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

/* ---- Walk-in hint (finalizar modal) ------------------------------------- */

.walkin-hint {
  display: block;
  margin-top: .3rem;
  font-size: .8rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ---- Responsive: mobile table -> stacked cards ------------------------ */

@media (max-width: 768px) {
  .auth-card { padding: 2rem 1.25rem; }
  .dashboard { padding: .75rem; }
  .dashboard-header { flex-direction: column; align-items: flex-start; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar select { min-width: 0; width: 100%; }

  table.services thead, table.turnos-table thead { display: none; }
  table.services, table.services tbody, table.services tr, table.services td,
  table.turnos-table, table.turnos-table tbody, table.turnos-table tr, table.turnos-table td {
    display: block;
    width: 100%;
  }
  table.services tr, table.turnos-table tr {
    background: var(--surface) !important;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: .75rem;
    padding: .5rem .25rem;
  }
  table.services tr:hover, table.turnos-table tr:hover { background: var(--primary-light) !important; }
  table.services td, table.turnos-table td {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: none;
    padding: .4rem .75rem;
    text-align: right;
  }
  table.services td::before, table.turnos-table td::before {
    content: attr(data-label);
    font-weight: 600;
    text-align: left;
  }
  table.services .actions-cell, table.turnos-table .actions-cell {
    justify-content: flex-end;
    padding-top: .25rem;
  }
  /* In stacked card mode, line up label/value columns for turnos cells. */
  table.turnos-table td::before { flex: 0 0 40%; }
  table.turnos-table .cell-stack { align-items: flex-end; text-align: right; }

  /* Calendario semanal: scroll horizontal en mobile */
  .calendario-semanal {
    gap: .35rem;
  }
  .dia-calendario {
    min-width: 60px;
    padding: .6rem .35rem;
  }
  .dia-calendario .dia-numero {
    font-size: 1.1rem;
  }

  /* Tarjetas: una sola columna en mobile */
  .tarjetas-grid {
    grid-template-columns: 1fr;
  }

  /* Sidebar collapses off-screen on mobile */
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
    max-width: 100vw;
    padding: 1rem;
    padding-top: 3.5rem;
  }
  .hamburger {
    display: flex;
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
  }
  .sidebar-overlay.visible {
    display: block;
  }
}

/* ---- Configuración del taller ------------------------------------------ */

.config-section {
  /* Uses .section as base — extra spacing tweaks for longer forms. */
}

.config-section .section-hint {
  margin: 0 0 1rem;
  font-size: .875rem;
  color: var(--text-muted);
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.form-row .form-group-inline {
  flex: 1;
  min-width: 180px;
}

/* 7-day checkbox grid */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .5rem 1rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .95rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--primary);
  transform: scale(1.15);
}

.checkbox-label.checkbox-inline {
  font-weight: 400;
  font-size: .875rem;
}

/* Per-day override rows */
.day-overrides {
  display: flex;
  flex-direction: column;
  gap: .65rem;
}

.day-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  padding: .6rem .75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.day-row .day-label {
  font-weight: 600;
  font-size: .95rem;
  min-width: 90px;
  color: var(--text);
}

.override-fields {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.override-fields input[type="time"] {
  width: 130px;
  padding: .45rem .6rem;
  font-size: .9rem;
}

.override-sep {
  font-size: .9rem;
  color: var(--text-muted);
}

/* Form action buttons at the bottom */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  margin-top: 1.5rem;
}

/* Responsive tweaks for config page */
@media (max-width: 768px) {
  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .form-row .form-group-inline {
    min-width: 0;
  }

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

  .day-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .day-row .day-label {
    min-width: 0;
  }

  .override-fields {
    width: 100%;
  }

  .override-fields input[type="time"] {
    flex: 1;
    width: auto;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .form-actions .btn {
    width: 100%;
  }
}

/* ---- Global notifications: sidebar badge + floating banner --------------- */

/* Badge counter inside sidebar nav items */
.nav-badge {
  display: inline-block;
  background: #e94560;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  margin-left: auto;
  line-height: 1.5;
  min-width: 1.35rem;
  text-align: center;
}

/* Floating banner — fixed at top of viewport, above everything */
.global-pausas-banner {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: linear-gradient(135deg, #c53030 0%, #9b2c2c 100%);
  color: #fff;
  font-size: 0.95rem;
  box-shadow: 0 4px 20px rgba(197, 48, 48, 0.45);
  border-bottom: 2px solid #feb2b2;
  animation: banner-slide-in 0.35s ease-out;
}

.global-pausas-banner.hidden {
  display: none;
}

@keyframes banner-slide-in {
  from { transform: translateY(-100%); }
  to   { transform: translateY(0); }
}

.global-pausas-banner__icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.global-pausas-banner__text {
  flex: 1;
  min-width: 0;
}

.global-pausas-banner__text strong {
  font-weight: 800;
  font-size: 1.1rem;
}

.global-pausas-banner__link {
  color: #fff;
  font-weight: 700;
  white-space: nowrap;
  padding: 0.4rem 0.85rem;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background 0.15s;
  flex-shrink: 0;
}

.global-pausas-banner__link:hover {
  background: rgba(255, 255, 255, 0.25);
  text-decoration: none;
}

.global-pausas-banner__close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  line-height: 1;
  opacity: 0.8;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  transition: opacity 0.15s, background 0.15s;
}

.global-pausas-banner__close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.15);
}

/* Responsive: stack banner on mobile */
@media (max-width: 768px) {
  .global-pausas-banner {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    justify-content: center;
    text-align: center;
  }

  .global-pausas-banner__text {
    flex: 0 0 100%;
    order: 1;
  }

  .global-pausas-banner__link {
    order: 2;
  }

  .global-pausas-banner__close {
    position: absolute;
    top: 0.25rem;
    right: 0.5rem;
  }
}
