:root {
  --ink: #14241f;
  --muted: #4d6158;
  --paper: #f3f6f4;
  --card: #ffffff;
  --line: #d5e0da;
  --green: #143d32;
  --green-2: #1f5c4a;
  --amber: #e8a020;
  --amber-ink: #3d2a04;
  --danger: #8c2f2f;
  --tv: #07140f;
  --shadow: 0 12px 40px rgba(20, 36, 31, 0.08);
  --radius: 22px;
  font-family: "Avenir Next", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
}

body { min-height: 100vh; }

button, input { font: inherit; }

button {
  cursor: pointer;
  border: 0;
  border-radius: 16px;
  min-height: 72px;
  padding: 0.85rem 1.2rem;
  font-size: 1.35rem;
  font-weight: 700;
}

button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}

#app { min-height: 100vh; }

.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar, .footer-note {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem 1.25rem;
}

.topbar {
  background: var(--green);
  color: white;
}

.brand { display: flex; flex-direction: column; gap: 0.15rem; }
.brand strong { font-size: 1.15rem; letter-spacing: 0.01em; }
.brand span, .footer-note { color: #d5e6df; font-size: 0.92rem; }
.footer-note { color: var(--muted); display: block; text-align: center; padding-bottom: 1.25rem; }

.nav {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav a {
  color: white;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font-weight: 700;
}

.nav a[aria-current="page"] { background: white; color: var(--green); }

.wrap {
  width: min(860px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 0.5rem;
  flex: 1;
}

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
  margin: 0 0 0.4rem;
}

.lede { font-size: 1.2rem; color: var(--muted); margin: 0 0 1.25rem; }

.tiles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}

@media (min-width: 800px) {
  .tiles { grid-template-columns: 1fr 1fr 1fr; }
}

.tile {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 180px;
  padding: 1.2rem;
  border-radius: var(--radius);
  background: var(--card);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.tile strong { font-size: 1.6rem; }
.tile span { margin-top: 0.35rem; color: var(--muted); font-size: 1.05rem; }
.tile.main { background: var(--green); color: white; }
.tile.main span { color: #d7ebe3; }

.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 1.1rem;
}

label { display: block; font-size: 1.15rem; font-weight: 700; margin-bottom: 0.45rem; }

.ident {
  width: 100%;
  min-height: 84px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: #f8fbf9;
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
  color: var(--ink);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
  margin: 0.8rem 0;
}

.keypad button, .ghost, .primary, .amber {
  width: 100%;
}

.keypad button, .ghost {
  background: #e7efeb;
  color: var(--ink);
}

.primary { background: var(--green); color: white; }
.amber { background: var(--amber); color: var(--amber-ink); }
.danger-text {
  color: var(--danger);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0.8rem 0 0;
}

.actions {
  display: grid;
  gap: 0.6rem;
  margin-top: 1rem;
}

@media (min-width: 700px) {
  .actions.two { grid-template-columns: 1fr 1fr; }
}

.status-name { font-size: clamp(2rem, 5vw, 3.2rem); margin: 0; }
.status-meta { font-size: 1.25rem; color: var(--muted); margin: 0.2rem 0 0.8rem; }

.pill {
  display: inline-block;
  background: #e5f4ec;
  color: var(--green);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-weight: 800;
}

.pill.debt { background: #fde8d8; color: #8a3d12; }

.ticket {
  margin-top: 1rem;
  background: #fff8ea;
  border: 2px dashed var(--amber);
  border-radius: 18px;
  padding: 1rem;
}

.ticket strong { font-size: 3rem; display: block; letter-spacing: 0.04em; }

.hint { color: var(--muted); font-size: 1rem; }

.linkish {
  background: transparent;
  color: var(--green-2);
  min-height: 52px;
  text-decoration: underline;
  width: auto;
  padding: 0.4rem;
}

/* Print sheet */
.print-sheet { display: none; }

body.printing .screen { display: none !important; }
body.printing .print-sheet { display: block; }

.print-sheet {
  width: min(720px, 100%);
  margin: 2rem auto;
  padding: 2rem;
  background: white;
  color: black;
}

.print-sheet h2 { font-size: 1.1rem; letter-spacing: 0.08em; margin: 0; }
.print-sheet h3 { font-size: 2rem; margin: 0.3rem 0 1rem; }
.print-sheet dl { display: grid; grid-template-columns: 11rem 1fr; gap: 0.45rem 1rem; font-size: 1.25rem; }
.print-sheet dt { color: #333; }
.print-sheet dd { margin: 0; font-weight: 700; }
.print-banner {
  margin-top: 1.5rem;
  padding-top: 0.8rem;
  border-top: 1px solid #bbb;
  font-size: 0.95rem;
}

@media print {
  body { background: white; }
  .screen { display: none !important; }
  .print-sheet { display: block !important; margin: 0; box-shadow: none; }
  .no-print { display: none !important; }
}

/* TV */
body.tv { background: var(--tv); color: white; overflow: hidden; }
body.tv .screen { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
body.tv .topbar { background: transparent; }
body.tv .footer-note, body.tv .brand span { color: #9fb5ac; }
body.tv .footer-note { padding-top: 0; padding-bottom: 0.8rem; }

.tv-stage {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 0 3vw 1vh;
  text-align: center;
}

.tv-kicker {
  margin: 0;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #9fb5ac;
  font-size: clamp(1.1rem, 2.4vw, 2rem);
}

.tv-hero {
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.tv-number {
  font-size: clamp(4.5rem, 24vh, 16rem);
  line-height: 0.85;
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.tv-who { font-size: clamp(2rem, 5vw, 4.5rem); margin: 0.4rem 0 0; }

.waiting h2 {
  margin: 0 0 0.6rem;
  font-size: clamp(1.2rem, 2vw, 1.8rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #9fb5ac;
  font-weight: 700;
}

.chips { display: flex; flex-wrap: wrap; gap: 0.7rem; justify-content: center; }
.chip {
  background: #12352b;
  border-radius: 18px;
  padding: 0.7rem 1rem;
  min-width: 7rem;
}
.chip b { display: block; font-size: clamp(1.8rem, 4vw, 3rem); }
.chip span { color: #c9ddd4; }

.tv-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
}
.tv-actions .amber { width: auto; min-width: 16rem; }
.tv-actions .linkish { color: #d7ebe3; }

/* WhatsApp simulator */
.phone-wrap {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 1rem 1rem 0;
}

.phone {
  width: min(400px, 100%);
  height: min(760px, calc(100vh - 150px));
  background: #111;
  border-radius: 36px;
  padding: 12px;
  box-shadow: var(--shadow);
  display: flex;
}

.phone-inner {
  background: #efeae2;
  border-radius: 26px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
  color: #111;
}

.wa-head {
  background: #075e54;
  color: white;
  padding: 0.9rem 1rem;
}
.wa-head strong { display: block; font-size: 1.15rem; }
.wa-head span { font-size: 0.85rem; opacity: 0.85; }

.chat {
  flex: 1;
  overflow: auto;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.bubble {
  max-width: 85%;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  line-height: 1.35;
  white-space: pre-wrap;
}
.bubble.bot { background: white; align-self: flex-start; }
.bubble.user { background: #d9fdd3; align-self: flex-end; }

.composer {
  display: flex;
  gap: 0.4rem;
  padding: 0.55rem;
  background: #f0f2f5;
}
.composer input {
  flex: 1;
  min-height: 52px;
  border-radius: 999px;
  border: 0;
  padding: 0 1rem;
  font-size: 1rem;
}
.composer button { min-height: 52px; width: auto; border-radius: 999px; background: #075e54; color: white; }

.demo-row { text-align: center; }
