/* ═══════════════════════════════════════
   LeadGare — Shared Design System v3
   ═══════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500&display=swap');

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

:root {
  --shell: #e6e3dd;
  --bg: #f4f2ef;
  --surface: #fff;
  --s2: #f0eeeb;
  --s3: #e8e5e0;
  --border: #e0ddd8;
  --b2: #d0cdc8;
  --text: #1a1a1c;
  --t2: #5c5a56;
  --t3: #98958f;
  --t4: #bbb9b2;
  --green: #1a8a4a;
  --gbg: #e6f4ed;
  --amber: #b06020;
  --abg: #fdf0e4;
  --red: #b81c1c;
  --rbg: #fde8e8;
  --blue: #1d55b8;
  --bbg: #e8eefb;
  --purple: #6b21a8;
  --pbg: #f3e8ff;
  --r: 10px;
  --rsm: 7px;
  --sh: 0 1px 2px rgba(0,0,0,.04), 0 0 0 1px rgba(0,0,0,.04);
  --shm: 0 4px 14px rgba(0,0,0,.09), 0 1px 3px rgba(0,0,0,.05);
}

body {
  font-family: 'Geist', sans-serif;
  background: var(--shell);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--b2); border-radius: 3px; }

/* ─── ANIMATIONS ─── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* ─── SHARED BUTTONS ─── */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 13px; border-radius: var(--rsm);
  font-size: 12.5px; font-weight: 500;
  font-family: 'Geist', sans-serif; cursor: pointer;
  border: 1px solid var(--border); background: var(--s2);
  color: var(--t2); transition: all .12s; text-decoration: none;
}
.btn:hover { background: var(--s3); color: var(--text); }
.btn.primary { background: var(--text); color: #fff; border-color: var(--text); }
.btn.primary:hover { opacity: .84; }
.btn.danger { background: var(--rbg); color: var(--red); border-color: #fca5a5; }
.btn.danger:hover { background: #fee2e2; }
.btn.success { background: var(--gbg); color: var(--green); border-color: #a8d8bc; }
.btn.sm { font-size: 11.5px; padding: 5px 10px; }

/* ─── SHARED PILLS ─── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 500; white-space: nowrap;
}
.pill::before { content: ''; width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.p-call   { background: #f0f0ee; color: var(--t2);   } .p-call::before   { background: var(--t2); }
.p-form   { background: var(--bbg); color: var(--blue);  } .p-form::before   { background: var(--blue); }
.p-chat   { background: var(--abg); color: var(--amber); } .p-chat::before   { background: var(--amber); }
.p-new      { background: var(--bbg); color: var(--blue); } .p-new::before { background: var(--blue); }
.p-retained { background: var(--gbg); color: var(--green); } .p-retained::before { background: var(--green); }
.p-reviewing{ background: var(--abg); color: var(--amber); } .p-reviewing::before { background: var(--amber); }
.p-rejected { background: var(--rbg); color: var(--red);  } .p-rejected::before { background: var(--red); }
.p-success  { background: var(--gbg); color: var(--green); } .p-success::before { background: var(--green); }
.p-error    { background: var(--rbg); color: var(--red);  } .p-error::before { background: var(--red); }

/* ─── SHARED TOGGLE ─── */
.toggle {
  width: 36px; height: 20px; border-radius: 12px;
  background: var(--b2); position: relative; cursor: pointer;
  flex-shrink: 0; transition: background .18s;
}
.toggle::after {
  content: ''; width: 14px; height: 14px; background: #fff;
  border-radius: 50%; position: absolute; left: 3px; top: 3px;
  transition: left .18s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle.on { background: var(--text); }
.toggle.on::after { left: 19px; }
.toggle.green.on { background: var(--green); }

/* ─── SHARED CARD ─── */
.card {
  background: var(--surface); border-radius: var(--r);
  box-shadow: var(--sh); overflow: hidden;
}
.card-head {
  padding: 12px 16px 10px; display: flex; align-items: center;
  gap: 6px; border-bottom: 1px solid var(--border);
}
.card-ttl {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--t3);
}
.card-tip {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1px solid var(--b2); display: flex;
  align-items: center; justify-content: center;
  font-size: 9px; color: var(--t3); cursor: help;
}
.card-more {
  margin-left: auto; width: 26px; height: 26px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px; color: var(--t3);
  letter-spacing: 1px; transition: background .12s;
}
.card-more:hover { background: var(--s2); color: var(--text); }
.card-body { padding: 14px 16px; }

/* ─── SHARED TABLE CARD ─── */
.tcard { background: var(--surface); border-radius: var(--r); box-shadow: var(--sh); overflow: hidden; }
.thead-row { display: flex; align-items: center; gap: 9px; padding: 11px 15px; border-bottom: 1px solid var(--border); }
.ttl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--t3); display: flex; align-items: center; gap: 5px; }
.tsearch { display: flex; align-items: center; gap: 6px; padding: 5px 10px; background: var(--s2); border: 1px solid var(--border); border-radius: var(--rsm); font-size: 12px; color: var(--t3); }
.tsearch input { border: none; background: transparent; font-family: 'Geist', sans-serif; font-size: 12px; color: var(--text); outline: none; width: 150px; }
.tsearch input::placeholder { color: var(--t3); }
.twrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 7px 13px; text-align: left;
  font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--t3);
  border-bottom: 1px solid var(--border); background: var(--s2);
  white-space: nowrap; user-select: none;
}
thead th:first-child { padding-left: 15px; }
thead th:last-child { padding-right: 15px; }
.thsort { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.thsort:hover { color: var(--t2); }
.sico { font-size: 8.5px; opacity: .45; }
tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; cursor: pointer; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--s2); }
tbody td { padding: 10px 13px; font-size: 12.5px; vertical-align: middle; }
tbody td:first-child { padding-left: 15px; }
tbody td:last-child { padding-right: 15px; }
.td-id { font-family: 'Geist Mono', monospace; font-size: 11px; color: var(--t3); }
.td-name { font-weight: 500; }
.td-sub { font-size: 10.5px; color: var(--t3); margin-top: 1px; }
.td-time { font-size: 11px; color: var(--t3); font-family: 'Geist Mono', monospace; white-space: nowrap; }
.tfoot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 15px; border-top: 1px solid var(--border);
  background: var(--s2); font-size: 11px; color: var(--t3);
}
.pag { display: flex; gap: 2px; }
.pgb {
  width: 27px; height: 27px; border-radius: 5px;
  border: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; cursor: pointer; color: var(--t2);
  font-family: 'Geist', sans-serif; transition: all .12s;
}
.pgb:hover { background: var(--s3); }
.pgb.active { background: var(--text); color: #fff; border-color: var(--text); }

/* ─── STAT CARDS ─── */
.stats-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 9px; flex-shrink: 0; }
.scard {
  background: var(--surface); border-radius: var(--r); box-shadow: var(--sh);
  padding: 15px 17px 13px; transition: box-shadow .15s; animation: fadeUp .3s ease both;
}
.scard:hover { box-shadow: var(--shm); }
.scard:nth-child(1) { animation-delay: .04s; } .scard:nth-child(2) { animation-delay: .08s; }
.scard:nth-child(3) { animation-delay: .12s; } .scard:nth-child(4) { animation-delay: .16s; }
.sc-lbl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--t3); margin-bottom: 6px; }
.sc-top { display: flex; align-items: flex-start; justify-content: space-between; }
.sc-val { font-size: 28px; font-weight: 600; letter-spacing: -1px; font-family: 'Geist Mono', monospace; line-height: 1; }
.sc-unit { font-size: 12px; font-weight: 400; color: var(--t3); font-family: 'Geist', sans-serif; margin-left: 3px; }
.sparkline { display: flex; align-items: flex-end; gap: 2px; height: 34px; margin-top: 2px; }
.spark-b { width: 4px; border-radius: 2px 2px 0 0; flex-shrink: 0; background: var(--b2); }
.spark-b.hi { background: var(--text); } .spark-b.mid { background: #aaa9a3; }
.sc-bot { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; padding-top: 9px; border-top: 1px solid var(--border); }
.sc-chg { font-size: 11.5px; font-weight: 600; display: flex; align-items: center; gap: 2px; }
.sc-chg.up { color: var(--green); } .sc-chg.down { color: var(--red); } .sc-chg.neu { color: var(--t3); }
.sc-sub { font-size: 11px; color: var(--t3); }

/* ─── FORM INPUTS ─── */
.form-input {
  width: 100%; font-family: 'Geist', sans-serif; font-size: 13px;
  padding: 8px 11px; border: 1px solid var(--border);
  border-radius: var(--rsm); background: var(--s2);
  color: var(--text); outline: none; transition: border-color .12s;
}
.form-input:focus { border-color: var(--text); }
.form-label { font-size: 11.5px; font-weight: 600; color: var(--t2); margin-bottom: 5px; display: block; }
.form-hint { font-size: 11px; color: var(--t3); margin-top: 4px; }
.form-row { margin-bottom: 14px; }

/* ─── CRM TAGS ─── */
.crm-tags { display: flex; gap: 3px; flex-wrap: wrap; }
.crm-tag { font-size: 10px; padding: 2px 6px; border-radius: 4px; border: 1px solid var(--b2); color: var(--t3); background: var(--s2); font-family: 'Geist Mono', monospace; }
.crm-tag.ok { background: var(--gbg); border-color: #a8d8bc; color: var(--green); }

/* ─── CHECKBOX ─── */
.cb { width: 14px; height: 14px; border-radius: 3px; border: 1.5px solid var(--b2); cursor: pointer; appearance: none; background: var(--surface); transition: all .12s; }
.cb:checked { background: var(--text); border-color: var(--text); }

/* ─── ROW MORE BUTTON ─── */
.row-more { width: 26px; height: 26px; border-radius: 5px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 13px; color: var(--t4); letter-spacing: 1px; transition: all .12s; }
.row-more:hover { background: var(--s3); color: var(--t2); }

/* ─── SOURCE BARS ─── */
.sr { display: flex; align-items: center; gap: 8px; }
.sr-name { font-size: 11px; color: var(--t2); width: 80px; flex-shrink: 0; }
.sr-track { flex: 1; height: 5px; background: var(--s2); border-radius: 3px; overflow: hidden; }
.sr-fill { height: 100%; border-radius: 3px; background: var(--text); transition: width .6s ease; }
.sr-val { font-size: 11px; font-weight: 600; font-family: 'Geist Mono', monospace; width: 26px; text-align: right; }

/* ─── NOTE BANNERS ─── */
.note { display: flex; gap: 10px; padding: 11px 14px; border-radius: var(--rsm); font-size: 12px; line-height: 1.5; margin-bottom: 12px; }
.note.info  { background: var(--bbg); border: 1px solid #bfdbfe; color: #1e3a8a; }
.note.warn  { background: var(--abg); border: 1px solid #fcd34d; color: #78350f; }
.note.success { background: var(--gbg); border: 1px solid #a8d8bc; color: #14532d; }
.note-icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }

/* ─── LOADING ─── */
.spinner { width: 18px; height: 18px; border: 2px solid var(--b2); border-top-color: var(--text); border-radius: 50%; animation: spin .7s linear infinite; }

/* ─── AUTH GUARD ─── */
.auth-redirect { display: none; }
