:root {
  --bg: #f6f6f6;
  --bg-soft: #ffffff;
  --card: #ffffff;
  --text: #121212;
  --muted: #5f5f5f;
  --line: #e5e5e5;
  --brand: #f7dc00;
  --brand-strong: #e8cd00;
  --brand-alt: #121212;
  --ok: #177e52;
  --warn: #b88700;
  --danger: #d63939;
  --font-body: "sofia-pro", "Poppins", "Segoe UI", sans-serif;
  --font-display: "GT Walsheim", "Poppins", "Segoe UI", sans-serif;
  --radius: 14px;
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
}


  color: var(--text);
  background: linear-gradient(180deg, #f5f5f5 0%, #fbfbfb 100%);
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(190deg, #070707 0%, #151515 100%);
  color: #f1f1f1;
  padding: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid #2f2f2f;
}

.sidebar-brand {
  background: var(--brand);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.sidebar-brand-img {
  max-height: 44px;
  width: auto;
  object-fit: contain;
}

.sidebar-brand-text {
  font-family: var(--font-display);
  font-size: 1rem;
  color: #101010;
  font-weight: 700;
}

.sidebar-brand-sub {
  font-size: 0.72rem;
  color: #3a3a3a;
}

.sidebar-nav {
  padding: 20px 18px;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.logo-img {
  max-height: 48px;
  width: auto;
  object-fit: contain;
  background-color: #f1f1f1;
  margin-left: 8px;
}

.logo-sub {
  font-size: 0.82rem;
  color: #cfcfcf;
  margin-bottom: 24px;
}

.menu {
  display: grid;
  gap: 6px;
}

.menu a {
  padding: 10px 12px;
  border-radius: 10px;
  color: #efefef;
  border: 1px solid transparent;
}

.menu a:hover,
.menu a.active {
  background: rgba(247, 220, 0, 0.14);
  border-color: rgba(247, 220, 0, 0.45);
  color: #fff3a0;
}

.content {
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  margin: 0;
}

.subtitle {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 4px;
}

.grid {
  display: grid;
  gap: 16px;
}

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

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.kpi {
  font-size: 1.65rem;
  font-weight: 700;
  margin-top: 8px;
}

.kpi-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  color: #555;
  font-family: 'sofia-pro', 'Sofia Pro', sans-serif;
  text-decoration: none;
}

.btn.primary {
  background: var(--brand);
  color: #101010;
}

.btn.primary:hover {
  background: var(--brand-strong);
}

.btn.ghost {
  background: #fff;
  border-color: var(--line);
}

.btn.ghost:hover {
  border-color: var(--brand-alt);
  color: var(--brand-alt);
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

label {
  display: block;
  font-size: 0.86rem;
  color: var(--muted);
  margin-bottom: 6px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.93rem;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(247, 220, 0, 0.3);
  border-color: var(--brand-alt);
}

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

.field {
  margin-bottom: 12px;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.check-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fdfdfd;
  cursor: pointer;
}

.check-item span {
  flex: 1;
  font-size: 13px;
  line-height: 1.3;
  pointer-events: none;
}

.check-item input[type="checkbox"] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--brand);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

.table tr.clickable-row {
  cursor: pointer;
}

.table tr.clickable-row:hover td {
  background: #fffbea;
}

.table td a:not(.btn),
.timeline-item a:not(.btn) {
  font-family: 'sofia-pro', 'Sofia Pro', sans-serif;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  transition: background 0.12s;
  display: inline-block;
  background: var(--brand);
  color: #101010;
}

.table td a:not(.btn):hover,
.timeline-item a:not(.btn):hover {
  background: var(--brand-strong);
  color: #101010;
}

.table-scroll {
  overflow-x: auto;
  padding-bottom: 6px;
}

.table-scroll table {
  min-width: 600px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  cursor: pointer;
  font-size: 0.9rem;
}

.foto-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 8px;
  background: #f9f9f9;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.foto-preview {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
}

.foto-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.foto-label {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 600;
}

.foto-input {
  display: none;
}

.cliente-search-wrap {
  position: relative;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-top: 4px;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.search-results-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
  transition: background 0.1s;
}

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

.search-results-item:hover {
  background: #fffbea;
}

.search-results-item .sr-name {
  font-weight: 600;
  color: #101010;
}

.search-results-item .sr-meta {
  font-size: 0.78rem;
  color: #888;
  margin-top: 2px;
}

.search-results-item .sr-vehiculos {
  font-size: 0.78rem;
  color: var(--brand-alt);
  margin-top: 2px;
}

.file-input {
  display: flex;
  align-items: center;
  gap: 10px;
}

.file-input input[type=file] {
  display: none;
}

.file-input-name {
  font-size: 0.88rem;
  color: #777;
  flex: 1;
}

.file-input::before {
  content: "Seleccionar archivo";
  display: inline-block;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  background: var(--brand);
  color: #101010;
  white-space: nowrap;
  transition: background 0.12s;
}

.file-input:hover::before {
  background: var(--brand-strong);
}

.foto-remove {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.2rem;
  line-height: 1;
  color: #d63939;
  border-color: #d63939;
  flex-shrink: 0;
}

.foto-remove:hover {
  background: #d63939;
  color: #fff;
}

.foto-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.foto-gallery a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: #555;
  font-size: 0.78rem;
  font-weight: 600;
  transition: opacity 0.12s;
}

