@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #0c0a09; --bg2: #141210; --card: #1a1816; --card-hover: #201e1b;
  --border: rgba(255,255,255,0.06); --border-h: rgba(255,255,255,0.12);
  --text: #fafaf9; --sub: #a8a29e; --muted: #57534e;
  --accent: #f97316; --accent-bg: rgba(249,115,22,0.08); --accent-border: rgba(249,115,22,0.2);
  --ig1: #833ab4; --ig2: #fd1d1d; --ig3: #fcb045;
  --green: #22c55e; --green-bg: rgba(34,197,94,0.08);
  --blue: #3b82f6; --blue-bg: rgba(59,130,246,0.08);
  --yellow: #f59e0b; --yellow-bg: rgba(245,158,11,0.08);
  --pink: #ec4899; --pink-bg: rgba(236,72,153,0.08);
  --red: #ef4444; --red-bg: rgba(239,68,68,0.08);
  --purple: #8b5cf6; --purple-bg: rgba(139,92,246,0.08);
  --display: 'DM Serif Display', Georgia, serif;
  --body: 'DM Sans', -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', monospace;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: var(--body); background: var(--bg); color: var(--text); min-height: 100vh; -webkit-font-smoothing: antialiased; overflow: hidden; }
::-webkit-scrollbar { width: 5px; } ::-webkit-scrollbar-track { background: transparent; } ::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 3px; }

/* ═══ LOGIN ═══ */
.login-screen {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 20% 50%, rgba(249,115,22,0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 50%, rgba(139,92,246,0.04) 0%, transparent 50%);
}
.login-card {
  width: 380px; padding: 40px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.login-brand { text-align: center; margin-bottom: 32px; }
.login-logo {
  width: 60px; height: 60px; margin: 0 auto 16px;
  background: var(--accent); border-radius: 16px;
  display: grid; place-items: center;
  font-size: 28px; color: #fff;
  box-shadow: 0 4px 20px rgba(249,115,22,0.3);
}
.login-brand h1 { font-family: var(--display); font-size: 1.5rem; font-weight: 400; }
.login-brand p { font-size: 0.72rem; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.1em; }

/* ═══ LAYOUT ═══ */
.shell { display: flex; height: 100vh; }
.sidebar { width: 252px; background: var(--bg2); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; position: relative; }
.sidebar::after { content:''; position:absolute; right:0; top:0; bottom:0; width:1px; background:linear-gradient(180deg,rgba(249,115,22,0.1),transparent 30%,transparent 70%,rgba(249,115,22,0.1)); }
.main-wrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ═══ BRAND ═══ */
.brand { padding: 26px 22px; border-bottom: 1px solid var(--border); }
.brand h1 { font-family: var(--display); font-size: 1.25rem; font-weight: 400; color: var(--text); letter-spacing: -0.01em; }
.brand p { font-size: 0.68rem; color: var(--muted); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500; }

/* ═══ NAV ═══ */
.nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.nav-label { font-size: 0.6rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); padding: 18px 14px 6px; }
.nav-btn { width: 100%; display: flex; align-items: center; gap: 11px; padding: 10px 14px; border: none; background: transparent; color: rgba(250,250,249,0.45); font-family: var(--body); font-size: 0.86rem; font-weight: 450; border-radius: var(--radius-sm); cursor: pointer; transition: all 0.12s; text-align: left; margin-bottom: 2px; }
.nav-btn:hover { background: rgba(255,255,255,0.04); color: rgba(250,250,249,0.7); }
.nav-btn.active { background: var(--accent); color: #fff; font-weight: 600; }
.nav-btn .ico { width: 22px; text-align: center; font-size: 15px; }
.nav-count { margin-left: auto; font-size: 0.64rem; font-weight: 700; font-family: var(--mono); padding: 2px 8px; border-radius: 10px; background: rgba(255,255,255,0.06); }
.nav-btn.active .nav-count { background: rgba(255,255,255,0.2); }
.nav-count.alert { background: rgba(249,115,22,0.25); color: var(--accent); }

.sidebar-footer { padding: 16px 18px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; font-size: 0.74rem; color: var(--muted); }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px rgba(34,197,94,0.4); animation: breathe 3s ease infinite; }
@keyframes breathe { 0%,100%{opacity:1} 50%{opacity:0.5} }

