:root {
    color-scheme: dark;
    --bg: #0A0D0C;
    --panel: #111615;
    --panel-2: #171E1C;
    --line: #212B28;
    --line-2: #31403B;
    --text: #E9EEEB;
    --muted: #93A09B;
    --faint: #66736E;
    --accent: #6FD6A8;
    --accent-dim: #2C6B52;
    --accent-ink: #05130C;
    --warn: #E0B26A;
    --bad: #E0776070;
    --bad-solid: #E07760;
    --radius: 6px;
  }
  * { box-sizing: border-box; }
  body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Archivo", "Helvetica Neue", Arial, sans-serif;
    font-size: 14.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
  }
  h1, h2, h3 { margin: 0; font-weight: 600; font-variation-settings: "wdth" 110; letter-spacing: -0.015em; text-wrap: balance; }
  a { color: inherit; }
  .mono { font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-variant-numeric: tabular-nums; }
  .eyebrow { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
  .wrap { max-width: 1060px; margin: 0 auto; padding: 0 22px; }
  :where(button, input, select, textarea, a):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  @media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

  /* ---------- barra demo ---------- */
  .demobar {
    background: #1A1408;
    border-bottom: 1px solid #2E2412;
    font-size: 12.5px;
    color: #D9BE86;
  }
  .demobar .wrap { display: flex; align-items: center; gap: 14px; min-height: 34px; flex-wrap: wrap; }
  .demobar b { color: var(--warn); font-weight: 600; }
  .demobar .spacer { margin-left: auto; }
  .linkish {
    background: none; border: none; padding: 0; font: inherit; color: #D9BE86;
    text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
  }
  .linkish:hover { color: var(--warn); }

  /* ---------- header ---------- */
  header.top { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 30; }
  .top .wrap { display: flex; align-items: center; gap: 18px; min-height: 62px; flex-wrap: wrap; }
  .brand { display: flex; align-items: center; gap: 11px; margin-right: auto; }
  .logo {
    width: 34px; height: 34px; border-radius: 8px; flex: 0 0 auto;
    background: linear-gradient(150deg, var(--accent), var(--accent-dim));
    color: var(--accent-ink); display: grid; place-items: center;
    font-weight: 700; font-size: 15px; letter-spacing: -0.02em;
  }
  .brand-txt { display: flex; flex-direction: column; line-height: 1.15; }
  .brand-name { font-weight: 700; font-size: 16px; font-variation-settings: "wdth" 115; }
  .brand-name span { color: var(--accent); }
  .brand-sub { font-size: 11px; color: var(--faint); }
  .nav { display: flex; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
  .nav button {
    appearance: none; font: inherit; font-size: 13px; font-weight: 500;
    background: none; border: none; color: var(--muted);
    padding: 6px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  }
  .nav button:hover { color: var(--text); }
  .nav button[aria-current="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
  .who { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }

  /* ---------- bloques ---------- */
  main { padding: 34px 0 90px; }
  .panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
  .pad { padding: 20px; }
  .stack { display: flex; flex-direction: column; gap: 18px; }
  .row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
  .head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
  .head h2 { font-size: 20px; }
  .head .note { font-size: 12.5px; color: var(--faint); margin-left: auto; }
  .sub { color: var(--muted); font-size: 13.5px; }

  /* ---------- stepper ---------- */
  .stepper { display: flex; gap: 8px; margin-bottom: 30px; overflow-x: auto; padding-bottom: 4px; }
  .stepper button {
    appearance: none; font: inherit; background: none; border: none; cursor: pointer;
    display: flex; align-items: center; gap: 9px; padding: 6px 12px 6px 6px; border-radius: 999px;
    color: var(--faint); font-size: 13px; white-space: nowrap;
  }
  .stepper button:disabled { cursor: default; opacity: .55; }
  .stepper .dot {
    width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
    background: var(--panel-2); border: 1px solid var(--line-2); font-size: 12px;
    font-family: "IBM Plex Mono", monospace; color: var(--muted);
  }
  .stepper .done .dot { background: var(--accent-dim); border-color: var(--accent-dim); color: var(--text); }
  .stepper [aria-current="true"] { color: var(--text); }
  .stepper [aria-current="true"] .dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

  /* ---------- listas seleccionables ---------- */
  .cards { display: grid; gap: 10px; }
  .cards.two { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .card {
    appearance: none; font: inherit; text-align: left; cursor: pointer;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 15px 17px; color: var(--text);
    display: flex; align-items: center; gap: 16px;
    transition: border-color .14s ease, background .14s ease;
  }
  .card:hover { border-color: var(--line-2); background: var(--panel-2); }
  .card[aria-pressed="true"] { border-color: var(--accent); background: #10201A; }
  .card .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .card-name { display: block; font-weight: 600; font-size: 15px; }
  .card-desc { display: block; font-size: 12.5px; color: var(--muted); }
  .card-meta { display: block; font-size: 11.5px; color: var(--faint); margin-top: 2px; font-family: "IBM Plex Mono", monospace; }
  .card-price { font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; font-size: 17px; font-weight: 500; color: var(--warn); }
  .card:disabled { opacity: .4; cursor: not-allowed; }
  .avatar {
    width: 42px; height: 42px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center;
    background: var(--panel-2); border: 1px solid var(--line-2); color: var(--accent);
    font-weight: 600; font-size: 14px;
  }

  /* ---------- días y horas ---------- */
  .days { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; }
  .day {
    appearance: none; font: inherit; flex: 0 0 auto; width: 68px; padding: 10px 0; cursor: pointer;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text);
    display: flex; flex-direction: column; align-items: center; gap: 1px;
    transition: border-color .14s ease;
  }
  .day:hover:not(:disabled) { border-color: var(--line-2); }
  .day .d1 { font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); }
  .day .d2 { font-size: 19px; font-weight: 600; font-family: "IBM Plex Mono", monospace; }
  .day .d3 { font-size: 10.5px; color: var(--faint); }
  .day[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
  .day[aria-pressed="true"] .d1, .day[aria-pressed="true"] .d3 { color: var(--accent-ink); opacity: .75; }
  .day:disabled { opacity: .3; cursor: not-allowed; }

  .band-label { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); margin: 18px 0 9px; }
  .times { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; }
  .time {
    appearance: none; font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; font-size: 13.5px;
    padding: 9px 0; cursor: pointer; color: var(--text);
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    transition: border-color .14s ease;
  }
  .time:hover:not(:disabled) { border-color: var(--line-2); }
  .time[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 500; }
  .time:disabled { color: var(--faint); background: transparent; border-style: dashed; cursor: not-allowed; text-decoration: line-through; }

  /* ---------- formularios ---------- */
  .fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
  .field { display: flex; flex-direction: column; gap: 6px; }
  .field.wide { grid-column: 1 / -1; }
  label { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
  input, select, textarea {
    font: inherit; color: var(--text); background: var(--panel-2);
    border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; width: 100%;
  }
  textarea { resize: vertical; min-height: 42px; }
  input::placeholder, textarea::placeholder { color: var(--faint); }
  select { cursor: pointer; }

  .btn {
    appearance: none; font: inherit; font-weight: 600; cursor: pointer;
    background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent);
    border-radius: var(--radius); padding: 11px 20px;
  }
  .btn:hover { filter: brightness(1.06); }
  .btn:disabled { opacity: .35; cursor: not-allowed; filter: none; }
  .btn.ghost { background: transparent; color: var(--text); border-color: var(--line-2); font-weight: 500; }
  .btn.ghost:hover { border-color: var(--muted); filter: none; }
  .btn.sm { padding: 6px 12px; font-size: 12.5px; font-weight: 500; }
  .btn.danger { background: transparent; color: var(--bad-solid); border-color: #4A2A22; }
  .err { color: var(--bad-solid); font-size: 13px; }

  /* ---------- resumen del turno ---------- */
  .summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; }
  .sitem { background: var(--panel); padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; }
  .sitem .v { font-size: 14px; font-weight: 500; }
  .sitem .v.none { color: var(--faint); font-weight: 400; }

  /* ---------- confirmación ---------- */
  .ok-hero { text-align: center; padding: 30px 20px 10px; }
  .ok-check { width: 54px; height: 54px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 26px; margin: 0 auto 16px; }
  .codebox { font-family: "IBM Plex Mono", monospace; font-size: 26px; letter-spacing: .12em; color: var(--accent); }

  /* ---------- tablas ---------- */
  .tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
  table { border-collapse: collapse; width: 100%; min-width: 620px; font-size: 13.5px; }
  th {
    text-align: left; font-family: "IBM Plex Mono", monospace; font-size: 10.5px; letter-spacing: .1em;
    text-transform: uppercase; color: var(--faint); font-weight: 400;
    padding: 11px 14px; background: var(--panel-2); border-bottom: 1px solid var(--line); white-space: nowrap;
  }
  td { padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--panel); vertical-align: middle; }
  tr:last-child td { border-bottom: none; }
  td.num { font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; }

  .pill {
    display: inline-block; font-family: "IBM Plex Mono", monospace; font-size: 10.5px; letter-spacing: .08em;
    text-transform: uppercase; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted);
    white-space: nowrap;
  }
  .pill.pendiente { color: var(--accent); border-color: var(--accent-dim); }
  .pill.atendido { color: var(--muted); }
  .pill.cancelado { color: var(--bad-solid); border-color: #4A2A22; }
  .pill.no_vino { color: var(--warn); border-color: #4A3A1B; }

  /* ---------- kpis ---------- */
  .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
  .kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
  .kpi .v { font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; font-size: 26px; font-weight: 500; line-height: 1.1; }
  .kpi .v.money { color: var(--accent); }
  .kpi .v.warn { color: var(--warn); }
  .kpi .v.bad { color: var(--bad-solid); }
  .bars { display: flex; flex-direction: column; gap: 12px; }
  .bar-row { display: flex; flex-direction: column; gap: 5px; }
  .bar-top { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
  .bar-top .n { font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; color: var(--warn); }
  .bar-track { height: 6px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
  .bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent-dim), var(--accent)); border-radius: 999px; }
  /* min(300px, 100%) evita que la columna fuerce un ancho minimo mayor al
     disponible en pantallas angostas (~320px), que causaba un desborde
     horizontal de pocos pixeles en el panel. */
  .two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 14px; }

  /* ---------- agenda del día ---------- */
  .agenda { display: grid; gap: 8px; }
  .slotline {
    display: grid; grid-template-columns: 62px 1fr auto; gap: 14px; align-items: center;
    background: var(--panel); border: 1px solid var(--line); border-left: 2px solid var(--line-2);
    border-radius: var(--radius); padding: 11px 14px;
  }
  .slotline.libre { background: transparent; border-style: dashed; color: var(--faint); }
  .slotline.pendiente { border-left-color: var(--accent); }
  .slotline.atendido { border-left-color: var(--line-2); opacity: .75; }
  .slotline.cancelado { border-left-color: var(--bad-solid); opacity: .6; }
  .slotline.no_vino { border-left-color: var(--warn); opacity: .8; }
  .slotline.bloqueo { border-left-color: var(--warn); background: #171208; }
  .slot-h { font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; font-size: 15px; }
  .slot-t { font-size: 13.5px; }
  .slot-t b { font-weight: 600; }
  .slot-s { font-size: 12px; color: var(--muted); }
  .actions { display: flex; gap: 6px; flex-wrap: wrap; }

  .week { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
  .wday { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
  .wday h4 { margin: 0; font-size: 12px; text-transform: capitalize; color: var(--muted); font-weight: 500; display: flex; justify-content: space-between; }
  .wturno { font-size: 12px; border-left: 2px solid var(--accent); padding-left: 7px; }
  .wturno .h { font-family: "IBM Plex Mono", monospace; color: var(--text); }
  .wturno .n { color: var(--muted); }

  /* ---------- modal ---------- */
  .backdrop { position: fixed; inset: 0; background: #05070699; display: grid; place-items: center; padding: 20px; z-index: 60; }
  .modal { background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; width: min(560px, 100%); max-height: 88vh; overflow-y: auto; padding: 22px; }
  .modal h3 { font-size: 17px; margin-bottom: 4px; }
  .checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; }
  .check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
  .check input { width: auto; }
  .hrow { display: grid; grid-template-columns: 42px 1fr 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
  .hrow .dname { color: var(--muted); font-size: 12px; text-transform: capitalize; }

  /* ---------- toast ---------- */
  .toast {
    position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(10px);
    background: var(--accent); color: var(--accent-ink); font-weight: 600;
    padding: 11px 20px; border-radius: var(--radius); font-size: 13.5px;
    opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; z-index: 80;
  }
  .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
  .toast.bad { background: var(--bad-solid); }

  footer { border-top: 1px solid var(--line); padding: 26px 0 40px; color: var(--faint); font-size: 12.5px; }
  .empty { color: var(--faint); font-size: 13.5px; padding: 18px 0; }

/* --- extras de la versión con servidor --- */
a.btn { text-decoration: none; display: inline-block; }
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--text); }
.who a.btn { text-decoration: none; }

/* ---------- foto de portada (pantalla de agendar) ---------- */
.hero-photo {
  position: relative;
  height: 220px;
  background-image:
    linear-gradient(180deg, rgba(10,13,12,.35) 0%, rgba(10,13,12,.55) 55%, var(--bg) 100%),
    url("https://images.unsplash.com/photo-1585747860715-2ba37e788b70?auto=format&fit=crop&w=1600&q=70");
  background-size: cover;
  background-position: center 30%;
  border-bottom: 1px solid var(--line);
}
.hero-photo .wrap { height: 100%; display: flex; align-items: flex-end; padding-bottom: 16px; }
.hero-photo p {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text);
  text-shadow: 0 1px 6px rgba(0,0,0,.7);
}
@media (min-width: 640px) { .hero-photo { height: 280px; } }
