/* ============================================================
   Pedidos · Paladar Consciente
   Sistema visual: cobre, crema y café. Móvil primero.
   ============================================================ */

:root {
  --copper: #B87555;
  --copper-dark: #9E6046;
  --copper-soft: #C99572;
  --cocoa: #4E382F;
  --cream: #F8F3ED;
  --beige: #EFE4D9;
  --gold: #C7A071;
  --white: #FFFFFF;

  --ink: var(--cocoa);
  --ink-soft: #7C6459;
  --ink-faint: #9C8579;
  --line: rgba(78, 56, 47, 0.10);
  --line-strong: rgba(78, 56, 47, 0.18);
  --surface: var(--white);
  --surface-alt: #FCF9F5;

  --shadow-sm: 0 1px 2px rgba(78, 56, 47, 0.05), 0 2px 8px rgba(78, 56, 47, 0.04);
  --shadow-md: 0 2px 6px rgba(78, 56, 47, 0.06), 0 12px 28px rgba(78, 56, 47, 0.07);
  --shadow-lg: 0 8px 40px rgba(78, 56, 47, 0.14);

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  --sans: 'Jost', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif;

  --tap: 52px;
  --bottom-nav: 72px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

body { overflow-x: hidden; }

h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--copper-dark); }

button, input, select, textarea { font: inherit; color: inherit; }

.serif { font-family: var(--serif); }

/* ------------------------------------------------ Utilidades */
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.tiny { font-size: 0.75rem; }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.eyebrow {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--copper);
  font-weight: 500;
}

/* ------------------------------------------------ Arranque */
.app-loading { min-height: 100dvh; display: grid; place-items: center; }
.boot { text-align: center; color: var(--ink-soft); }
.boot-mark {
  width: 62px; height: 62px; border-radius: 20px;
  background: var(--copper); color: var(--cream);
  display: grid; place-items: center; margin: 0 auto 14px;
  font-family: var(--serif); font-size: 1.6rem; letter-spacing: 0.05em;
}

/* ------------------------------------------------ Login */
.login-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px 20px calc(28px + var(--safe-b));
  background:
    radial-gradient(120% 80% at 50% 0%, #FDFAF6 0%, var(--cream) 55%, var(--beige) 100%);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--white);
  border-radius: var(--r-xl);
  padding: 34px 26px 30px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line);
}
.login-logo {
  width: 60px; height: 60px; border-radius: 19px;
  background: linear-gradient(150deg, var(--copper), var(--copper-soft));
  color: var(--cream); display: grid; place-items: center;
  font-family: var(--serif); font-size: 1.5rem; margin: 0 auto 18px;
  box-shadow: 0 6px 18px rgba(184, 117, 85, 0.28);
}
.login-card h1 { font-family: var(--serif); font-size: 1.9rem; text-align: center; }
.login-card .sub { text-align: center; color: var(--ink-soft); margin-bottom: 24px; font-size: 0.92rem; }

/* ------------------------------------------------ Estructura */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(248, 243, 237, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
  display: flex; align-items: center; gap: 12px;
}
.topbar-title { font-family: var(--serif); font-size: 1.25rem; line-height: 1.1; }
.topbar-search { display: none; }
.topbar-page { display: none; }
.topbar-sub { font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--copper); }

