/* ============================================================
   AZERI — Diseño (mobile-first, dashboard SaaS moderno)
   ============================================================ */

:root {
  --bg: #eef2f7;
  --card: #ffffff;
  --card-soft: #f7f9fc;
  --ink: #1b2333;
  --muted: #6a7488;
  --line: #e3e8f0;
  --primary: #1d6fb8;
  --primary-dark: #0e5a9c;
  --primary-soft: #e8f1fb;
  --accent: #f59e0b;
  --green: #16a34a;
  --green-soft: #e6f6ec;
  --red: #dc2626;
  --red-soft: #fdecec;
  --amber: #d97706;
  --amber-soft: #fdf3e3;
  --gray-soft: #eef1f5;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .05);
  --shadow-lg: 0 8px 30px rgba(16, 24, 40, .14);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 14px 14px 40px; flex: 1; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(120deg, #0e4f8a 0%, #135f9e 60%, #1d6fb8 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px;
  box-shadow: 0 2px 10px rgba(10, 40, 80, .25);
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand .logo { font-size: 26px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.3)); display: flex; align-items: center; }
.brand .logo img { height: 32px; max-width: 120px; object-fit: contain; border-radius: 8px; background: #fff; padding: 3px 6px; }
.brand-text h1 { font-size: 19px; letter-spacing: 3px; line-height: 1.05; }
.brand-text p { font-size: 11px; opacity: .85; white-space: nowrap; }

.nav { display: flex; gap: 3px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: #fff; text-decoration: none; font-size: 12.5px; font-weight: 600;
  padding: 7px 10px; border-radius: 9px; white-space: nowrap;
  display: flex; align-items: center; gap: 4px;
}
.nav a:hover { background: rgba(255,255,255,.14); }
.nav a.active { background: rgba(255,255,255,.22); }

.userbox { display: flex; align-items: center; gap: 6px; min-width: 0; }
.chip {
  background: rgba(255,255,255,.16); border-radius: 99px; padding: 5px 11px;
  font-size: 12px; font-weight: 600; white-space: nowrap; display: flex; align-items: center; gap: 5px;
}
.btn-mini {
  background: rgba(255,255,255,.2); color: #fff; border: none; border-radius: 8px;
  padding: 5px 9px; font-size: 12px; cursor: pointer; font-weight: 600;
}
.btn-mini:hover { background: rgba(255,255,255,.32); }

/* ---------- Tarjetas y layout ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
  animation: fadeUp .28s ease both;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: 1fr; }
@media (min-width: 760px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } }

/* Semana: 1 columna móvil, 7 columnas escritorio */
.week-grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .week-grid { grid-template-columns: repeat(7, 1fr); } }

/* ---------- Tipografía ---------- */
h2.section { font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.2px; margin: 22px 0 10px; }
h3 { font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.big { font-size: 22px; font-weight: 800; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: none; border-radius: 12px; padding: 10px 16px; font-size: 14px; font-weight: 700;
  cursor: pointer; text-decoration: none; transition: transform .08s ease, box-shadow .15s ease, background .15s;
  font-family: var(--font);
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(29,111,184,.35); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: var(--card-soft); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: #eef1f6; }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(245,158,11,.35); }
.btn-danger { background: var(--red); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Badges y estados ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 99px; padding: 3px 10px; font-size: 11.5px; font-weight: 700;
}
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-gray { background: var(--gray-soft); color: var(--muted); }
.badge-blue { background: var(--primary-soft); color: var(--primary-dark); }

.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 10px; padding: 6px 11px; font-weight: 700; font-size: 13px; }

.ocup-0 { color: var(--muted); }
.ocup-1 { color: var(--green); }
.ocup-2 { color: var(--amber); }
.ocup-3 { color: var(--red); }

/* ---------- Barras de ocupación ---------- */
.bar { height: 7px; border-radius: 99px; background: var(--gray-soft); overflow: hidden; margin-top: 7px; }
.bar > i { display: block; height: 100%; border-radius: 99px; transition: width .4s ease; }

/* ---------- Tarjeta de día (semana) ---------- */
.day-card { display: flex; flex-direction: column; gap: 8px; cursor: pointer; transition: transform .1s ease, box-shadow .15s ease; }
.day-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.day-card.today { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(29,111,184,.18); }
.day-head { display: flex; justify-content: space-between; align-items: baseline; }
.day-name { font-weight: 800; font-size: 14px; text-transform: uppercase; letter-spacing: .4px; }
.day-date { font-size: 11.5px; color: var(--muted); }
.festivo-tag { font-size: 10.5px; color: var(--amber); font-weight: 700; }
.svc-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 10px; background: var(--card-soft); }
.svc-row .name { font-weight: 700; font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.svc-row .count { font-weight: 800; font-size: 13px; }

/* ---------- Servicios (HOY / día) ---------- */
.svc-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 13px 15px; cursor: pointer; width: 100%; text-align: left;
  transition: border-color .15s, box-shadow .15s, transform .08s;
  font-family: var(--font);
}
.svc-btn:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-1px); }
.svc-btn .ico { font-size: 24px; }
.svc-btn .lbl { font-weight: 800; font-size: 14px; }
.svc-btn .sub { font-size: 12px; color: var(--muted); }

