/* Digiwebex WhatsApp Chatbot - look and feel.
   Every colour is a variable, so a theme (html[data-theme=...]) only swaps variables.
   Themes: digiwebex (default, logo blue), emerald, royal, sunset, midnight (dark). */
:root, [data-theme='digiwebex'] {
  --accent: #1e73be; --accent-dark: #155a96; --accent-soft: #e8f1fb; --accent-bright: #4ea3ef; --ring-c: rgba(30, 115, 190, 0.25);
  --side-bg: linear-gradient(180deg, #0f1b2d 0%, #0a1322 100%); --side-text: rgba(255, 255, 255, 0.7);
  --bg: #f2f5f9; --bg-glow: rgba(30, 115, 190, 0.08);
  --card: #fff; --surface: #f7f9fc; --input: #fff; --hover: #f8fafd;
  --text: #1c2733; --ink: #0d1722; --muted: #637083; --border: #e2e8f0; --border-strong: #cbd5e1;
  --ok-bg: #e6f6ee; --ok-text: #0b5d45; --ok-line: #16a34a;
  --err-bg: #fdeeec; --err-text: #8e2a20; --err-line: #d9534f;
  --warn-bg: #fff5e2; --warn-text: #7d5200; --warn-line: #f0a030;
  --danger: #c0392b;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 27, 45, 0.05), 0 12px 30px -16px rgba(15, 27, 45, 0.18);
  --shadow-lg: 0 24px 60px -20px rgba(15, 27, 45, 0.35);
  color-scheme: light;
}
[data-theme='emerald'] {
  --accent: #0f8a6a; --accent-dark: #0a6b52; --accent-soft: #e6f5ef; --accent-bright: #25d366; --ring-c: rgba(15, 138, 106, 0.22);
  --side-bg: linear-gradient(180deg, #0a3a32 0%, #062a24 100%);
  --bg: #f1f6f4; --bg-glow: rgba(37, 211, 102, 0.08); --surface: #f6faf8; --hover: #f7fbf9;
  --text: #1b2c28; --ink: #10231f; --muted: #62736f; --border: #e1e9e6; --border-strong: #cbd8d4;
}
[data-theme='royal'] {
  --accent: #7c3aed; --accent-dark: #6025c9; --accent-soft: #f1eafe; --accent-bright: #a78bfa; --ring-c: rgba(124, 58, 237, 0.22);
  --side-bg: linear-gradient(180deg, #24124d 0%, #170b33 100%);
  --bg: #f5f3fb; --bg-glow: rgba(124, 58, 237, 0.08); --surface: #f9f7fe; --hover: #faf8ff;
  --text: #241f33; --ink: #16122a; --muted: #6b6681; --border: #e6e2f0; --border-strong: #d0cae2;
}
[data-theme='sunset'] {
  --accent: #e8590c; --accent-dark: #c2410c; --accent-soft: #fff0e6; --accent-bright: #fb923c; --ring-c: rgba(232, 89, 12, 0.22);
  --side-bg: linear-gradient(180deg, #3b1508 0%, #260c04 100%);
  --bg: #fbf6f2; --bg-glow: rgba(232, 89, 12, 0.08); --surface: #fdf9f6; --hover: #fffaf6;
  --text: #2e2420; --ink: #1f1410; --muted: #7a6a62; --border: #efe4dc; --border-strong: #ddccc0;
}
[data-theme='midnight'] {
  --accent: #2ecc8f; --accent-dark: #25b07a; --accent-soft: rgba(46, 204, 143, 0.13); --accent-bright: #2ecc8f; --ring-c: rgba(46, 204, 143, 0.3);
  --side-bg: #0a0e14; --side-text: rgba(230, 237, 243, 0.62);
  --bg: #0d1117; --bg-glow: rgba(46, 204, 143, 0.06);
  --card: #161b22; --surface: #1c232c; --input: #0d1117; --hover: #1c232c;
  --text: #d6dee6; --ink: #f0f6fc; --muted: #8b98a5; --border: #2a323c; --border-strong: #3a4450;
  --ok-bg: rgba(46, 204, 143, 0.12); --ok-text: #7ee2b8; --ok-line: #2ecc8f;
  --err-bg: rgba(248, 81, 73, 0.12); --err-text: #ffa198; --err-line: #f85149;
  --warn-bg: rgba(210, 153, 34, 0.14); --warn-text: #e3b341; --warn-line: #d29922;
  --danger: #f85149;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 30px -16px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px; line-height: 1.55; color: var(--text); -webkit-font-smoothing: antialiased;
  background: radial-gradient(1200px 500px at 100% -10%, var(--bg-glow), transparent 60%), var(--bg);
  background-attachment: fixed; min-height: 100vh;
}
body.noscroll { overflow: hidden; }
h1, h2, h3, h4 { margin: 0 0 8px; line-height: 1.25; color: var(--ink); letter-spacing: -0.015em; }
h2 { font-size: 27px; font-weight: 800; }
h3 { font-size: 17px; font-weight: 700; }
p { margin: 0 0 10px; }
a { color: var(--accent); text-decoration: none; font-weight: 600; }
a:hover { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 3px; }
[data-theme='midnight'] a:hover { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--err-text); }
.right { text-align: right; margin-bottom: 12px; font-size: 14px; }
.center-screen { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }
:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring-c); border-radius: 8px; }
::selection { background: var(--ring-c); }

/* logo + brand */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; color: var(--ink); }
.logo { width: 38px; height: 38px; border-radius: 11px; background: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); }
.logo img { width: 30px; height: 30px; display: block; }
.logo-name { font-weight: 800; font-size: 19px; letter-spacing: 0.04em; text-transform: uppercase; }
/* older pages (admin) still use the small chat-bubble mark */
.brand-dot { position: relative; width: 26px; height: 22px; border-radius: 8px 8px 8px 2px; background: var(--accent); display: inline-block; }
.brand-dot::before, .brand-dot::after { content: ''; position: absolute; left: 6px; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, 0.92); }
.brand-dot::before { top: 7px; width: 14px; }
.brand-dot::after { top: 12px; width: 9px; }

