/* AE SYSTEMS CRM — LIGHT CORPORATE THEME */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg:        #f4f6f9;
  --surface:   #ffffff;
  --surface2:  #f9fafb;
  --surface3:  #f0f2f5;
  --border:    #e5e7eb;
  --border2:   #d1d5db;
  --teal:      #00a885;
  --teal-lt:   #e6f7f4;
  --teal-md:   rgba(0,168,133,0.15);
  --amber:     #d97706;
  --amber-lt:  #fef3c7;
  --red:       #dc2626;
  --red-lt:    #fee2e2;
  --blue:      #2563eb;
  --blue-lt:   #dbeafe;
  --purple:    #7c3aed;
  --purple-lt: #ede9fe;
  --green:     #059669;
  --green-lt:  #d1fae5;
  --text:      #111827;
  --text2:     #374151;
  --text3:     #6b7280;
  --text4:     #9ca3af;
  --font-head: 'Plus Jakarta Sans', sans-serif;
  --font-body: 'Inter', sans-serif;
  --radius:    10px;
  --radius-sm: 6px;
  --shadow:    0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.10);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ── LOGIN ── */
.login-screen {
  min-height: 100vh;
  display: flex;
  background: #fff;
}
.login-left {
  flex: 1;
  background: linear-gradient(145deg, #003d2e 0%, #006652 55%, #00a885 100%);
  display: flex; flex-direction: column;
  align-items: flex-start; justify-content: center;
  padding: 64px;
  position: relative; overflow: hidden;
}
.login-left::before {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(circle at 80% 20%, rgba(255,255,255,0.05) 0%, transparent 50%),
                    radial-gradient(circle at 20% 80%, rgba(255,255,255,0.03) 0%, transparent 40%);
}
.login-brand { position: relative; z-index: 1; }
.login-brand-name {
  font-family: var(--font-head); font-size: 38px; font-weight: 800;
  color: #fff; letter-spacing: -0.5px; margin-bottom: 6px;
}
.login-brand-tag {
  font-size: 11px; color: rgba(255,255,255,0.55);
  letter-spacing: 3px; text-transform: uppercase; font-weight: 500;
  margin-bottom: 52px;
}
.login-feature {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; position: relative; z-index: 1;
}
.login-feature-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.45); flex-shrink: 0;
}
.login-feature-text { font-size: 14px; color: rgba(255,255,255,0.7); }
.login-iit {
  margin-top: 52px; padding: 12px 16px;
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius); display: inline-flex; align-items: center; gap: 10px;
  position: relative; z-index: 1;
}
.login-iit-text { font-size: 12px; color: rgba(255,255,255,0.75); font-weight: 500; }
.login-right {
  width: 420px; min-width: 420px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px 44px;
}
.login-form-logo {
  font-family: var(--font-head); font-size: 20px; font-weight: 800;
  color: var(--teal); margin-bottom: 4px;
}
.login-form-title {
  font-family: var(--font-head); font-size: 22px; font-weight: 700;
  color: var(--text); margin-bottom: 6px; text-align: center;
}
.login-form-sub { font-size: 13px; color: var(--text3); margin-bottom: 32px; text-align: center; line-height: 1.6; }
.login-divider { width: 100%; height: 1px; background: var(--border); margin: 24px 0; }
.login-google-wrap { width: 100%; display: flex; justify-content: center; margin-bottom: 6px; }
.login-note { font-size: 12px; color: var(--text4); text-align: center; margin-top: 14px; line-height: 1.6; }
.login-error {
  width: 100%; background: var(--red-lt); border: 1px solid #fca5a5;
  color: var(--red); padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: 14px; display: none;
}

/* ── LAYOUT ── */
.app { display: flex; height: 100vh; overflow: hidden; }
.hidden { display: none !important; }