.foto-gallery a:hover {
  opacity: 0.8;
}

.foto-gallery img {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  cursor: pointer;
  background: #f0f0f0;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge.ok { background: #dbf8ec; color: #177e52; }
.badge.warn { background: #fff4b8; color: #7a5b00; }
.badge.info { background: #ececec; color: #303030; }

.diagram-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  background: #f0f0f0;
  position: relative;
  display: inline-block;
}

.diagram-img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.diagram-canvas {
  position: absolute;
  top: 8px;
  left: 8px;
  cursor: crosshair;
  border-radius: 8px;
  touch-action: none;
  pointer-events: all;
}

.diagram-label {
  font-size: 7px;
  fill: #3a5060;
  pointer-events: none;
  font-family: Arial, sans-serif;
  font-weight: 700;
  text-anchor: middle;
}

.hint {
  color: var(--muted);
  font-size: 0.82rem;
}

.signature {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  width: 100%;
  height: 160px;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  background: transparent;
}

.login-card {
  width: 100%;
  max-width: 460px;
}

.timeline {
  display: grid;
  gap: 8px;
}

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

.mobile-menu {
  display: none;
}

.public-header {
  position: sticky;
  top: 0;
  z-index: 30;
}

.public-top {
  background: var(--brand);
  color: #0f0f0f;
  text-align: center;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 0.86rem;
}

.public-nav {
  background: #f1f1f1;
  border-bottom: 1px solid #e3e3e3;
}

.public-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(1280px, 96vw);
  margin: 0 auto;
  padding: 12px 20px;
}

.public-menu {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.public-menu a {
  padding: 8px 10px;
  border-radius: 9px;
  color: #555;
  font-family: 'sofia-pro', 'Sofia Pro', sans-serif;
  text-decoration: none;
}

.public-menu a:hover {
  background: #fff8b8;
  color: #333;
}

.public-main {
  width: min(1280px, 96vw);
  margin: 14px auto 26px;
}

.hero-slider {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  min-height: 420px;
  position: relative;
}

.hero-slide {
  display: none;
  position: relative;
  min-height: 420px;
}

.hero-slide.active {
  display: block;
}

.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(247,220,0,.45) 0%, rgba(247,220,0,.08) 45%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 50px 36px;
  max-width: 640px;
}

.hero-content h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 3.4rem);
  margin: 0 0 10px;
  color: #000000;
  -webkit-text-stroke: 1.5px #ffffff;
  paint-order: stroke fill;
  text-shadow: 2px 2px 0 #fff, -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff;
}

.hero-content p {
  margin: 0 0 16px;
  color: #000000;
  -webkit-text-stroke: 1px #ffffff;
  paint-order: stroke fill;
  text-shadow: 2px 2px 0 #fff, -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff;
}

.hero-content .btn {
  background: var(--brand);
  color: #101010;
  -webkit-text-stroke: 1px #ffffff;
  paint-order: stroke fill;
  text-shadow: 1px 1px 0 #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff;
  border-color: #101010;
}

.hero-content .btn:hover {
  background: var(--brand-strong);
}

.promos-wrap {
  margin-top: 18px;
}

.promo-card {
  border-top: 5px solid var(--brand);
}

.promo-thumb {
  width: 100%;
  height: 170px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
}

.public-footer {
  background: #0a0a0a;
}

.public-footer-inner {
  width: min(1280px, 96vw);
  margin: 0 auto;
  padding: 18px 20px;
  color: #f2f2f2;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.public-footer a {
  color: #ffef7b;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  min-width: 580px;
}

.calendar-scroll {
  overflow-x: auto;
  padding-bottom: 6px;
}

.calendar-weekday {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #4a4a4a;
  padding: 4px 2px;
  text-align: center;
}

#cal_month_label {
  font-size: 1.08rem;
  font-weight: 700;
  color: #111;
  letter-spacing: 0.01em;
}

.calendar-cell {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  min-height: 62px;
  background: #fff;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.calendar-cell:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
}

.calendar-cell.empty {
  background: transparent;
  border-style: dashed;
  cursor: default;
}

.calendar-cell.selected {
  outline: 2px solid #121212;
}

