:root {
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
  --secondary: #0ea5e9;
  --accent: #10b981;
  --accent-light: #d1fae5;
  --surface: #ffffff;
  --bg: #f8fafc;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
}

.top-bar-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.back-link, .aux-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: color 0.15s;
}

.back-link:hover, .aux-link:hover {
  color: var(--primary);
}

.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  flex: 1;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  background-color: var(--primary-light);
  color: var(--primary-hover);
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  letter-spacing: 0.3px;
}

.title {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 620px;
  margin: 0 auto;
}

/* Card layout */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
}

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

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

select.form-select {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-main);
  background-color: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
}

select.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* DNI Keypad selector */
.dni-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}

@media (min-width: 600px) {
  .dni-grid {
    grid-template-columns: repeat(10, 1fr);
  }
}

.dni-btn {
  background: #f1f5f9;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.2rem;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.dni-btn:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.dni-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary-hover);
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.35);
  transform: translateY(-2px);
}

.dni-btn small {
  font-size: 0.65rem;
  font-weight: 500;
  opacity: 0.8;
  margin-top: 0.15rem;
}

/* Result Hero Box */
.result-hero {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  text-align: center;
  margin-bottom: 1.75rem;
  box-shadow: 0 10px 25px -5px rgba(2, 132, 199, 0.3);
  position: relative;
  overflow: hidden;
}

.result-hero::after {
  content: "";
  position: absolute;
  top: -50px;
  right: -50px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.result-tag {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px);
  margin-bottom: 0.75rem;
}

.result-tag.status-future {
  background: #fef08a;
  color: #854d0e;
}

.result-tag.status-today {
  background: #4ade80;
  color: #064e3b;
  animation: pulse-ring 2s infinite;
}

.result-tag.status-past {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

.result-date-title {
  font-size: 1.05rem;
  font-weight: 500;
  opacity: 0.9;
  margin-bottom: 0.35rem;
}

.result-date {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.5px;
  margin-bottom: 0.6rem;
}

.result-countdown {
  font-size: 1.05rem;
  font-weight: 600;
  opacity: 0.95;
  margin-bottom: 1.25rem;
}

.result-meta-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  text-align: left;
}

@media (min-width: 600px) {
  .result-meta-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.result-meta-card {
  background: rgba(255, 255, 255, 0.12);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}

.result-meta-card .label {
  opacity: 0.8;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 0.2rem;
}

.result-meta-card .value {
  font-weight: 700;
  font-size: 0.95rem;
}

.actions-row {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #ffffff;
  color: var(--primary-hover);
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: transform 0.15s, background 0.15s;
}

.action-btn:hover {
  background: #f1f5f9;
  transform: translateY(-1px);
}

/* Full month schedule table */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: 1rem;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.schedule-table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 700;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.schedule-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
}

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

.schedule-table tr.highlighted {
  background: var(--primary-light);
  font-weight: 700;
}

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.status-badge.today {
  background: #dcfce7;
  color: #15803d;
}

.status-badge.future {
  background: #fef9c3;
  color: #a16207;
}

.status-badge.past {
  background: #f1f5f9;
  color: #64748b;
}

/* Info Callout */
.info-callout {
  background: #eff6ff;
  border-left: 4px solid var(--primary);
  padding: 1rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
  color: #1e3a8a;
}

/* FAQ Accordion */
.faq-section {
  margin-top: 2rem;
}

.faq-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 1rem;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 0.6rem;
  overflow: hidden;
}

.faq-question {
  width: 100%;
  padding: 1rem 1.25rem;
  text-align: left;
  background: none;
  border: none;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-answer {
  padding: 0 1.25rem 1rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
  display: none;
}

.faq-item.open .faq-answer {
  display: block;
}

.faq-item.open .faq-icon {
  transform: rotate(180deg);
}

.faq-icon {
  transition: transform 0.2s ease;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Cross sell */
.cross-sell {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.cross-sell h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-main);
}

.cross-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}

.cross-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.15s;
}

.cross-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.cross-icon {
  font-size: 1.5rem;
}

.cross-info strong {
  display: block;
  font-size: 0.88rem;
  color: var(--text-main);
}

.cross-info span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Footer */
.footer {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: #ffffff;
}

.footer a {
  color: var(--primary);
  text-decoration: none;
}