/* ── SIDEBAR ── */
.sidebar {
  width: 220px; min-width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar-logo { padding: 20px 18px 16px; border-bottom: 1px solid var(--border); }
.sidebar-logo .brand { font-family: var(--font-head); font-size: 16px; font-weight: 800; color: var(--teal); }
.sidebar-logo .tagline { font-size: 9px; color: var(--text4); font-weight: 500; letter-spacing: 1px; text-transform: uppercase; margin-top: 2px; }
.sidebar-user { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 9px; }
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--teal-lt); border: 2px solid var(--teal-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--teal); flex-shrink: 0; overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 10px; color: var(--text4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-section { padding: 14px 10px 6px; }
.sidebar-section-label { font-size: 9px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text4); padding: 0 8px; margin-bottom: 4px; }
.nav-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; color: var(--text3); cursor: pointer; transition: all .15s; margin-bottom: 1px; }
.nav-item:hover { background: var(--surface2); color: var(--text2); }
.nav-item.active { background: var(--teal-lt); color: var(--teal); font-weight: 600; }
.nav-icon { font-size: 13px; width: 16px; text-align: center; }
.nav-count { margin-left: auto; background: var(--surface3); color: var(--text4); font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 20px; }
.nav-item.active .nav-count { background: var(--teal-md); color: var(--teal); }
.sidebar-footer { margin-top: auto; padding: 12px 14px; border-top: 1px solid var(--border); }
.btn-signout { width: 100%; padding: 7px; background: transparent; border: 1px solid var(--border2); border-radius: var(--radius-sm); color: var(--text3); font-size: 12px; font-weight: 500; cursor: pointer; transition: all .15s; font-family: var(--font-body); }
.btn-signout:hover { border-color: var(--red); color: var(--red); background: var(--red-lt); }

