/* ─── Google Font ───────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ─── CSS Variables ─────────────────────────────────────────────────────── */
:root {
  --bg:           #070709;
  --bg-surface:   #0d0d10;
  --bg-elevated:  #141418;
  --bg-hover:     #1a1a20;
  --border:       rgba(255,255,255,.06);
  --border-hover: rgba(255,255,255,.14);
  --text:         #ececf0;
  --text-muted:   #6b7280;
  --text-faint:   #2d2d35;
  --accent:       #22c55e;
  --accent-dim:   rgba(34,197,94,.1);
  --accent-hover: #16a34a;
  --purple:       #8b5cf6;
  --purple-dim:   rgba(139,92,246,.1);
  --blue:         #3b82f6;
  --blue-dim:     rgba(59,130,246,.1);
  --red:          #ef4444;
  --red-dim:      rgba(239,68,68,.1);
  --yellow:       #f59e0b;
  --yellow-dim:   rgba(245,158,11,.1);
  --sidebar-w:    228px;
  --topbar-h:     54px;
  --radius:       12px;
  --radius-sm:    8px;
  --radius-xs:    6px;
  --shadow:       0 8px 32px rgba(0,0,0,.55);
  --shadow-lg:    0 20px 60px rgba(0,0,0,.7);
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */
*,*::before,*::after { box-sizing:border-box; margin:0; padding:0 }
* { font-family:'Inter',-apple-system,BlinkMacSystemFont,sans-serif }
body { background:var(--bg); color:var(--text); min-height:100vh; -webkit-font-smoothing:antialiased }
a { color:inherit; text-decoration:none }
button { cursor:pointer; font-family:inherit }
::-webkit-scrollbar { width:4px; height:4px }
::-webkit-scrollbar-track { background:transparent }
::-webkit-scrollbar-thumb { background:rgba(255,255,255,.08); border-radius:999px }
::-webkit-scrollbar-thumb:hover { background:rgba(255,255,255,.16) }

/* ─── App Layout ─────────────────────────────────────────────────────────── */
.app-layout { display:flex; min-height:100vh }

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  width:var(--sidebar-w); min-height:100vh;
  background:var(--bg-surface);
  border-right:1px solid var(--border);
  display:flex; flex-direction:column;
  position:fixed; top:0; left:0; bottom:0; z-index:50;
  transition:transform .25s cubic-bezier(.4,0,.2,1);
  overflow-y:auto; overflow-x:hidden;
}

.sidebar-logo {
  display:flex; align-items:center; gap:10px;
  padding:15px 14px 14px;
  border-bottom:1px solid var(--border);
}
.sidebar-logo-icon {
  width:32px; height:32px; border-radius:9px;
  background:linear-gradient(135deg,#22c55e 0%,#8b5cf6 100%);
  display:flex; align-items:center; justify-content:center;
  font-weight:800; font-size:11px; color:#000; flex-shrink:0;
  box-shadow:0 2px 8px rgba(34,197,94,.25);
}
.sidebar-logo-text { font-weight:700; font-size:14px; letter-spacing:-.4px; color:var(--text) }
.sidebar-logo-sub  { font-size:10px; color:var(--text-muted); margin-top:1px; letter-spacing:.2px }

.sidebar-nav { flex:1; padding:8px 8px; display:flex; flex-direction:column; gap:1px }
.sidebar-section-label {
  font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:1px;
  color:var(--text-faint); padding:12px 8px 5px;
}

.nav-item {
  display:flex; align-items:center; gap:9px; padding:8px 10px;
  border-radius:var(--radius-sm); color:var(--text-muted);
  font-size:13px; font-weight:500; transition:all .14s ease;
  border:none; background:transparent; width:100%; text-align:left;
  cursor:pointer; position:relative; white-space:nowrap;
}
.nav-item:hover { background:var(--bg-hover); color:var(--text) }
.nav-item.active {
  background:rgba(34,197,94,.08); color:var(--accent); font-weight:600;
  box-shadow:inset 3px 0 0 var(--accent);
}
.nav-item-danger { color:var(--text-muted) }
.nav-item-danger:hover { background:var(--red-dim) !important; color:#f87171 !important }

.nav-icon {
  width:18px; height:18px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  opacity:.7;
}
.nav-item.active .nav-icon,
.nav-item:hover .nav-icon { opacity:1 }

.nav-badge {
  margin-left:auto; background:var(--red); color:#fff;
  font-size:9px; font-weight:800; border-radius:999px;
  padding:1px 6px; min-width:16px; text-align:center;
}
.sidebar-bottom { padding:8px; border-top:1px solid var(--border) }
.sidebar-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.6); z-index:49; backdrop-filter:blur(2px) }

