/* Delta CRM – Modern Decision-Focused UI */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0891b2;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}

/* Sidebar Layout */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px;
  background: #0f172a;
  color: #e2e8f0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s ease;
}
.sidebar-brand {
  padding: 1.25rem 1.5rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: .6rem;
}
.sidebar-brand span { color: #60a5fa; }
.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem 1.5rem;
  color: #94a3b8;
  text-decoration: none;
  font-weight: 500;
  transition: all .15s;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  background: rgba(37,99,235,.15);
  color: #fff;
}
.sidebar-nav a.active { border-right: 3px solid var(--primary); }
.sidebar-nav .nav-section {
  padding: 1rem 1.5rem .4rem;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #475569;
}
.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,.08);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.user-chip img, .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #334155;
}
.avatar-sm { width: 28px; height: 28px; }
.avatar-lg { width: 80px; height: 80px; }
.user-chip .name { font-weight: 600; color: #fff; font-size: .9rem; }
.user-chip .role { font-size: .75rem; color: #64748b; }

.main-content {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: .85rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.page-content { padding: 1.5rem 1.75rem; flex: 1; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body { padding: 1.25rem; }

/* Stat cards – decision focused */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--primary);
}
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before { background: var(--danger); }
.stat-card.info::before { background: var(--info); }
.stat-card .label { font-size: .8rem; color: var(--muted); font-weight: 500; margin-bottom: .25rem; }
.stat-card .value { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
.stat-card .hint { font-size: .75rem; color: var(--muted); margin-top: .35rem; }

/* Priority / Action cards for Client */
.action-needed {
  border-left: 4px solid var(--warning);
  background: #fffbeb;
}
.meeting-ready {
  border-left: 4px solid var(--success);
  background: #ecfdf5;
}

/* Kanban */
.kanban-board {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  min-height: 60vh;
}
.kanban-column {
  min-width: 280px;
  max-width: 300px;
  background: #e2e8f0;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
}
.kanban-column-header {
  padding: .85rem 1rem;
  font-weight: 600;
  font-size: .85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #cbd5e1;
}
.kanban-column-header .count {
  background: #94a3b8;
  color: #fff;
  font-size: .7rem;
  padding: .15rem .5rem;
  border-radius: 20px;
}
.kanban-cards {
  padding: .75rem;
  flex: 1;
  min-height: 100px;
}
.kanban-card {
  background: #fff;
  border-radius: 8px;
  padding: .85rem;
  margin-bottom: .6rem;
  box-shadow: var(--shadow);
  cursor: grab;
  transition: box-shadow .15s, transform .15s;
  border: 1px solid transparent;
}
.kanban-card:hover { box-shadow: var(--shadow-lg); }
.kanban-card.sortable-ghost { opacity: .4; }
.kanban-card.sortable-drag { box-shadow: var(--shadow-lg); transform: rotate(2deg); }
.kanban-card .company { font-weight: 600; margin-bottom: .25rem; }
.kanban-card .meta { font-size: .75rem; color: var(--muted); }
.kanban-card .icp {
  display: inline-block;
  background: #dbeafe;
  color: var(--primary);
  font-size: .7rem;
  font-weight: 600;
  padding: .1rem .4rem;
  border-radius: 4px;
  margin-top: .4rem;
}

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  padding: .75rem 1rem;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}
.table td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:hover td { background: #f8fafc; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: .875rem;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover { background: #f1f5f9; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-lg { padding: .7rem 1.4rem; font-size: 1rem; }

/* Badges */
.badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 6px;
  font-size: .72rem;
  font-weight: 600;
}
.badge-stage { background: #e2e8f0; color: #334155; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #cffafe; color: #155e75; }

/* Forms */
.form-control, .form-select {
  width: 100%;
  padding: .55rem .85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .9rem;
  background: #fff;
  transition: border-color .15s;
}
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-label { font-weight: 500; margin-bottom: .35rem; display: block; font-size: .85rem; }
.form-group { margin-bottom: 1rem; }

/* Alerts */
.alert {
  padding: .85rem 1.15rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: .9rem;
}
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #ecfeff; color: #155e75; border: 1px solid #a5f3fc; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--muted);
}
.empty-state i { font-size: 2.5rem; margin-bottom: .75rem; opacity: .4; }

/* Mobile */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text);
}
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Priority list for client */
.priority-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.priority-item:hover { background: #f8fafc; }
.priority-item:last-child { border-bottom: none; }
.priority-rank {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .8rem;
  flex-shrink: 0;
}
.priority-rank.hot { background: var(--danger); }
.priority-info { flex: 1; min-width: 0; }
.priority-info .title { font-weight: 600; }
.priority-info .sub { font-size: .8rem; color: var(--muted); }
.priority-action { flex-shrink: 0; }
