/* Estilos compartidos de los paneles (escuela y papás). */
:root {
  color-scheme: light;
  --bg: #f6ecda;
  --surface: #ffffff;
  --surface-2: #fdf6ea;
  --border: #e7d6b8;
  --border-strong: #d8c099;
  --ink: #1b120b;
  --muted: #7a6650;
  --red: #e31e24;
  --red-dark: #8c1014;
  --red-tint: #fad9d5;
  --amber: #f2a93c;
  --amber-dark: #9a6414;
  --amber-tint: #fbe7c4;
  --bread: #ecc17e;
  --green: #1fa855;
  --green-dark: #0f7a3d;
  --green-tint: #d9f2e2;
  --wa: #25d366;
  --dark: #150c08;
  --on-dark: #f6ecda;
  --on-dark-muted: #c9b79c;
  --paper: #fffdf8;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-ticket:
    0 1px 0 rgba(27, 18, 11, 0.06), 0 10px 24px -14px rgba(27, 18, 11, 0.35);
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main {
  flex: 1;
}
.wrap {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding-inline: 20px;
}
@media (max-width: 480px) {
  .wrap {
    padding-inline: 16px;
  }
}
a {
  color: inherit;
}
::selection {
  background: var(--red);
  color: var(--on-dark);
}
.display {
  font-family: "Fraunces", "Inter", serif;
  text-wrap: balance;
}
.num {
  font-variant-numeric: tabular-nums;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus {
  top: 12px;
}
:focus-visible {
  outline: 2.5px solid var(--amber);
  outline-offset: 2px;
}

/* ---------- Nav ---------- */
.nav-outer {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(246, 236, 218, 0.88);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-block: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}
.brand img {
  width: 30px;
  height: 33px;
  flex: none;
  filter: drop-shadow(0 6px 10px rgba(227, 30, 36, 0.35));
}
.brand-name {
  font-family: "Fraunces", serif;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.01em;
  display: block;
  line-height: 1.1;
}
.brand-tag {
  font-size: 11px;
  color: var(--muted);
  display: block;
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.who-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  font-family: "Fraunces", serif;
  max-width: 240px;
  min-width: 0;
}
.who-pill span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--red-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  flex: none;
  font-family: "Inter", sans-serif;
}
@media (max-width: 560px) {
  .who-pill span:last-child,
  .brand-tag {
    display: none;
  }
  .who-pill {
    padding: 4px;
  }
}

/* ---------- Buttons ---------- */
.btn {
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  text-decoration: none;
  padding: 11px 18px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.12s ease;
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--red-dark);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--red);
}
.btn-dark {
  background: var(--ink);
  color: var(--bg);
}
.btn-dark:hover:not(:disabled) {
  background: #3a271a;
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border-strong);
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--ink);
  color: var(--ink);
}
.btn-danger {
  background: transparent;
  color: var(--red-dark);
  border-color: var(--red-tint);
}
.btn-danger:hover:not(:disabled) {
  background: var(--red-tint);
}
.btn-sm {
  padding: 8px 13px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}
.btn-wide {
  width: 100%;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn.is-busy {
  color: transparent !important;
}
.btn.is-busy::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-color: rgba(255, 255, 255, 0.9) rgba(255, 255, 255, 0.9) transparent
    transparent;
  animation: spin 0.7s linear infinite;
}
.btn-ghost.is-busy::after,
.btn-danger.is-busy::after {
  border-color: var(--muted) var(--muted) transparent transparent;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  padding: 0;
}
.icon-btn svg {
  width: 16px;
  height: 16px;
}
.icon-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.icon-btn.danger:hover {
  border-color: var(--red);
  color: var(--red-dark);
}

/* ---------- Hero band ---------- */
.hero-band {
  background:
    radial-gradient(
      900px 460px at 88% -30%,
      rgba(227, 30, 36, 0.32),
      transparent 60%
    ),
    radial-gradient(
      700px 420px at 0% 60%,
      rgba(242, 169, 60, 0.14),
      transparent 60%
    ),
    var(--dark);
  color: var(--on-dark);
}
.hero-inner {
  padding-block: 34px 30px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}
.hero-title {
  font-family: "Fraunces", serif;
  font-weight: 800;
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: -0.02em;
  line-height: 1.04;
  margin: 0 0 8px;
}
.hero-sub {
  font-size: 15px;
  color: var(--on-dark-muted);
  max-width: 56ch;
  margin: 0;
}
.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--on-dark-muted);
  margin-bottom: 14px;
}
.live-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.live-dot[data-state="live"]::before {
  background: var(--wa);
  box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.6);
  animation: ping 2s ease-out infinite;
}
.live-dot[data-state="error"]::before {
  background: var(--amber);
}
@keyframes ping {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.55);
  }
  80%,
  100% {
    box-shadow: 0 0 0 8px rgba(37, 211, 102, 0);
  }
}

