@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Outfit:wght@400;600;700&display=swap');

:root {
  --bg: #12100c;
  --surface: #1a1610;
  --border: rgba(232, 168, 56, 0.14);
  --amber: #e8a838;
  --amber-light: #f5c96a;
  --yellow: #f0c14d;
  --text-on-accent: #2a2018;
  --muted: #a89888;
  --red: #c45c4a;
  --green: #5cb87a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: #f5f5f5;
  min-height: 100vh;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
}

.login-card h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2rem;
  color: var(--amber-light);
  letter-spacing: 0.05em;
}

.muted { color: var(--muted); font-size: 0.9rem; margin: 0.5rem 0 1.5rem; }
.hint { font-size: 0.75rem; color: var(--muted); margin-top: 1rem; }
.hint code { background: #222; padding: 0.15rem 0.4rem; border-radius: 4px; }
.error { color: #ff6b6b; font-size: 0.9rem; margin-bottom: 0.75rem; padding: 0.5rem; background: rgba(231,76,60,0.15); border-radius: 6px; }
.error[hidden] { display: none !important; }

label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

label input, label select, label textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.65rem 0.85rem;
  font: inherit;
  color: #fff;
  background: #1a1a1a;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
}

.admin-app {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0;
}

.brand {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.75rem;
  padding: 0 1.25rem 1.5rem;
  letter-spacing: 0.05em;
}

.brand span { color: var(--amber-light); }

.sidebar-nav button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.75rem 1.25rem;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.sidebar-nav button.active,
.sidebar-nav button:hover {
  color: var(--amber-light);
  background: rgba(232, 168, 56, 0.06);
  border-left-color: var(--amber);
}

.sidebar-foot {
  margin-top: auto;
  padding: 1rem 1.25rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.main {
  padding: 1.5rem 2rem;
  overflow-x: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.topbar h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.5rem;
  letter-spacing: 0.08em;
  color: var(--amber-light);
}

.panel { display: none; }
.panel.active { display: block; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}

.stat-card span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
}

.stat-card strong {
  font-size: 2rem;
  color: var(--amber-light);
}

.toolbar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.btn {
  padding: 0.55rem 1rem;
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.btn-primary { background: linear-gradient(135deg, var(--amber-light), var(--amber)); color: var(--text-on-accent); }
.btn-ghost { background: rgba(255,255,255,0.08); color: #fff; border: 1px solid rgba(255,255,255,0.12); }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }
.btn-danger { background: var(--red); color: #fff; }

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th, td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

th { color: var(--muted); font-weight: 600; font-size: 0.7rem; text-transform: uppercase; }

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-pending { background: rgba(241,196,15,0.2); color: #f1c40f; }
.status-confirmed { background: rgba(52,152,219,0.2); color: #3498db; }
.status-preparing { background: rgba(155,89,182,0.2); color: #9b59b6; }
.status-delivery { background: rgba(46,204,113,0.2); color: #2ecc71; }
.status-completed { background: rgba(149,165,166,0.2); color: #bdc3c7; }
.status-cancelled { background: rgba(231,76,60,0.2); color: #e74c3c; }

.options-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.options-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  min-height: 300px;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 0.35rem;
}

.list-item:hover, .list-item.selected {
  background: rgba(232, 168, 56, 0.08);
}

.list-item.selected { border: 1px solid var(--border); }

.settings-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.25rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
  padding-bottom: 0;
  border-bottom: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}

.settings-tabs__btn {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.65rem 1rem;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}

.settings-tabs__btn:hover {
  color: var(--text);
}

.settings-tabs__btn.active {
  color: var(--amber-light);
  border-bottom-color: var(--amber);
}

.settings-tab-panels {
  min-height: 200px;
}

.settings-tab-panel[hidden] {
  display: none !important;
}

.settings-form-footer {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  background: var(--bg);
  z-index: 2;
}

.settings-form fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.settings-form legend {
  color: var(--amber-light);
  font-weight: 700;
  padding: 0 0.5rem;
}

.tier-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.payment-row {
  display: grid;
  grid-template-columns: 1fr 7rem 5rem auto;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.payment-row select {
  width: 100%;
}

.payment-row .checkbox {
  margin: 0;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .payment-row {
    grid-template-columns: 1fr 1fr;
  }
  .payment-row .checkbox {
    grid-column: 1;
  }
  .payment-row [data-rm-payment] {
    grid-column: 2;
    justify-self: end;
  }
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal[hidden] { display: none !important; }

.modal__box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal__box h2 {
  color: var(--amber-light);
  margin-bottom: 1rem;
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 0.05em;
}

.modal__actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  justify-content: flex-end;
}

.checkbox { display: flex; align-items: center; gap: 0.5rem; }
.checkbox input { width: auto; margin: 0; }

.bcv-status {
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(232, 168, 56, 0.06);
  border: 1px solid rgba(232, 168, 56, 0.15);
  border-radius: 8px;
}

.bcv-status a { color: var(--amber-light); }
.bcv-ok { color: #2ecc71; }
.bcv-err { color: #ff6b6b; }
.bcv-actions { margin: 0.75rem 0 1rem; }

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: linear-gradient(135deg, var(--amber-light), var(--amber));
  color: var(--text-on-accent);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 2000;
}

.toast.show { opacity: 1; }

@media (max-width: 768px) {
  .admin-app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; }
  .sidebar-nav { display: flex; flex-wrap: wrap; width: 100%; }
  .options-layout { grid-template-columns: 1fr; }
}

/* Notificaciones Panel */
.notifications-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.notifications-stats {
  margin-bottom: 1.5rem;
}

.stat-card--warn strong {
  color: var(--red);
}

.text-muted {
  color: var(--muted);
}

.text-connected {
  color: var(--green);
}

.text-disconnected {
  color: var(--red);
}

.notifications-col h3 {
  font-family: 'Bebas Neue', sans-serif;
  color: var(--amber-light);
  font-size: 1.25rem;
  margin-bottom: 1rem;
  letter-spacing: 0.02em;
}

.notifications-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
}

.notification-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-item:hover {
  background: rgba(232, 168, 56, 0.05);
}

.notification-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.notification-status.success {
  background: var(--green);
}

.notification-status.error {
  background: var(--red);
}

.notification-status.pending {
  background: var(--yellow);
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-type {
  font-size: 0.8rem;
  color: var(--muted);
}

.notification-order {
  font-weight: 600;
  color: var(--amber-light);
}

.notification-time {
  font-size: 0.75rem;
  color: var(--muted);
}

/* SSE Live indicator */
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--green);
}

.live-indicator::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* App Restaurante Panel */
.kitchen-url {
  display: block;
  background: var(--surface-light);
  padding: 0.75rem;
  border-radius: 8px;
  margin: 0.5rem 0;
  font-family: monospace;
  word-break: break-all;
}

.help-box {
  background: rgba(232, 168, 56, 0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.help-box h4 {
  color: var(--amber-light);
  margin: 1.25rem 0 0.5rem;
  font-size: 1rem;
}

.help-box h4:first-child {
  margin-top: 0;
}

.help-box ol {
  margin-left: 1.25rem;
  color: var(--muted);
}

.help-box li {
  margin-bottom: 0.5rem;
}

@media (max-width: 768px) {
  .notifications-layout {
    grid-template-columns: 1fr;
  }
}
