/* ===================================================================
   Vacaciones — estética "carta de restaurante"
   Papel crema, tinta verde botella, acento terracota.
   Tipos: Fraunces (display) + Karla (texto).
   =================================================================== */

:root {
  --paper: #f6f0e3;
  --paper-deep: #efe6d2;
  --ink: #1e3528;
  --ink-soft: #57695c;
  --line: #d9cdb2;
  --accent: #c2562a;
  --accent-deep: #9c3f1b;
  --accent-wash: #f3e0d2;
  --ok: #2f6b46;
  --radius: 14px;
  --shadow: 0 2px 0 rgba(30, 53, 40, 0.08), 0 14px 34px -18px rgba(30, 53, 40, 0.35);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100dvh;
  font-family: "Karla", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(194, 86, 42, 0.07), transparent 60%),
    radial-gradient(100% 50% at 50% 100%, rgba(30, 53, 40, 0.08), transparent 65%),
    var(--paper);
}

/* grano de papel */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.12 0 0 0 0 0.2 0 0 0 0 0.15 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.page {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 16px 120px;
}
.page--wide { max-width: 760px; }

/* ---------- cabecera tipo carta ---------- */

.masthead {
  text-align: center;
  padding: 18px 8px 16px;
  border-top: 3px double var(--ink);
  border-bottom: 3px double var(--ink);
  margin-bottom: 22px;
  animation: rise 0.5s ease both;
}
.masthead .kicker {
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin: 0 0 6px;
}
.masthead h1 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: clamp(28px, 8vw, 38px);
  line-height: 1.08;
  margin: 0;
  font-variation-settings: "opsz" 60;
}
.masthead h1 em {
  font-style: italic;
  color: var(--accent);
}
.masthead .sub {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
}

/* ---------- tarjetas ---------- */

.card {
  background: #fffdf7;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  animation: rise 0.5s ease both;
}
.card h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 21px;
  margin: 0 0 12px;
}

label { display: block; font-weight: 700; font-size: 14px; margin: 14px 0 6px; }

input[type="text"], input[type="password"], input[type="number"] {
  width: 100%;
  padding: 13px 14px;
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(194, 86, 42, 0.15); }

/* selector de cargo como fichas grandes */
.role-grid { display: grid; gap: 10px; }
.role-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  cursor: pointer;
  font-size: 17px;
  font-weight: 700;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.role-option:active { transform: scale(0.98); }
.role-option input { position: absolute; opacity: 0; }
.role-option .dot {
  width: 22px; height: 22px;
  border: 2px solid var(--ink-soft);
  border-radius: 50%;
  flex: none;
  display: grid; place-items: center;
  transition: border-color 0.15s;
}
.role-option .dot::after {
  content: "";
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--accent);
  transform: scale(0);
  transition: transform 0.15s;
}
.role-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-wash);
}
.role-option:has(input:checked) .dot { border-color: var(--accent); }
.role-option:has(input:checked) .dot::after { transform: scale(1); }

/* ---------- botones ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 18px;
  margin-top: 18px;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--paper);
  background: var(--ink);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, opacity 0.15s;
}
.btn:hover { background: #2a4736; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn--accent { background: var(--accent); }
.btn--accent:hover { background: var(--accent-deep); }
.btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--line);
}
.btn--ghost:hover { background: var(--paper-deep); }
.btn--small { width: auto; padding: 9px 14px; font-size: 14px; margin-top: 0; }

.error-msg {
  color: var(--accent-deep);
  background: var(--accent-wash);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 700;
  margin-top: 12px;
  display: none;
}
.error-msg.show { display: block; }

/* ---------- ficha del trabajador ---------- */

.me-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffdf7;
  box-shadow: var(--shadow);
  animation: rise 0.5s ease both;
}
.me-strip .who { font-weight: 800; font-size: 15px; }
.me-strip .who small {
  display: block;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-deep);
}
.me-strip .tally {
  font-family: "Fraunces", Georgia, serif;
  font-size: 15px;
  white-space: nowrap;
  color: var(--ink-soft);
}
.me-strip .tally b {
  font-size: 22px;
  color: var(--ink);
  font-style: italic;
}