/* ---------- Tabs ---------- */
.tabs-outer {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 57px;
  z-index: 40;
}
.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tab-btn {
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 14.5px;
  background: none;
  border: none;
  color: var(--muted);
  padding: 14px 14px 12px;
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.tab-btn:hover {
  color: var(--ink);
}
.tab-btn[aria-selected="true"] {
  color: var(--red-dark);
  border-bottom-color: var(--red-dark);
}
.tab-count {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 800;
  background: var(--red);
  color: #fff;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tab-count:empty {
  display: none;
}
.tab-panel {
  padding-block: 28px 56px;
}
.tab-panel[hidden] {
  display: none;
}

/* ---------- Panels / cards ---------- */
.panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.panel-head h2,
.section-title {
  font-family: "Fraunces", serif;
  font-weight: 800;
  font-size: 19px;
  margin: 0;
  letter-spacing: -0.01em;
}
.panel-head p,
.section-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 2px 0 0;
}
.panel-body {
  padding: 8px 10px 14px;
}
.panel-foot {
  padding: 16px 22px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

/* ---------- Rows ---------- */
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
}
.row + .row {
  border-top: 1px solid var(--surface-2);
}
.row:hover {
  background: var(--surface-2);
}
.row-main {
  flex: 1;
  min-width: 0;
}
.row-title {
  font-weight: 700;
  font-size: 14.5px;
  display: block;
  overflow-wrap: anywhere;
}
.row-sub {
  font-size: 12.5px;
  color: var(--muted);
  display: block;
  overflow-wrap: anywhere;
}
.row-price {
  font-weight: 700;
  color: var(--red-dark);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.row.is-off .row-title,
.row.is-off .row-price {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

/* ---------- Forms ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field label,
.label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
}
.input,
select.input,
textarea.input {
  font-family: "Inter", sans-serif;
  font-size: 15px;
  font-weight: 500;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  width: 100%;
  min-width: 0;
}
.input::placeholder {
  color: #a8957c;
}
.input:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(242, 169, 60, 0.25);
}
textarea.input {
  resize: vertical;
  min-height: 64px;
}
.form-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.form-row > .field {
  flex: 1 1 160px;
}
.hint {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0;
}
.form-error {
  font-size: 13px;
  color: var(--red-dark);
  background: var(--red-tint);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  margin: 0;
}
.form-error[hidden] {
  display: none;
}

/* ---------- Switch ---------- */
.switch {
  position: relative;
  width: 44px;
  height: 26px;
  flex: none;
  display: inline-block;
}
.switch input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}
.switch .track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  transition: background 0.2s ease;
}
.switch .track::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}
.switch input:checked + .track {
  background: var(--green);
}
.switch input:checked + .track::before {
  transform: translateX(18px);
}
.switch.danger input:checked + .track {
  background: var(--red);
}
.switch input:focus-visible + .track {
  outline: 2.5px solid var(--amber);
  outline-offset: 2px;
}

/* ---------- Status chip ---------- */
.chip {
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip.nuevo {
  background: var(--red-tint);
  color: var(--red-dark);
}
.chip.preparando {
  background: var(--amber-tint);
  color: var(--amber-dark);
}
.chip.listo {
  background: var(--green-tint);
  color: var(--green-dark);
}
.chip.entregado {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}
.chip.cancelado {
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--border-strong);
  text-decoration: line-through;
}

/* ---------- Stat tiles ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 900px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 20px;
  min-width: 0;
}
.stat-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 6px;
}
.stat-value {
  font-family: "Fraunces", serif;
  font-weight: 800;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.stat-note {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 0;
}

/* ---------- Empty / skeleton ---------- */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 34px 20px;
  font-size: 14px;
}
.empty b {
  display: block;
  color: var(--ink);
  font-family: "Fraunces", serif;
  font-size: 16px;
  margin-bottom: 4px;
}
.skeleton {
  border-radius: var(--radius-md);
  background: linear-gradient(
    90deg,
    var(--surface-2) 25%,
    #f3e6cf 37%,
    var(--surface-2) 63%
  );
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
  height: 56px;
  margin: 8px;
}
@keyframes shimmer {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

/* ---------- Banner ---------- */
.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: 18px;
  background: var(--amber-tint);
  color: #5c3b08;
  border: 1px solid #f0d49e;
}
.banner.danger {
  background: var(--red-tint);
  color: var(--red-dark);
  border-color: #f2b8b1;
}
.banner[hidden] {
  display: none;
}
.banner .btn {
  margin-left: auto;
}

/* ---------- Toasts ---------- */
.toast-host {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
.toast {
  background: var(--ink);
  color: var(--bg);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 16px 36px -12px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 380px;
  transform: translateY(12px);
  opacity: 0;
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
}
.toast.show {
  transform: none;
  opacity: 1;
}
.toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--wa);
  flex: none;
}
.toast.error .toast-dot {
  background: var(--red);
}
.toast.info .toast-dot {
  background: var(--amber);
}

/* ---------- Dialog ---------- */
.dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: min(440px, calc(100vw - 32px));
  width: 100%;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.5);
}
.dialog::backdrop {
  background: rgba(21, 12, 8, 0.55);
  backdrop-filter: blur(3px);
}
.dialog form {
  padding: 24px;
}
.dialog h2 {
  font-family: "Fraunces", serif;
  font-size: 20px;
  margin: 0 0 8px;
}
.dialog p {
  color: var(--muted);
  margin: 0 0 20px;
  font-size: 14.5px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Footer ---------- */
.site-foot {
  border-top: 1px solid var(--border);
}
.site-foot .wrap {
  padding-block: 26px 34px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
}
.site-foot .credit {
  font-family: "Fraunces", serif;
  font-weight: 800;
  color: var(--red-dark);
}

/* ---------- Boot overlay ---------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  transition: opacity 0.3s ease;
}
.boot img {
  width: 54px;
  animation: bob 1.1s ease-in-out infinite;
}
.boot p {
  margin: 0;
  font-family: "Fraunces", serif;
  font-weight: 700;
  color: var(--muted);
}
.boot.done {
  opacity: 0;
  pointer-events: none;
}
@keyframes bob {
  50% {
    transform: translateY(-6px) rotate(-4deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
