/* San Miguel de Colina — Agenda de Eventos. Español chileno. */
:root {
  --bg: #faf7f1;
  --card: #ffffff;
  --ink: #2e2a24;
  --muted: #8c8475;
  --line: #e7e0d3;
  --olive: #7a8450;
  --olive-d: #5c6539;
  --gold: #b08d57;
  --disp: #6f8f5f;
  --disp-bg: #e8f0e2;
  --res: #c25b54;
  --res-bg: #f6e2e0;
  --tent: #d39a36;
  --tent-bg: #f8eed6;
  --bloq: #9a948a;
  --bloq-bg: #ece9e3;
  --shadow: 0 6px 24px rgba(60,52,40,.10);
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 600; letter-spacing: .2px; margin: 0; }
a { color: var(--olive-d); }
.wrap { max-width: 920px; margin: 0 auto; padding: 24px 18px 64px; }

/* Header */
.head { text-align: center; padding: 26px 0 18px; }
.head .kicker { text-transform: uppercase; letter-spacing: 3px; font-size: 12px; color: var(--gold); font-weight: 600; }
.head h1 { font-size: clamp(30px, 6vw, 46px); margin: 6px 0 2px; }
.head .sub { color: var(--muted); font-size: 15px; }

/* Card */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin: 18px 0; }
.card h2 { font-size: 26px; margin-bottom: 6px; }
.card .hint { color: var(--muted); font-size: 14px; margin-bottom: 14px; }

/* Calendar */
.cal-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-top .mes { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 24px; font-weight: 600; text-transform: capitalize; }
.navbtn { border: 1px solid var(--line); background: #fff; color: var(--ink); width: 40px; height: 40px; border-radius: 10px; font-size: 18px; cursor: pointer; transition: .15s; }
.navbtn:hover { background: var(--bg); border-color: var(--olive); }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.dow { text-align: center; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); padding: 4px 0; }
.cell { aspect-ratio: 1 / 1; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 15px; border: 1px solid transparent; position: relative; }
.cell .num { font-weight: 600; }
.cell .tag { font-size: 9px; text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }
.cell.empty { background: transparent; }
.cell.neutral { color: #c9c2b4; background: #fbfaf7; }
.cell.disp { background: var(--disp-bg); color: var(--disp-d, #43643a); border-color: #cfe0c2; }
.cell.res { background: var(--res-bg); color: #97433d; border-color: #ecc9c5; }
.cell.tent { background: var(--tent-bg); color: #8f6c1e; border-color: #ecdcae; }
.cell.bloq { background: var(--bloq-bg); color: #6f6a62; border-color: #ddd8cf; }
.cell.today { outline: 2px solid var(--gold); outline-offset: -2px; }
.cell.clickable { cursor: pointer; }
.cell.clickable:hover { outline: 2px solid var(--olive); outline-offset: -2px; }

/* Legend */
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 16px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.dot.disp { background: var(--disp); } .dot.res { background: var(--res); }
.dot.tent { background: var(--tent); } .dot.bloq { background: var(--bloq); }

/* Range */
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
input, select, textarea { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--olive); }
.btn { font: inherit; font-weight: 600; padding: 11px 18px; border-radius: 10px; border: 1px solid var(--olive); background: var(--olive); color: #fff; cursor: pointer; transition: .15s; }
.btn:hover { background: var(--olive-d); border-color: var(--olive-d); }
.btn.ghost { background: #fff; color: var(--olive-d); }
.btn.ghost:hover { background: var(--bg); }
.btn.danger { background: #fff; color: var(--res); border-color: var(--res); }
.btn.danger:hover { background: var(--res-bg); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.lista-fechas { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.lista-fechas li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid #cfe0c2; background: var(--disp-bg); border-radius: 10px; }
.lista-fechas .fecha-dia { font-weight: 700; color: #43643a; }
.lista-fechas .fecha-dow { color: var(--muted); font-size: 13px; text-transform: capitalize; }
.vacio { color: var(--muted); font-style: italic; padding: 12px 0; }

/* Admin */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.topbar .who { font-size: 14px; color: var(--muted); }
.eventos-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.ev-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: #fff; transition: .12s; }
.ev-item:hover { border-color: var(--olive); background: var(--bg); }
.ev-item .ev-fecha { font-weight: 700; min-width: 96px; }
.ev-item .ev-nombres { flex: 1; }
.badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; padding: 3px 8px; border-radius: 999px; }
.badge.res { background: var(--res-bg); color: #97433d; }
.badge.tent { background: var(--tent-bg); color: #8f6c1e; }
.badge.bloq { background: var(--bloq-bg); color: #6f6a62; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
.prov-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px dashed var(--line); }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--gold); margin: 18px 0 8px; }
.msg { padding: 10px 14px; border-radius: 10px; margin: 10px 0; font-size: 14px; }
.msg.err { background: var(--res-bg); color: #97433d; }
.msg.ok { background: var(--disp-bg); color: #43643a; }
.overlay { position: fixed; inset: 0; background: rgba(46,42,36,.45); display: none; align-items: flex-start; justify-content: center; padding: 24px; overflow: auto; z-index: 50; }
.overlay.show { display: flex; }
.modal { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; width: 100%; max-width: 640px; }
.modal h2 { margin-bottom: 12px; }
.login-box { max-width: 380px; margin: 40px auto; }
.spinner { color: var(--muted); font-size: 14px; padding: 18px 0; text-align: center; }
.hidden { display: none !important; }