/* ── MAIN ── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px 24px; display: flex; align-items: center; gap: 10px; flex-shrink: 0; box-shadow: var(--shadow); }
.topbar-title { font-family: var(--font-head); font-size: 16px; font-weight: 700; color: var(--text); flex: 1; }
.topbar-title span { color: var(--teal); }
.content { flex: 1; overflow-y: auto; padding: 22px 24px; }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-sm); font-family: var(--font-body); font-size: 13px; font-weight: 600; border: none; cursor: pointer; transition: all .15s; white-space: nowrap; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: #008f71; }
.btn-ghost { background: var(--surface); color: var(--text2); border: 1px solid var(--border2); }
.btn-ghost:hover { border-color: var(--teal); color: var(--teal); background: var(--teal-lt); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-danger { background: var(--red-lt); color: var(--red); border: 1px solid #fca5a5; }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-ai { background: var(--purple-lt); color: var(--purple); border: 1px solid #c4b5fd; }
.btn-ai:hover { background: var(--purple); color: #fff; }

/* ── STATS ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat-card::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px; }
.stat-card.c-teal::after  { background: var(--teal); }
.stat-card.c-amber::after { background: var(--amber); }
.stat-card.c-blue::after  { background: var(--blue); }
.stat-card.c-purple::after{ background: var(--purple); }
.stat-label { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 10px; }
.stat-value { font-family: var(--font-head); font-size: 28px; font-weight: 800; line-height: 1; }
.stat-card.c-teal   .stat-value { color: var(--teal); }
.stat-card.c-amber  .stat-value { color: var(--amber); }
.stat-card.c-blue   .stat-value { color: var(--blue); }
.stat-card.c-purple .stat-value { color: var(--purple); }
.stat-sub { font-size: 11px; color: var(--text4); margin-top: 6px; }

/* ── PIPELINE ── */
.pipeline-wrap { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.pipeline-col { min-width: 236px; max-width: 252px; flex-shrink: 0; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; }
.pipeline-col-head { padding: 11px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 7px; background: var(--surface); border-radius: var(--radius) var(--radius) 0 0; }
.stage-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.stage-name-label { font-family: var(--font-head); font-size: 11px; font-weight: 700; color: var(--text2); flex: 1; text-transform: uppercase; letter-spacing: 0.5px; }
.stage-count { background: var(--surface3); color: var(--text3); font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 20px; }
.pipeline-col-body { padding: 8px; flex: 1; display: flex; flex-direction: column; gap: 7px; min-height: 80px; }
.lead-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 13px; cursor: pointer; transition: all .15s; box-shadow: var(--shadow); }
.lead-card:hover { border-color: var(--teal); box-shadow: 0 4px 12px rgba(0,168,133,0.1); transform: translateY(-1px); }
.lead-name { font-family: var(--font-head); font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.lead-company { font-size: 11px; color: var(--text3); margin-bottom: 7px; }
.lead-meta { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.lead-owner { font-size: 10px; color: var(--text4); margin-top: 5px; }

/* ── TAGS ── */
.tag { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.3px; }
.badge-stage { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 20px; border: 1px solid; }

/* ── TABLE ── */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
thead th { padding: 11px 16px; text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text3); background: var(--surface2); border-bottom: 1px solid var(--border); }
tbody tr { border-bottom: 1px solid var(--border); cursor: pointer; transition: background .1s; }
tbody tr:hover { background: #f0faf8; }
tbody tr:last-child { border-bottom: none; }
td { padding: 11px 16px; font-size: 13px; color: var(--text2); }
td.primary { color: var(--text); font-weight: 600; }

/* ── FILTERS ── */
.filters-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filter-chip { padding: 5px 13px; border-radius: 20px; font-size: 12px; font-weight: 500; border: 1px solid var(--border2); color: var(--text3); cursor: pointer; background: var(--surface); transition: all .15s; }
.filter-chip:hover { border-color: var(--teal); color: var(--teal); }
.filter-chip.active { background: var(--teal-lt); color: var(--teal); border-color: var(--teal); font-weight: 600; }
.view-toggle { display: flex; gap: 2px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; }
.view-btn { padding: 4px 12px; border-radius: 4px; font-size: 12px; font-weight: 500; cursor: pointer; color: var(--text3); transition: all .15s; }
.view-btn.active { background: var(--surface); color: var(--teal); font-weight: 600; box-shadow: var(--shadow); }

/* ── MODAL ── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.3); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; backdrop-filter: blur(2px); }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; width: 100%; max-width: 580px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-wide { max-width: 740px; }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.modal-title { font-family: var(--font-head); font-size: 16px; font-weight: 700; color: var(--text); flex: 1; }
.modal-close { width: 26px; height: 26px; background: var(--surface2); border: 1px solid var(--border); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text3); font-size: 13px; transition: all .15s; }
.modal-close:hover { background: var(--red-lt); color: var(--red); border-color: #fca5a5; }
.modal-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 13px; }
.modal-footer { padding: 13px 22px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; justify-content: flex-end; background: var(--surface2); border-radius: 0 0 12px 12px; }

/* ── FORMS ── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.7px; }
input, select, textarea { background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 9px 11px; font-family: var(--font-body); font-size: 13px; color: var(--text); transition: border .15s, box-shadow .15s; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(0,168,133,0.1); }
textarea { resize: vertical; min-height: 80px; }
select option { background: #fff; color: var(--text); }

/* ── SETTINGS ── */
.settings-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; box-shadow: var(--shadow); }
.settings-head { padding: 13px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; background: var(--surface2); }
.settings-head-title { font-family: var(--font-head); font-size: 13px; font-weight: 700; color: var(--text); }
.settings-body { padding: 13px 16px; display: flex; flex-direction: column; gap: 8px; }
.settings-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.item-color { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.item-name { flex: 1; font-size: 13px; font-weight: 500; color: var(--text); }
.item-actions { display: flex; gap: 5px; }

/* ── AI PANEL ── */
.ai-output { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px; font-size: 13px; line-height: 1.7; color: var(--text2); min-height: 120px; white-space: pre-wrap; word-break: break-word; }
.ai-output.loading { color: var(--text4); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ── COLOR SWATCHES ── */
.color-options { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.color-swatch { width: 22px; height: 22px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: all .15s; }
.color-swatch.selected { border-color: var(--text); transform: scale(1.15); }

/* ── DETAIL ── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-item { display: flex; flex-direction: column; gap: 3px; }
.detail-label { font-size: 10px; font-weight: 600; color: var(--text4); text-transform: uppercase; letter-spacing: 0.8px; }
.detail-value { font-size: 13px; color: var(--text); font-weight: 500; }
.detail-notes { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px; font-size: 13px; line-height: 1.6; color: var(--text2); }

/* ── MISC ── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text4); }
.empty-state .empty-icon { font-size: 30px; margin-bottom: 10px; }
.empty-state p { font-size: 13px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-header h2 { font-family: var(--font-head); font-size: 17px; font-weight: 700; color: var(--text); }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--text); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; z-index: 9999; opacity: 0; transition: opacity .2s; pointer-events: none; box-shadow: var(--shadow-md); }
.toast.show { opacity: 1; }
.toast.success { background: var(--teal); }
.toast.error { background: var(--red); }
.spinner { display: inline-block; width: 13px; height: 13px; border: 2px solid var(--border2); border-top-color: var(--teal); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 10px; }
