/* ============================================================
   LEARNOVA CRM — styles
   ============================================================ */
:root {
  --primary: #252a5c;          /* Learnova logo navy */
  --primary-light: #2a5ba8;
  --accent: #f5a81c;           /* Learnova logo yellow */
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #22293a;
  --muted: #7a8299;
  --border: #e3e7ef;
  --green: #1e9e5a;
  --red: #d64545;
  --orange: #e08a00;
  --purple: #7b5cc9;
  --radius: 10px;
  --shadow: 0 1px 4px rgba(20, 40, 80, .08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--primary-light); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); }
.login-card { background: var(--card); border-radius: 14px; padding: 40px 36px; width: 360px; box-shadow: 0 10px 40px rgba(0,0,0,.25); text-align: center; }
.login-card h1 { color: var(--primary); font-size: 26px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); margin-bottom: 24px; }
.login-card form { text-align: left; }
.login-logo { width: 110px; height: 110px; object-fit: cover; border-radius: 18px; margin: 0 auto 14px; display: block; box-shadow: 0 4px 14px rgba(37,42,92,.35); }
.crm-tag { font-size: 14px; font-weight: 700; color: var(--muted); letter-spacing: 1px; vertical-align: middle; }

/* ---------- Layout ---------- */
.app { display: none; min-height: 100vh; }
.app.active { display: flex; }
.sidebar { width: 220px; background: var(--primary); color: #fff; display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; }
.sidebar .brand { padding: 16px 18px; font-size: 19px; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,.15); display: flex; align-items: center; gap: 10px; }
.sidebar .brand .txt span { color: var(--accent); }
.sidebar .brand .crm-tag { color: rgba(255,255,255,.55); font-size: 11px; letter-spacing: 1px; }
.brand-logo { width: 38px; height: 38px; object-fit: cover; border-radius: 9px; flex: none; }
.sidebar nav { flex: 1; padding: 12px 0; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 12px 18px; color: rgba(255,255,255,.82); text-decoration: none; font-size: 14.5px; border-left: 3px solid transparent; }
.sidebar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar nav a.active { background: rgba(255,255,255,.13); color: #fff; border-left-color: var(--accent); }
.sidebar .userbox { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.15); font-size: 13px; }
.sidebar .userbox .name { font-weight: 600; }
.sidebar .userbox .role { color: rgba(255,255,255,.6); text-transform: capitalize; }
.sidebar .userbox button { margin-top: 8px; width: 100%; }

.main { flex: 1; margin-left: 220px; padding: 24px 28px; }
.page-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.page-title h2 { font-size: 22px; color: var(--primary); }

