/* Identidad visual Microbiota — coherente con el sitio estático. */
:root {
  --bg: #ffffff;
  --bar: #00191e;      /* barra superior (fondo plano del logo) */
  --ink: #1b2b2e;      /* texto principal */
  --petroleo: #0e2a2e; /* títulos */
  --teal: #16464c;     /* acentos / botones */
  --gold: #c7a55a;     /* acento / CTA */
  --cream: #f5f1e8;    /* fondos suaves */
  --border: #e7e2d6;   /* bordes */
  --muted: #5b6b6d;    /* texto secundario (contraste AA sobre blanco) */
  --ok: #1f7a4d;       /* disponible */
  --ok-bg: #e7f4ec;
  --full: #8a6d1f;     /* completa */
  --full-bg: #faf3dd;
  --danger: #b3261e;   /* bloqueada / error */
  --danger-bg: #fcebe9;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(14, 42, 46, 0.08);
  --maxw: 880px;
}

* { box-sizing: border-box; }

/* El atributo [hidden] debe ganar siempre: varias clases setean display (flex/inline-flex)
   y, por especificidad, le ganarían al display:none del user-agent. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

h1, h2, h3, legend { font-family: 'Lora', Georgia, serif; color: var(--petroleo); line-height: 1.2; }
h1 { font-size: 1.7rem; margin: 0 0 .4rem; }
h2 { font-size: 1.35rem; }
a { color: var(--teal); }

.muted { color: var(--muted); }
.hint { color: var(--muted); font-weight: 400; font-size: .9em; }

/* Barra superior de marca */
.topbar { background: var(--bar); color: #fff; }
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: .7rem 1rem;
  display: flex; align-items: center; gap: .75rem;
}
.logo { border-radius: 8px; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: 'Lora', serif; font-weight: 600; font-size: 1.1rem; }
.brand-sub { font-size: .82rem; opacity: .85; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.container.narrow { max-width: 420px; }

.intro { margin: .5rem 0 1.25rem; }
.intro p { color: var(--muted); }

/* Tarjetas / formularios */
.card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow); margin: 0 auto;
}
.field { margin-bottom: 1rem; }
.field > label, legend { display: block; font-weight: 600; margin-bottom: .35rem; color: var(--petroleo); }
fieldset.field { border: 0; padding: 0; margin: 0 0 1rem; }