/* forms */
label { display: block; font-size: 13.5px; font-weight: 600; margin: 16px 0 6px; color: var(--ink); }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; line-height: 1.45; flex-wrap: wrap; }
label.check input[type='checkbox'] { margin-top: 3px; }
input, textarea, select {
  width: 100%; padding: 11px 13px; font: inherit; border: 1px solid var(--border-strong);
  border-radius: 11px; background: var(--input); color: var(--text); transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.75; }
input[type='checkbox'] { width: 17px; height: 17px; padding: 0; accent-color: var(--accent); flex: none; }
input:hover, textarea:hover, select:hover { border-color: var(--muted); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring-c); }
textarea { resize: vertical; }
select {
  width: auto; max-width: 100%; padding-right: 34px; cursor: pointer; appearance: none; -webkit-appearance: none;
  background: var(--input) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23889' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
}

/* buttons */
.btn {
  display: inline-block; padding: 11px 20px; border-radius: 11px; border: 1px solid transparent;
  font: inherit; font-weight: 700; font-size: 14.5px; cursor: pointer; text-align: center; text-decoration: none !important;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.05s, color 0.15s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 6px 16px -6px var(--accent), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
.btn.primary:hover:not(:disabled) { background: var(--accent-dark); color: #fff; }
[data-theme='midnight'] .btn.primary { color: #062016; }
.btn.ghost { background: var(--card); border-color: var(--border-strong); color: var(--ink); }
.btn.ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn.sm { padding: 7px 13px; font-size: 13px; border-radius: 9px; }
.btn.block { display: block; width: 100%; margin-top: 16px; padding: 13px 20px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.link-danger { background: none; border: 0; color: var(--danger); cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; padding: 4px 2px; }
.link-danger:hover { text-decoration: underline; text-underline-offset: 3px; }
.icon-btn { width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--border); background: var(--card); color: var(--ink); cursor: pointer; display: grid; place-items: center; font-size: 17px; padding: 0; }
.icon-btn:hover { border-color: var(--accent); background: var(--accent-soft); }

.alert { padding: 11px 14px; border-radius: 11px; font-size: 14px; margin: 12px 0; border-left: 4px solid transparent; }
.alert.error { background: var(--err-bg); color: var(--err-text); border-left-color: var(--err-line); }
.alert.ok { background: var(--ok-bg); color: var(--ok-text); border-left-color: var(--ok-line); }
.alert.warn { background: var(--warn-bg); color: var(--warn-text); border-left-color: var(--warn-line); }
.err:empty { display: none; }

/* sign in / sign up */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(circle at 15% 10%, rgba(255, 255, 255, 0.12), transparent 40%),
    radial-gradient(circle at 90% 95%, var(--accent), transparent 50%), var(--side-bg);
}
.auth-card { width: 100%; max-width: 440px; background: var(--card); border-radius: 22px; padding: 34px 30px 28px; box-shadow: var(--shadow-lg); }
.auth-card h1 { font-size: 26px; font-weight: 800; margin: 22px 0 4px; }
.auth-card > p.muted { margin-bottom: 4px; }
.auth-footer { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); text-align: center; font-size: 14px; color: var(--muted); }

/* ------------------------------------------------------------------ app frame: sidebar + header */
.app { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--side-bg); color: var(--side-text);
  display: flex; flex-direction: column; padding: 20px 14px 14px; z-index: 40;
}
.side-brand { display: flex; align-items: center; gap: 11px; color: #fff; padding: 2px 8px 22px; text-decoration: none !important; }
.side-brand:hover { color: #fff; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-group { font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--side-text); opacity: 0.6; padding: 18px 12px 6px; }
.side nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px;
  color: var(--side-text); font-weight: 600; font-size: 14.5px; transition: background 0.15s, color 0.15s;
}
.side nav a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; text-decoration: none; }
.side nav a.on { background: rgba(255, 255, 255, 0.12); color: #fff; box-shadow: inset 3px 0 0 var(--accent-bright); }
.side nav a.on .ic { stroke: var(--accent-bright); }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-foot { display: flex; align-items: center; gap: 10px; padding: 12px 10px 4px; margin-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }
.biz { font-size: 14px; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backdrop { display: none; }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.header {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 12px 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.menu-btn, .header-brand { display: none; }
.header-brand { align-items: center; gap: 9px; color: var(--ink); text-decoration: none !important; }
.header-brand .logo { width: 32px; height: 32px; border-radius: 9px; }
.header-brand .logo img { width: 25px; height: 25px; }
.header-brand .logo-name { font-size: 16px; }

/* theme picker */
.theme-wrap { position: relative; }
.theme-menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 220px; background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 8px; z-index: 50;
}
.theme-title { font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); padding: 6px 10px; }
.theme-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px; background: none; color: var(--text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-align: left; }
.theme-menu button:hover { background: var(--hover); }
.theme-menu button.on { background: var(--accent-soft); color: var(--accent); }
.theme-menu button.on::after { content: '✓'; margin-left: auto; }
.swatch { width: 20px; height: 20px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5), 0 0 0 1px var(--border-strong); }

