/* ═══════════════════════════════════════════════
   Tenecall AI WhatsApp — Shared Stylesheet
   ═══════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue: #1B4FD8; --blue-l: #EEF3FF; --blue-d: #1340B5;
  --yellow: #F5C518; --yellow-l: #FFFBEA;
  --green: #10B981; --green-l: #ECFDF5;
  --red: #EF4444;   --red-l: #FEF2F2;
  --purple: #8B5CF6; --purple-l: #F5F3FF;
  --orange: #F97316; --orange-l: #FFF7ED;
  --g50:#F8FAFC; --g100:#F1F5F9; --g200:#E2E8F0; --g300:#CBD5E1;
  --g400:#94A3B8; --g500:#64748B; --g600:#475569;
  --g700:#334155; --g800:#1E293B; --g900:#0F172A;

  /* Theme tokens */
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --border: #E2E8F0;
  --text: #0F172A;
  --text2: #64748B;
  --text3: #94A3B8;
  --sidebar-bg: #FFFFFF;
  --topbar-bg: #FFFFFF;
  --input-bg: #F1F5F9;
  --chat-bg: #EEF3FF;
  --table-head: #F8FAFC;
  --hover: rgba(27,79,216,.06);
  --tog-off: #CBD5E1;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
}

body.dark {
  --bg: #0D1117;
  --card: #161B22;
  --border: #30363D;
  --text: #F0F6FC;
  --text2: #8B949E;
  --text3: #484F58;
  --sidebar-bg: #0D1117;
  --topbar-bg: #0D1117;
  --input-bg: #21262D;
  --chat-bg: #0D1117;
  --table-head: #161B22;
  --hover: rgba(255,255,255,.04);
  --tog-off: #484F58;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

/* ── Layout ── */
#app      { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.topbar   { height: 56px; background: var(--topbar-bg); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 20px; gap: 12px; flex-shrink: 0; box-shadow: var(--shadow); }
.topbar-title { flex: 1; font-size: 15px; font-weight: 700; color: var(--text); }
.body     { display: flex; flex: 1; overflow: hidden; }
.sidebar  { width: 220px; background: var(--sidebar-bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto; }
.main     { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.screen   { padding: 24px; overflow-y: auto; flex: 1; }

/* ── Logo ── */
.logo-area  { padding: 18px 16px 14px; border-bottom: 1px solid var(--border); }
.logo-row   { display: flex; align-items: center; gap: 10px; }
.logo-box   { width: 36px; height: 36px; border-radius: 10px; background: var(--blue); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 18px; }
.logo-name  { font-size: 15px; font-weight: 800; color: var(--text); letter-spacing: -.3px; }
.logo-sub   { font-size: 10px; color: var(--yellow); font-weight: 700; letter-spacing: .4px; margin-top: -2px; }
.role-pill  { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; margin-top: 10px; }

/* ── Navigation ── */
nav          { flex: 1; padding: 8px 10px; }
.nav-btn     { width: 100%; display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 8px; margin-bottom: 2px; background: transparent; border: none; color: var(--text2); transition: all .15s; text-align: left; font-size: 13px; font-weight: 500; text-decoration: none; }
.nav-btn:hover { background: var(--hover); color: var(--text); }
.nav-btn.active { background: rgba(27,79,216,.1); color: var(--blue); font-weight: 700; }
.nav-icon    { font-size: 17px; flex-shrink: 0; width: 20px; text-align: center; }
.nav-badge   { margin-left: auto; background: var(--red); color: #fff; border-radius: 10px; font-size: 10px; font-weight: 700; padding: 1px 6px; }
.sidebar-bottom { padding: 12px; border-top: 1px solid var(--border); }

/* ── Badge ── */
.badge    { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.b-blue   { background: var(--blue-l);   color: var(--blue); }
.b-green  { background: var(--green-l);  color: #065F46; }
.b-red    { background: var(--red-l);    color: #991B1B; }
.b-yellow { background: var(--yellow-l); color: #92400E; }
.b-purple { background: var(--purple-l); color: #5B21B6; }
.b-gray   { background: var(--g100);     color: var(--g600); }
.b-orange { background: var(--orange-l); color: #9A3412; }
body.dark .b-blue   { background: rgba(27,79,216,.2);    color: #93C5FD; }
body.dark .b-green  { background: rgba(16,185,129,.15);  color: #6EE7B7; }
body.dark .b-red    { background: rgba(239,68,68,.15);   color: #FCA5A5; }
body.dark .b-yellow { background: rgba(245,197,24,.15);  color: #FDE68A; }
body.dark .b-purple { background: rgba(139,92,246,.15);  color: #C4B5FD; }
body.dark .b-gray   { background: rgba(255,255,255,.08); color: var(--text2); }
body.dark .b-orange { background: rgba(249,115,22,.15);  color: #FDBA74; }

/* ── Avatar ── */
.av { border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; flex-shrink: 0; }

/* ── Card ── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; }

/* ── Stat Card ── */
.stat-card   { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; }
.stat-label  { font-size: 12px; color: var(--text2); font-weight: 500; margin-bottom: 10px; }
.stat-row    { display: flex; align-items: center; justify-content: space-between; }
.stat-val    { font-size: 26px; font-weight: 800; color: var(--text); letter-spacing: -1px; }
.stat-icon   { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.stat-sub    { font-size: 12px; margin-top: 6px; font-weight: 500; }
.t-green     { color: var(--green); }
.t-red       { color: var(--red); }
.t-muted     { color: var(--text2); }

/* ── Grid helpers ── */
.g4  { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 16px; }
.g3  { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-bottom: 16px; }
.g2  { display: grid; grid-template-columns: 1fr 1fr;      gap: 14px; margin-bottom: 16px; }
.g23 { display: grid; grid-template-columns: 2fr 1fr;      gap: 14px; margin-bottom: 16px; }

/* ── Mini Bar Chart ── */
.bars       { display: flex; align-items: flex-end; gap: 5px; height: 80px; }
.bar        { flex: 1; border-radius: 3px 3px 0 0; min-height: 3px; transition: height .3s; }
.bar-labels { display: flex; justify-content: space-between; margin-top: 5px; }
.bar-labels span { font-size: 9px; color: var(--text3); }

/* ── Progress Bar ── */
.prog      { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.prog-fill { height: 6px; border-radius: 3px; }

/* ── Toggle ── */
.tog     { width: 36px; height: 19px; border-radius: 10px; border: none; position: relative; flex-shrink: 0; transition: background .2s; }
.tog-dot { width: 13px; height: 13px; background: #fff; border-radius: 50%; position: absolute; top: 3px; transition: left .2s; }

/* ── Table ── */
.tbl    { width: 100%; border-collapse: collapse; }
.tbl th { padding: 10px 14px; font-size: 11px; font-weight: 700; color: var(--text2); text-align: left; text-transform: uppercase; letter-spacing: .5px; background: var(--table-head); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text); }
.tbl tr:hover td { background: var(--hover); }

/* ── Buttons ── */
.btn       { padding: 8px 16px; border-radius: 8px; border: none; font-size: 13px; font-weight: 600; transition: all .15s; }
.btn-blue  { background: var(--blue); color: #fff; }
.btn-blue:hover { background: var(--blue-d); }
.btn-ghost { background: var(--input-bg); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--border); }
.btn-sm    { padding: 4px 10px; font-size: 11px; border-radius: 6px; }
.btn-red   { background: var(--red-l); color: var(--red); border: none; }

/* ── Input ── */
.inp         { width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: 13px; outline: none; transition: border-color .15s; }
.inp:focus   { border-color: var(--blue); }
body.dark .inp { background: var(--input-bg); }
.search-box  { display: flex; align-items: center; gap: 8px; background: var(--input-bg); border-radius: 8px; padding: 8px 12px; }
.search-box input { background: none; border: none; outline: none; font-size: 13px; color: var(--text); flex: 1; }

/* ── Screen Header ── */
.sh        { margin-bottom: 20px; }
.sh-row    { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.screen-title { font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: -.5px; }
.screen-sub   { font-size: 13px; color: var(--text2); margin-top: 3px; }

/* ── Topbar buttons ── */
.tb-btn-role { padding: 6px 14px; border-radius: 8px; background: var(--blue-l); color: var(--blue); border: none; font-size: 12px; font-weight: 600; }
.tb-btn-dark { padding: 6px 12px; border-radius: 8px; background: var(--input-bg); color: var(--text); border: 1px solid var(--border); font-size: 12px; font-weight: 500; }
