/* ITmantras CRM — app.css */
/* Font: Syne (headings) + DM Sans (body) */

:root {
  --brand: #1e40af;
  --brand-light: #3b82f6;
  --brand-dark: #1e3a8a;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --warn: #f97316;
  --sidebar-w: 220px;
  --topbar-h: 56px;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-soft: #64748b;
  --text-muted: #94a3b8;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

h1,h2,h3,h4 { font-family: 'Syne', sans-serif; font-weight: 700; }

a { color: var(--brand-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== APP SHELL ===== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--brand-dark);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s ease;
}

.sidebar-head {
  padding: 22px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.brand {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}
.brand span { color: var(--accent); }
.brand-sub { font-size: 10px; color: rgba(255,255,255,.45); text-transform: uppercase; letter-spacing: 2px; }

.sidenav { flex: 1; overflow-y: auto; padding: 10px 0; }
.sidenav::-webkit-scrollbar { width: 3px; }
.sidenav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 3px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: rgba(255,255,255,.7);
  font-size: 13px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .15s;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(255,255,255,.12); color: #fff; border-left-color: var(--accent); font-weight: 600; }
.nav-icon { font-size: 16px; min-width: 20px; text-align: center; }
.nav-label { flex: 1; }

.sidebar-foot {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-chip { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.user-avatar {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; font-size: 14px; flex-shrink: 0;
}
.user-name { color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: rgba(255,255,255,.5); font-size: 11px; text-transform: capitalize; }
.logout-btn { color: rgba(255,255,255,.5); font-size: 18px; cursor: pointer; padding: 4px; transition: color .2s; background: none; border: none; }
.logout-btn:hover { color: var(--danger); text-decoration: none; }

/* ===== MAIN WRAP ===== */
.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== TOPBAR ===== */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.menu-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text); }
.page-title { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; color: var(--text); flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.notif-btn { position: relative; font-size: 20px; text-decoration: none; }
.notif-badge {
  position: absolute; top: -4px; right: -6px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 800;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.topbar-user { color: var(--text-soft); font-size: 13px; }

/* ===== PAGE BODY ===== */
.page-body { padding: 24px; flex: 1; }

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.card-title {
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== STAT CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon { font-size: 26px; }
.stat-value { font-family: 'Syne', sans-serif; font-size: 26px; font-weight: 800; color: var(--text); }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.stat-sub { font-size: 11px; color: var(--success); font-weight: 600; }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
thead tr { background: #f8fafc; }
th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 13px; }
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

/* ===== FORMS ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-grid.cols3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid.cols1 { grid-template-columns: 1fr; }
.form-row { margin-bottom: 16px; }
.form-row.span2 { grid-column: span 2; }
.form-row.span3 { grid-column: span 3; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--text-soft); margin-bottom: 5px; }
.req { color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], input[type=tel], input[type=url],
select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  transition: border-color .15s;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand-light); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
textarea { resize: vertical; min-height: 80px; }
select { cursor: pointer; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 7px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--brand-light); color: #fff; border-color: var(--brand-light); }
.btn-primary:hover { background: var(--brand); border-color: var(--brand); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-warn { background: var(--warn); color: #fff; border-color: var(--warn); }
.btn-outline { background: transparent; color: var(--brand-light); border-color: var(--brand-light); }
.btn-outline:hover { background: var(--brand-light); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-ghost { background: #f1f5f9; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: #e2e8f0; }

/* ===== FILTERS BAR ===== */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  background: var(--surface);
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.filters-bar select, .filters-bar input { width: auto; min-width: 140px; padding: 7px 10px; font-size: 12px; }
.filters-bar .btn { padding: 7px 14px; font-size: 12px; }

/* ===== FLASH ===== */
.flash {
  padding: 12px 16px;
  border-radius: 7px;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 500;
}

/* ===== PIPELINE STAGES ===== */
.pipeline {
  display: flex;
  gap: 0;
  margin: 20px 0;
  background: #f8fafc;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.pipeline-stage {
  flex: 1;
  padding: 14px 12px;
  text-align: center;
  border-right: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
}
.pipeline-stage:last-child { border-right: none; }
.pipeline-stage:hover { background: #eff6ff; }
.pipeline-stage.active { background: var(--brand-light); color: #fff; }
.ps-count { font-family: 'Syne', sans-serif; font-size: 22px; font-weight: 800; }
.ps-label { font-size: 11px; opacity: .8; text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ===== MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: 14px;
  padding: 28px;
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp .2s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-title { font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 800; margin-bottom: 20px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ===== DETAIL PAGE ===== */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.detail-group { margin-bottom: 14px; }
.detail-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.detail-value { font-size: 14px; color: var(--text); margin-top: 2px; font-weight: 500; }

/* ===== TIMELINE ===== */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-dot { position: absolute; left: -20px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand-light); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--brand-light); }
.timeline-content { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.timeline-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ===== ACTION BAR ===== */
.action-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.action-bar-left { display: flex; align-items: center; gap: 10px; }

/* ===== PRIORITY PILL ===== */
.prio-hot { color:#ef4444; background:#fef2f2; padding:2px 10px; border-radius:20px; font-size:11px; font-weight:700; }
.prio-warm { color:#f59e0b; background:#fffbeb; padding:2px 10px; border-radius:20px; font-size:11px; font-weight:700; }
.prio-cold { color:#3b82f6; background:#eff6ff; padding:2px 10px; border-radius:20px; font-size:11px; font-weight:700; }

/* ===== CHARTS PLACEHOLDER ===== */
.chart-wrap { min-height: 200px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); }

/* ===== LOGIN PAGE ===== */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 60%, #1e40af 100%); padding: 20px; }
.login-card { background: #fff; border-radius: 18px; padding: 44px 40px; max-width: 420px; width: 100%; box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.login-brand { font-family: 'Syne', sans-serif; font-size: 30px; font-weight: 800; color: #0f172a; }
.login-brand span { color: #3b82f6; }
.login-tagline { color: #94a3b8; font-size: 13px; margin-bottom: 32px; margin-top: 4px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .menu-toggle { display: block; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid.cols3 { grid-template-columns: 1fr; }
  .form-row.span2, .form-row.span3 { grid-column: span 1; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .pipeline { flex-wrap: wrap; }
  .action-bar { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .page-body { padding: 14px; }
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px 20px; }
}

/* ===== MISC ===== */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .es-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.flex { display: flex; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .items-center { align-items: center; }
.w-full { width: 100%; }
.tc-box { background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 16px; font-size: 13px; line-height: 1.7; max-height: 200px; overflow-y: auto; }
.otp-input { font-size: 24px; text-align: center; letter-spacing: 10px; font-weight: 800; }
