/* ─── Heura Jornada ────────────────────────────────────────────────────────
   Diseño de Sales Prices (ITHeuraFoods/sales-prices-dashboard): mismos tokens,
   tipografía Geist y componentes. Las fuentes se sirven desde aquí (OFL, ver
   fonts/LICENSE-Geist.txt) para no depender de Google Fonts ni abrir la CSP. */

@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-Variable.0e46e732cced.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("fonts/GeistMono-Variable.addf0d443087.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  /* Surfaces */
  --bg: #FAFAF7;
  --surface: #FFFFFF;
  --surface-2: #F5F4EF;
  --surface-3: #EDEBE5;
  --border: #E7E5E0;
  --border-strong: #D4D2CC;
  /* Text */
  --text: #0A0A0A;
  --text-2: #4F4E4A;
  --text-3: #8A8984;
  /* Accents */
  --accent: #FDE01E;
  --accent-deep: #E5C800;
  --accent-soft: #FFF6BF;
  --accent-tint: rgba(253, 224, 30, 0.10);
  --accent-fg: #0A0A0A;
  /* Status */
  --neg: #B53221;
  --neg-bg: #FBE9E5;
  --pos: #1E7F46;
  --pos-bg: rgba(30, 127, 70, 0.12);
  /* Effects */
  --shadow-sm: 0 1px 0 rgba(15, 17, 21, 0.03), 0 1px 2px rgba(15, 17, 21, 0.04);
  --shadow-md: 0 1px 0 rgba(15, 17, 21, 0.04), 0 8px 24px rgba(15, 17, 21, 0.06);
  --radius: 6px;
  --radius-lg: 10px;
  --mono: "Geist Mono", ui-monospace, "SF Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D0E0B;
    --surface: #16170F;
    --surface-2: #1F1F18;
    --surface-3: #292920;
    --border: #2A2A22;
    --border-strong: #3A3A30;
    --text: #F7F6F0;
    --text-2: #B3B1A8;
    --text-3: #6E6C64;
    --accent-soft: rgba(253, 224, 30, 0.16);
    --accent-fg: #0A0A0A;
    --neg-bg: rgba(181, 50, 33, 0.16);
    --shadow-sm: 0 1px 0 rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 1px 0 rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D0E0B;
  --surface: #16170F;
  --surface-2: #1F1F18;
  --surface-3: #292920;
  --border: #2A2A22;
  --border-strong: #3A3A30;
  --text: #F7F6F0;
  --text-2: #B3B1A8;
  --text-3: #6E6C64;
  --accent-soft: rgba(253, 224, 30, 0.16);
  --neg-bg: rgba(181, 50, 33, 0.16);
  --shadow-sm: 0 1px 0 rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 1px 0 rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Geist", ui-sans-serif, system-ui, sans-serif;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.45;
  min-height: 100vh;
}
a { color: inherit; }
main a:not(.btn):not(.big) {
  text-decoration: underline;
  text-decoration-color: var(--text-3);
  text-underline-offset: 3px;
}
main a:not(.btn):not(.big):hover { text-decoration-color: var(--accent-deep); }
code, kbd, .mono { font-family: var(--mono); font-feature-settings: "tnum", "zero"; }

/* ─── Top bar ─────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 24px;
  border-right: 1px solid var(--border);
  margin-right: 8px;
  height: 32px;
  text-decoration: none;
  flex-shrink: 0;
}
.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  position: relative;
  flex-shrink: 0;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: #0A0A0A;
  opacity: 0.92;
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; color: var(--text); }
.brand-divider { color: var(--text-3); font-size: 14px; }
.brand-product { color: var(--text-2); font-weight: 500; font-size: 14px; letter-spacing: -0.005em; }

.tabs {
  display: flex;
  gap: 2px;
  align-items: center;
  height: 56px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .12s, border-color .12s;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

.topbar-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.user-stamp {
  font-size: 12px;
  color: var(--text-3);
  font-family: var(--mono);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.user-stamp::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pos);
  display: inline-block;
}
.icon-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, color .12s, border-color .12s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }

/* ─── Page ─────────────────────────────────────────────────────────────── */
main.page { max-width: 1100px; margin: 0 auto; padding: 28px 28px 48px; }
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
  font-family: var(--mono);
}
h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 20px; }
.card h1 { font-size: 22px; margin-bottom: 16px; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin: 28px 0 10px; }
.mt0 { margin-top: 0; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.foot {
  text-align: center;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  padding: 24px 16px 32px;
}

/* ─── Cards, avisos y mensajes ────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.card.alert { border-left: 3px solid var(--accent); }
.messages { margin-bottom: 4px; }
.msg {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-3);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin: 0 0 12px;
  box-shadow: var(--shadow-sm);
  font-size: 13.5px;
}
.msg.success { border-left-color: var(--pos); }
.msg.error { border-left-color: var(--neg); background: var(--neg-bg); }
.msg.info, .msg.warning { border-left-color: var(--accent); }
.grid2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid2 > .card { margin-bottom: 0; }

/* ─── Botones ─────────────────────────────────────────────────────────── */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s, opacity .12s;
}
button:hover, .btn:hover { background: var(--surface-2); }
button.primary, .btn.primary { background: var(--text); color: var(--surface); border-color: var(--text); }
button.primary:hover, .btn.primary:hover { background: var(--text); opacity: 0.88; }
button.danger { color: var(--neg); }
button.small, .btn.small { height: 28px; padding: 0 10px; font-size: 12px; }
button.link { height: auto; padding: 0; border: 0; background: none; font-weight: 500; }
.big, a.big {
  display: flex;
  width: 100%;
  height: 48px;
  font-size: 16px;
  font-weight: 700;
  background: var(--accent);
  color: var(--accent-fg);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  text-decoration: none;
  align-items: center;
  justify-content: center;
}
.big:hover, a.big:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.inline { display: inline; margin: 0; }
form.dev { margin: 6px 0; }
.w100 { width: 100%; }
.w80 { width: 90px; }
.left { justify-content: flex-start; text-align: left; }
.center { text-align: center; }
.narrow { max-width: 460px; margin: 24px auto; }
.wide { max-width: 720px; margin: 0 auto; }