/* ═══ TOPBAR ═══ */
.topbar { height: 62px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 30px; background: var(--bg2); flex-shrink: 0; }
.topbar h2 { font-family: var(--display); font-size: 1.15rem; font-weight: 400; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* ═══ CONTENT ═══ */
.content { flex: 1; overflow-y: auto; padding: 28px 30px; }
.view { display: none; animation: fadeIn 0.25s ease; }
.view.active { display: block; }
@keyframes fadeIn { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }

/* ═══ BUTTONS ═══ */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; font-family: var(--body); font-size: 0.82rem; font-weight: 600; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); color: var(--text); cursor: pointer; transition: all 0.12s; white-space: nowrap; }
.btn:hover { border-color: var(--border-h); background: var(--card-hover); }
.btn-p { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-p:hover { background: #ea690f; box-shadow: 0 2px 16px rgba(249,115,22,0.25); }
.btn-sm { padding: 5px 12px; font-size: 0.76rem; }
.btn-ghost { border: none; background: transparent; color: var(--muted); padding: 4px 8px; font-size: 0.78rem; cursor: pointer; }
.btn-ghost:hover { color: var(--sub); }
.btn-danger { color: var(--red); border-color: rgba(239,68,68,0.2); }
.btn-danger:hover { background: var(--red-bg); }

/* ═══ STAT CARDS ═══ */
.stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 28px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 20px 22px; }
.stat-label { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 8px; }
.stat-val { font-family: var(--display); font-size: 1.7rem; font-weight: 400; letter-spacing: -0.03em; line-height: 1; margin-bottom: 5px; }
.stat-sub { font-size: 0.73rem; color: var(--muted); font-family: var(--mono); }

/* ═══ CARDS ═══ */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 22px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.card-title { font-family: var(--display); font-size: 1.05rem; font-weight: 400; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ═══ BADGES ═══ */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; font-size: 0.67rem; font-weight: 600; border-radius: 20px; font-family: var(--mono); letter-spacing: 0.02em; }
.b-discovered { background: rgba(107,114,128,0.12); color: #9ca3af; }
.b-pending { background: var(--yellow-bg); color: var(--yellow); }
.b-approved { background: var(--blue-bg); color: var(--blue); }
.b-sent { background: var(--purple-bg); color: var(--purple); }
.b-convo { background: var(--green-bg); color: var(--green); }
.b-followup { background: rgba(249,115,22,0.1); color: #f97316; }
.b-booked { background: var(--pink-bg); color: var(--pink); }
.b-declined { background: var(--red-bg); color: var(--red); }
.b-ig { background: linear-gradient(135deg,var(--ig1),var(--ig2),var(--ig3)); color: #fff; }
.b-email { background: var(--blue-bg); color: var(--blue); }

/* ═══ AVATAR ═══ */
.av { border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; font-family: var(--mono); flex-shrink: 0; }

/* ═══ TABLE ═══ */
.tbl-wrap { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--card); }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; padding: 12px 18px; font-size: 0.67rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: var(--bg); border-bottom: 1px solid var(--border); }
.tbl td { padding: 14px 18px; font-size: 0.84rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: rgba(255,255,255,0.015); }

/* ═══ CHAT ═══ */
.chat-layout { display: grid; grid-template-columns: 310px 1fr; height: calc(100vh - 160px); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--card); }
.chat-list { border-right: 1px solid var(--border); overflow-y: auto; }
.chat-list-head { padding: 16px 18px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.chat-item { display: flex; gap: 12px; padding: 14px 18px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background 0.1s; }
.chat-item:hover { background: rgba(255,255,255,0.02); }
.chat-item.active { background: var(--accent-bg); }
.chat-pane { display: flex; flex-direction: column; }
.chat-header { padding: 14px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.msg-row { display: flex; }
.msg-row.out { justify-content: flex-end; }
.msg-row.in { justify-content: flex-start; }
.msg-bubble { max-width: 75%; padding: 12px 16px; font-size: 0.86rem; line-height: 1.65; white-space: pre-wrap; }
.msg-bubble.out-ig { border-radius: 16px 16px 4px 16px; background: linear-gradient(135deg,#833ab4,#c13584); color: #fff; }
.msg-bubble.out-email { border-radius: 16px 16px 4px 16px; background: var(--accent); color: #fff; }
.msg-bubble.in { border-radius: 16px 16px 16px 4px; background: var(--bg); color: var(--text); }
.msg-time { font-size: 0.64rem; margin-top: 6px; opacity: 0.55; }
.chat-input { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.chat-input input { flex: 1; padding: 10px 14px; font-family: var(--body); font-size: 0.88rem; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; color: var(--text); outline: none; }
.chat-input input:focus { border-color: var(--accent); }
.chat-empty { display: grid; place-items: center; color: var(--muted); text-align: center; }

/* ═══ FLOW ═══ */
.flow-pipe { display: flex; gap: 0; align-items: flex-start; overflow-x: auto; padding-bottom: 16px; }
.flow-step { width: 160px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; flex-shrink: 0; }
.flow-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--accent-bg); border: 2px solid var(--accent); display: grid; place-items: center; font-size: 24px; }
.flow-label { font-weight: 700; font-size: 0.82rem; }
.flow-desc { font-size: 0.71rem; color: var(--muted); line-height: 1.5; padding: 0 6px; }
.flow-arrow { display: flex; align-items: center; padding-top: 18px; color: var(--muted); font-size: 20px; margin: 0 -6px; flex-shrink: 0; }

/* ═══ APPROVAL CARD ═══ */
.approval-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.draft-box { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 18px; font-size: 0.88rem; line-height: 1.75; white-space: pre-wrap; margin-bottom: 18px; outline: none; }
.draft-box:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.draft-box .ig-label { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); font-size: 0.78rem; }
.draft-box .ig-label span { background: linear-gradient(135deg,var(--ig1),var(--ig2),var(--ig3)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-weight: 800; }

/* ═══ SEQUENCE STEPS ═══ */
.seq-step { display: flex; gap: 16px; align-items: flex-start; padding: 16px 0; border-bottom: 1px solid var(--border); }
.seq-step:last-child { border-bottom: none; }
.seq-num { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-bg); color: var(--accent); display: grid; place-items: center; font-size: 0.78rem; font-weight: 700; font-family: var(--mono); flex-shrink: 0; }
.seq-label { font-weight: 600; font-size: 0.88rem; margin-bottom: 4px; }
.seq-desc { font-size: 0.8rem; color: var(--sub); line-height: 1.5; }
.seq-timing { font-size: 0.7rem; font-family: var(--mono); color: var(--muted); margin-top: 6px; }

/* ═══ FORMS ═══ */
.fg { margin-bottom: 16px; }
.fl { display: block; font-size: 0.72rem; font-weight: 600; color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.04em; }
.fi, .fs { width: 100%; padding: 10px 14px; font-family: var(--body); font-size: 0.86rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); outline: none; transition: border-color 0.15s; }
.fi:focus, .fs:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.fs { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2357534e' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.fs option { background: var(--card); }
textarea.fi { resize: vertical; line-height: 1.6; }

/* ═══ MODAL ═══ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 5000;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.2s ease;
  pointer-events: none;
}
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal {
  width: 560px; max-height: 85vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  transform: translateY(10px); transition: transform 0.2s ease;
}
.modal-overlay.show .modal { transform: translateY(0); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ═══ ADMIN TABS ═══ */
.admin-tabs { display: flex; gap: 4px; margin-bottom: 24px; padding: 4px; background: var(--bg2); border-radius: 10px; border: 1px solid var(--border); }
.admin-tab {
  flex: 1; padding: 10px 16px; border: none; background: transparent;
  color: var(--muted); font-family: var(--body); font-size: 0.82rem; font-weight: 600;
  border-radius: 8px; cursor: pointer; transition: all 0.12s; text-align: center;
}
.admin-tab:hover { color: var(--sub); background: rgba(255,255,255,0.03); }
.admin-tab.active { background: var(--accent); color: #fff; }

/* ═══ TOAST ═══ */
.toast-wrap { position: fixed; bottom: 24px; right: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--card); border: 1px solid var(--border); color: var(--text); padding: 12px 20px; border-radius: var(--radius-sm); font-size: 0.84rem; box-shadow: 0 8px 32px rgba(0,0,0,0.4); animation: toastIn 0.3s ease; display: flex; align-items: center; gap: 10px; }
@keyframes toastIn { from{opacity:0;transform:translateY(10px)} to{opacity:1} }

/* ═══ EMPTY ═══ */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .icon { font-size: 40px; margin-bottom: 10px; opacity: 0.3; }
.empty h3 { font-family: var(--display); font-size: 1.1rem; color: var(--sub); margin-bottom: 6px; font-weight: 400; }

/* ═══ ALERT BANNER ═══ */
.alert-banner { background: linear-gradient(135deg,rgba(245,158,11,0.08),rgba(249,115,22,0.04)); border: 1px solid rgba(245,158,11,0.15); border-radius: 14px; padding: 20px; margin-bottom: 24px; }

/* ═══ RESPONSIVE ═══ */
@media (max-width:1100px) { .stats { grid-template-columns: repeat(2,1fr); } }
@media (max-width:768px) { .sidebar { display:none; } .stats { grid-template-columns: 1fr; } .grid-2 { grid-template-columns: 1fr; } .chat-layout { grid-template-columns: 1fr; } .chat-list { display: none; } }
