@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0A0E1A;
  color: #F1F5F9;
  line-height: 1.6;
}

/* Typography */
h1, h2, h3, h4, h5, h6 { font-weight: 700; }
a { text-decoration: none; color: inherit; }

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  background: rgba(10, 14, 26, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px 0;
  z-index: 100;
  transition: all 0.2s ease;
}

.navbar.scrolled {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.logo:hover { opacity: 0.8; }

.logo-image {
  height: 40px;
  width: auto;
}

.logo-wordmark {
  display: flex;
  gap: 2px;
  font-weight: 800;
  font-size: 1.2rem;
}

.logo-wordmark .park { color: #F1F5F9; }
.logo-wordmark .tike { color: #4A90E2; }

.title {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.title .sub {
  font-size: 0.85rem;
  color: #94A3B8;
  margin-left: 8px;
}

.conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  font-size: 0.85rem;
}

.conn-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #EF4444;
  animation: pulse 2s infinite;
}

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

.iconbtn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #F1F5F9;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.iconbtn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Material Icons / Material Icons Outlined - the same font families
   Flutter's Icons class draws from (see index.html's icon() function and
   its comment). Standard Google boilerplate for correct ligature
   rendering, plus .ic as a shared sizing/alignment hook so each usage
   below only needs to set font-size, not repeat the whole block. */
.material-icons, .material-icons-outlined {
  font-weight: normal;
  font-style: normal;
  display: inline-block;
  line-height: 1;
  text-transform: none;
  letter-spacing: normal;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
}

.ic {
  font-size: 20px;
  vertical-align: -4px;
}

.iconbtn .ic {
  font-size: 20px;
}

/* Main shell */
.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.panel {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 24px;
}

.rls-warning {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  color: #FCA5A5;
}

.rls-warning b { color: #FEE2E2; }
.rls-warning .mono {
  font-family: monospace;
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Forms */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fl {
  font-size: 0.85rem;
  font-weight: 600;
  color: #CBD5E1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input, select, textarea {
  font-family: inherit;
  color: #F1F5F9;
}

input::placeholder, textarea::placeholder {
  color: #64748B;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

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

.btn-primary {
  background: linear-gradient(135deg, #2D70B3 0%, #1e5a96 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(45, 112, 179, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(45, 112, 179, 0.4);
}

.btn-tonal {
  background: rgba(255, 255, 255, 0.1);
  color: #F1F5F9;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-tonal:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-ghost {
  background: transparent;
  color: #94A3B8;
  border: 1px solid transparent;
}

.btn-ghost:hover:not(:disabled) {
  color: #F1F5F9;
  background: rgba(255, 255, 255, 0.05);
}

.btn-danger {
  background: linear-gradient(135deg, #DC2626 0%, #b91c1c 100%);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(220, 38, 38, 0.4);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

/* Cards */
.card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
}

/* Tables */
.dt {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.dt thead {
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dt th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  color: #CBD5E1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dt td {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.dt tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.dt .mono {
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  color: #94A3B8;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge.pending {
  background: rgba(251, 191, 36, 0.2);
  color: #FCD34D;
}

.badge.acknowledged {
  background: rgba(34, 197, 94, 0.2);
  color: #86EFAC;
}

.badge.error {
  background: rgba(239, 68, 68, 0.2);
  color: #FCA5A5;
}

.badge.sent {
  background: rgba(59, 130, 246, 0.2);
  color: #93C5FD;
}

.badge.cancelled {
  background: rgba(168, 85, 247, 0.2);
  color: #D8B4FE;
}

/* Stats */
.stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}

.stat .n {
  font-size: 1.8rem;
  font-weight: 800;
}

.stat .l {
  font-size: 0.85rem;
  color: #94A3B8;
}

.stat.green .n { color: #86EFAC; }
.stat.amber .n { color: #FCD34D; }
.stat.red .n { color: #FCA5A5; }
.stat.blue .n { color: #93C5FD; }

.stat-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.stat-row .stat {
  flex: 1;
  min-width: 160px;
}

/* Panel head / body (view chrome inside .panel) */
.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.htitle {
  flex: 1;
  font-size: 1.3rem;
  font-weight: 700;
}

.panel-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.back {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: #F1F5F9;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.back:hover {
  background: rgba(255, 255, 255, 0.1);
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #F1F5F9;
}

/* Home bento grid */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

.bento-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 28px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
  color: inherit;
}

.bento-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.bento-card .ic {
  font-size: 32px;
  vertical-align: middle;
}

.bento-card .lb {
  font-size: 0.9rem;
  font-weight: 600;
}

/* Generic label used inside tiles/rows */
.lb {
  font-weight: 600;
}

/* Numeric table cells */
.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Row-level action buttons inside table cells/cards */
.row-actions,
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* Modal content box (backdrop already defined above) */
.modal {
  background: #0F1522;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 24px;
  width: min(420px, 90vw);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal h3 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

.modal .actions {
  justify-content: flex-end;
  margin-top: 18px;
}

/* Shown by showModalError() (see index.html) - a real backend error stays
   on screen inside the still-open modal instead of only flashing in a
   toast after the modal has already closed. */
.modal-error {
  color: #FCA5A5;
  font-size: 0.85rem;
  background: rgba(214, 69, 69, 0.1);
  border: 1px solid rgba(214, 69, 69, 0.3);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 4px;
}

/* Modal & Toast */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 999;
}

.modal-backdrop.active {
  display: block;
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(10, 14, 26, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 16px 20px;
  max-width: 400px;
  z-index: 1000;
  font-size: 0.95rem;
  backdrop-filter: blur(10px);
}

/* Loading & States */
.loading-state, .empty-state, .error-state {
  padding: 40px;
  text-align: center;
  color: #94A3B8;
}

.loading-state::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #4A90E2;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 12px;
}

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

/* Muted text */
.muted {
  color: #64748B;
}

/* Responsive */
@media (max-width: 768px) {
  .navbar-inner {
    flex-wrap: wrap;
    gap: 12px;
  }

  .title {
    flex-basis: 100%;
    order: 3;
  }

  .shell {
    padding: 12px;
  }

  .panel {
    padding: 16px;
  }

  .dt {
    font-size: 0.85rem;
  }

  .dt th, .dt td {
    padding: 8px;
  }
}

/* Un ticket anulado se devolvió: sigue en la lista por trazabilidad, pero
   tiene que leerse de un vistazo como lo que es, no como un cobro más. */
.dt tr.voided td {
  opacity: 0.55;
}
.dt tr.voided td.num {
  text-decoration: line-through;
}
.pill-void {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #FCA5A5;
  background: rgba(214, 69, 69, 0.14);
  border: 1px solid rgba(214, 69, 69, 0.35);
}

/* Estado de las cajas - ver till_health en Supabase, alimentado por
   TillHealth (lib/core/health/) en la app. Colores literales, no
   var(--brand-*): esas variables no están definidas en este fichero (solo
   en demo/parktike-demo.css, una página aparte), así que cualquier tile
   que las use ya heredaba el color del texto en vez del tinte de marca -
   un fallo previo, no algo que reintroduzca aquí. Reutiliza en su lugar la
   misma paleta literal que ya usan .stat y .pill-void en este archivo. */
.health-banner {
  cursor: pointer;
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(252, 211, 77, 0.1);
  border: 1px solid rgba(252, 211, 77, 0.3);
  color: #FCD34D;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.health-banner.severe {
  background: rgba(214, 69, 69, 0.14);
  border-color: rgba(214, 69, 69, 0.35);
  color: #FCA5A5;
}
.health-banner .ic {
  font-size: 16px;
  vertical-align: -3px;
}

.health-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.health-card {
  padding: 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.health-card.warn {
  border-color: rgba(252, 211, 77, 0.35);
}
.health-card.severe {
  border-color: rgba(214, 69, 69, 0.35);
}
.health-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.health-status {
  font-size: 0.82rem;
  font-weight: 600;
  color: #86EFAC;
}
.health-card.warn .health-status { color: #FCD34D; }
.health-card.severe .health-status { color: #FCA5A5; }
.health-card ul {
  margin: 0 0 8px 18px;
  padding: 0;
  font-size: 0.9rem;
  color: #F1F5F9;
}
.health-seen {
  font-size: 0.78rem;
  color: rgba(241, 245, 249, 0.55);
}