.icon-btn {
  width: 42px; height: 42px; flex: 0 0 42px;
  border-radius: 13px; border: 1px solid var(--line);
  background: var(--white); color: var(--ink);
  display: grid; place-items: center; cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { background: var(--beige); }
.icon-btn.plain { border-color: transparent; background: transparent; }

.main {
  flex: 1;
  padding: 18px 16px calc(var(--bottom-nav) + var(--safe-b) + 26px);
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}

/* ------------------------------------------------ Nav inferior (móvil) */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding-bottom: var(--safe-b);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; min-height: var(--bottom-nav); text-decoration: none;
  color: var(--ink-faint); font-size: 0.66rem; letter-spacing: 0.02em;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav a.active { color: var(--copper); }
.bottom-nav a.active svg { stroke: var(--copper); }
.bottom-nav .nav-fab { position: relative; }
.bottom-nav .nav-fab span.bubble {
  position: absolute; top: -18px;
  width: 56px; height: 56px; border-radius: 20px;
  background: linear-gradient(150deg, var(--copper), var(--copper-soft));
  color: var(--white); display: grid; place-items: center;
  box-shadow: 0 8px 22px rgba(184, 117, 85, 0.36);
}
.bottom-nav .nav-fab small { margin-top: 34px; }

/* ------------------------------------------------ Sidebar (escritorio) */
.sidebar { display: none; }

@media (min-width: 900px) {
  .shell { flex-direction: row; }
  .sidebar {
    display: flex; flex-direction: column;
    width: 258px; flex: 0 0 258px;
    background: var(--white);
    border-right: 1px solid var(--line);
    padding: 24px 16px;
    position: sticky; top: 0; height: 100dvh;
  }
  .sidebar-brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 22px; }
  .sidebar-mark {
    width: 44px; height: 44px; border-radius: 14px;
    background: linear-gradient(150deg, var(--copper), var(--copper-soft));
    color: var(--cream); display: grid; place-items: center;
    font-family: var(--serif); font-size: 1.15rem;
  }
  .sidebar nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
  .sidebar nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: var(--r-md);
    color: var(--ink-soft); text-decoration: none; font-size: 0.95rem;
    transition: background 0.15s ease, color 0.15s ease;
  }
  .sidebar nav a:hover { background: var(--surface-alt); color: var(--ink); }
  .sidebar nav a.active { background: var(--beige); color: var(--cocoa); font-weight: 500; }
  .sidebar nav a.active svg { stroke: var(--copper); }
  .sidebar nav .nav-sep {
    margin: 14px 14px 6px; font-size: 0.65rem; letter-spacing: 0.16em;
    text-transform: uppercase; color: var(--ink-faint);
  }
  .sidebar-user {
    border-top: 1px solid var(--line); padding-top: 14px; margin-top: 10px;
  }
  .bottom-nav { display: none; }
  .main { padding: 26px 34px 60px; }
  .topbar { padding: 14px 34px; }
  .topbar .topbar-brand { display: none; }
  .topbar .search-mobile { display: none; }
  .topbar-search { display: block; max-width: 460px; margin-left: auto; }
  .topbar-page { display: block; min-width: 180px; }
  .topbar-page .topbar-title { font-size: 1.35rem; }
}

.avatar {
  width: 38px; height: 38px; border-radius: 12px; flex: 0 0 38px;
  background: var(--beige); color: var(--copper-dark);
  display: grid; place-items: center; font-weight: 500; font-size: 0.85rem;
}

/* ------------------------------------------------ Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 20px;
  border-radius: var(--r-md); border: 1px solid transparent;
  background: var(--white); color: var(--ink);
  font-size: 0.98rem; font-weight: 500; cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(150deg, var(--copper), var(--copper-soft));
  color: var(--white); box-shadow: 0 4px 14px rgba(184, 117, 85, 0.26);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 6px 18px rgba(184, 117, 85, 0.34); }
.btn-outline { border-color: var(--line-strong); background: var(--white); color: var(--ink); }
.btn-outline:hover:not(:disabled) { background: var(--surface-alt); }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover:not(:disabled) { background: var(--beige); color: var(--ink); }
.btn-danger { background: #A9736E; color: var(--white); }
.btn-danger:hover:not(:disabled) { background: #96635E; }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 0.88rem; border-radius: var(--r-sm); }
.btn-lg { min-height: 58px; font-size: 1.02rem; }

.btn-tile {
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 68px; padding: 0 18px;
  border-radius: var(--r-lg); border: 1px solid var(--line);
  background: var(--white); box-shadow: var(--shadow-sm);
  cursor: pointer; text-align: left; text-decoration: none; color: var(--ink);
}
.btn-tile .tile-icon {
  width: 44px; height: 44px; border-radius: 14px; flex: 0 0 44px;
  background: var(--beige); color: var(--copper-dark); display: grid; place-items: center;
}
.btn-tile.accent { background: linear-gradient(150deg, var(--copper), var(--copper-soft)); color: var(--white); border-color: transparent; }
.btn-tile.accent .tile-icon { background: rgba(255, 255, 255, 0.2); color: var(--white); }

/* ------------------------------------------------ Tarjetas */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px;
}
.card-tight { padding: 14px; }
.card-title {
  font-size: 0.7rem; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--copper); font-weight: 500; margin-bottom: 12px;
}
.section-title { font-family: var(--serif); font-size: 1.5rem; margin-bottom: 4px; }
.page-head { margin-bottom: 18px; }

.divider { height: 1px; background: var(--line); margin: 14px 0; border: 0; }

