/* Palo Llamadas - light, high-contrast theme for tablets used in daylight */
:root {
  --font: "General Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --text-xs: clamp(0.75rem, 0.72rem + 0.15vw, 0.8125rem);
  --text-sm: clamp(0.875rem, 0.84rem + 0.15vw, 0.9375rem);
  --text-base: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --text-lg: clamp(1.125rem, 1.05rem + 0.4vw, 1.3125rem);
  --text-xl: clamp(1.5rem, 1.3rem + 0.9vw, 1.9rem);
  --s1: 0.25rem; --s2: 0.5rem; --s3: 0.75rem; --s4: 1rem; --s5: 1.25rem; --s6: 1.5rem; --s8: 2rem; --s10: 2.5rem; --s12: 3rem;

  --bg: #f4f2ec;
  --surface: #ffffff;
  --surface-2: #faf8f3;
  --line: #d9d5c8;
  --line-strong: #b4ae9c;
  --ink: #14211f;
  --ink-2: #44524f;
  --ink-3: #66726f;
  --accent: #0b5f66;
  --accent-ink: #ffffff;
  --accent-soft: #dcefee;
  --accent-strong: #084449;
  --ok: #1f6b3a; --ok-soft: #dff1e3;
  --warn: #8a5300; --warn-soft: #fdebc8;
  --bad: #a3221c; --bad-soft: #fbe1de;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 33, 31, .08), 0 6px 18px rgba(20, 33, 31, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: var(--text-base); line-height: 1.45;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; }
h2 { font-size: var(--text-lg); font-weight: 600; line-height: 1.25; }
h3 { font-size: var(--text-sm); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
a { color: var(--accent); }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #1a73e8; outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: var(--s2) var(--s4); z-index: 100; }
.skip:focus { left: var(--s2); top: var(--s2); }
.muted { color: var(--ink-2); }
.small { font-size: var(--text-sm); }
.xs { font-size: var(--text-xs); }
.en { color: var(--ink-2); font-weight: 400; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: var(--s2) var(--s4); border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: var(--text-sm);
  text-decoration: none; color: var(--ink); transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover { background: #7f1915; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(20, 33, 31, .06); }
.btn.sm { min-height: 36px; padding: var(--s1) var(--s3); font-size: var(--text-xs); }
.btn.big { min-height: 56px; font-size: var(--text-base); padding: var(--s3) var(--s6); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.chip {
  display: inline-flex; align-items: center; gap: var(--s1); min-height: 44px; padding: var(--s2) var(--s4);
  border-radius: 999px; border: 1.5px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: var(--text-sm);
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }

.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: var(--text-xs); font-weight: 700; letter-spacing: .03em; white-space: nowrap; }
.tag.turn { background: var(--accent); color: #fff; }
.tag.next { background: var(--accent-soft); color: var(--accent-strong); }
.tag.lider { background: #2b2f77; color: #fff; }
.tag.break { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad); color: #fff; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.plain { background: #ece9df; color: var(--ink-2); }

/* ---------- shell ---------- */
.top {
  display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap;
  padding: var(--s3) var(--s5); background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: var(--s3); text-decoration: none; color: var(--ink); font-weight: 700; }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand small { display: block; font-weight: 500; color: var(--ink-2); font-size: var(--text-xs); }
.top .spacer { flex: 1; }
.top .stat { font-size: var(--text-sm); color: var(--ink-2); }
.top .stat b { color: var(--ink); font-size: var(--text-base); }
.clock { font-weight: 700; font-size: var(--text-lg); }
.testbar { background: #2b2f77; color: #fff; font-size: var(--text-xs); font-weight: 600; text-align: center; padding: 4px var(--s3); letter-spacing: .02em; }
.offline { display: none; background: var(--bad); color: #fff; font-weight: 700; text-align: center; padding: var(--s3); font-size: var(--text-lg); letter-spacing: .04em; }
body.is-offline .offline { display: block; }
.page { padding: var(--s5); max-width: 1500px; margin: 0 auto; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > header { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card .body { padding: var(--s4); }
.empty { padding: var(--s6) var(--s4); text-align: center; color: var(--ink-2); }

/* ---------- home ---------- */
.home { max-width: 980px; }
.home-head { margin-bottom: var(--s6); }
.home-head p { margin-top: var(--s2); max-width: 62ch; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s4); }
.tile { display: block; padding: var(--s4) var(--s5); text-decoration: none; color: var(--ink); transition: border-color .12s, transform .12s; }
.tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.tile .n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; font-size: var(--text-xs); margin-bottom: var(--s2); }
.tile h2 { margin-bottom: var(--s1); }
.tile p { font-size: var(--text-sm); color: var(--ink-2); }
.home section { margin-top: var(--s8); }
.home section > h3 { margin-bottom: var(--s3); }
.row { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: center; }
select, input[type="number"], input[type="text"], input[type="date"] {
  min-height: 44px; padding: var(--s2) var(--s3); border-radius: var(--radius-sm); border: 1.5px solid var(--line-strong); background: var(--surface);
}
ol.steps { margin: 0; padding-left: 1.3em; display: grid; gap: var(--s2); max-width: 70ch; }

/* ---------- reception ---------- */
.rx { display: grid; grid-template-columns: minmax(300px, 360px) 1fr; gap: var(--s4); align-items: start; }
@media (max-width: 860px) { .rx { grid-template-columns: 1fr; } .page { padding: var(--s3); } }
.rot { list-style: none; margin: 0; padding: 0; }
.rot li { display: grid; grid-template-columns: 28px 1fr auto; gap: var(--s2) var(--s3); align-items: center; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
.rot li.up { background: var(--accent-soft); }
.rot .pos { font-weight: 700; color: var(--ink-3); text-align: center; }
.rot .who { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; font-weight: 600; font-size: var(--text-lg); }
.rot .meta { grid-column: 2 / -1; font-size: var(--text-sm); color: var(--ink-2); display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.tchip { display: inline-block; padding: 1px 7px; border-radius: 6px; background: #ece9df; font-weight: 600; font-size: var(--text-xs); color: var(--ink); }
.tchip.calling { background: var(--bad); color: #fff; }
.groups { display: grid; gap: var(--s4); }
.grp-head { display: flex; align-items: baseline; gap: var(--s3); margin-bottom: var(--s2); }
.map { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: var(--s2); }
.tbl {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 2px;
  min-height: 86px; padding: var(--s2) var(--s3); text-align: left; border-radius: var(--radius-sm);
  border: 1.5px dashed var(--line-strong); background: var(--surface-2); color: var(--ink);
}
.tbl:hover { border-color: var(--accent); }
.tbl .lab { font-weight: 700; font-size: var(--text-lg); line-height: 1.1; }
.tbl .sub { font-size: var(--text-xs); color: var(--ink-2); line-height: 1.25; }
.tbl.busy { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.tbl.busy .sub { color: var(--accent-strong); font-weight: 600; }
.tbl.calling { border-color: var(--bad); background: var(--bad-soft); box-shadow: 0 0 0 2px var(--bad) inset; }
.tbl.calling .sub { color: var(--bad); }
.tbl .flag { position: absolute; bottom: 6px; right: 6px; }
.kitchen { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s3); }
.slot { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--s3); display: grid; gap: var(--s2); background: var(--surface-2); }
.slot select { width: 100%; }
.below { display: grid; gap: var(--s4); margin-top: var(--s4); }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(20, 33, 31, .55); display: grid; place-items: center; padding: var(--s4); z-index: 50; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 2rem); overflow: auto; background: var(--surface); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal > header { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); }
.modal .body { padding: var(--s5); display: grid; gap: var(--s5); }
.modal footer { display: flex; gap: var(--s3); justify-content: space-between; flex-wrap: wrap; padding: var(--s4) var(--s5); border-top: 1px solid var(--line); background: var(--surface-2); }
.stepper { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.stepper .val { min-width: 3ch; text-align: center; font-size: var(--text-xl); font-weight: 700; }
.stepper > .btn { width: 56px; flex: none; min-height: 56px; font-size: var(--text-xl); padding: 0; }
.quick { display: flex; gap: var(--s2); flex-wrap: wrap; flex-basis: 100%; }
.quick .btn { min-width: 48px; min-height: 44px; padding: 0 var(--s2); font-size: var(--text-base); }
.field > label, .field > .label { display: block; font-weight: 600; margin-bottom: var(--s2); }
.hint { font-size: var(--text-sm); color: var(--ink-2); margin-top: var(--s2); }
.err { color: var(--bad); font-weight: 600; }

/* ---------- bar board ---------- */
.board { display: grid; gap: var(--s3); }
.call {
  display: grid; grid-template-columns: minmax(120px, 170px) 1fr auto auto; gap: var(--s4); align-items: center;
  padding: var(--s4) var(--s5); border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); border-left: 12px solid var(--ok); box-shadow: var(--shadow);
}
.call.lvl-1 { border-left-color: #c77700; }
.call.lvl-2 { border-left-color: var(--bad); background: var(--bad-soft); }
.call.acked { border-left-color: var(--accent); }
.call .mesa { font-size: var(--text-xl); font-weight: 700; line-height: 1; }
.call .why { font-size: var(--text-lg); font-weight: 600; }
.call .timer { font-size: var(--text-xl); font-weight: 700; min-width: 5ch; text-align: right; }
@media (max-width: 640px) {
  .call { grid-template-columns: 1fr auto; padding: var(--s3) var(--s4); }
  .call .acts { grid-column: 1 / -1; }
  .call .acts .btn { width: 100%; }
}
.allclear { display: grid; place-items: center; gap: var(--s2); min-height: 40vh; text-align: center; }
.allclear svg { width: 56px; height: 56px; color: var(--ok); }

/* ---------- phone simulation ---------- */
.sim { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: var(--s6); align-items: start; max-width: 1000px; }
@media (max-width: 860px) { .sim { grid-template-columns: 1fr; } }
.phone { border-radius: 28px; border: 10px solid #1d2424; background: #cfe3e0; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 600px; max-height: 80vh; }
.phone .ph-head { background: var(--accent); color: #fff; padding: var(--s3) var(--s4); display: flex; align-items: center; gap: var(--s3); }
.phone .avatar { width: 36px; height: 36px; border-radius: 50%; background: #fff; display: grid; place-items: center; flex: none; }
.phone .avatar svg { width: 26px; height: 26px; }
.phone .ph-head b { display: block; line-height: 1.2; }
.phone .ph-head span { font-size: var(--text-xs); opacity: .9; }
.phone .msgs { flex: 1; overflow: auto; padding: var(--s3); display: flex; flex-direction: column; gap: var(--s3); }
.msg { align-self: flex-start; max-width: 92%; min-width: 72%; }
.bubble { background: #fff; border-radius: 4px 14px 14px 14px; padding: var(--s2) var(--s3); box-shadow: 0 1px 1px rgba(0, 0, 0, .12); font-size: var(--text-sm); white-space: normal; overflow-wrap: anywhere; }
.bubble .at { display: block; text-align: right; font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.ibtns { display: grid; gap: 4px; margin-top: 4px; }
.ibtns .r { display: flex; gap: 4px; }
.ibtns button { flex: 1; min-height: 44px; border: 0; border-radius: 8px; background: rgba(11, 95, 102, .92); color: #fff; font-weight: 600; font-size: var(--text-sm); }
.ibtns button:hover { background: var(--accent-strong); }
.kb { background: #e9eeed; padding: var(--s2); display: grid; gap: 6px; border-top: 1px solid #b9c9c6; }
.kb .r { display: flex; gap: 6px; }
.kb button { flex: 1; min-height: 46px; border: 0; border-radius: 8px; background: #fff; font-weight: 600; box-shadow: 0 1px 0 rgba(0, 0, 0, .18); }
.kb button:hover { background: var(--accent-soft); }
.sim-side { display: grid; gap: var(--s4); }

/* ---------- guest ---------- */
.guest { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: linear-gradient(180deg, #0b5f66 0, #0b5f66 190px, var(--bg) 190px); }
.guest header { color: #fff; text-align: center; padding: var(--s6) var(--s4) var(--s4); }
.guest header .logo { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 700; font-size: var(--text-lg); letter-spacing: .12em; }
.guest header .logo svg { width: 30px; height: 30px; }
.guest header .mesa { margin-top: var(--s2); font-size: var(--text-sm); opacity: .92; }
.guest main { flex: 1; width: min(460px, 100%); margin: 0 auto; padding: 0 var(--s4) var(--s8); display: grid; gap: var(--s4); align-content: start; }
.guest .panel { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: var(--s6) var(--s5); text-align: center; display: grid; gap: var(--s4); }
.guest .callbtn { width: 100%; min-height: 104px; border-radius: 16px; border: 0; background: var(--accent); color: #fff; display: grid; gap: 2px; place-content: center; font-weight: 700; font-size: var(--text-xl); line-height: 1.15; box-shadow: 0 6px 0 var(--accent-strong); }
.guest .callbtn span { font-size: var(--text-base); font-weight: 500; opacity: .92; }
.guest .callbtn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--accent-strong); }
.guest .reason { width: 100%; min-height: 68px; border-radius: 14px; border: 1.5px solid var(--line-strong); background: var(--surface); display: grid; gap: 0; place-content: center; font-weight: 600; font-size: var(--text-lg); line-height: 1.2; }
.guest .reason span { font-size: var(--text-sm); font-weight: 400; color: var(--ink-2); }
.guest .reason:hover { border-color: var(--accent); background: var(--accent-soft); }
.guest .status-ic { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto; background: var(--accent-soft); color: var(--accent); }
.guest .status-ic.go { background: var(--ok-soft); color: var(--ok); }
.guest .status-ic svg { width: 38px; height: 38px; }
.guest .pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(11, 95, 102, .35); } 50% { box-shadow: 0 0 0 14px rgba(11, 95, 102, 0); } }
.guest footer { text-align: center; font-size: var(--text-xs); color: var(--ink-3); padding: var(--s4); }
.linkbtn { background: none; border: 0; color: var(--accent); font-weight: 600; text-decoration: underline; min-height: 44px; padding: var(--s2); }

/* ---------- reports / settings ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s3); }
.kpi { padding: var(--s3) var(--s4); }
.kpi .v { font-size: var(--text-xl); font-weight: 700; line-height: 1.1; }
.kpi .l { font-size: var(--text-xs); color: var(--ink-2); margin-top: 2px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: var(--s4); margin-top: var(--s4); }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
th, td { padding: var(--s2) var(--s4); text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); font-weight: 600; background: var(--surface-2); }
td.num, th.num { text-align: right; }
.bar { height: 8px; background: var(--accent); border-radius: 4px; min-width: 2px; }
.stack { display: grid; gap: var(--s4); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--s4); }
.form-grid input { width: 100%; }
.note { background: var(--warn-soft); color: #5a3600; border-radius: var(--radius-sm); padding: var(--s3) var(--s4); font-size: var(--text-sm); }
.note.info { background: var(--accent-soft); color: var(--accent-strong); }

#toast { position: fixed; left: 50%; bottom: var(--s6); transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: var(--s3) var(--s5); border-radius: 999px; font-weight: 600; font-size: var(--text-sm); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 80; max-width: calc(100vw - 2rem); text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.bad { background: var(--bad); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- all-in-one test screen ---------- */
.combo { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--s5); align-items: start; }
.combo .phone { min-height: 560px; max-height: 640px; }
.guest-frame { background: var(--bg); }
.guest-frame > div { flex: 1; display: flex; flex-direction: column; overflow: auto; }
.guest-frame .guest { min-height: 100%; flex: 1; }

@media (max-width: 560px) { .cols { grid-template-columns: 1fr; } .top { padding: var(--s2) var(--s3); gap: var(--s2); } .top .stat { order: 3; flex-basis: 100%; } }