/* page */
.page { width: 100%; max-width: 1060px; margin: 0 auto; padding: 30px 28px 80px; }
.page.narrow { max-width: 760px; }
.page > h2:first-child, .page > .row:first-child h2 { margin-bottom: 4px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card > h3:first-child, .card > .step-head:first-child { margin-top: 0; }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.step-head h3 { margin: 0; }
.step-no { width: 32px; height: 32px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 14px; font-weight: 800; flex: none; }

.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.row.gap, .gap { gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.choice { text-align: left; padding: 18px; border: 1.5px solid var(--border); border-radius: 13px; background: var(--card); cursor: pointer; font: inherit; color: var(--ink); display: flex; flex-direction: column; gap: 4px; transition: border-color 0.15s, background 0.15s; }
.choice:hover:not(:disabled) { border-color: var(--accent); }
.choice span { color: var(--muted); font-size: 13px; }
.choice.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice:disabled { cursor: not-allowed; opacity: 0.8; }

.qr-box { text-align: center; padding: 14px 0; }
.qr-box img { width: 264px; max-width: 100%; border: 1px solid var(--border); border-radius: 16px; padding: 12px; background: #fff; box-shadow: var(--shadow); }

.kv { display: grid; grid-template-columns: 120px 1fr auto; gap: 10px; align-items: center; margin: 10px 0; font-size: 14px; }
.kv code { background: var(--surface); border: 1px solid var(--border); padding: 7px 10px; border-radius: 8px; word-break: break-all; font-size: 12.5px; color: var(--ink); }

/* chatbot builder */
.stepper { display: flex; gap: 8px; margin: 14px 0 18px; }
.stepper-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); position: relative; }
.stepper-item span { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); font-weight: 800; color: var(--muted); position: relative; z-index: 1; }
.stepper-item.active span, .stepper-item.done span { background: var(--accent); color: #fff; }
.stepper-item.active { color: var(--ink); font-weight: 700; }
.stepper-item em { font-style: normal; text-align: center; }
.faq { border: 1px solid var(--border); border-radius: 13px; padding: 14px 16px 16px; margin: 14px 0; background: var(--surface); }
.faq .faq { background: var(--card); }
.actions { margin-top: 24px; }

/* the chat preview looks like a WhatsApp chat */
.chat-preview { background-color: #ece5db; background-image: radial-gradient(rgba(0, 0, 0, 0.045) 1px, transparent 1.2px); background-size: 14px 14px; padding: 18px; border-radius: 14px; border: 1px solid #ddd3c4; color: #111; }
.bubble { background: #fff; color: #111; display: inline-block; max-width: 90%; padding: 9px 13px; border-radius: 0 12px 12px 12px; font-size: 14px; white-space: pre-wrap; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12); }
.test-form { margin-top: 16px; }
.test-form input { flex: 1; min-width: 200px; }

/* nested menu editor */
.sub { margin-top: 14px; padding-left: 14px; border-left: 3px solid var(--accent-soft); }
.sub-title { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }

/* tabs under a page title (Orders | Settings, chatbot steps) */
.tabs { display: flex; gap: 4px; margin: 18px 0 20px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 13px; overflow-x: auto; scrollbar-width: none; width: fit-content; max-width: 100%; }
.tabs::-webkit-scrollbar { display: none; }
.tab { background: none; border: 0; border-radius: 10px; padding: 9px 16px; font: inherit; font-weight: 700; font-size: 14px; color: var(--muted); cursor: pointer; white-space: nowrap; transition: background 0.15s, color 0.15s; }
.tab:hover { color: var(--ink); }
.tab.on { background: var(--card); color: var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
[data-pane][hidden] { display: none; }

/* save bar that stays at the bottom of the screen */
.savebar {
  position: sticky; bottom: 14px; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 12px 16px; margin-top: 18px; box-shadow: var(--shadow-lg);
}
.savebar > span { flex: 1; min-width: 200px; }

/* "How it works" guides */
.how { border-left: 4px solid var(--accent); }
.how ol, .how-box ul { margin: 6px 0 12px; padding-left: 22px; }
.how li, .how-box li { margin: 6px 0; line-height: 1.6; }
.how ul { margin: 4px 0; padding-left: 18px; list-style: disc; }
.how-box { background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; margin: 6px 0 14px; font-size: 14px; }
.how-box > summary { cursor: pointer; font-weight: 700; color: var(--ink); }
.kbd { display: inline-block; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; font-weight: 600; padding: 1px 7px; margin: 1px 1px; border-radius: 6px; background: var(--card); border: 1px solid var(--border-strong); color: var(--ink); white-space: nowrap; }

/* small helpers */
.hint { background: var(--accent-soft); border-radius: 11px; padding: 10px 13px; font-size: 13.5px; margin: 14px 0 0; color: var(--ink); }
.empty { border: 1.5px dashed var(--border-strong); border-radius: 13px; padding: 24px; text-align: center; color: var(--muted); margin: 14px 0; }
.pill { display: inline-block; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 700; margin-left: 6px; }
details.more { margin-top: 14px; border-top: 1px dashed var(--border-strong); padding-top: 10px; }
details.more > summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--muted); }
details.more > summary:hover, details.more[open] > summary { color: var(--ink); }
.status { display: inline-block; border-radius: 999px; padding: 5px 13px; font-size: 13px; font-weight: 700; background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.status.on { background: var(--ok-bg); color: var(--ok-text); border-color: transparent; }
.status.on::before { content: '● '; color: #25d366; }
.status.off { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }

/* dashboard */
.hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.section-title { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 26px 0 12px; }
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin: 18px 0 8px; }
.kpi {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 2px; padding: 16px 16px 14px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--text); text-decoration: none !important;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.kpi:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow-lg); color: var(--text); }
.kpi::after { content: ''; position: absolute; right: -24px; top: -24px; width: 80px; height: 80px; border-radius: 50%; background: var(--tone); opacity: 0.12; }
.kpi-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-size: 18px; background: color-mix(in srgb, var(--tone) 16%, transparent); margin-bottom: 8px; }
.kpi-val { font-size: 28px; font-weight: 800; color: var(--ink); line-height: 1.1; letter-spacing: -0.02em; }
.kpi-label { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.kpi-sub { font-size: 12px; color: var(--muted); }
.kpi.t1 { --tone: var(--accent); } .kpi.t2 { --tone: #f59e0b; } .kpi.t3 { --tone: #8b5cf6; } .kpi.t4 { --tone: #eab308; } .kpi.t5 { --tone: #22c55e; }
@media (max-width: 1180px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .kpi { padding: 13px; } .kpi-val { font-size: 24px; } .kpis .kpi:last-child { grid-column: 1 / -1; } }

/* tables (leads, orders, chats, admin) */
.card.table-wrap { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface); color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; border-bottom-color: var(--border-strong); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--hover); }

