:root {
  --brand: #0f766e;
  --brand-dark: #0b5953;
  --brand-soft: #e6f4f2;
  --wa: #1fa855;
  --ink: #1b2430;
  --muted: #64707d;
  --line: #e3e8ee;
  --bg: #f4f6f8;
  --card: #fff;
  --red: #c0392b;
  --amber: #b7791f;
  --radius: 14px;
  --nav-h: 64px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Devanagari", sans-serif;
  line-height: 1.45; min-height: 100vh;
}
a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { margin: 0 0 .4rem; line-height: 1.25; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; }
.mt { margin-top: 1rem; } .mb { margin-bottom: 1rem; } .mt0 { margin-top: 0; }
.row { display: flex; align-items: center; gap: .6rem; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: .75rem; }

/* Layout */
.shell { max-width: 640px; margin: 0 auto; padding: 1rem 1rem calc(var(--nav-h) + 1.5rem); }
.shell.public { padding-bottom: 2rem; }
.shell.wide { max-width: 1000px; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--brand); color: #fff;
  display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem;
}
.topbar .title { font-weight: 700; flex: 1; }
.topbar a, .topbar button { color: #fff; }
.topbar .back { font-size: 1.4rem; line-height: 1; padding: 0 .3rem; }
.topbar-inner { max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: .6rem; width: 100%; }
.wide .topbar-inner, .topbar.wide .topbar-inner { max-width: 1000px; }
.brand-logo { display: inline-flex; align-items: center; gap: .5rem; font-weight: 800; }
.brand-logo svg { width: 28px; height: 28px; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.card + .card { margin-top: .75rem; }
.card.flat { padding: 0; overflow: hidden; }
.card-title { font-weight: 700; margin-bottom: .5rem; }
.hero { background: linear-gradient(135deg, var(--brand), #14958a); color: #fff; border: 0; }
.hero .muted { color: #cdeee9; }
.big-number { font-size: 2.1rem; font-weight: 800; line-height: 1.1; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: .8rem; }
.stat { background: rgba(255,255,255,.15); border-radius: 10px; padding: .5rem .6rem; }
.stat b { display: block; font-size: 1.25rem; }
.stat span { font-size: .75rem; color: #d7f1ed; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 46px;
  padding: .6rem 1.1rem; border-radius: 12px; border: 1px solid var(--line); background: #fff;
  color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-align: center;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.wa { background: var(--wa); color: #fff; border-color: var(--wa); }
.btn.danger { color: var(--red); border-color: #efc9c4; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn.block { display: flex; width: 100%; }
.btn.lg { min-height: 56px; font-size: 1.1rem; }
.btn.sm { min-height: 36px; padding: .3rem .8rem; font-size: .9rem; border-radius: 10px; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
button.link { background: none; border: 0; color: var(--brand); font: inherit; padding: 0; cursor: pointer; text-decoration: underline; }

/* Forms */
label.field { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .9rem; }
label.field > .hint { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; margin-top: .2rem; }
input[type=text], input[type=tel], input[type=number], input[type=url], input[type=search], select, textarea {
  width: 100%; min-height: 48px; padding: .65rem .8rem; border: 1.5px solid #cfd7df; border-radius: 12px;
  font: inherit; background: #fff; color: var(--ink); margin-top: .3rem;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
.input-big { font-size: 1.6rem; letter-spacing: .08em; font-weight: 700; min-height: 60px; }
.err { color: var(--red); font-size: .85rem; margin-top: .25rem; font-weight: 500; }
.field.has-error input, .field.has-error select { border-color: var(--red); }
.check { display: flex; align-items: center; gap: .6rem; min-height: 44px; font-weight: 500; }
.check input { width: 22px; height: 22px; accent-color: var(--brand); }
.prefix { display: flex; align-items: center; gap: .4rem; }
.prefix span.pre { margin-top: .3rem; padding: .85rem .7rem; background: var(--bg); border: 1.5px solid #cfd7df; border-radius: 12px; font-weight: 600; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .9rem; border-radius: 999px;
  border: 1.5px solid #cfd7df; background: #fff; font-weight: 600; font-size: .95rem; cursor: pointer; min-height: 42px;
  color: var(--ink);
}
.chip small { color: var(--muted); font-weight: 500; }
.chip.on, input:checked + .chip { background: var(--brand); border-color: var(--brand); color: #fff; }
input:checked + .chip small { color: #cdeee9; }
.chips input[type=checkbox], .chips input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
.chips label { position: relative; }
.scroll-x { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .4rem; margin: 0 -1rem; padding-left: 1rem; padding-right: 1rem; scrollbar-width: none; }
.scroll-x::-webkit-scrollbar { display: none; }
.scroll-x .chip { white-space: nowrap; flex: none; }

/* Badges */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--bg); color: var(--muted); }
.badge.green { background: #dcf5e5; color: #187a3f; }
.badge.blue { background: #dfeaff; color: #2456b5; }
.badge.amber { background: #fdf0d3; color: #925f0a; }
.badge.red { background: #fde3df; color: #a8281b; }
.badge.purple { background: #ece3fb; color: #6535b1; }
.badge.teal { background: #d8f2ef; color: #0d6a62; }
.badge.gray { background: #eceff2; color: #4f5b67; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list-item { display: flex; align-items: center; gap: .75rem; padding: .8rem 1rem; color: inherit; }
.avatar {
  width: 42px; height: 42px; flex: none; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark);
  display: grid; place-items: center; font-weight: 800;
}
.avatar.sm { width: 34px; height: 34px; font-size: .85rem; }
.li-main { flex: 1; min-width: 0; }
.li-main b, .li-main .sub { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-main .sub { color: var(--muted); font-size: .85rem; }
.li-side { text-align: right; font-size: .85rem; color: var(--muted); }
.li-side b { color: var(--ink); display: block; font-size: 1rem; }
.chev { color: #9aa6b2; font-size: 1.3rem; }

/* Group cards */
.group-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.group-card { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; color: inherit; }
.group-card .count { font-size: 1.8rem; font-weight: 800; }
.group-card.attn { border-left: 5px solid var(--amber); }
.attention { display: flex; align-items: center; gap: .8rem; background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--amber); border-radius: var(--radius); padding: .85rem 1rem; color: inherit; margin-bottom: .6rem; }
.attention.red { border-left-color: var(--red); } .attention.blue { border-left-color: #2f6bd8; }
.attention .num { font-size: 1.6rem; font-weight: 800; }

/* Limit meter */
.meter { height: 10px; border-radius: 999px; background: #e3e8ee; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--wa); border-radius: 999px; }
.meter.low > i { background: var(--amber); } .meter.out > i { background: var(--red); }
.limit-bar { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem 1rem; }
.tip { background: #fff8e6; border: 1px solid #f3e1a8; color: #6e5410; border-radius: 12px; padding: .7rem .9rem; font-size: .85rem; }
.note { background: var(--brand-soft); border-radius: 12px; padding: .7rem .9rem; font-size: .9rem; }

/* Bottom nav */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; height: var(--nav-h); background: #fff;
  border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: .7rem; font-weight: 600; }
.bottom-nav a svg { width: 24px; height: 24px; }
.bottom-nav a.on { color: var(--brand); }
.bottom-nav a.add { position: relative; }
.bottom-nav a.add span.fab {
  position: absolute; top: -22px; width: 58px; height: 58px; border-radius: 50%; background: var(--brand);
  color: #fff; display: grid; place-items: center; box-shadow: 0 4px 12px rgba(15,118,110,.45); border: 4px solid var(--bg);
}
.bottom-nav a.add span.fab svg { width: 28px; height: 28px; }
.bottom-nav a.add em { font-style: normal; margin-top: 30px; }

/* Messages and toast */
.msgs { position: fixed; top: 60px; left: 0; right: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; gap: .4rem; padding: 0 1rem; pointer-events: none; }
.msg { pointer-events: auto; background: #17212b; color: #fff; padding: .65rem 1rem; border-radius: 12px; max-width: 460px; width: 100%; font-size: .92rem; box-shadow: 0 6px 20px rgba(0,0,0,.2); animation: fade 6s forwards; }
.msg.success { background: #14683a; } .msg.error { background: #9d2418; }
@keyframes fade { 0%,85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-8px); } }
.toast {
  position: fixed; left: 1rem; right: 1rem; bottom: calc(var(--nav-h) + .8rem); z-index: 40; max-width: 460px; margin: 0 auto;
  background: #17212b; color: #fff; border-radius: 14px; padding: .8rem 1rem; display: flex; align-items: center; gap: .75rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.toast b { display: block; } .toast span { font-size: .85rem; color: #b9c4cf; }
.toast form button { background: none; border: 1.5px solid #fff; color: #fff; padding: .4rem .9rem; border-radius: 10px; font: inherit; font-weight: 700; cursor: pointer; }

/* Suggestions */
.suggest { background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-top: .4rem; overflow: hidden; box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.suggest button { display: flex; width: 100%; align-items: center; gap: .7rem; padding: .7rem .9rem; border: 0; border-bottom: 1px solid var(--line); background: #fff; font: inherit; text-align: left; cursor: pointer; min-height: 52px; }
.suggest button:last-child { border-bottom: 0; }
.suggest button:hover { background: var(--brand-soft); }
.known { background: #e9f8ef; border: 1px solid #bfe6cd; border-radius: 12px; padding: .6rem .9rem; font-size: .9rem; margin-bottom: .9rem; }

/* WhatsApp preview */
.wa-bubble { background: #dcf8c6; border-radius: 14px 14px 4px 14px; padding: .8rem 1rem; white-space: pre-wrap; word-break: break-word; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.wa-screen { background: #e5ddd5; border-radius: var(--radius); padding: 1rem; }

/* Tables (staff) */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.funnel-row { margin-bottom: .55rem; }
.funnel-row .bar { height: 26px; background: var(--brand); border-radius: 6px; color: #fff; padding: 0 .5rem; display: flex; align-items: center; font-weight: 700; font-size: .85rem; min-width: 28px; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; }
.kpi b { font-size: 1.6rem; display: block; }
.alert-row { display: flex; gap: .5rem; align-items: center; padding: .4rem 0; font-size: .9rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #25a35a; flex: none; }
.dot.warn { background: var(--amber); }

/* Email preview */
.email-frame { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.email-head { background: #f1f3f5; padding: .7rem 1rem; font-size: .85rem; }
.email-body { padding: 1.2rem; }

/* Landing */
.hero-public { background: linear-gradient(160deg, var(--brand-dark), var(--brand) 60%, #19a095); color: #fff; padding: 1.2rem 1rem 2.2rem; }
.hero-public .inner { max-width: 640px; margin: 0 auto; }
.hero-public h1 { font-size: 1.9rem; margin-top: 1rem; }
.hero-public .pill { display: inline-block; background: rgba(255,255,255,.18); padding: .3rem .8rem; border-radius: 999px; font-size: .85rem; font-weight: 600; }
.trust { list-style: none; padding: 0; margin: 1rem 0; }
.trust li { padding: .25rem 0 .25rem 1.7rem; position: relative; }
.trust li::before { content: "✓"; position: absolute; left: 0; font-weight: 800; color: #9df0dd; }
.google-btn { display: flex; align-items: center; justify-content: center; gap: .7rem; background: #fff; color: #1f1f1f; border: 1px solid #dadce0; border-radius: 12px; min-height: 52px; font-weight: 600; font-size: 1rem; width: 100%; cursor: pointer; font-family: inherit; }
.google-btn svg { width: 22px; height: 22px; }
.lang-switch { float: right; background: rgba(255,255,255,.18); color: #fff; padding: .3rem .8rem; border-radius: 999px; font-weight: 600; font-size: .85rem; }
.step { display: flex; gap: .8rem; align-items: flex-start; }
.step .n { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; }
.steps-bar { display: flex; gap: .4rem; margin-bottom: 1rem; }
.steps-bar i { flex: 1; height: 6px; border-radius: 99px; background: #d5dce3; }
.steps-bar i.on { background: var(--brand); }
.persona { display: flex; align-items: center; gap: .8rem; width: 100%; text-align: left; background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; font: inherit; cursor: pointer; color: inherit; }
.persona:hover { border-color: var(--brand); }
.persona + .persona, form + form .persona { margin-top: .6rem; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.empty .icon { font-size: 2.2rem; }
.sticky-actions { position: sticky; bottom: calc(var(--nav-h) + .5rem); }
.hide { display: none !important; }
details.card summary { cursor: pointer; font-weight: 700; }

@media (min-width: 700px) {
  .group-grid { grid-template-columns: repeat(4, 1fr); }
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .shell { padding-top: 1.5rem; }
}
@media (min-width: 900px) {
  .bottom-nav { max-width: 640px; left: 50%; transform: translateX(-50%); border: 1px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0; }
}