/* ─── Main Content ───────────────────────────────────────────────────────── */
.main-content { margin-left:var(--sidebar-w); flex:1; display:flex; flex-direction:column; min-height:100vh }

/* ─── Topbar ─────────────────────────────────────────────────────────────── */
.topbar {
  height:var(--topbar-h); background:var(--bg-surface); border-bottom:1px solid var(--border);
  display:flex; align-items:center; justify-content:space-between;
  padding:0 20px; position:sticky; top:0; z-index:40;
}
.topbar-left  { display:flex; align-items:center; gap:10px }
.topbar-right { display:flex; align-items:center; gap:8px }
.topbar-tenant { font-size:13px; font-weight:600; color:var(--text) }
.topbar-plan {
  font-size:9px; font-weight:700; text-transform:uppercase; letter-spacing:.6px;
  color:var(--text-muted); background:rgba(255,255,255,.05);
  border:1px solid var(--border); border-radius:5px; padding:2px 8px;
}
.hamburger {
  display:none; background:transparent; border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:7px 8px; color:var(--text-muted);
  transition:all .14s;
}
.hamburger:hover { border-color:var(--border-hover); color:var(--text) }
.page-content { flex:1; padding:24px }

/* ─── Notification bell ──────────────────────────────────────────────────── */
.notif-btn {
  position:relative; background:transparent; border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:7px 9px; color:var(--text-muted);
  display:flex; align-items:center; justify-content:center;
  transition:all .14s; cursor:pointer;
}
.notif-btn:hover { border-color:var(--border-hover); color:var(--text); background:var(--bg-hover) }
.notif-badge {
  position:absolute; top:-5px; right:-5px; background:var(--red); color:#fff;
  font-size:9px; font-weight:800; border-radius:999px; padding:1px 5px;
  min-width:16px; text-align:center; line-height:14px; border:2px solid var(--bg-surface);
}

.notif-dropdown {
  position:fixed; top:calc(var(--topbar-h) + 6px); right:16px; width:340px;
  background:var(--bg-elevated); border:1px solid var(--border);
  border-radius:var(--radius); box-shadow:var(--shadow-lg); z-index:100;
  overflow:hidden; max-height:480px; overflow-y:auto;
}
.notif-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:13px 16px; border-bottom:1px solid var(--border);
  font-size:13px; font-weight:600; position:sticky; top:0;
  background:var(--bg-elevated);
}
.notif-item {
  display:flex; gap:10px; align-items:flex-start; padding:12px 16px;
  border-bottom:1px solid var(--border); cursor:pointer; transition:background .14s;
}
.notif-item:hover { background:var(--bg-hover) }
.notif-item:last-child { border-bottom:none }
.notif-item.unread { background:rgba(34,197,94,.03) }
.notif-icon-wrap { flex-shrink:0; margin-top:1px; opacity:.8 }
.notif-dot {
  width:7px; height:7px; border-radius:50%; background:var(--accent);
  flex-shrink:0; margin-top:5px;
}
.notif-title { font-size:12px; font-weight:600; color:var(--text) }
.notif-msg   { font-size:11px; color:var(--text-muted); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:240px }
.notif-time  { font-size:10px; color:var(--text-faint); margin-top:3px }