input, select, textarea {
  width: 100%; min-height: 44px; padding: .6rem .7rem; font: inherit; color: var(--ink);
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
}
textarea { min-height: 80px; resize: vertical; line-height: 1.5; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, .day-card:focus-visible, .check:focus-within {
  outline: 3px solid var(--gold); outline-offset: 2px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }

.checks { display: grid; gap: .5rem; }
.check {
  display: flex; align-items: center; gap: .6rem; min-height: 44px;
  padding: .35rem .6rem; border: 1px solid var(--border); border-radius: 10px; cursor: pointer;
}
.check input { width: 22px; height: 22px; min-height: 0; flex: 0 0 auto; accent-color: var(--teal); }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .6rem 1.1rem; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--teal); color: #fff; width: 100%; }
.btn-primary:hover { background: #11383d; }
.btn-primary:disabled { opacity: .6; cursor: progress; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--petroleo); }
.btn-ghost:hover { background: var(--cream); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { min-height: 38px; padding: .35rem .7rem; font-size: .9rem; }

.form-error {
  background: var(--danger-bg); color: var(--danger); border: 1px solid #f3c9c5;
  padding: .6rem .8rem; border-radius: 10px; margin: .25rem 0 1rem; font-weight: 500;
}
.empty { background: var(--cream); border: 1px solid var(--border); padding: 1rem; border-radius: var(--radius); }

/* Confirmación */
.confirm { text-align: center; }
.confirm-check {
  width: 56px; height: 56px; border-radius: 50%; background: var(--ok-bg); color: var(--ok);
  display: grid; place-items: center; font-size: 1.8rem; margin: 0 auto .6rem;
}

/* ---------- Panel ---------- */
.panel-toolbar { background: var(--cream); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.panel-toolbar-inner { display: flex; align-items: center; justify-content: space-between; padding: .5rem 1rem; gap: 1rem; }
.live { display: flex; align-items: center; gap: .45rem; font-size: .9rem; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #bbb; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-bg); }
.dot.off { background: var(--danger); }
.toolbar-actions { display: flex; align-items: center; gap: .5rem; }
.inline { display: inline; margin: 0; }
.bell { position: relative; background: transparent; border: 1px solid var(--border); border-radius: 10px; min-height: 44px; min-width: 44px; cursor: pointer; font-size: 1.05rem; }
.bell-count {
  position: absolute; top: -6px; right: -6px; background: var(--danger); color: #fff;
  border-radius: 999px; font-size: .72rem; min-width: 20px; height: 20px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}

/* Panel de notificaciones (reservas por la web) */
.notif-wrap { position: relative; display: inline-flex; }
.notif-panel {
  position: absolute; top: calc(100% + 8px); right: 0; width: min(360px, 92vw);
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); z-index: 60; max-height: 70vh; overflow-y: auto;
}
.notif-head { padding: .7rem .9rem; border-bottom: 1px solid var(--border); display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.notif-sub { font-size: .75rem; color: var(--muted); }
.notif-list { padding: .25rem; }
.notif-item { padding: .55rem .65rem; border-radius: 8px; }
.notif-item + .notif-item { border-top: 1px solid var(--border); }
.notif-item.is-unread { background: var(--ok-bg); }
.notif-name { font-weight: 700; color: var(--petroleo); }
.notif-item.is-cancel .notif-name { text-decoration: line-through; color: var(--muted); }
.notif-meta { font-size: .82rem; color: var(--muted); margin-top: .1rem; }
.notif-when { font-size: .72rem; color: var(--muted); margin-top: .1rem; }
.notif-empty { padding: 1.1rem .9rem; text-align: center; color: var(--muted); font-size: .9rem; }

.panel-title { margin-top: 1rem; }
.legend { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .25rem 0 1rem; font-size: .85rem; color: var(--muted); }
.legend-hint { margin-left: .25rem; }
.chip { padding: .15rem .55rem; border-radius: 999px; font-weight: 600; font-size: .8rem; }
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-llena { background: var(--full-bg); color: var(--full); }
.chip-bloqueada { background: var(--danger-bg); color: var(--danger); }

.calendar { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.day-card {
  text-align: left; background: #fff; border: 1px solid var(--border); border-left: 6px solid var(--ok);
  border-radius: 12px; padding: .7rem .8rem; cursor: pointer; display: grid; gap: .15rem; min-height: 92px;
}
.day-card:hover { box-shadow: var(--shadow); }
.day-card .day-when { font-weight: 700; color: var(--petroleo); font-family: 'Lora', serif; }
.day-card .day-sede { font-size: .85rem; color: var(--muted); }
.day-card .day-cupo { font-size: 1.05rem; }
.day-card .day-state { font-size: .78rem; font-weight: 600; }
.day-card.is-ok { border-left-color: var(--ok); }
.day-card.is-ok .day-state { color: var(--ok); }
.day-card.is-llena { border-left-color: var(--full); background: var(--full-bg); }
.day-card.is-llena .day-state { color: var(--full); }
.day-card.is-bloqueada { border-left-color: var(--danger); background: var(--danger-bg); }
.day-card.is-bloqueada .day-state { color: var(--danger); }

/* Drawer del día */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(14,42,46,.45); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(460px, 100%); background: #fff;
  z-index: 50; box-shadow: -8px 0 30px rgba(0,0,0,.18); display: flex; flex-direction: column;
  overflow-y: auto;
}
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 1rem; border-bottom: 1px solid var(--border); }
.drawer-actions { padding: .75rem 1rem; border-bottom: 1px solid var(--border); display: flex; gap: .5rem; flex-wrap: wrap; }
#drawer-body { padding: 1rem; }
.icon-btn { background: transparent; border: 1px solid var(--border); border-radius: 10px; min-height: 44px; min-width: 44px; cursor: pointer; font-size: 1rem; }

.turno {
  border: 1px solid var(--border); border-radius: 12px; padding: .7rem .8rem; margin-bottom: .6rem; background: #fff;
}
.turno.cancelado { opacity: .55; }
.turno h3 { margin: 0 0 .2rem; font-size: 1rem; }
.turno .meta { font-size: .85rem; color: var(--muted); display: grid; gap: .1rem; }
.turno .badge { font-size: .72rem; font-weight: 700; padding: .1rem .45rem; border-radius: 999px; }
.badge-web { background: var(--ok-bg); color: var(--ok); }
.badge-manual { background: #e9eef0; color: var(--teal); }
.badge-cancel { background: var(--danger-bg); color: var(--danger); }
.turno-actions { display: flex; gap: .4rem; margin-top: .5rem; flex-wrap: wrap; }

.section-title { font-weight: 700; color: var(--petroleo); margin: 1.2rem 0 .5rem; font-family: 'Lora', serif; }
.warn {
  background: var(--full-bg); color: var(--full); border: 1px solid #ecd9a0;
  padding: .55rem .7rem; border-radius: 10px; font-size: .88rem; margin: .25rem 0 .5rem;
}

@media (max-width: 560px) {
  .grid-2 { grid-template-columns: 1fr; }
  h1 { font-size: 1.45rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .day-card, .btn { transition: box-shadow .15s ease, background .15s ease; }
}