.appt-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.appt-item {
  display: grid;
  grid-template-columns: 70px 1fr auto auto;
  gap: 12px;
  align-items: center;
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}

.appt-time {
  font-weight: 700;
  font-size: 1rem;
  color: #121212;
}

.appt-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.appt-status {
  white-space: nowrap;
}

.appt-action {
  white-space: nowrap;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.slot-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  font-weight: 600;
}

.slot-btn:hover {
  border-color: #121212;
}

.slot-btn.disabled {
  background: #f2f2f2;
  color: #888;
  cursor: not-allowed;
}

.slot-btn.selected {
  background: #f7dc00;
  border-color: #121212;
}

.calendar-cell h4 {
  margin: 0;
  font-size: 0.98rem;
  text-align: center;
}

.calendar-cell .hint {
  margin-top: 4px;
  font-size: 0.76rem;
}

.calendar-cell.state-full {
  background: #f7f7f7;
}

.calendar-cell.disabled-day,
.calendar-cell.past {
  opacity: 0.55;
  cursor: not-allowed;
  background: #f1f1f1;
}

.calendar-cell.state-low {
  background: #fff9db;
}

.calendar-cell.state-available {
  background: #f8fff8;
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: -300px;
    z-index: 40;
    width: 280px;
    transition: left 0.25s ease;
  }

  .sidebar-brand {
    padding: 12px 14px;
  }

  .sidebar-brand-img {
    max-height: 36px;
  }

  .sidebar-brand-text {
    font-size: 0.9rem;
  }

  .sidebar-brand-sub {
    font-size: 0.65rem;
  }

  .sidebar.open {
    left: 0;
  }

  .mobile-menu {
    display: inline-flex;
  }

  .grid.cols-2,
  .grid.cols-3,
  .check-grid {
    grid-template-columns: 1fr;
  }

  .public-nav-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .logo-img {
    max-height: 36px;
    margin-left: 0;
  }

  .public-main {
    width: min(1280px, 100vw);
    margin: 0 auto 24px;
  }

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

  body[data-page="inicio"] .login-shell {
    display: block;
    min-height: auto;
    padding: 10px;
  }

  .hero-slider,
  .hero-slide {
    border-radius: 0;
    min-height: 360px;
  }

  .hero-content {
    padding: 28px 18px;
  }

  .calendar-grid {
    min-width: 0;
    gap: 3px;
  }

  .calendar-scroll {
    overflow-x: scroll;
    -webkit-overflow-scrolling: touch;
  }

  .calendar-weekday {
    font-size: 0.6rem;
    padding: 2px 1px;
    letter-spacing: 0;
  }

  .calendar-cell {
    padding: 3px;
    min-height: 36px;
    border-radius: 6px;
    font-size: 0.8rem;
  }

  .appt-item {
    grid-template-columns: 60px 1fr;
    grid-template-rows: auto auto;
  }

  .appt-info {
    grid-column: 1 / -1;
  }

  .appt-status,
  .appt-action {
    grid-column: auto;
  }

  .calendar-cell h4 {
    font-size: 0.78rem;
    margin: 0;
  }

  .calendar-cell .cell-count {
    font-size: 0.6rem;
  }

  .calendar-cell .cell-bar {
    height: 3px;
    border-radius: 2px;
    margin-top: 2px;
  }

  .login-shell {
    display: block;
    padding: 10px;
    min-height: auto;
  }

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

  #form_cita_publica .card .grid.cols-3 {
    grid-template-columns: 1fr;
  }

  input[type="radio"] {
    width: 16px !important;
    height: 16px;
    flex-shrink: 0;
  }

  #booking_panel .btn-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .info-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; align-items: baseline; }
  .info-grid span { font-size: 13px; }
  .timeline { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
  .timeline-item { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
  .timeline-item::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
  .timeline-item .t-time { color: var(--text-muted); font-size: 11px; }
}

/* ── Modal / Overlay ── */
.modal-overlay {
  display: none !important;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.4);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex !important;
}

.modal-box {
  background: #fff;
  border-radius: 14px;
  max-width: 780px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-header h3 {
  margin: 0;
  font-size: 1rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: #999;
  line-height: 1;
}

.modal-close:hover { color: #333; }

.modal-search {
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-search input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.9rem;
  box-sizing: border-box;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.modal-table {
  width: 100%;
  border-collapse: collapse;
}

.modal-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.75rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: #fafafa;
}

.modal-table td {
  padding: 10px 14px;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.1s;
}

.modal-table tr:hover td {
  background: #fffbea;
}

.modal-table tr:last-child td {
  border-bottom: none;
}

.modal-empty {
  padding: 40px 20px;
  text-align: center;
  color: #aaa;
  font-size: 0.9rem;
}
