:root {
  --bg: #f4f7f5;
  --card: #ffffff;
  --ink: #14231c;
  --muted: #5a6b62;
  --brand: #0b3d2e;
  --brand-2: #1f7a5a;
  --line: #d7e3dc;
  --green: #1f9d55;
  --amber: #d97706;
  --red: #dc2626;
  --off: #94a3b8;
  --radius: 16px;
  --shadow: 0 8px 24px rgba(11, 61, 46, 0.08);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body { min-height: 100vh; }

.top {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 16px; background: var(--brand); color: #fff;
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; gap: 10px; align-items: center; }
.logo { font-size: 1.4rem; }
.sub { font-size: 0.75rem; opacity: 0.85; }
.hours { display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem;
  background: rgba(255,255,255,0.12); padding: 6px 10px; border-radius: 999px; }
.hours .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--off); }
.hours.open .dot { background: #4ade80; }
.hours.closed .dot { background: #fbbf24; }

.wrap { padding: 16px; max-width: 560px; margin: 0 auto; }
.hero h1 { margin: 0 0 6px; font-size: 1.7rem; }
.plain { color: var(--muted); line-height: 1.45; margin: 0 0 12px; }

.flash { list-style: none; padding: 12px 16px; margin: 0; }
.flash li { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46;
  padding: 10px 12px; border-radius: 12px; margin-bottom: 8px; }
.flash li.error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

.health-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 18px; }
.chip { background: #e8f2ec; color: var(--brand); font-size: 0.78rem;
  padding: 6px 10px; border-radius: 999px; }

.empty {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 28px 20px; text-align: center; border: 1px solid var(--line);
}
.big-check {
  width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%;
  background: #dcfce7; color: var(--green); display: grid; place-items: center;
  font-size: 2rem; font-weight: 700;
}
.empty h2 { margin: 0 0 8px; }

.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.card {
  display: grid; grid-template-columns: 12px 1fr; gap: 12px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; border: 1px solid var(--line);
}
.light { width: 12px; border-radius: 999px; background: var(--off); }
.light-green .light { background: var(--green); }
.light-amber .light { background: var(--amber); }
.light-red .light { background: var(--red); }
.light-off .light { background: var(--off); }
.card h2 { margin: 0 0 4px; font-size: 1.05rem; }
.owner { font-size: 0.85rem; color: var(--muted); margin: 6px 0 0; }

.callbox, .card-form {
  margin-top: 18px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.callbox h2 { margin-top: 0; font-size: 1.1rem; }

.btn {
  display: inline-flex; justify-content: center; align-items: center;
  width: 100%; min-height: 48px; border-radius: 12px; border: 0;
  font-size: 1rem; font-weight: 600; text-decoration: none; cursor: pointer;
  margin-top: 8px;
}
.btn.primary, .btn.call { background: var(--brand-2); color: #fff; }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--line); }
.actions { display: grid; gap: 8px; margin-top: 16px; }

label { display: block; font-weight: 600; margin: 8px 0 6px; }
input[type=email] {
  width: 100%; min-height: 48px; border-radius: 12px; border: 1px solid var(--line);
  padding: 0 12px; font-size: 1rem; background: #fff;
}
.modes { border: 0; padding: 0; margin: 12px 0; }
.radio { display: flex; gap: 8px; align-items: center; font-weight: 500; margin: 8px 0; }
.note { font-size: 0.9rem; margin-top: 16px; }

.foot { padding: 20px 16px 32px; text-align: center; color: var(--muted); }
.hint { margin: 0 0 6px; }
.tiny { margin: 0; font-size: 0.75rem; opacity: 0.8; }

@media (min-width: 640px) {
  .btn { width: auto; padding: 0 18px; }
  .actions { grid-template-columns: 1fr 1fr; }
}


.card-actions { display: grid; gap: 8px; margin-top: 10px; }
.inline-form { margin: 0; }
.chip.good { background: #dcfce7; color: #166534; }
.chip.warn { background: #ffedd5; color: #9a3412; }
.ids { margin-top: 8px; color: var(--muted); font-size: 0.85rem; }
.ids summary { cursor: pointer; }
.chip.bad{background:#fde2e1;color:#8a1c14;border-color:#f1a39d}
.chip .tiny{opacity:.75;font-size:.75em}
h2.section{margin:1rem 0 .4rem;font-size:1.1rem}
.card.handled{opacity:.6}

/* —— Team home dashboard —— */
.wrap-wide { max-width: 720px; }
.top-nav { display: flex; gap: 6px; margin-left: auto; margin-right: 10px; }
.top-nav a {
  color: #fff; text-decoration: none; font-size: 0.85rem; font-weight: 600;
  padding: 6px 10px; border-radius: 999px; background: rgba(255,255,255,0.1);
}
.top-nav a.on, .top-nav a:hover { background: rgba(255,255,255,0.22); }

.stat-grid {
  display: grid; grid-template-columns: 1fr; gap: 12px; margin: 14px 0 18px;
}
@media (min-width: 560px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .queue-grid { grid-template-columns: repeat(2, 1fr); }
}
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 14px;
}
.stat-card h2 { margin: 0 0 4px; font-size: 0.95rem; color: var(--muted); font-weight: 600; }
.stat-num {
  margin: 0; font-size: 2.4rem; line-height: 1.1; font-weight: 750; color: var(--brand);
  letter-spacing: -0.02em;
}
.stat-sub { margin: 2px 0 8px; color: var(--muted); font-size: 0.9rem; }
.stat-money { margin: 0; font-size: 1.25rem; font-weight: 700; color: var(--brand-2); }
.stat-card.soft .stat-num { font-size: 2rem; }
.stat-card.muted-card { background: #f7faf8; }
.stat-card.muted-card .stat-sub { margin-bottom: 4px; }

.visitor-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 18px;
}
.visitor-card h2 { margin: 0 0 10px; font-size: 1.1rem; }
.visitor-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.section-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.booking-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.booking-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; box-shadow: var(--shadow);
}
.btn.small { min-height: 36px; width: auto; padding: 0 12px; font-size: 0.9rem; margin-top: 0; }
code { font-size: 0.85em; background: #e8f2ec; padding: 1px 5px; border-radius: 6px; }

@media (max-width: 640px) {
  .top { flex-wrap: wrap; }
  .top-nav { order: 3; width: 100%; margin: 4px 0 0; }
}

/* —— Live page —— */
.visitor-nums.three { grid-template-columns: repeat(3, 1fr); }
table.states { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 1rem; }
table.states th, table.states td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: left; }
table.states .num { text-align: right; font-weight: 700; }
.feed-counts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0 10px; }
.badge { font-size: 0.8rem; padding: 4px 10px; border-radius: 999px; background: #e8f2ec; color: var(--brand); }
.badge.waiting { background: #ffedd5; color: #9a3412; }
.badge.answered { background: #dcfce7; color: #166534; }
.badge.handed { background: #e0e7ff; color: #3730a3; }
.feed-box { display: grid; gap: 10px; margin-bottom: 18px; }
.convo { background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--off); border-radius: 12px; padding: 12px; box-shadow: var(--shadow); }
.convo.st-waiting { border-left-color: var(--amber); }
.convo.st-answered { border-left-color: var(--green); }
.convo.st-handed { border-left-color: #6366f1; }
.convo-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.bubble { margin-top: 8px; padding: 8px 10px; border-radius: 10px; white-space: pre-wrap; word-break: break-word; }
.bubble.customer { background: #f1f5f9; }
.bubble.bot { background: #ecfdf5; margin-left: 18px; }
.bubble .who { display: block; font-size: 0.72rem; font-weight: 700; color: var(--muted); }

/* sent badges (sentbadges) */
.sb-badge{display:inline-block;padding:.25rem .6rem;border-radius:8px;font-weight:800;font-size:.95rem;color:#fff}
.sb-sent{background:#2e7d32}.sb-draft{background:#757575}.sb-failed{background:#c62828}
.sb-auto{display:inline-block;padding:.2rem .5rem;border-radius:8px;background:#1565c0;color:#fff;font-weight:800;font-size:.8rem;letter-spacing:.05em}
.sb-warn{background:#fff3cd;border:2px solid #e0a800;border-radius:10px;padding:.5rem .7rem;font-weight:700;margin:.5rem 0}
.sb-list{margin:.5rem 0}.sb-h{font-weight:700;margin:.3rem 0}.sb-row{margin:.3rem 0;line-height:1.6}.sb-ch{font-size:.85rem;color:#555;text-transform:uppercase}
.sb-txt{color:#333}.sb-who{color:#555;font-size:.9rem}.sb-page .sb-row{border-bottom:1px solid #eee;padding:.35rem 0}
.sb-tablewrap{overflow-x:auto}.sb-table{border-collapse:collapse;width:100%;font-size:.95rem}.sb-table td,.sb-table th{border-bottom:1px solid #e3e3e3;padding:.4rem;text-align:left;vertical-align:top}.sb-paid{background:#e8f5e9}
.bubble .sb-badge{margin-left:.4rem;font-size:.75rem;padding:.1rem .4rem}.bubble .sb-auto{font-size:.7rem;margin-left:.2rem}

/* simplify */
.msgnav{display:flex;flex-wrap:wrap;gap:.4rem;margin:.6rem 0}.msgnav a{padding:.5rem .8rem;border-radius:10px;background:#e6efe9;color:#0b3d2e;text-decoration:none;font-weight:600}.msgnav a.on{background:#0b3d2e;color:#fff}
.ub-reply{margin:.2rem;background:#e6efe9;color:#0b3d2e;border:0;font-weight:700}