/* ------------------------------------------------------------------ tablets and phones */
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; max-width: 84vw; transform: translateX(-105%); transition: transform 0.22s ease; box-shadow: var(--shadow-lg); }
  .side.open { transform: none; }
  .backdrop { display: block; position: fixed; inset: 0; background: rgba(5, 10, 20, 0.5); z-index: 35; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
  .backdrop.show { opacity: 1; pointer-events: auto; }
  .menu-btn { display: grid; }
  .header-brand { display: flex; }
  .header { padding: 10px 16px; }
  .page { padding: 24px 18px 72px; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  h2 { font-size: 23px; }
  .page { padding: 18px 12px 64px; }
  .header-brand .logo-name { display: none; }
  .grid2 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .stepper-item em { display: none; }
  .card { padding: 16px; border-radius: 14px; }
  .faq { padding: 12px; }
  .sub { padding-left: 9px; }
  .auth-card { padding: 28px 20px 22px; border-radius: 18px; }
  .actions .btn { flex: 1; }
  .tabs { width: 100%; }
  .tab { flex: 1; padding: 9px 10px; }
  .savebar { bottom: 8px; padding: 10px 12px; }
  .savebar > span { min-width: 0; flex-basis: 100%; }
  .savebar .row { width: 100%; }
  .savebar .btn { flex: 1; }
  /* tables turn into stacked cards */
  .card.table-wrap { background: none; border: 0; box-shadow: none; overflow: visible; }
  table, thead, tbody, tr, th, td { display: block; }
  thead { display: none; }
  tr { background: var(--card); border: 1px solid var(--border); border-radius: 13px; padding: 8px 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
  td { border: 0; padding: 5px 0; }
  tbody tr:hover td { background: none; }
  td[data-l]::before { content: attr(data-l) ': '; color: var(--muted); font-size: 12px; font-weight: 600; }
}

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

/* ---- Dashboard: choose WhatsApp Web (QR) or the WhatsApp Business API */
.conn-choose { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 0 0 16px; }
.conn-opt { text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 2px solid var(--border); border-radius: 14px; padding: 14px 16px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.conn-opt:hover { border-color: var(--border-strong); }
.conn-opt:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring-c); }
.conn-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.conn-opt strong { display: block; font-size: 1.02rem; color: var(--ink); }
.conn-tag { display: inline-block; margin: 6px 0 4px; font-size: .78rem; font-weight: 600; color: var(--accent-dark); background: var(--card); border: 1px solid var(--border); border-radius: 99px; padding: 2px 9px; }
.conn-opt ul { margin: 6px 0 0; padding-left: 18px; font-size: .86rem; color: var(--muted); }
.api-hook { margin-top: 14px; padding: 12px 14px; border: 1px dashed var(--border-strong); border-radius: 12px; background: var(--surface); }
.api-hook input[readonly] { font-family: ui-monospace, Consolas, monospace; font-size: .82rem; }
.api-hook .row { align-items: center; }
/* opening hours: one tick per day */
.days-row { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 6px 0 4px; }
.days-row label { display: inline-flex; align-items: center; gap: 5px; margin: 0; font-weight: 500; }
/* message templates (WhatsApp API) */
.tpl-list { margin-top: 10px; display: grid; gap: 8px; }
.tpl-row { padding: 8px 10px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.tpl-st { display: inline-block; font-size: .74rem; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); margin-left: 4px; }
.tpl-st.ok { background: var(--ok-bg); color: var(--ok-text); border-color: transparent; }
.tpl-st.wait { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.tpl-st.bad { background: var(--err-bg); color: var(--err-text); border-color: transparent; }
/* team inbox */
.inbox-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.inbox-filters button { font: inherit; font-size: .85rem; padding: 5px 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--card); color: var(--text); cursor: pointer; }
.inbox-filters button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.who { display: inline-block; font-size: .75rem; padding: 1px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-dark); margin-left: 4px; }
.who.done { background: var(--ok-bg); color: var(--ok-text); }
.inbox-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 8px; }
.inbox-bar select { width: auto; }
/* security page */
.tfa-qr { display: inline-block; background: #fff; padding: 8px; border-radius: 12px; border: 1px solid var(--border); }
.tfa-qr svg { display: block; width: 190px; height: 190px; }
.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; font-family: ui-monospace, Consolas, monospace; margin: 8px 0; }
.codes span { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; text-align: center; }