.closed-banner {
  text-align: center;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-weight: 700;
  margin-bottom: 16px;
  animation: rise 0.5s ease both;
}

.hint {
  font-size: 13.5px;
  color: var(--ink-soft);
  text-align: center;
  margin: 0 0 16px;
}
.hint .chip {
  display: inline-block;
  min-width: 17px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

/* ayuda bajo un campo del formulario */
.field-hint {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin: 6px 0 0;
}

/* ---------- calendario ---------- */

.month {
  background: #fffdf7;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 12px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  animation: rise 0.45s ease both;
}
.month h3 {
  font-family: "Fraunces", Georgia, serif;
  font-style: italic;
  font-weight: 600;
  font-size: 20px;
  text-align: center;
  margin: 2px 0 10px;
  position: relative;
}
.month h3::before, .month h3::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 18%;
  border-top: 1px solid var(--line);
}
.month h3::before { left: 2%; }
.month h3::after { right: 2%; }

.dow, .days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.dow {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: center;
  margin-bottom: 6px;
}
.day {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s, transform 0.08s;
  -webkit-tap-highlight-color: transparent;
}
.day:not(:disabled):active { transform: scale(0.92); }
.day:disabled { color: #c2b89f; cursor: default; }
.day.past { color: #c2b89f; border-color: #e7dcc2; background: transparent; }
.day.selected {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.day .count {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  box-shadow: 0 0 0 1.5px var(--paper);
}
.day.selected .count { box-shadow: 0 0 0 1.5px var(--ink); }

/* minileyenda bajo el mes (solo si hay días pedidos por compañeros) */
.month-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 2px 0;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--ink-soft);
}
.month-legend .count-sample {
  flex: none;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
}

/* ---------- barra de guardado ---------- */

.savebar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 10;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(246, 240, 227, 0.92) 35%);
  transform: translateY(110%);
  transition: transform 0.25s ease;
  pointer-events: none;
}
.savebar.show { transform: translateY(0); pointer-events: auto; }
.savebar .inner {
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  padding: 10px 10px 10px 20px;
  box-shadow: 0 16px 34px -12px rgba(30, 53, 40, 0.55);
}
.savebar .label { flex: 1; font-weight: 700; font-size: 14.5px; }
.savebar .btn { width: auto; margin: 0; padding: 11px 20px; background: var(--accent); }
.savebar .btn:hover { background: var(--accent-deep); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  z-index: 20;
  transform: translate(-50%, 20px);
  background: var(--ok);
  color: #fff;
  font-weight: 700;
  font-size: 14.5px;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--accent-deep); }

/* ---------- panel de administración ---------- */

.round-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 16px 0;
  border-bottom: 1px dashed var(--line);
}
.round-item:last-child { border-bottom: none; }
.round-item .info { flex: 1 1 200px; min-width: 0; }
.round-item .title {
  font-family: "Fraunces", Georgia, serif;
  font-size: 19px;
  font-weight: 600;
}
.round-item .meta { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.round-item .url {
  display: block;
  font-size: 12.5px;
  margin-top: 6px;
  color: var(--accent-deep);
  word-break: break-all;
  text-decoration: none;
  font-weight: 700;
}
.round-item .actions { display: flex; flex-wrap: wrap; gap: 8px; }

.badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  vertical-align: 2px;
  margin-left: 8px;
}
.badge.open { background: #ddebdd; color: var(--ok); }
.badge.closed { background: var(--accent-wash); color: var(--accent-deep); }

.form-row { display: flex; gap: 10px; }
.form-row > div:first-child { flex: 1; }
.form-row > div:last-child { width: 110px; }

.empty {
  text-align: center;
  color: var(--ink-soft);
  font-style: italic;
  font-family: "Fraunces", Georgia, serif;
  padding: 22px 0;
}

footer.colophon {
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 28px;
}
footer.colophon::before { content: "❧"; display: block; font-size: 18px; margin-bottom: 6px; color: var(--accent); }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.hidden { display: none !important; }