/* ---------- Mesas ---------- */
.mesa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.mesa {
  border-radius: 12px; padding: 9px 4px; text-align: center; font-weight: 800; font-size: 13.5px;
  border: 1.5px solid var(--line); background: var(--card-soft); cursor: pointer;
  transition: transform .08s, box-shadow .15s;
}
.mesa:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.mesa.libre { color: var(--green); border-color: #bbe7c9; background: var(--green-soft); }
.mesa.ocupada { color: var(--red); border-color: #f3c1c1; background: var(--red-soft); }
.mesa .dot { display: block; font-size: 10px; }
.planta-title { font-weight: 800; font-size: 13px; margin: 14px 0 8px; display: flex; align-items: center; gap: 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }

/* ---------- Limpieza ---------- */
.clean-card { border-left: 4px solid var(--primary); }
.clean-card.obligatoria { border-left-color: var(--red); background: linear-gradient(90deg, #fff7f7, #fff); }
.clean-turno { font-weight: 800; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.clean-motivos { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.clean-motivos li { list-style: none; display: flex; gap: 7px; }
.clean-motivos li::before { content: "•"; color: var(--primary); font-weight: 800; }
.estado-tag { font-size: 11px; font-weight: 800; padding: 2px 9px; border-radius: 99px; }

/* ---------- Notas ---------- */
.note { border-left: 4px solid var(--line); }
.note.importante { border-left-color: var(--red); background: linear-gradient(90deg, #fff8f0, #fff); }
.note .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.note .autor { font-weight: 700; font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.note .texto { margin-top: 5px; font-size: 13.5px; white-space: pre-wrap; }

/* ---------- Formularios ---------- */
.form { display: grid; gap: 10px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 11px;
  font-size: 14px; font-family: var(--font); background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29,111,184,.12);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

/* ---------- Tablas (escritorio) ---------- */
.tabla { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabla th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .7px; padding: 8px 10px; border-bottom: 2px solid var(--line); }
.tabla td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tabla tr:hover td { background: var(--card-soft); }
@media (max-width: 700px) { .tabla-wrap { overflow-x: auto; } }

/* ---------- Modal ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .55); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fadeIn .18s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: 18px; max-width: 460px; width: 100%;
  max-height: 88vh; overflow-y: auto; padding: 20px; box-shadow: var(--shadow-lg);
  animation: pop .2s ease both;
}
@keyframes pop { from { opacity: 0; transform: scale(.95) translateY(8px); } to { opacity: 1; transform: none; } }
.modal h3 { font-size: 17px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.modal .close { float: right; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--muted); }

/* ---------- Toast ---------- */
#toast-root { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); }
.toast {
  background: #1b2333; color: #fff; border-radius: 12px; padding: 12px 16px;
  font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-lg);
  animation: toastIn .25s ease both; display: flex; gap: 9px; align-items: center;
}
.toast.err { background: #b91c1c; }
.toast.ok { background: #15803d; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Cabecera de sección ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.page-head h2 { font-size: 20px; display: flex; align-items: center; gap: 9px; }
.subtitle { color: var(--muted); font-size: 13px; }
.nav-week { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hoy-banner {
  background: linear-gradient(120deg, #0e4f8a, #1d6fb8); color: #fff; border-radius: var(--radius);
  padding: 18px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  box-shadow: var(--shadow-lg);
}
.hoy-banner .d { font-size: 13px; opacity: .9; }
.hoy-banner .h { font-size: 24px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }

/* ---------- Estado vacío ---------- */
.empty { text-align: center; color: var(--muted); padding: 26px 10px; font-size: 13.5px; }
.empty .ico { font-size: 34px; display: block; margin-bottom: 8px; }

/* ---------- Tabs admin ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button {
  border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 13px;
  font-size: 13px; font-weight: 700; cursor: pointer; color: var(--muted); font-family: var(--font);
}
.tabs button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Varios ---------- */
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.kpi { text-align: center; padding: 14px 8px; }
.kpi .v { font-size: 26px; font-weight: 800; }
.kpi .l { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }

.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 18px; }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; }
  .nav { order: 3; width: 100%; justify-content: flex-start; }
  .brand-text p { display: none; }
}

.skeleton { background: linear-gradient(90deg, #edf0f5 25%, #f6f8fb 50%, #edf0f5 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 12px; height: 90px; }
@keyframes shimmer { to { background-position: -200% 0; } }