/* ---------- Cards / stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); border-top: 3px solid var(--primary-light); }
.stat .num { font-size: 26px; font-weight: 700; color: var(--primary); }
.stat .lbl { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stat.green { border-top-color: var(--green); } .stat.green .num { color: var(--green); }
.stat.orange { border-top-color: var(--orange); } .stat.orange .num { color: var(--orange); }
.stat.red { border-top-color: var(--red); } .stat.red .num { color: var(--red); }
.stat.purple { border-top-color: var(--purple); } .stat.purple .num { color: var(--purple); }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.card h3 { font-size: 15px; color: var(--primary); margin-bottom: 12px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1000px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 9px 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); border-bottom: 2px solid var(--border); }
td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: #f8fafd; }
td .link { cursor: pointer; color: var(--primary-light); font-weight: 600; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.b-blue   { background: #e3ecfa; color: #1a4f9e; }
.b-green  { background: #dff3e7; color: #157347; }
.b-orange { background: #fdf0d8; color: #a36a00; }
.b-red    { background: #fbe3e3; color: #b52f2f; }
.b-gray   { background: #ebedf2; color: #5a6172; }
.b-purple { background: #ede7fb; color: #5c3fa8; }

/* ---------- Forms ---------- */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 12px 0 4px; }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 7px; font-size: 14px; font-family: inherit; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(42,91,168,.12); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- Buttons ---------- */
button, .btn { cursor: pointer; border: none; border-radius: 7px; padding: 9px 16px; font-size: 13.5px; font-weight: 600; font-family: inherit; background: var(--primary-light); color: #fff; }
button:hover, .btn:hover { filter: brightness(1.08); }
button:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-outline { background: #fff; color: var(--primary-light); border: 1px solid var(--primary-light); }
.btn-green { background: var(--green); }
.btn-red { background: var(--red); }
.btn-gray { background: #6a7186; }
.btn-accent { background: var(--accent); color: #3a2b00; }

/* ---------- Filter bar ---------- */
.filter-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.filter-bar input, .filter-bar select { width: auto; min-width: 160px; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,25,50,.5); display: none; align-items: flex-start; justify-content: center; z-index: 100; overflow-y: auto; padding: 40px 16px; }
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: 12px; width: 640px; max-width: 100%; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { width: 860px; }
.modal h3 { color: var(--primary); margin-bottom: 6px; font-size: 18px; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------- Toast ---------- */
#toast { position: fixed; bottom: 24px; right: 24px; background: var(--text); color: #fff; padding: 12px 20px; border-radius: 8px; display: none; z-index: 200; box-shadow: 0 6px 24px rgba(0,0,0,.3); max-width: 380px; }
#toast.error { background: var(--red); }
#toast.show { display: block; animation: slideup .25s ease; }
@keyframes slideup { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Misc ---------- */
.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 30px 0; }
.timeline { list-style: none; }
.timeline li { padding: 8px 0 8px 18px; border-left: 2px solid var(--border); position: relative; font-size: 13px; }
.timeline li::before { content: ''; position: absolute; left: -5px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary-light); }
.copy-box { background: #f4f6fa; border: 1px dashed var(--border); border-radius: 8px; padding: 12px; font-family: Consolas, monospace; font-size: 13px; white-space: pre-wrap; margin: 10px 0; }
.loading { text-align: center; padding: 40px; color: var(--muted); }
.pill-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.pill-tabs button { background: #fff; color: var(--muted); border: 1px solid var(--border); }
.pill-tabs button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Demo week calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.cal-head .range { font-weight: 700; color: var(--primary); min-width: 210px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-day { background: var(--card); border: 1px solid var(--border); border-radius: 8px; min-height: 120px; padding: 8px; }
.cal-day.today { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(245,166,35,.25); }
.cal-day .d-head { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; margin-bottom: 6px; }
.cal-day.today .d-head { color: var(--orange); }
.cal-chip { display: block; background: #e3ecfa; border-left: 3px solid var(--primary-light); border-radius: 5px; padding: 5px 7px; font-size: 11.5px; margin-bottom: 5px; cursor: pointer; line-height: 1.35; }
.cal-chip:hover { filter: brightness(.96); }
.cal-chip.s-Attended { background: #dff3e7; border-left-color: var(--green); }
.cal-chip.s-Confirmed { background: #fdf0d8; border-left-color: var(--orange); }
.cal-chip.s-Cancelled, .cal-chip.s-NoShow { background: #ebedf2; border-left-color: #9aa1b3; opacity: .7; }
.cal-chip b { display: block; }
@media (max-width: 900px) { .cal-grid { grid-template-columns: 1fr 1fr; } }

/* ---------- Lead pipeline stepper ---------- */
.pipe { display: flex; align-items: center; margin: 14px 0 6px; overflow-x: auto; padding: 4px 2px; }
.pipe-step { display: flex; flex-direction: column; align-items: center; gap: 5px; flex: none; min-width: 62px; }
.pipe-dot { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; border: 2px solid var(--border); background: #fff; color: var(--muted); }
.pipe-lbl { font-size: 11px; font-weight: 600; color: var(--muted); text-align: center; line-height: 1.1; }
.pipe-line { flex: 1; height: 3px; background: var(--border); min-width: 14px; border-radius: 2px; margin-bottom: 20px; }
.pipe-step.done .pipe-dot { background: var(--green); border-color: var(--green); color: #fff; }
.pipe-step.done .pipe-lbl { color: var(--green); }
.pipe-step.now .pipe-dot { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 0 0 4px rgba(37,42,92,.15); transform: scale(1.12); }
.pipe-step.now .pipe-lbl { color: var(--primary); font-weight: 700; }
.pipe-exit { border-radius: 8px; padding: 10px 14px; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
.pipe-exit-red { background: #fbe3e3; color: #b52f2f; }
.pipe-exit-purple { background: #ede7fb; color: #5c3fa8; }

/* ---------- Target progress ---------- */
.tprog { background: var(--border); border-radius: 20px; height: 14px; overflow: hidden; margin: 6px 0 2px; }
.tprog-bar { height: 100%; border-radius: 20px; transition: width .4s ease; }

/* ---------- Import preview ---------- */
.import-preview { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.import-preview table { font-size: 12.5px; }
.row-bad td { background: #fbe3e3 !important; }

/* ---------- Card header w/ actions ---------- */
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-head h3 { margin-bottom: 0; }

@media (max-width: 800px) {
  .sidebar { width: 64px; }
  .sidebar .brand { font-size: 13px; padding: 12px 8px; justify-content: center; }
  .sidebar .brand .txt, .sidebar nav a .txt, .sidebar .userbox { display: none; }
  .brand-logo { width: 34px; height: 34px; }
  .main { margin-left: 64px; padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
}
