/* Le Coq Turnos · mismo sistema visual que la intranet de Le Coq (intranet.lcq.es/reservas):
   gris claro, tarjetas blancas, tinta casi negra, rojo Le Coq de acento y tipografía del sistema. */
:root {
  --bg: #f4f4f4; --card: #fff; --ink: #111; --mute: #6b6b6b; --line: #e0e0e0; --acc: #e83028; --acc-ink: #fff;
  --sunk: #f8f8f8; --hover: #f4f4f4; --bad: #8b1a12; --fin: #777;
  --logo: url("/assets/brand/logo.png");
  /* Estados y áreas (mismos tonos que los chips de reservas) */
  --ok: #2e7d32; --ok-soft: #e3f1e4; --warn: #9a6400; --warn-soft: #fdf1d6; --bad-soft: #f9e0dd; --acc-soft: #fde6e4;
  --sala: #2f6fed; --sala-soft: #e5edfd; --cocina: #9a4a12; --cocina-soft: #f8e9dc; --reparto: #2e7d32; --reparto-soft: #e3f1e4; --oficina: #555; --oficina-soft: #ececec;
  /* Alias usados por las vistas */
  --surface: var(--card); --fg: var(--ink); --muted: var(--mute); --ember: var(--acc); --ember-ink: var(--acc-ink); --ember-soft: var(--acc-soft); --focus: var(--acc);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0d0d0d; --card: #1a1a1a; --ink: #f5f5f5; --mute: #a3a3a3; --line: #333; --sunk: #151515; --hover: #222; --bad: #ff6b5e; --fin: #8a8a8a;
  --logo: url("/assets/brand/logo-oscuro.png");
  --ok: #7fd08a; --ok-soft: #15291a; --warn: #f0c060; --warn-soft: #2e2410; --bad-soft: #3a1714; --acc-soft: #3a1513;
  --sala: #8fb2ff; --sala-soft: #16233d; --cocina: #f0a96b; --cocina-soft: #33220f; --reparto: #7fd08a; --reparto-soft: #15291a; --oficina: #bbb; --oficina-soft: #2a2a2a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.4 var(--font); -webkit-text-size-adjust: 100%; padding-top: env(safe-area-inset-top, 0px); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
.lbl { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); font-weight: 700; }
.muted { color: var(--mute); } .small { font-size: 13px; } .quote { font-style: italic; }