.status-badge {
  display:flex; align-items:center; gap:6px; font-size:12px; padding:6px 12px;
  border-radius:var(--radius-sm); border:1px solid var(--border);
  background:transparent; cursor:pointer; transition:all .14s;
}
.status-badge:hover { border-color:var(--border-hover); background:var(--bg-hover) }
.status-dot { width:6px; height:6px; border-radius:50%; flex-shrink:0 }

/* ─── Page header ────────────────────────────────────────────────────────── */
.page-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:24px; flex-wrap:wrap; gap:12px }
.page-title  { font-size:20px; font-weight:700; letter-spacing:-.5px }
.page-subtitle { font-size:13px; color:var(--text-muted); margin-top:3px }

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card { background:var(--bg-surface); border:1px solid var(--border); border-radius:var(--radius) }
.card-hover { transition:all .2s ease; cursor:pointer }
.card-hover:hover { border-color:rgba(34,197,94,.2); transform:translateY(-2px); box-shadow:0 8px 32px rgba(34,197,94,.06) }
.stat-card {
  background:var(--bg-surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:18px 20px; transition:all .2s ease;
}
.stat-card:hover { border-color:var(--border-hover) }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn-primary {
  background:var(--accent); color:#000; font-weight:700; font-size:13px;
  border-radius:var(--radius-sm); padding:9px 18px; transition:all .14s;
  cursor:pointer; border:none; display:inline-flex; align-items:center; gap:6px; white-space:nowrap;
}
.btn-primary:hover  { background:var(--accent-hover); transform:translateY(-1px); box-shadow:0 4px 12px rgba(34,197,94,.3) }
.btn-primary:active { transform:none; box-shadow:none }
.btn-primary:disabled { opacity:.45; cursor:not-allowed; transform:none; box-shadow:none }

.btn-outline {
  border:1.5px solid var(--accent); color:var(--accent); font-weight:600; font-size:13px;
  border-radius:var(--radius-sm); padding:8px 16px; transition:all .14s;
  cursor:pointer; background:transparent; display:inline-flex; align-items:center; gap:6px;
}
.btn-outline:hover { background:var(--accent-dim) }

.btn-ghost {
  background:transparent; border:1px solid var(--border); color:var(--text-muted);
  border-radius:var(--radius-sm); padding:7px 12px; font-size:12px; cursor:pointer;
  transition:all .14s; display:inline-flex; align-items:center; gap:5px;
}
.btn-ghost:hover { color:var(--text); border-color:var(--border-hover); background:var(--bg-hover) }

.btn-danger {
  background:transparent; border:1px solid rgba(239,68,68,.25); color:#f87171;
  border-radius:var(--radius-sm); padding:7px 14px; font-size:12px; cursor:pointer; transition:all .14s;
  display:inline-flex; align-items:center; gap:5px;
}
.btn-danger:hover { background:var(--red-dim); border-color:var(--red) }

.btn-icon {
  background:var(--bg-elevated); border:1px solid var(--border); color:var(--text-muted);
  border-radius:var(--radius-sm); padding:7px 9px; cursor:pointer;
  transition:all .14s; display:inline-flex; align-items:center; justify-content:center;
}
.btn-icon:hover { border-color:var(--border-hover); color:var(--text); background:var(--bg-hover) }

/* ─── Inputs ─────────────────────────────────────────────────────────────── */
.input {
  background:var(--bg-elevated); border:1.5px solid rgba(255,255,255,.07);
  border-radius:var(--radius-sm); padding:10px 14px; color:var(--text);
  width:100%; transition:border-color .14s; outline:none; font-size:13px; line-height:1.5;
}
.input:focus { border-color:var(--accent) }
.input::placeholder { color:var(--text-muted); opacity:.6 }
select.input option { background:#1a1a20 }
textarea.input { resize:vertical }

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge { display:inline-flex; align-items:center; gap:4px; padding:3px 9px; border-radius:999px; font-size:11px; font-weight:600; white-space:nowrap }
.tag-new       { background:rgba(34,197,94,.1);   color:#22c55e }
.tag-qualified { background:rgba(59,130,246,.1);  color:#60a5fa }
.tag-scheduled { background:rgba(139,92,246,.1);  color:#a78bfa }
.tag-closed    { background:rgba(34,197,94,.1);   color:#4ade80 }
.tag-lost      { background:rgba(239,68,68,.1);   color:#f87171 }

/* ─── Alerts ─────────────────────────────────────────────────────────────── */
.alert-error   { background:var(--red-dim);   border:1px solid rgba(239,68,68,.2);  color:#f87171;    border-radius:var(--radius-sm); padding:10px 14px; font-size:13px }
.alert-success { background:var(--accent-dim);border:1px solid rgba(34,197,94,.2);  color:var(--accent); border-radius:var(--radius-sm); padding:10px 14px; font-size:13px }

/* ─── Data table ─────────────────────────────────────────────────────────── */
.data-table { width:100%; border-collapse:collapse }
.data-table th {
  text-align:left; font-size:10.5px; font-weight:700; text-transform:uppercase;
  letter-spacing:.6px; color:var(--text-muted); padding:10px 14px;
  border-bottom:1px solid var(--border);
}
.data-table td { padding:12px 14px; border-bottom:1px solid rgba(255,255,255,.025); font-size:13px }
.data-table tr:hover td { background:var(--bg-hover) }
.data-table tr:last-child td { border-bottom:none }

/* ─── Modal ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,.78); backdrop-filter:blur(6px);
  z-index:200; display:flex; align-items:center; justify-content:center; padding:16px;
}
.modal-box {
  background:var(--bg-surface); border:1px solid rgba(255,255,255,.09);
  border-radius:16px; width:100%; max-height:92vh; display:flex; flex-direction:column;
  box-shadow:var(--shadow-lg);
}
.modal-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 20px; border-bottom:1px solid var(--border);
}
.modal-title  { font-weight:700; font-size:15px; letter-spacing:-.3px }
.modal-body   { overflow-y:auto; flex:1; padding:20px }
.modal-footer { display:flex; align-items:center; justify-content:flex-end; gap:10px; padding:14px 20px; border-top:1px solid var(--border) }

/* ─── Tabs ───────────────────────────────────────────────────────────────── */
.tab-group { display:flex; gap:2px; background:var(--bg-elevated); border-radius:var(--radius-sm); padding:3px; margin-bottom:20px }
.tab-pill  { flex:1; padding:7px 12px; border-radius:var(--radius-xs); font-size:12px; font-weight:600; text-align:center; border:none; background:transparent; color:var(--text-muted); cursor:pointer; transition:all .14s }
.tab-pill.active { background:var(--bg-surface); color:var(--text); box-shadow:0 1px 3px rgba(0,0,0,.3) }

/* ─── Toggle ─────────────────────────────────────────────────────────────── */
.toggle-wrap  { display:flex; align-items:center; gap:12px; padding:10px 0; cursor:pointer; user-select:none }
.sr-only      { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0) }
.toggle-track { width:38px; height:20px; background:rgba(255,255,255,.1); border-radius:999px; position:relative; transition:background .2s; flex-shrink:0 }
.toggle-track .toggle-thumb { position:absolute; top:2px; left:2px; width:16px; height:16px; background:#fff; border-radius:50%; transition:transform .2s }
input[type="checkbox"]:checked + .toggle-track { background:var(--accent) }
input[type="checkbox"]:checked + .toggle-track .toggle-thumb { transform:translateX(18px) }

/* ─── Gradient utilities ─────────────────────────────────────────────────── */
.gradient-text { background:linear-gradient(135deg,#22c55e,#8b5cf6); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text }
.gradient-bg   { background:linear-gradient(135deg,#22c55e 0%,#128c7e 50%,#8b5cf6 100%) }

/* ─── Animations ─────────────────────────────────────────────────────────── */
.hidden   { display:none !important }
.fade-in  { animation:fadeIn .25s ease }
@keyframes fadeIn { from { opacity:0; transform:translateY(6px) } to { opacity:1; transform:translateY(0) } }
.spin     { animation:spin 1s linear infinite }
@keyframes spin { to { transform:rotate(360deg) } }
.pulse    { animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.spinner  { width:26px; height:26px; border:2px solid var(--border); border-top-color:var(--accent); border-radius:50%; animation:spin .8s linear infinite }

/* ─── Calendar ───────────────────────────────────────────────────────────── */
.cal-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:3px }
.cal-day-head {
  text-align:center; font-size:10.5px; font-weight:700; text-transform:uppercase;
  color:var(--text-muted); padding:8px 4px; letter-spacing:.4px;
}
.cal-day {
  border-radius:var(--radius-sm); display:flex; flex-direction:column; align-items:center;
  padding:8px 4px 6px; cursor:pointer; transition:all .14s; border:1px solid transparent;
  min-height:52px; font-size:13px;
}
.cal-day:hover        { background:var(--bg-hover); border-color:var(--border) }
.cal-day.today        { background:var(--accent-dim); border-color:rgba(34,197,94,.25); color:var(--accent); font-weight:700 }
.cal-day.other-month  { opacity:.2 }
.cal-day.selected     { background:var(--accent) !important; color:#000 !important; font-weight:700 }
.cal-dot              { width:4px; height:4px; border-radius:50%; background:var(--accent); margin-top:4px }

/* ─── Note cards ─────────────────────────────────────────────────────────── */
.note-card        { background:var(--bg-elevated); border:1px solid var(--border); border-radius:var(--radius-sm); padding:12px 14px }
.note-card.agent  { border-left:3px solid var(--purple) }
.note-card.human  { border-left:3px solid var(--accent) }

/* ─── Chat bubbles ───────────────────────────────────────────────────────── */
.msg-bubble      { max-width:72%; border-radius:16px; padding:9px 14px; font-size:13px; line-height:1.5; word-break:break-word }
.msg-bubble.bot  { background:rgba(255,255,255,.05); color:#d1d5db; border-radius:4px 16px 16px 16px }
.msg-bubble.user { background:rgba(34,197,94,.12); color:#86efac; border-radius:16px 4px 16px 16px }

/* ─── Filter buttons ─────────────────────────────────────────────────────── */
.filter-btn {
  border:1px solid var(--border); background:transparent; color:var(--text-muted);
  border-radius:999px; padding:5px 14px; font-size:12px; cursor:pointer;
  transition:all .14s; white-space:nowrap; font-weight:500;
  display:inline-flex; align-items:center; gap:5px;
}
.filter-btn:hover      { border-color:var(--border-hover); color:var(--text); background:var(--bg-hover) }
.filter-btn.active-filter { border-color:var(--accent); color:var(--accent); background:var(--accent-dim) }

/* ─── Tab buttons (legacy compat) ────────────────────────────────────────── */
.tab-btn         { border:none; background:transparent; border-radius:var(--radius-sm); padding:6px 12px; font-size:12.5px; font-weight:500; cursor:pointer; transition:all .14s; color:var(--text-muted); white-space:nowrap }
.tab-btn.active  { background:var(--bg-elevated); color:var(--text); font-weight:600 }
.tab-btn.inactive:hover { color:var(--text) }

/* ─── Kanban ─────────────────────────────────────────────────────────────── */
.kanban-col { width:240px; flex-shrink:0; background:rgba(255,255,255,.015); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width:1024px) {
  :root { --sidebar-w: 200px }
}
@media (max-width:768px) {
  .sidebar { transform:translateX(-100%) }
  .sidebar.open { transform:translateX(0); box-shadow:6px 0 32px rgba(0,0,0,.8) }
  .sidebar-overlay { display:block }
  .main-content { margin-left:0 }
  .hamburger { display:flex; align-items:center; justify-content:center }
  .page-content { padding:14px }
  .topbar { padding:0 14px }
  .notif-dropdown { right:8px; left:8px; width:auto }
}
@media (max-width:480px) {
  .page-content { padding:10px }
  .modal-overlay { padding:0; align-items:flex-end }
  .modal-box { border-radius:20px 20px 0 0; max-height:95vh }
  .page-title { font-size:17px }
}
