/* Santosh Ji admin panel — tokens from DESIGN.md (kitchen green + saffron) */
:root {
  --bg: #F8FAF8; --card: #fff; --line: #E6ECE6; --line2: #DCE5DC;
  --text: #1F2922; --muted: #5B685E; --soft: #F3F6F3;
  --green: #008F2D; --green-d: #006B24; --green-bg: #EAF7EE;
  --saffron: #FF5200; --saffron-bg: #FFF2E6;
  --red: #C93B2B; --red-bg: #FDECEA; --amber: #B45309; --amber-bg: #FFF6E5;
  --wa: #25D366;
  --r: 16px; --shadow: 0 2px 8px -2px rgba(0,50,15,.06);
  --side: 240px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3, b, .btn, .pill, .stat b { font-family: 'Plus Jakarta Sans', Inter, sans-serif; }
a { color: var(--green-d); }
code { background: var(--soft); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .block { display: block; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } .row.gap { gap: 10px; margin-top: 12px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ── shell ─────────────────────────────────────────── */
.side { position: fixed; inset: 0 auto 0 0; width: var(--side); background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 14px; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand img { width: 42px; height: 42px; object-fit: contain; border-radius: 12px; background: #fff; border: 1px solid var(--line); padding: 3px; }
.brand b { font-size: 16px; display: block; } .brand small { color: var(--muted); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 26px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--muted);
  text-decoration: none; font-weight: 600; }
.nav a:hover { background: var(--soft); color: var(--text); }
.nav a.on { background: var(--green-bg); color: var(--green-d); }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid var(--line); }
.me b { display: block; font-size: 13.5px; } .me small { color: var(--muted); font-size: 12px; text-transform: capitalize; }
.me div:nth-child(2) { flex: 1; min-width: 0; }
.avatar { width: 36px; height: 36px; border-radius: 9999px; background: var(--green); color: #fff; display: flex;
  align-items: center; justify-content: center; font-weight: 800; }
.icon-btn { width: 36px; height: 36px; border: 0; border-radius: 9999px; background: transparent; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn:hover { background: var(--soft); color: var(--text); }
.top, .tabbar { display: none; }
.main { margin-left: var(--side); padding: 28px 32px 48px; max-width: 1180px; }
.page-title { font-size: 26px; font-weight: 800; margin: 0 0 18px; letter-spacing: -.01em; }

@media (max-width: 900px) {
  .side { display: none; }
  .top { display: flex; position: sticky; top: 0; z-index: 20; align-items: center; justify-content: space-between;
    padding: 10px 16px; background: rgba(255,255,255,.95); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
  .top .brand img { width: 34px; height: 34px; } .top .brand b { font-size: 15px; }
  .main { margin: 0; padding: 18px 16px 96px; }
  .page-title { font-size: 22px; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: #fff;
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 24px -2px rgba(0,30,10,.08); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0;
    color: var(--muted); text-decoration: none; font-size: 10.5px; font-weight: 600; }
  .tabbar a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70px; }
  .tabbar a.on { color: var(--green); }
}

/* ── cards & grids ─────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card h2 { font-size: 16px; margin: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card-head a { font-size: 13px; font-weight: 600; text-decoration: none; }
.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(4, 1fr); margin-bottom: 16px; }
.grid.two { grid-template-columns: 1fr 1fr; } .grid.two.tight { gap: 12px; }
@media (max-width: 1100px) { .grid.stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .grid.two { grid-template-columns: 1fr; } }
.stat { margin: 0; }
.stat small { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.stat b { display: block; font-size: 28px; font-weight: 800; margin: 2px 0; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 12.5px; }
.stat.saffron b { color: var(--saffron); }

/* ── buttons, inputs ───────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px;
  border-radius: 9999px; border: 1.5px solid transparent; font-weight: 700; font-size: 14px; cursor: pointer;
  text-decoration: none; background: var(--soft); color: var(--text); white-space: nowrap; }
.btn.primary { background: var(--green); color: #fff; } .btn.primary:hover { background: var(--green-d); }
.btn.ghost { background: #fff; border-color: var(--line2); color: var(--text); } .btn.ghost:hover { border-color: var(--green); }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger-ghost { background: #fff; border-color: #F5C2BC; color: var(--red); }
.btn.small { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; }
input:not([type=checkbox]) { height: 44px; border: 1.5px solid var(--line2); border-radius: 10px; padding: 0 12px;
  font: 500 15px Inter, sans-serif; color: var(--text); background: #fff; outline: none; }
input:focus { border-color: var(--green); }
input:disabled { background: var(--soft); }
label.check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 500; }
label.check input { width: 20px; height: 20px; accent-color: var(--green); margin-top: 2px; }
.settings h2 { margin-top: 6px; }

/* ── pills, tags, alerts ───────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 9999px; font-size: 12.5px; font-weight: 800; }
.pill i { width: 8px; height: 8px; border-radius: 9999px; background: currentColor; }
.pill.ok { background: var(--green-bg); color: var(--green-d); } .pill.ok i { animation: blink 2s infinite; }
.pill.warn { background: var(--amber-bg); color: var(--amber); } .pill.warn i { animation: blink 1s infinite; }
.pill.bad { background: var(--red-bg); color: var(--red); } .pill.off { background: var(--soft); color: var(--muted); }
@keyframes blink { 50% { opacity: .35; } }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 700; background: var(--soft); color: var(--muted); }
.t-used { background: var(--green-bg); color: var(--green-d); } .t-claimed, .t-approved { background: #E8F1FE; color: #1D4ED8; }
.t-rejected { background: var(--red-bg); color: var(--red); }
.t-pending { background: var(--amber-bg); color: var(--amber); }
.t-expired, .t-locked, .t-failed_no_phone { background: var(--red-bg); color: var(--red); }
.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 13.5px; }
.alert.ok { background: var(--green-bg); color: var(--green-d); } .alert.bad { background: var(--red-bg); color: var(--red); }
.alert.warn { background: var(--amber-bg); color: #7A4A00; }

/* ── tables ─────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: #FBFCFB; white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td small { color: var(--muted); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.blocked td { background: #FFF8F7; }
.card:not(.flush) .table th, .card:not(.flush) .table td { padding-left: 0; }
.search { display: flex; gap: 8px; margin-bottom: 8px; } .search input { flex: 1; min-width: 0; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { padding: 6px 12px; border-radius: 9999px; border: 1px solid var(--line2); background: #fff; color: var(--muted);
  text-decoration: none; font-size: 12.5px; font-weight: 700; text-transform: capitalize; }
.chip.on { background: var(--green); border-color: var(--green); color: #fff; }

/* ── events ─────────────────────────────────────────── */
.events { list-style: none; margin: 0; padding: 0; }
.events li { display: grid; grid-template-columns: 12px auto 1fr; column-gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.events li:last-child { border-bottom: 0; }
.events b { font-size: 13px; } .events small { color: var(--muted); font-size: 12px; text-align: right; }
.events em { grid-column: 2 / 4; font-style: normal; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev { width: 9px; height: 9px; border-radius: 9999px; background: var(--line2); }
.ev-connected { background: var(--green); } .ev-disconnected, .ev-auth_unreachable { background: var(--red); }
.ev-pairing_code, .ev-admin_logout { background: var(--saffron); }

/* ── WhatsApp ───────────────────────────────────────── */
.wa-ic { width: 46px; height: 46px; border-radius: 14px; background: var(--wa); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.wa-ic.big { width: 56px; height: 56px; border-radius: 16px; }
.wa-banner { display: flex; align-items: center; gap: 14px; }
.wa-banner small { color: var(--muted); font-weight: 600; }
.wa-banner.attn { border-color: #FFD8C2; background: linear-gradient(90deg, #FFF8F2, #fff); }
.wa-status-head { display: flex; align-items: center; gap: 14px; }
.wa-status-head small { color: var(--muted); font-weight: 600; }
.wa-status-head h2 { font-size: 20px; margin: 0 0 4px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 14px 0 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; }
.seg { display: inline-flex; padding: 4px; background: var(--soft); border-radius: 9999px; margin: 4px 0 16px; }
.seg button { border: 0; background: transparent; padding: 8px 16px; border-radius: 9999px; font: 700 13.5px 'Plus Jakarta Sans', sans-serif; color: var(--muted); cursor: pointer; }
.seg button.on { background: #fff; color: var(--green-d); box-shadow: var(--shadow); }
.link-grid { display: grid; grid-template-columns: 320px 1fr; gap: 24px; align-items: start; }
@media (max-width: 760px) { .link-grid { grid-template-columns: 1fr; } }
.qr-box, .code-box { min-height: 300px; border: 1.5px dashed var(--line2); border-radius: var(--r); display: flex;
  align-items: center; justify-content: center; padding: 16px; background: #fff; text-align: center; }
.qr-box svg { width: 100%; max-width: 280px; height: auto; }
.code-box form { width: 100%; }
.pair-code { font: 800 34px/1.1 'Plus Jakarta Sans', monospace; letter-spacing: .12em; color: var(--text); margin: 6px 0 12px; }
.steps { margin: 0; padding-left: 0; list-style: none; counter-reset: s; display: flex; flex-direction: column; gap: 12px; }
.steps li { counter-increment: s; position: relative; padding-left: 38px; min-height: 26px; font-size: 14px; line-height: 1.55; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: -1px; width: 26px; height: 26px; border-radius: 9999px;
  background: var(--green-bg); color: var(--green-d); font: 800 13px 'Plus Jakarta Sans'; display: flex; align-items: center; justify-content: center; }
.spinner { width: 34px; height: 34px; border-radius: 9999px; border: 3px solid var(--line); border-top-color: var(--green); animation: spin .8s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── login ──────────────────────────────────────────── */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(1200px 500px at 50% -10%, #EAF7EE, var(--bg)); }
.login-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line); border-radius: 24px;
  padding: 30px 26px; box-shadow: 0 16px 40px -8px rgba(0,20,5,.12); text-align: center; }
.login-card form { text-align: left; margin-top: 18px; }
.login-logo { width: 96px; height: auto; }
.login-card h1 { margin: 8px 0 2px; font-size: 22px; }
.login-card .small { margin-top: 16px; }

/* confirm dialog */
.dlg { position: fixed; inset: 0; background: rgba(31,41,34,.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.dlg > div { background: #fff; border-radius: 20px; padding: 22px; max-width: 380px; width: 100%; box-shadow: 0 16px 40px -8px rgba(0,20,5,.18); }
.dlg h3 { margin: 0 0 6px; } .dlg p { color: var(--muted); margin: 0 0 16px; }
.dlg .row { justify-content: flex-end; }
.row.center { justify-content: center; }

/* Customers table on phones: keep name, orders and the Block button visible */
@media (max-width: 600px) {
  .table.customers th:nth-child(2), .table.customers td:nth-child(2),
  .table.customers th:nth-child(4), .table.customers td:nth-child(4) { display: none; }
  .table.customers td, .table.customers th { padding-left: 10px; padding-right: 10px; }
}