/* ------------------------------------------------ Estadísticas */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 720px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow-sm);
}
.stat .label { font-size: 0.74rem; color: var(--ink-soft); letter-spacing: 0.02em; }
.stat .value { font-family: var(--serif); font-size: 2rem; line-height: 1.1; margin-top: 4px; }
.stat .value.money { font-size: 1.5rem; }
.stat.accent { background: linear-gradient(150deg, #FBF6F1, var(--beige)); border-color: rgba(184, 117, 85, 0.22); }
.stat.accent .value { color: var(--copper-dark); }

/* ------------------------------------------------ Etiquetas de estatus */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase;
  font-weight: 500; white-space: nowrap;
  background: var(--beige); color: var(--ink-soft);
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.st-nuevo         { background: #F1E7DB; color: #8A6A4B; }
.chip.st-confirmado    { background: #E7EDE2; color: #5F7550; }
.chip.st-en-preparacion{ background: #F6E6DC; color: #A2603F; }
.chip.st-listo         { background: #E2EBEA; color: #4E7570; }
.chip.st-en-camino     { background: #F3E9D8; color: #94733F; }
.chip.st-entregado     { background: #E6EAE4; color: #6A7A64; }
.chip.st-cancelado     { background: #F1E2E1; color: #96635E; }
.chip.pay-pendiente    { background: #F5E9E2; color: #9C6B4E; }
.chip.pay-anticipo     { background: #F3EDE0; color: #8C7440; }
.chip.pay-pagado       { background: #E7EDE2; color: #5F7550; }
.chip.pay-reembolsado  { background: #ECE7E6; color: #7E6C68; }

/* ------------------------------------------------ Formularios */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 0.83rem; color: var(--ink-soft); font-weight: 400; }
.field > label .req { color: var(--copper); }
.field .hint { font-size: 0.75rem; color: var(--ink-faint); }
.field .err { font-size: 0.78rem; color: #A34F49; }

.input, .select, .textarea {
  width: 100%; min-height: var(--tap);
  padding: 12px 14px;
  background: var(--white);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  appearance: none;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--copper);
  box-shadow: 0 0 0 3px rgba(184, 117, 85, 0.14);
}
.input.invalid, .select.invalid, .textarea.invalid { border-color: #C2837E; }
.input::placeholder, .textarea::placeholder { color: #B7A296; }
.select {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%23B87555' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}
.input-prefix { position: relative; }
.input-prefix .prefix {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--ink-faint); pointer-events: none;
}
.input-prefix .input { padding-left: 30px; }
.input-suffix { position: relative; }
.input-suffix .suffix {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--ink-faint); pointer-events: none; font-size: 0.85rem;
}

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.field-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
@media (max-width: 420px) { .field-grid-3 { grid-template-columns: 1fr 1fr; } }

/* Selección tipo "pastilla" — cómoda con el dedo */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  padding: 11px 16px; min-height: 46px;
  border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--white); color: var(--ink-soft);
  font-size: 0.9rem; cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  transition: all 0.14s ease; -webkit-tap-highlight-color: transparent;
}
.pill:hover { border-color: var(--copper-soft); }
.pill.on {
  background: var(--copper); border-color: var(--copper);
  color: var(--white); box-shadow: 0 3px 10px rgba(184, 117, 85, 0.24);
}
.pill.on.soft { background: var(--beige); color: var(--copper-dark); border-color: var(--copper-soft); box-shadow: none; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  min-height: var(--tap); padding: 6px 0;
}
.switch { position: relative; width: 54px; height: 30px; flex: 0 0 54px; cursor: pointer; }
.switch input { position: absolute; inset: 0; z-index: 2; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px; pointer-events: none;
  background: var(--beige); border: 1px solid var(--line-strong); transition: background 0.18s ease;
}
.switch .knob {
  position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; pointer-events: none;
  border-radius: 50%; background: var(--white); box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease;
}
.switch input:checked ~ .track { background: var(--copper); border-color: var(--copper); }
.switch input:checked ~ .knob { transform: translateX(24px); }

/* ------------------------------------------------ Acordeones del formulario */
.accordion { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; box-shadow: var(--shadow-sm); }
.accordion + .accordion { margin-top: 12px; }
.accordion > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; min-height: 62px;
}
.accordion > summary::-webkit-details-marker { display: none; }
.accordion .acc-step {
  width: 30px; height: 30px; border-radius: 10px; flex: 0 0 30px;
  background: var(--beige); color: var(--copper-dark);
  display: grid; place-items: center; font-size: 0.8rem; font-weight: 500;
}
.accordion[open] .acc-step { background: var(--copper); color: var(--white); }
.accordion .acc-title { font-size: 1rem; font-weight: 500; }
.accordion .acc-sub { font-size: 0.78rem; color: var(--ink-faint); }
.accordion .acc-chevron { margin-left: auto; color: var(--ink-faint); transition: transform 0.2s ease; }
.accordion[open] .acc-chevron { transform: rotate(180deg); }
.accordion .acc-body { padding: 4px 18px 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.accordion.has-error { border-color: #C2837E; }

/* ------------------------------------------------ Listado de pedidos */
.order-card {
  display: block; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 15px 16px;
  box-shadow: var(--shadow-sm); cursor: pointer;
  transition: box-shadow 0.16s ease, transform 0.12s ease, border-color 0.16s ease;
  -webkit-tap-highlight-color: transparent;
}
.order-card:hover { box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.order-card:active { transform: scale(0.995); }
.order-card .folio { font-size: 0.7rem; letter-spacing: 0.1em; color: var(--copper); }
.order-card .name { font-family: var(--serif); font-size: 1.28rem; line-height: 1.2; }
.order-card .meta { font-size: 0.85rem; color: var(--ink-soft); }
.order-card .price { font-weight: 500; }

.order-table { width: 100%; min-width: 1020px; border-collapse: separate; border-spacing: 0; font-size: 0.9rem; }
.order-table td:first-child, .order-table th:first-child { white-space: nowrap; }
.order-table th {
  text-align: left; font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 500; padding: 10px 12px; border-bottom: 1px solid var(--line);
}
.order-table td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.order-table tbody tr { cursor: pointer; }
.order-table tbody tr:hover td { background: var(--surface-alt); }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); }

/* ------------------------------------------------ Calendario */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-label { font-family: var(--serif); font-size: 1.35rem; }
.seg {
  display: inline-flex; background: var(--beige); border-radius: 999px; padding: 3px; gap: 2px;
}
.seg button {
  border: 0; background: transparent; color: var(--ink-soft);
  padding: 8px 14px; border-radius: 999px; font-size: 0.85rem; cursor: pointer; min-height: 40px;
}
.seg button.on { background: var(--white); color: var(--copper-dark); box-shadow: var(--shadow-sm); font-weight: 500; }

.cal-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.cal-day-list { display: flex; flex-direction: column; gap: 10px; }
.cal-hour-group { display: grid; grid-template-columns: 62px 1fr; gap: 12px; align-items: start; }
.cal-hour-label {
  font-size: 0.78rem; color: var(--ink-faint); padding-top: 14px; text-align: right;
  border-right: 1px solid var(--line); padding-right: 10px; min-height: 44px;
}
.cal-hour-items { display: flex; flex-direction: column; gap: 8px; min-height: 44px; }

.cal-event {
  border: 1px solid var(--line); border-left: 4px solid var(--copper);
  background: var(--surface); border-radius: var(--r-md);
  padding: 10px 12px; cursor: pointer; box-shadow: var(--shadow-sm);
  text-align: left; width: 100%; display: block;
  transition: box-shadow 0.16s ease, transform 0.12s ease;
}
.cal-event:hover { box-shadow: var(--shadow-md); }
.cal-event:active { transform: scale(0.99); }
.cal-event .t { font-size: 0.76rem; color: var(--copper-dark); letter-spacing: 0.02em; }
.cal-event .n { font-weight: 500; line-height: 1.25; }
.cal-event .p { font-size: 0.84rem; color: var(--ink-soft); }
.cal-event.st-cancelado { opacity: 0.6; border-left-color: #A9736E; }
.cal-event.st-cancelado .n { text-decoration: line-through; }
.cal-event.st-confirmado { border-left-color: #7C9169; }
.cal-event.st-listo { border-left-color: #6E8F8A; }
.cal-event.st-entregado { border-left-color: #94A08D; }
.cal-event.st-en-camino { border-left-color: var(--gold); }
.cal-event.compact { padding: 6px 8px; border-radius: var(--r-sm); border-left-width: 3px; }
.cal-event.compact .n { font-size: 0.8rem; }

.week-grid { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); gap: 10px; min-width: 980px; }
@media (max-width: 899px) {
  .week-grid { grid-template-columns: repeat(7, minmax(120px, 1fr)); gap: 8px; min-width: 780px; }
}
.week-col { display: flex; flex-direction: column; gap: 8px; }
.week-col-head {
  position: sticky; top: 0; background: var(--cream); padding: 6px 2px 8px; text-align: center;
  border-bottom: 1px solid var(--line); z-index: 2;
}
.week-col-head .dow { font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); }
.week-col-head .num { font-family: var(--serif); font-size: 1.4rem; line-height: 1.1; }
.week-col-head.today .num {
  background: var(--copper); color: var(--white); border-radius: 12px;
  display: inline-block; min-width: 38px; padding: 0 6px;
}
.week-col-body { display: flex; flex-direction: column; gap: 7px; min-height: 90px; }

.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.month-dow {
  text-align: center; font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-faint); padding-bottom: 6px;
}
.month-cell {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  min-height: 84px; padding: 5px; display: flex; flex-direction: column; gap: 3px;
  cursor: pointer; overflow: hidden;
}
.month-cell.out { background: transparent; border-color: transparent; opacity: 0.45; }
.month-cell.today { border-color: var(--copper); }
.month-cell .d { font-size: 0.78rem; color: var(--ink-soft); }
.month-cell.today .d { color: var(--copper); font-weight: 600; }
.month-dot-row { display: flex; flex-wrap: wrap; gap: 3px; }
.month-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--copper-soft); }
.month-cell .mini {
  font-size: 0.66rem; color: var(--ink-soft); line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (max-width: 640px) {
  .month-cell { min-height: 58px; }
  .month-cell .mini { display: none; }
}

/* ------------------------------------------------ Detalle */
.detail-head {
  background: linear-gradient(150deg, #FBF7F2, var(--beige));
  border: 1px solid rgba(184, 117, 85, 0.18);
  border-radius: var(--r-xl); padding: 20px; box-shadow: var(--shadow-sm);
}
.detail-head h1 { font-family: var(--serif); font-size: 1.9rem; line-height: 1.1; }
.detail-grid { display: grid; gap: 12px; }
@media (min-width: 760px) { .detail-grid { grid-template-columns: 1fr 1fr; } }
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--ink-soft); font-size: 0.86rem; }
.kv .v { text-align: right; font-weight: 400; }
.kv .v.strong { font-weight: 500; }
.note-block {
  background: var(--surface-alt); border-radius: var(--r-md); padding: 12px 14px;
  font-size: 0.92rem; line-height: 1.55; white-space: pre-wrap; border: 1px solid var(--line);
}
.promo-block {
  background: linear-gradient(150deg, #FBF3E8, #F3E6D3);
  border: 1px solid rgba(199, 160, 113, 0.4);
  border-radius: var(--r-md); padding: 14px; display: flex; gap: 12px; align-items: center;
}

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px; background: var(--line-strong); }
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item::before {
  content: ''; position: absolute; left: -21px; top: 6px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--white); border: 2px solid var(--copper-soft);
}
.timeline-item .when { font-size: 0.76rem; color: var(--ink-faint); }
.timeline-item .what { font-size: 0.92rem; }
.timeline-item .chg { font-size: 0.8rem; color: var(--ink-soft); }

/* ------------------------------------------------ Resumen / confirmación */
.summary-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-xl); padding: 22px; box-shadow: var(--shadow-md);
}
.summary-card h2 { font-family: var(--serif); font-size: 1.7rem; line-height: 1.15; }
.success-mark {
  width: 74px; height: 74px; border-radius: 50%; margin: 0 auto 16px;
  background: #E7EDE2; color: #5F7550; display: grid; place-items: center;
}

/* ------------------------------------------------ Modal / hoja inferior */
.overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(59, 41, 34, 0.42);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade 0.18s ease;
}
@media (min-width: 760px) { .overlay { align-items: center; padding: 24px; } }
.sheet {
  background: var(--cream); width: 100%; max-width: 520px;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 22px 20px calc(22px + var(--safe-b));
  box-shadow: var(--shadow-lg); max-height: 92dvh; overflow-y: auto;
  animation: rise 0.22s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@media (min-width: 760px) { .sheet { border-radius: var(--r-xl); padding-bottom: 22px; } }
.sheet h3 { font-family: var(--serif); font-size: 1.45rem; margin-bottom: 6px; }
.sheet-handle { width: 42px; height: 4px; border-radius: 999px; background: var(--line-strong); margin: 0 auto 14px; }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.option-list { display: flex; flex-direction: column; gap: 8px; }
.option-list button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: var(--tap); padding: 12px 16px; text-align: left;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--white); cursor: pointer;
}
.option-list button.on { border-color: var(--copper); background: #FBF3EE; }
.option-list button:hover { background: var(--surface-alt); }

/* ------------------------------------------------ Toasts */
.toasts {
  position: fixed; z-index: 120; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--bottom-nav) + var(--safe-b) + 78px);
  display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 32px));
  pointer-events: none;
}
@media (min-width: 900px) { .toasts { bottom: 26px; left: auto; right: 26px; transform: none; } }
.toast {
  background: var(--cocoa); color: #F6EFE9;
  border-radius: var(--r-md); padding: 13px 16px; font-size: 0.92rem;
  box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: flex-start;
  animation: rise 0.2s ease;
}
.toast.ok { background: #4F6543; }
.toast.err { background: #8E524C; }
.toast.warn { background: #8A6A3E; }

/* ------------------------------------------------ Skeletons y vacíos */
.skel {
  background: linear-gradient(90deg, var(--beige) 25%, #F5EDE5 37%, var(--beige) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--r-md);
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.skel-line { height: 13px; margin-bottom: 8px; }
.skel-card { height: 96px; border-radius: var(--r-lg); margin-bottom: 12px; }

.empty { text-align: center; padding: 46px 20px; color: var(--ink-soft); }
.empty .mark {
  width: 62px; height: 62px; border-radius: 20px; margin: 0 auto 14px;
  background: var(--beige); color: var(--copper); display: grid; place-items: center;
}
.empty h3 { font-family: var(--serif); font-size: 1.35rem; color: var(--ink); margin-bottom: 4px; }

.banner {
  border-radius: var(--r-md); padding: 12px 14px; font-size: 0.88rem;
  display: flex; gap: 10px; align-items: flex-start;
}
.banner.info { background: #F4EEE6; color: #7C6459; border: 1px solid var(--line-strong); }
.banner.warn { background: #F8EFE2; color: #8A6A3E; border: 1px solid rgba(199, 160, 113, 0.45); }
.banner.err { background: #F6E9E7; color: #8E524C; border: 1px solid rgba(169, 115, 110, 0.4); }
.banner.ok { background: #ECF1E7; color: #566B49; border: 1px solid rgba(124, 145, 105, 0.35); }

/* ------------------------------------------------ Buscador */
.search-wrap { position: relative; flex: 1; min-width: 0; }
.search-wrap .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); }
.search-input {
  width: 100%; min-height: 46px; padding: 10px 14px 10px 42px;
  border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--white); color: var(--ink);
}
.search-input:focus { outline: none; border-color: var(--copper); box-shadow: 0 0 0 3px rgba(184, 117, 85, 0.13); }

.filter-bar { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.filter-bar::-webkit-scrollbar { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ------------------------------------------------- Barras de las encuestas */
/* Una sola serie, un solo color. El número siempre escrito al lado, para que
   el dato se lea aunque el color no se distinga. */

.barras { display: flex; flex-direction: column; gap: 8px; }

.barra-fila {
  display: grid;
  grid-template-columns: minmax(64px, 96px) 1fr auto;
  align-items: center;
  gap: 10px;
}

.barra-etiqueta {
  font-size: 13px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.barra-riel {
  height: 10px;
  border-radius: 999px;
  background: var(--beige);
  overflow: hidden;
}

.barra-relleno {
  height: 100%;
  min-width: 3px;
  border-radius: 999px;
  background: var(--copper);
}

.barra-valor {
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  min-width: 2ch;
  text-align: right;
}

/* Estrellas y número juntos: el número es el que se lee si el color falla. */
.calif { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.calif-estrellas { color: var(--gold); letter-spacing: 2px; }
.calif-num { font-size: 13px; font-weight: 500; color: var(--ink-soft); }

/* Reseña que necesita atención. El color acompaña, no informa solo: la
   sección se llama "Por atender" y cada ficha trae su calificación escrita. */
.card-alerta {
  border-left: 3px solid #A9736E;
  background: linear-gradient(90deg, #FCF6F5 0%, var(--surface) 40%);
}

/* ------------------------------------------------ Partidas de un pedido */

.divisor-partidas {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 12px;
  font-size: 13px;
  color: var(--ink-faint);
}
.divisor-partidas::before,
.divisor-partidas::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.partida {
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-alt);
}

.partida-num {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--copper);
}

.campo-partida { display: block; }
.etiqueta-partida {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.partida .campo-partida + .campo-partida { margin-top: 10px; }
.partida .field-grid + .field-grid,
.partida .field-grid + .campo-partida { margin-top: 10px; }