/* ---------- Estructura: menú lateral + contenido ---------- */
#app { display: grid; grid-template-columns: 320px minmax(0, 1fr); min-height: 100vh; }
#menu { background: var(--card); border-right: 1px solid var(--line); padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
/* Menú lateral en negro con texto e iconos en blanco, como en Reservas (solo el menú; el resto sigue en fondo claro) */
#menu { --card: #000; --ink: #fff; --mute: #c4c4c4; --line: #2e2e2e; --bg: #333; --hover: #333; --logo: url("/assets/brand/logo-oscuro.png"); color: var(--ink); }
.marca { padding: 2px 8px 12px; display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo { display: inline-block; background: var(--logo) left center / contain no-repeat; width: 104px; height: 52px; flex: 0 0 auto; }
.logo.grande { width: 200px; height: 100px; }
.marcatxt { font-size: 17px; font-weight: 700; position: relative; top: 6px; }
.grp { margin-bottom: 6px; }
.gt { display: flex; width: 100%; justify-content: space-between; align-items: center; padding: 8px; border: 0; background: none; color: var(--mute); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; }
.gt i { font-style: normal; transition: transform .15s; }
.grp.cerrado .gt i { transform: rotate(-90deg); }
.grp.cerrado .gi { display: none; }
.ic { width: 18px; height: 18px; flex: 0 0 auto; }
.mi { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 12px; margin: 1px 0; border: 0; background: none; border-radius: 8px; font-weight: 500; cursor: pointer; text-decoration: none; color: var(--ink); }
.mi:hover { background: var(--bg); }
.mi.on { background: var(--acc); color: var(--acc-ink); }
#menu .pie { margin-top: auto; padding: 10px 8px 4px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
#menu .pie #quien { flex-basis: 100%; font-weight: 600; }
#menu .pie .link { display: inline-flex; align-items: center; gap: 6px; }
#menu .pie .ic { width: 15px; height: 15px; }
.link { background: none; border: 0; color: var(--mute); font-size: 13px; text-decoration: underline; cursor: pointer; padding: 4px; }
#velo { display: none; }
.principal { min-width: 0; }
#topbar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 12px 24px 0; }
#topbar button { border: 1px solid var(--line); background: var(--card); border-radius: 8px; font-size: 20px; line-height: 1; padding: 6px 10px; cursor: pointer; }
#topbar button:hover { background: var(--hover); }
#topbar .marca { display: none; padding: 0; }
#topbar .logo { width: 72px; height: 36px; }
#topbar .marcatxt { top: 4px; }
#contenido { padding: 8px 24px 90px; max-width: 1500px; width: 100%; margin: 0 auto; }
@media (min-width: 860px) {
  #app { transition: grid-template-columns .22s; }
  body.menu-oculto #app { grid-template-columns: 0 minmax(0, 1fr); }
  body.menu-oculto #menu { visibility: hidden; overflow: hidden; padding: 0; border-right: 0; }
  body.menu-oculto #topbar .marca { display: flex; }
}
@media (max-width: 859px) {
  #app { grid-template-columns: 1fr; }
  #topbar { background: var(--card); border-bottom: 1px solid var(--line); padding: 8px 12px; }
  #topbar .marca { display: flex; }
  #menu { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; height: auto; z-index: 40; transform: translateX(-105%); transition: transform .2s; box-shadow: 2px 0 12px rgba(0,0,0,.25); }
  body.menu-abierto #menu { transform: none; }
  body.menu-abierto #velo { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 30; }
  #contenido { padding: 12px 12px 90px; }
}
.solo { min-height: 100vh; padding: 24px 16px 60px; }
.phone { max-width: 460px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 12px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 0; }

/* ---------- Acceso (como el de reservas: foto + panel) ---------- */
#login { display: grid; grid-template-columns: 1fr 1fr; min-height: 100dvh; margin: -24px -16px -60px; }
#login .lg-foto { position: relative; background: #2a2a2a url("/assets/brand/login-foto.jpg") center / cover no-repeat; min-height: 180px; }
#login .lg-foto::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(0,0,0,.04), rgba(0,0,0,.3)); }
#login .lg-panel { display: flex; flex-direction: column; justify-content: center; padding: 40px clamp(24px, 7vw, 96px); background: var(--bg); }
#login .lg-caja { width: 100%; max-width: 380px; margin: 0 auto; }
#login .lg-logo { display: block; margin: 0 0 30px; width: 200px; height: 100px; }
#login h1 { font-size: 26px; line-height: 1.15; margin: 0 0 6px; }
#login .lg-sub { color: var(--mute); margin: 0 0 20px; font-size: 14px; }
#login .field > span { font-size: 12px; }
#login input { padding: 12px 14px; font-size: 16px; }
#login .btn.pri { width: 100%; margin-top: 8px; min-height: 48px; }
#login .lg-nota { color: var(--mute); font-size: 13px; margin: 18px 0 0; }
#login .lg-nota a { color: var(--mute); font-weight: 600; }
@media (max-width: 820px) {
  #login { grid-template-columns: 1fr; grid-template-rows: 170px 1fr; }
  #login .lg-panel { justify-content: flex-start; padding: 26px 22px 40px; }
  #login .lg-logo { margin-bottom: 22px; width: 150px; height: 75px; }
}

/* ---------- Formularios y botones ---------- */
select, input[type=text], input[type=email], input[type=password], input[type=time], input[type=number], input[type=date], input[type=month], textarea {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-height: 42px; max-width: 100%; }
textarea { width: 100%; min-height: 80px; resize: vertical; }
input[type=file] { max-width: 100%; }
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 600; color: var(--mute); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; text-decoration: none; transition: transform .08s, opacity .15s; }
.btn:hover { border-color: var(--acc); color: var(--acc); }
.btn:active { transform: scale(.97); }
.btn.pri { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); font-weight: 700; }
.btn.pri:hover { opacity: .92; color: var(--acc-ink); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--card); }
.btn.dark:hover { opacity: .9; color: var(--card); }
.btn.sm { min-height: 32px; padding: 6px 12px; font-size: 13px; }
.btn.big { min-height: 56px; font-size: 16px; width: 100%; border-radius: 12px; }
.btn[disabled] { opacity: .55; cursor: default; transform: none; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.neu { background: var(--line); color: var(--mute); }
.area { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 1px 7px; border-radius: 6px; }
.area.SALA { background: var(--sala-soft); color: var(--sala); } .area.COCINA { background: var(--cocina-soft); color: var(--cocina); }
.area.REPARTO { background: var(--reparto-soft); color: var(--reparto); } .area.OFICINA { background: var(--oficina-soft); color: var(--oficina); }
.notice { border-radius: 10px; padding: 10px 12px; background: color-mix(in srgb, var(--ink) 6%, var(--card)); border: 1px solid var(--line); font-size: 14px; }
.error { border-radius: 10px; padding: 10px 12px; background: var(--bad-soft); color: var(--bad); font-weight: 600; font-size: 14px; }

/* ---------- Pestañas, KPI, tablas, listas ---------- */
.tabs { display: flex; gap: 6px; margin: 4px 0 16px; overflow-x: auto; padding-bottom: 2px; }
.tabs a { flex: 0 0 auto; text-decoration: none; padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-weight: 600; font-size: 14px; white-space: nowrap; }
.tabs a:hover { border-color: var(--acc); color: var(--acc); }
.tabs a[aria-current="page"] { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--acc); color: var(--acc-ink); font-size: 12px; line-height: 20px; text-align: center; margin-left: 6px; }
.tabs a[aria-current="page"] .badge { background: var(--acc-ink); color: var(--acc); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 8px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.kpi .v { font-weight: 700; font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 13px; color: var(--mute); }
.kpi.alert { border-color: var(--acc); box-shadow: inset 4px 0 0 var(--acc); } .kpi.caution { border-color: var(--warn); box-shadow: inset 4px 0 0 var(--warn); }

.tw { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; letter-spacing: .03em; text-transform: uppercase; color: var(--mute); font-weight: 700; background: var(--sunk); white-space: nowrap; }
tbody tr:hover td { background: var(--sunk); }
tr:last-child td { border-bottom: 0; } td.r, th.r { text-align: right; } tfoot td { font-weight: 700; background: var(--sunk); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: center; }
.list li:last-child { border-bottom: 0; }

/* ---------- Calendario ---------- */
.cal { min-width: 980px; table-layout: fixed; }
.cal th, .cal td { padding: 6px; border-right: 1px solid var(--line); }
.cal th:first-child, .cal td:first-child { position: sticky; left: 0; background: var(--card); z-index: 1; width: 180px; }
.cal thead th:first-child { background: var(--sunk); }
.cal tbody tr:hover td { background: none; }
.cell { display: block; width: 100%; min-height: 52px; border: 1px dashed transparent; border-radius: 8px; background: none; padding: 4px; cursor: pointer; text-align: left; }
.cell:hover { border-color: var(--line); background: var(--sunk); } .cell[disabled] { cursor: default; background: none; border-color: transparent; }
.sh { display: block; border-radius: 6px; padding: 4px 6px; font-size: 12px; line-height: 1.3; font-variant-numeric: tabular-nums; font-weight: 600; }
.sh.SALA { background: var(--sala-soft); color: var(--sala); } .sh.COCINA { background: var(--cocina-soft); color: var(--cocina); }
.sh.REPARTO { background: var(--reparto-soft); color: var(--reparto); } .sh.OFICINA { background: var(--oficina-soft); color: var(--oficina); }
.sh.draft { outline: 2px dashed var(--acc); outline-offset: 1px; } .sh.vac { background: var(--line); color: var(--mute); }
.sh.else { background: repeating-linear-gradient(135deg, var(--line) 0 6px, transparent 6px 12px); color: var(--mute); }
.off { font-size: 12px; color: var(--mute); padding: 4px 6px; display: block; } .off.draft { outline: 2px dashed var(--acc); border-radius: 6px; }
.over { color: var(--acc); font-weight: 700; }
.draftbar { position: sticky; bottom: 12px; z-index: 5; background: var(--ink); color: var(--card); border-radius: 12px; padding: 12px 16px; display: flex; gap: 10px 18px; align-items: center; flex-wrap: wrap; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.draftbar .grow { flex: 1 1 260px; }
.draftbar .btn:not(.pri) { background: transparent; color: var(--card); border-color: color-mix(in srgb, var(--card) 35%, transparent); }
.warns { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.warns li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; background: var(--warn-soft); font-size: 14px; }
.warns li.HIGH { background: var(--bad-soft); }

/* ---------- Fichaje (móvil y terminal) ---------- */
.clock { position: relative; background: #111; color: #fff; border: 1px solid #111; border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
:root[data-theme="dark"] .clock { background: var(--card); border-color: var(--line); }
.clock .sym { position: absolute; top: 16px; right: 16px; height: 56px; width: auto; }
.clock .t { font-weight: 700; font-size: 56px; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.clock .btn:not(.pri) { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.clock .btn:not(.pri):hover { border-color: #fff; color: #fff; }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keys button { min-height: 66px; font-weight: 700; font-size: 26px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); cursor: pointer; transition: transform .08s; }
.keys button:active { transform: scale(.96); }
.keys button.word { font-size: 15px; }
.term { max-width: 900px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: 16px; }
.pinv { font-size: 32px; letter-spacing: .5em; min-height: 42px; }

/* ---------- Gráficos ---------- */
.chart svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--mute); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.bars { display: flex; flex-direction: column; gap: 14px; }
.track { position: relative; height: 6px; background: var(--line); border-radius: 3px; }
.track .fx { position: absolute; inset: 0 auto 0 0; background: var(--ink); border-radius: 3px; }
.track .vr { position: absolute; top: 0; bottom: 0; background: var(--acc); }
.track .mk { position: absolute; top: -5px; bottom: -5px; width: 2px; background: var(--ink); }

/* ---------- Diálogos ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50; display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
@media (min-width: 700px) { .scrim { align-items: center; } }
.sheet { background: var(--card); border-radius: 16px; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; margin: auto; }
dialog.sheet { border: 0; color: var(--ink); }
dialog.sheet::backdrop { background: rgba(0,0,0,.5); }
dialog.sheet:not([open]) { display: none; }
dialog.sheet[open] { display: flex; }
@media (max-width: 699px) { dialog.sheet { margin: auto 0 0; max-width: 100%; border-radius: 16px 16px 0 0; } }
.opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.opt { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--card); cursor: pointer; text-align: left; }
.opt:hover { border-color: var(--acc); }
.opt b { display: block; font-size: 14px; } .opt span { font-size: 12px; color: var(--mute); }
.opt.cur { border-color: var(--acc); box-shadow: inset 0 0 0 1px var(--acc); }
.trail { font-size: 13px; color: var(--mute); border-left: 2px solid var(--line); padding-left: 10px; display: flex; flex-direction: column; gap: 2px; }
.hide { display: none !important; }
code { font-size: .85em; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
