/* El Capricho de Marlen — panel de reservas (móvil primero) */
:root {
  --cream: #f7f0e5; --paper: #fbf7f0; --burgundy: #3d0c14; --burgundy-2: #2a070d;
  --wine: #7d1d2b; --rose: #a8172b; --gold: #b48a52; --gold-soft: #d5b98a;
  --ink: #2b1b17; --muted: #6e5a51; --line: rgba(61, 12, 20, .14);
  --ok: #2d6a45; --warn: #9a6a12;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Jost", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 400 16px/1.5 var(--sans); }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.15; margin: 0 0 .6rem; }
h2 { font-size: 1.7rem; margin-top: 1.6rem; }
h3.sub { font-size: 1.35rem; margin-top: 2rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
code { font-size: .85em; background: #fff; padding: .1em .3em; }
input, select, textarea, button { font: inherit; }
label { display: grid; gap: .3rem; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
label em { text-transform: none; letter-spacing: 0; font-weight: 300; }
input, select, textarea { width: 100%; min-height: 46px; padding: .6rem .75rem; font-size: 1rem; color: var(--ink); background: #fff; border: 1px solid #d8c9b5; border-radius: 4px; text-transform: none; letter-spacing: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(125, 29, 43, .25); border-color: var(--wine); }
.check { display: flex; align-items: center; gap: .6rem; text-transform: none; letter-spacing: 0; font-size: 1rem; color: var(--ink); }
.check input { width: 22px; height: 22px; min-height: 0; accent-color: var(--wine); }
.check.big { font-size: 1.1rem; font-weight: 500; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: .6rem 1.2rem; border: 1px solid transparent; border-radius: 4px; cursor: pointer; font-weight: 500; letter-spacing: .04em; text-decoration: none; }
.btn-wine { background: var(--wine); color: var(--cream); }
.btn-wine:hover { background: var(--burgundy); }
.btn-gold { background: var(--gold); color: var(--burgundy-2); }
.btn-gold:hover { background: var(--gold-soft); }
.btn-block { width: 100%; }
.btn-ghost { min-height: 42px; padding: .45rem .9rem; background: transparent; border: 1px solid var(--line); border-radius: 4px; color: inherit; cursor: pointer; }
.btn-ghost:hover { border-color: var(--wine); color: var(--wine); }
.icon-btn { width: 46px; min-height: 46px; font-size: 1.6rem; line-height: 1; background: #fff; border: 1px solid #d8c9b5; border-radius: 4px; cursor: pointer; color: var(--wine); }
.link { background: none; border: 0; color: var(--wine); text-decoration: underline; cursor: pointer; padding: .6rem 0; }
.msg { min-height: 1.3em; margin: .2rem 0; color: var(--wine); font-size: .95rem; }
.msg.ok { color: var(--ok); }

.brand { margin: 0; display: flex; flex-direction: column; line-height: 1; font-family: var(--serif); }
.brand-small { font-size: .78rem; letter-spacing: .3em; text-transform: uppercase; font-family: var(--sans); color: var(--gold-soft); }
.brand-big { font-size: 1.6rem; font-style: italic; }

/* Acceso */
.login { min-height: 100svh; display: grid; place-items: center; padding: 1.2rem; background: linear-gradient(180deg, var(--burgundy), var(--burgundy-2)); }
.login-card { width: 100%; max-width: 400px; background: var(--paper); padding: 2rem 1.5rem; border-top: 3px solid var(--gold); display: grid; gap: 1rem; }
.login-card .brand { color: var(--burgundy); }
.login-card .brand-small { color: var(--gold); }
.login-card form { display: grid; gap: .9rem; }

/* Cabecera */
.top { position: sticky; top: 0; z-index: 20; background: var(--burgundy); color: var(--cream); box-shadow: 0 1px 0 rgba(180, 138, 82, .3); padding-top: env(safe-area-inset-top); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 1rem; max-width: 1180px; margin: 0 auto; }
.top-actions { display: flex; align-items: center; gap: .6rem; }
.top .btn-ghost { border-color: rgba(247, 240, 229, .35); }
.top .btn-ghost:hover { color: var(--gold-soft); border-color: var(--gold-soft); }
.sync { font-size: .75rem; color: var(--gold-soft); }
.tabs { display: flex; max-width: 1180px; margin: 0 auto; overflow-x: auto; }
.tabs button { flex: 1; min-width: 88px; min-height: 46px; background: none; border: 0; border-bottom: 3px solid transparent; color: rgba(247, 240, 229, .75); cursor: pointer; letter-spacing: .06em; }
.tabs button[aria-selected="true"] { color: var(--cream); border-bottom-color: var(--gold); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 1rem 1rem calc(4rem + env(safe-area-inset-bottom)); }
.datebar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.datebar input[type="date"] { width: auto; flex: 1 1 150px; }
.datebar .btn-gold { margin-left: auto; }
.summary { color: var(--muted); margin-top: -.2rem; }
.filters { display: flex; gap: .4rem; margin: .4rem 0 .8rem; }
.filters button { min-height: 38px; padding: .3rem .9rem; border: 1px solid #d8c9b5; background: #fff; border-radius: 99px; cursor: pointer; }
.filters button[aria-pressed="true"] { background: var(--wine); border-color: var(--wine); color: var(--cream); }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 1rem; display: grid; gap: .9rem; }
.panel.inline { grid-template-columns: 1fr; }
.grid2, .grid3 { display: grid; gap: .8rem; grid-template-columns: 1fr; }

/* Tarjetas de reserva */
.cards { display: grid; gap: .7rem; }
.card { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 6px; padding: .85rem .95rem; display: grid; gap: .35rem; }
.card.st-arrived { border-left-color: var(--ok); }
.card.st-no_show { border-left-color: var(--warn); opacity: .8; }
.card.st-cancelled { border-left-color: #bbb; opacity: .6; }
.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.card-time { font-family: var(--serif); font-size: 1.55rem; font-weight: 600; color: var(--burgundy); }
.card-time small { font-family: var(--sans); font-size: .8rem; font-weight: 400; color: var(--muted); }
.card-name { font-size: 1.1rem; font-weight: 500; }
.card-meta { display: flex; flex-wrap: wrap; gap: .35rem .9rem; font-size: .95rem; }
.card-meta a { color: var(--wine); }
.card-notes { font-size: .92rem; background: var(--paper); padding: .4rem .6rem; border-radius: 4px; }
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 99px; font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; background: #f1e6d6; color: var(--burgundy); }
.badge.tables { background: var(--burgundy); color: var(--cream); }
.badge.arrived { background: #dcefe2; color: var(--ok); }
.badge.no_show { background: #f6ead2; color: var(--warn); }
.badge.cancelled { background: #eee; color: #666; }
.card-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .3rem; }
.card-actions button { min-height: 40px; padding: .35rem .75rem; font-size: .9rem; border: 1px solid #d8c9b5; background: #fff; border-radius: 4px; cursor: pointer; }
.card-actions button:hover { border-color: var(--wine); color: var(--wine); }
.card-actions .armed { background: var(--rose); color: #fff; border-color: var(--rose); }
.empty { padding: 1.2rem; text-align: center; color: var(--muted); background: #fff; border: 1px dashed #d8c9b5; border-radius: 6px; }

/* Línea de tiempo de mesas */
.timeline-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 6px; -webkit-overflow-scrolling: touch; }
.timeline { position: relative; min-width: 760px; padding: .5rem .5rem .8rem 4.2rem; }
.tl-hours { position: relative; height: 1.4rem; font-size: .72rem; color: var(--muted); }
.tl-hours span { position: absolute; transform: translateX(-50%); }
.tl-row { position: relative; height: 2.3rem; border-top: 1px solid var(--line); }
.tl-label { position: absolute; left: -4rem; width: 3.8rem; top: .55rem; font-size: .8rem; font-weight: 500; }
.tl-label small { color: var(--muted); font-weight: 300; }
.tl-item { position: absolute; top: .3rem; height: 1.7rem; border-radius: 4px; padding: 0 .35rem; font-size: .72rem; line-height: 1.7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--wine); color: var(--cream); cursor: pointer; border: 0; }
.tl-item.block { background: repeating-linear-gradient(45deg, #8a7a70, #8a7a70 6px, #9d8d83 6px, #9d8d83 12px); cursor: default; }
.tl-item.arrived { background: var(--ok); }

/* Semana */
.week { display: grid; gap: .7rem; }
.week-day { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: .7rem .8rem; }
.week-day.today { border-color: var(--gold); box-shadow: inset 0 3px 0 var(--gold); }
.week-day.closed { background: #f3eee6; }
.week-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; cursor: pointer; background: none; border: 0; width: 100%; padding: 0; text-align: left; color: inherit; }
.week-head strong { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; text-transform: capitalize; }
.week-head span { font-size: .85rem; color: var(--muted); }
.week-list { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .2rem; font-size: .9rem; }
.week-list li { display: grid; grid-template-columns: 4.6rem 1fr auto; gap: .4rem; padding: .25rem 0; border-top: 1px dashed var(--line); }
.week-list .t { font-weight: 500; color: var(--burgundy); }

/* Chips de mesas */
.chips { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.chips legend { width: 100%; margin-bottom: .35rem; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.chips legend em { text-transform: none; letter-spacing: 0; font-weight: 300; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; min-height: 0; }
.chip span { display: inline-flex; align-items: center; gap: .3rem; min-height: 42px; padding: .35rem .8rem; background: #fff; border: 1px solid #d8c9b5; border-radius: 99px; font-size: .92rem; }
.chip input:checked + span { background: var(--wine); color: var(--cream); border-color: var(--wine); }
.chip input:focus-visible + span { outline: 2px solid var(--wine); outline-offset: 2px; }
.chip small { opacity: .75; }

/* Horario */
.hours-day { display: grid; gap: .4rem; padding: .6rem 0; border-bottom: 1px dashed var(--line); }
.hours-day strong { font-weight: 500; }
.shift { display: grid; grid-template-columns: 1fr 1fr auto; gap: .4rem; align-items: center; }
.shift button, .hours-day > button { min-height: 42px; }

/* Mesas (editor) */
.table-row { display: grid; grid-template-columns: 3.2rem 1fr 5rem auto; gap: .5rem; align-items: center; padding: .35rem 0; border-bottom: 1px dashed var(--line); }
.table-row input { min-height: 42px; }
.table-row .check { font-size: .9rem; }

/* Diálogo */
.dialog { width: min(640px, calc(100vw - 1rem)); max-height: calc(100svh - 1rem); border: 0; border-radius: 8px; padding: 0; background: var(--paper); color: var(--ink); }
.dialog::backdrop { background: rgba(42, 7, 13, .6); }
.dialog form { display: grid; gap: .9rem; padding: 1.2rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .6rem; position: sticky; bottom: 0; background: var(--paper); padding-top: .4rem; }

.toast { position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; max-width: calc(100vw - 2rem); background: var(--burgundy-2); color: var(--cream); padding: .75rem 1.1rem; border-radius: 6px; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); }

@media (min-width: 700px) {
  .grid2 { grid-template-columns: 1fr 1fr; }
  .grid3 { grid-template-columns: repeat(3, 1fr); }
  .panel.inline { grid-template-columns: 1fr 2fr auto; align-items: end; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
  .week { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .week-list li { grid-template-columns: 1fr; gap: 0; }
  .wrap { padding-left: 1.4rem; padding-right: 1.4rem; }
}