/* ─── Formularios ─────────────────────────────────────────────────────── */
input[type=text], input[type=email], input[type=date], input[type=time], input[type=number], select, textarea {
  font: inherit;
  font-size: 14px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  outline: none;
  max-width: 100%;
}
input[type=date], input[type=time], input[type=number] { font-family: var(--mono); font-weight: 500; }
textarea { height: auto; min-height: 72px; padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-deep); box-shadow: 0 0 0 2px var(--accent-tint), inset 0 0 0 1px var(--accent); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input[type=checkbox], input[type=radio] { accent-color: #0A0A0A; width: 15px; height: 15px; }
.check-line { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
label.block {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--mono);
  margin-bottom: 6px;
}
form p { margin: 0 0 14px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.row-actions input[type=text] { min-width: 180px; flex: 1; }
.otp { font-size: 24px !important; letter-spacing: 6px; width: 190px; height: 48px !important; font-family: var(--mono); }

/* Control segmentado (Oficina/Teletrabajo, días de la semana) */
.choice {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 3px;
  margin: 10px 0 8px;
}
.choice label {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: background .12s, color .12s, box-shadow .12s;
}
.choice label:hover { color: var(--text); }
.choice label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 600; }
.choice label:has(input:focus-visible) { outline: 2px solid var(--accent-deep); outline-offset: 1px; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }

/* Tramos de la jornada */
.segments { display: grid; gap: 10px; margin: 6px 0 10px; }
.segment { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg-label {
  width: 92px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--mono);
}
.segment input[type=time] { height: 42px; font-size: 16px; min-width: 124px; }

/* Registrar varios días: una fila por día pendiente */
.bulk-head, .bulk-row {
  display: grid;
  grid-template-columns: minmax(130px, 160px) minmax(0, 1fr) minmax(0, 1fr) minmax(110px, 140px);
  grid-template-areas: "day m t mode";
  gap: 8px 18px;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
.bulk-head {
  background: var(--surface-2);
  padding-top: 10px;
  padding-bottom: 10px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--mono);
}
.bulk-row { transition: opacity .12s, background .12s; }
.bulk-row:hover { background: var(--surface-2); }
.bulk-row:has(.bulk-day input:not(:checked)) { opacity: 0.45; }
.bulk-row.has-error { background: var(--neg-bg); }
.bulk-day { grid-area: day; display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.bulk-pair { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 6px; }
.bulk-pair:nth-of-type(1) { grid-area: m; }
.bulk-pair:nth-of-type(2) { grid-area: t; }
.bulk-pair .seg-label { display: none; }
.bulk-pair input[type=time] { width: 100%; min-width: 0; }
.bulk-mode { grid-area: mode; }
.bulk-error { grid-column: 1 / -1; margin: 0; color: var(--neg); font-size: 12.5px; font-weight: 600; }
.bulk-foot { padding: 16px 20px 20px; }
.bulk-section { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; padding: 18px 20px 6px; }
.bulk-row + .bulk-section, .bulk-reason + .bulk-section { border-top: 1px solid var(--border-strong); margin-top: 4px; }
.bulk-section h2 { margin: 0; font-size: 15px; }
.bulk-section button { margin-left: auto; }
.bulk-reason { padding: 12px 20px 4px; }
.bulk-reason.has-error textarea { border-color: var(--neg); }
.bulk-foot p { margin: 0 0 12px; }
.bulk-head .num { text-align: right; }
.bulk-total { grid-area: mode; text-align: right; font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.bulk-total.off b { color: var(--neg); }
.bulk-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0 !important; }

/* ─── KPIs ────────────────────────────────────────────────────────────── */
.kpis { display: flex; flex-wrap: wrap; margin: 2px 0 8px; }
.kpis > div { display: flex; flex-direction: column; gap: 2px; padding: 2px 18px 2px 0; margin-right: 18px; border-right: 1px solid var(--border); }
.kpis > div:last-child { border-right: none; margin-right: 0; }
.kpis > div > b { order: 1; font-family: var(--mono); font-weight: 600; font-size: 20px; letter-spacing: -0.01em; color: var(--text); }
.kpis > div > span {
  order: 2;
  font-size: 10.5px;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: var(--mono);
}

/* ─── Tablas ──────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.card.table-wrap { padding: 0; }
.card.table-wrap > p { margin: 12px 20px 14px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
th {
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: 600;
  padding: 10px 14px;
  text-align: left;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--mono);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
tr:last-child > td { border-bottom: none; }
tr:hover > td { background: var(--surface-2); }
td.num, th.num { text-align: right; }

/* Dashboard de People (pestaña Registro) */
.subtabs { display: flex; gap: 4px; margin: 0 0 16px; border-bottom: 1px solid var(--border); }
.subtabs a { padding: 8px 12px; color: var(--text-2); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.subtabs a:hover { color: var(--text); }
.subtabs a.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.filters .presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.filters .btn.on { background: var(--text); color: var(--surface); border-color: var(--text); }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 8px; }
.tile { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.tile-label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.tile-value { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; color: var(--text); }
.tile-sub { font-size: 12.5px; color: var(--text-2); }
.meter { display: block; width: 100%; height: 6px; }
.meter .track { fill: var(--surface-3); }
.meter.good .fill { fill: var(--pos); }
.meter.warn .fill { fill: var(--accent-deep); }
.meter.bad .fill { fill: var(--neg); }
.meter-cell { display: grid; grid-template-columns: minmax(60px, 1fr) 48px; align-items: center; gap: 10px; min-width: 150px; }
.meter-cell .num { text-align: right; font-family: var(--mono); font-weight: 500; }
table.dash tr.total td { border-top: 1px solid var(--border); background: var(--surface-2); }
@media (max-width: 1000px) { .hide-md { display: none; } }
ul.plain { list-style: none; padding: 0; margin: 8px 0 0; }
ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--border); }
ul.plain li:last-child { border-bottom: none; }

td.num { font-family: var(--mono); font-weight: 500; }
tr.void > td { text-decoration: line-through; color: var(--text-3); }
tr.sel > td { background: var(--accent-tint); }
tr.sel:hover > td { background: var(--accent-soft); }
tr.muted > td { color: var(--text-3); }
.card:not(.table-wrap) table th:first-child, .card:not(.table-wrap) table td:first-child { padding-left: 0; }
.card:not(.table-wrap) table th { background: none; }

/* ─── Etiquetas (badges) ──────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 5px;
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--text-2);
  margin: 1px 4px 1px 0;
}
.chip.ok { background: var(--pos-bg); color: var(--pos); }
.chip.bad { background: var(--neg); color: #fff; }
.chip.warn { background: var(--accent-soft); color: var(--text); }

/* ─── Paginación de semanas y meses ───────────────────────────────────── */
.pager { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pager b { font-size: 14px; font-weight: 600; }

/* ─── Acceso ──────────────────────────────────────────────────────────── */
.login-brand { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.login-brand .brand-name { font-size: 18px; }
.login-brand .brand-product { font-size: 17px; }

/* ─── Móvil ───────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 10px 16px 0; gap: 4px; }
  .brand { border-right: none; padding-right: 0; margin-right: 0; }
  .user-stamp { display: none; }
  .tabs { order: 3; width: calc(100% + 32px); margin: 0 -16px; padding: 0 10px; height: 44px; }
  .tab { padding: 0 10px; }
  main.page { padding: 18px 16px 40px; }
  h1 { font-size: 23px; }
  .card { padding: 16px; }
  .hide-sm { display: none; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 12px 14px; }
  .tile-value { font-size: 22px; }
  .meter-cell { min-width: 110px; grid-template-columns: minmax(40px, 1fr) 42px; }
  th, td { padding: 9px 10px; }
  .kpis > div { padding-right: 12px; margin-right: 12px; }
  .segment { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px 8px; }
  .seg-label { grid-column: 1 / -1; width: auto; }
  .segment input[type=time] { min-width: 0; width: 100%; }
  .bulk-row { padding: 14px 16px; }
  .bulk-foot { padding: 14px 16px 18px; }
  .bulk-section, .bulk-reason { padding-left: 16px; padding-right: 16px; }
}

/* Varios días: por debajo de 900 px cada día en varias líneas (día y modalidad, mañana, tarde) */
@media (max-width: 900px) {
  .bulk-head { display: none; }
  .bulk-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "day mode" "m m" "t t"; }
  .bulk-pair { grid-template-columns: 70px minmax(0, 1fr) auto minmax(0, 1fr); }
  .bulk-pair .seg-label { display: block; width: auto; grid-column: auto; }
}
