:root {
  --bg-primary: #0f1117;
  --bg-secondary: #161921;
  --bg-card: #1c1f2b;
  --bg-card-hover: #222639;
  --bg-input: #1e2235;
  --border: #2a2e42;
  --border-light: #353a52;
  --text-primary: #e8eaf0;
  --text-secondary: #8b8fa3;
  --text-muted: #5d6177;
  --accent-blue: #4c7bf5;
  --accent-blue-hover: #3d6ae0;
  --accent-blue-bg: rgba(76,123,245,0.12);
  --primary: #4c7bf5;
  --primary-light: #2a3760;
  --accent-purple: #9b6dff;
  --accent-purple-bg: rgba(155,109,255,0.12);
  --accent-green: #34d399;
  --accent-green-bg: rgba(52,211,153,0.12);
  --accent-orange: #f59e0b;
  --accent-orange-bg: rgba(245,158,11,0.12);
  --accent-red: #ef4444;
  --accent-red-bg: rgba(239,68,68,0.12);
  --accent-pink: #ec4899;
  --accent-pink-bg: rgba(236,72,153,0.12);
  --accent-cyan: #22d3ee;
  --accent-cyan-bg: rgba(34,211,238,0.12);
  --sidebar-width: 260px;
  --header-height: 64px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
  --transition: all 0.2s ease;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
}

.app {
  display: flex;
  height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s ease;
  z-index: 100;
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: white;
}

.logo-text {
  font-weight: 700;
  font-size: 18px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.nav-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-blue-bg);
  color: var(--accent-blue);
}

.nav-item svg {
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--radius-sm);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--text-muted); }

/* Main */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle {
  display: flex;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  width: 360px;
  transition: var(--transition);
}

.search-bar:focus-within {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-bg);
}

.search-bar input {
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  width: 100%;
  font-family: inherit;
}

.search-bar input::placeholder { color: var(--text-muted); }
.search-bar svg { color: var(--text-muted); flex-shrink: 0; }

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent-red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.badge.hidden { display: none; }

.btn-primary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: none;
  background: linear-gradient(135deg, var(--accent-blue), #6366f1);
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(76,123,245,0.4);
}

.btn-secondary {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.btn-text {
  background: none;
  border: none;
  color: var(--accent-blue);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-family: inherit;
}

.btn-text:hover {
  background: var(--accent-blue-bg);
}

/* Content */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.page { display: none; animation: fadeIn 0.3s ease; }
.page.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 26px;
  font-weight: 700;
}

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.blue { background: var(--accent-blue-bg); color: var(--accent-blue); }
.stat-icon.purple { background: var(--accent-purple-bg); color: var(--accent-purple); }
.stat-icon.green { background: var(--accent-green-bg); color: var(--accent-green); }
.stat-icon.orange { background: var(--accent-orange-bg); color: var(--accent-orange); }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.card-header h3 {
  font-size: 14px;
  font-weight: 600;
}

.card-body {
  padding: 12px 20px 20px;
  overflow: visible;
}

/* Items */
.item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.item-row:last-child { border-bottom: none; }
.item-row:hover { background: var(--bg-card-hover); margin: 0 -20px; padding: 10px 20px; border-radius: var(--radius-sm); }

.item-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: white;
  flex-shrink: 0;
}

.item-info {
  flex: 1;
  min-width: 0;
}

.item-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-meta {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Tags */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  gap: 4px;
}

.tag.blue { background: var(--accent-blue-bg); color: var(--accent-blue); }
.tag.purple { background: var(--accent-purple-bg); color: var(--accent-purple); }
.tag.green { background: var(--accent-green-bg); color: var(--accent-green); }
.tag.orange { background: var(--accent-orange-bg); color: var(--accent-orange); }
.tag.pink { background: var(--accent-pink-bg); color: var(--accent-pink); }
.tag.cyan { background: var(--accent-cyan-bg); color: var(--accent-cyan); }

.tag-remove {
  cursor: pointer;
  opacity: 0.6;
  transition: var(--transition);
}
.tag-remove:hover { opacity: 1; }

/* Filters Bar */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  width: 280px;
  transition: var(--transition);
}

.search-filter:focus-within {
  border-color: var(--accent-blue);
}

.search-filter input {
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  width: 100%;
  font-family: inherit;
}

.search-filter input::placeholder { color: var(--text-muted); }
.search-filter svg { color: var(--text-muted); flex-shrink: 0; }

.tag-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-tag {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.filter-tag:hover, .filter-tag.active {
  background: var(--accent-blue-bg);
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

/* Contacts Grid */
.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.contact-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(76,123,245,0.15);
}

.contact-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.contact-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: white;
  flex-shrink: 0;
}

.contact-card-info h4 {
  font-size: 15px;
  font-weight: 600;
}

.contact-card-info p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.contact-card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.contact-card-contact {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.contact-card-contact span {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.contact-card-contact svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.contact-card-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: var(--transition);
}

.contact-card:hover .contact-card-actions { opacity: 1; }

.action-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: var(--bg-primary);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.action-btn:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.action-btn.delete:hover { color: var(--accent-red); background: var(--accent-red-bg); }

/* Empty state */
.empty-state {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 30px 0;
}

.empty-state.full {
  padding: 60px 0;
  font-size: 15px;
}

/* Deals Board */
.deals-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  min-height: calc(100vh - 200px);
}

.deal-column {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.column-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.stage-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.stage-dot.lead { background: var(--accent-blue); }
.stage-dot.negotiation { background: var(--accent-orange); }
.stage-dot.proposal { background: var(--accent-purple); }
.stage-dot.closed { background: var(--accent-green); }

.column-header h4 {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
}

.column-header .count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 10px;
}

.deal-list {
  flex: 1;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.deal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.deal-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-1px);
}

.deal-card h5 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.deal-card .deal-amount {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-green);
  margin-bottom: 6px;
}

.deal-card .deal-contact {
  font-size: 12px;
  color: var(--text-muted);
}

.deal-card-actions {
  display: flex;
  gap: 4px;
  margin-top: 10px;
  justify-content: flex-end;
}

/* Tasks */
.tasks-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.filter-btn {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.filter-btn:hover, .filter-btn.active {
  background: var(--accent-blue-bg);
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition);
}

.task-item:hover {
  border-color: var(--border-light);
}

.task-check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.task-check:hover { border-color: var(--accent-green); }

.task-check.completed {
  background: var(--accent-green);
  border-color: var(--accent-green);
}

.task-check.completed svg { display: block; }
.task-check svg { display: none; }

.task-content {
  flex: 1;
  min-width: 0;
}

.task-content h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.task-content p {
  font-size: 12px;
  color: var(--text-muted);
}

.task-item.completed .task-content h4 {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-priority {
  width: 4px;
  height: 32px;
  border-radius: 2px;
  flex-shrink: 0;
}

.task-priority.low { background: var(--accent-blue); }
.task-priority.medium { background: var(--accent-orange); }
.task-priority.high { background: var(--accent-red); }

.task-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.task-date {
  font-size: 12px;
  color: var(--text-muted);
}

.task-date.overdue { color: var(--accent-red); }

.task-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: var(--transition);
}

.task-item:hover .task-actions { opacity: 1; }

/* Calendar */
.calendar-container {
  max-width: 800px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 24px;
}

.calendar-nav h3 {
  font-size: 18px;
  font-weight: 600;
  min-width: 200px;
  text-align: center;
}

.calendar-grid {
  display: block;
  margin-bottom: 24px;
}

.cal-header {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.cal-day:hover { background: var(--bg-card-hover); }
.cal-day.today { background: var(--accent-blue); color: white; font-weight: 700; }
.cal-day.selected { background: var(--accent-purple); color: white; font-weight: 700; }
.cal-day.other-month { color: var(--text-muted); opacity: 0.4; }

.cal-day.has-events::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-green);
}

.calendar-events {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.calendar-events h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 480px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: slideUp 0.3s ease;
}

.modal-large { width: 700px; }
.modal-small { width: 360px; padding: 24px; }
.modal-confirm { width: 400px; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-bg);
}

.form-group select {
  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='%238b8fa3' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-group textarea { resize: vertical; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* Tags Input */
.tags-input {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 42px;
  cursor: text;
}

.tags-input:focus-within {
  border-color: var(--accent-blue);
}

.tags-input input {
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  flex: 1;
  min-width: 80px;
  padding: 2px;
  font-family: inherit;
}

.tags-input input::placeholder { color: var(--text-muted); }

/* Contact Detail */
.contact-detail {
  padding: 24px;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.detail-avatar {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 24px;
  color: white;
  flex-shrink: 0;
}

.detail-info h2 {
  font-size: 22px;
  font-weight: 700;
}

.detail-info p {
  color: var(--text-muted);
  font-size: 14px;
}

.detail-section {
  margin-bottom: 24px;
}

.detail-section h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-field label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-field span {
  font-size: 14px;
  color: var(--text-primary);
}

.detail-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

/* Notes in detail */
.notes-section {
  margin-top: 16px;
}

.note-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
}

.note-item .note-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.note-item .note-text {
  font-size: 13px;
  color: var(--text-secondary);
}

.add-note-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.add-note-form input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  font-family: inherit;
}

.add-note-form input:focus { border-color: var(--accent-blue); }

/* Personal notes page */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.note-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.note-card:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-sm);
}

.note-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.note-card-header h4 {
  font-size: 15px;
  font-weight: 600;
}

.note-card-date {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.note-card-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  white-space: pre-line;
  word-break: break-word;
}

.note-card-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin-top: auto;
}

/* Quick Add */
.quick-add-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-add-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
}

.quick-add-option:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.qa-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.qa-icon.blue { background: var(--accent-blue-bg); color: var(--accent-blue); }
.qa-icon.purple { background: var(--accent-purple-bg); color: var(--accent-purple); }
.qa-icon.green { background: var(--accent-green-bg); color: var(--accent-green); }

/* Notifications */
.notifications-panel {
  position: fixed;
  top: var(--header-height);
  right: 0;
  width: 340px;
  max-height: calc(100vh - var(--header-height));
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0 0 0 var(--radius-md);
  box-shadow: var(--shadow);
  z-index: 200;
  display: none;
  overflow-y: auto;
}

.notifications-panel.open { display: block; }

.notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
}

.notif-header h4 { font-size: 14px; font-weight: 600; }

.notif-list {
  padding: 8px;
}

.notif-item {
  padding: 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  transition: var(--transition);
}

.notif-item:hover { background: var(--bg-input); }
.notif-item .notif-text { font-size: 13px; margin-bottom: 4px; }
.notif-item .notif-time { font-size: 11px; color: var(--text-muted); }

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
}

.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error { border-left: 3px solid var(--accent-red); }
.toast.info { border-left: 3px solid var(--accent-blue); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Responsive */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .deals-board { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    z-index: 200;
  }

  .sidebar.open { transform: translateX(0); }

  .menu-toggle { display: flex; }

  .search-bar { width: 200px; }

  .stats-grid { grid-template-columns: 1fr 1fr; }

  .dashboard-grid { grid-template-columns: 1fr; }

  .deals-board { grid-template-columns: 1fr; }

  .contacts-grid { grid-template-columns: 1fr; }

  .form-row { grid-template-columns: 1fr; }

  .header { padding: 0 16px; }
  .content { padding: 16px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .search-bar { width: 160px; }
  .btn-primary span { display: none; }
}

/* Dropdown for deal move */
.dropdown {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 50;
  min-width: 150px;
  padding: 4px;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  border-radius: 4px;
  transition: var(--transition);
  font-family: inherit;
}

.dropdown-item:hover {
  background: var(--bg-input);
  color: var(--text-primary);
}

/* ===== JS-Generated Content Styles ===== */

/* Search Results Dropdown */
.search-bar { position: relative; }

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-height: 320px;
  overflow-y: auto;
  display: none;
  z-index: 300;
  margin-top: 4px;
}

.search-results.open { display: block; }

.search-results-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: var(--transition);
}

.search-result-item:hover { background: var(--bg-input); }

.search-result-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  color: white;
  flex-shrink: 0;
}

.search-result-info { display: flex; flex-direction: column; }
.search-result-name { font-size: 13px; font-weight: 600; }
.search-result-detail { font-size: 11px; color: var(--text-muted); }

/* Contact Card (JS-generated) */
.contact-card-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: white;
  flex-shrink: 0;
}

.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
}

.contact-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(76,123,245,0.15);
}

.contact-card-info { flex: 1; min-width: 0; }
.contact-card-name { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.contact-card-detail { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.contact-card-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: var(--transition);
  position: absolute;
  top: 12px;
  right: 12px;
}

.contact-card:hover .contact-card-actions { opacity: 1; }

/* Deal Column (JS-generated) */
.deal-column {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.deal-column-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.deal-column-header h3 { font-size: 13px; font-weight: 600; flex: 1; }
.deal-count { font-size: 12px; color: var(--text-muted); background: var(--bg-card); padding: 2px 8px; border-radius: 10px; }
.deal-column-body { flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 120px; }
.deals-empty { text-align: center; padding: 24px; color: var(--text-muted); font-size: 13px; }

.deal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  transition: var(--transition);
}

.deal-card:hover { border-color: var(--border-light); }
.deal-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.deal-card-name { font-size: 13px; font-weight: 600; flex: 1; }
.deal-card-amount { font-size: 15px; font-weight: 700; color: var(--accent-green); margin-bottom: 6px; }
.deal-card-contact { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.deal-card-desc { font-size: 12px; color: var(--text-secondary); margin-top: 6px; line-height: 1.4; }
.deal-card-moves { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }

.deal-card-actions {
  display: flex;
  gap: 4px;
}

/* Task Variants (JS-generated) */
.task-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition);
}

.task-item:hover { border-color: var(--border-light); }

.task-completed { opacity: 0.6; }
.task-overdue { border-color: rgba(239,68,68,0.3); }

.task-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-green);
  cursor: pointer;
}

.task-priority-bar {
  width: 4px;
  height: 36px;
  border-radius: 2px;
  flex-shrink: 0;
}

.task-priority-bar.priority-low { background: var(--accent-blue); }
.task-priority-bar.priority-medium { background: var(--accent-orange); }
.task-priority-bar.priority-high { background: var(--accent-red); }

.task-content { flex: 1; min-width: 0; }
.task-name { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.task-name.task-done { text-decoration: line-through; color: var(--text-muted); }
.task-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.task-date { font-size: 12px; color: var(--text-muted); }
.task-priority-badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.task-priority-badge.priority-low { background: var(--accent-blue-bg); color: var(--accent-blue); }
.task-priority-badge.priority-medium { background: var(--accent-orange-bg); color: var(--accent-orange); }
.task-priority-badge.priority-high { background: var(--accent-red-bg); color: var(--accent-red); }
.task-contact { font-size: 12px; color: var(--text-muted); }
.task-desc { font-size: 12px; color: var(--text-secondary); margin-top: 6px; line-height: 1.4; }
.task-actions { display: flex; gap: 4px; flex-shrink: 0; opacity: 0; transition: var(--transition); }
.task-item:hover .task-actions { opacity: 1; }

/* Calendar (JS-generated) */
.calendar-header-cell { text-align: center; font-size: 12px; font-weight: 600; color: var(--text-muted); padding: 8px; }

.calendar-day {
  height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  gap: 2px;
}

.calendar-day:hover { background: var(--bg-card-hover); }
.calendar-day.today { background: var(--accent-blue); color: white; font-weight: 700; }
.calendar-day.selected { background: var(--accent-purple); color: white; font-weight: 700; }
.calendar-day.empty { cursor: default; }
.calendar-day.has-events .calendar-day-number { font-weight: 700; }

.calendar-day-number { line-height: 1; }
.calendar-event-dot { font-size: 9px; font-weight: 700; color: var(--accent-green); }
.calendar-day.today .calendar-event-dot,
.calendar-day.selected .calendar-event-dot { color: rgba(255,255,255,0.8); }

.calendar-event-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.calendar-event-item:last-child { border-bottom: none; }
.calendar-event-icon { font-size: 18px; }
.calendar-event-type { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; display: block; }
.calendar-event-name { font-size: 13px; font-weight: 600; display: block; }

/* Dashboard List Items */
.dash-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.dash-list-item:last-child { border-bottom: none; }
.dash-list-item:hover { opacity: 0.8; }

.dash-list-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  color: white;
  flex-shrink: 0;
}

.dash-list-info { flex: 1; min-width: 0; }
.dash-list-name { font-size: 13px; font-weight: 600; display: block; }
.dash-list-detail { font-size: 11px; color: var(--text-muted); display: block; }
.dash-list-icon { font-size: 18px; flex-shrink: 0; }
.dash-list-amount { font-size: 13px; font-weight: 700; color: var(--accent-green); flex-shrink: 0; }

/* Button Variants */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
}

.btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-primary { background: linear-gradient(135deg, var(--accent-blue), #6366f1); color: white; border: none; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(76,123,245,0.4); }
.btn-outline { background: transparent; border-color: var(--border); }
.btn-outline:hover { background: var(--bg-card-hover); }
.btn-danger { color: var(--accent-red); }
.btn-danger:hover { background: var(--accent-red-bg); border-color: var(--accent-red); }
.btn-icon { width: 32px; height: 32px; padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 6px; }
.btn-icon.btn-sm { width: 26px; height: 26px; }

/* Badge Variants */
.badge-lead { background: var(--accent-blue-bg); color: var(--accent-blue); }
.badge-negotiation { background: var(--accent-orange-bg); color: var(--accent-orange); }
.badge-proposal { background: var(--accent-purple-bg); color: var(--accent-purple); }
.badge-closed { background: var(--accent-green-bg); color: var(--accent-green); }

/* Tag Filter Buttons */
.tag-filter-btn {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.tag-filter-btn:hover, .tag-filter-btn.active {
  background: var(--accent-blue-bg);
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

/* Tag color variants */
.tag-blue { background: var(--accent-blue-bg); color: var(--accent-blue); }
.tag-purple { background: var(--accent-purple-bg); color: var(--accent-purple); }
.tag-green { background: var(--accent-green-bg); color: var(--accent-green); }
.tag-orange { background: var(--accent-orange-bg); color: var(--accent-orange); }
.tag-pink { background: var(--accent-pink-bg); color: var(--accent-pink); }
.tag-cyan { background: var(--accent-cyan-bg); color: var(--accent-cyan); }

/* Tags Container */
.tags-container { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* Contact Detail (JS-generated) */
.contact-detail-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.contact-detail-avatar {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 24px;
  color: white;
  flex-shrink: 0;
}

.contact-detail-title h2 { font-size: 22px; font-weight: 700; }
.contact-detail-title p { color: var(--text-muted); font-size: 14px; }

.contact-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.detail-item label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.detail-item span { font-size: 14px; color: var(--text-primary); }

.contact-detail-section {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.contact-detail-section:last-of-type { border-bottom: none; }

.contact-detail-section h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.contact-detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.deal-mini-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.deal-mini-card:last-child { border-bottom: none; }
.deal-mini-info { display: flex; align-items: center; gap: 8px; }
.deal-mini-amount { font-weight: 700; color: var(--accent-green); }

.task-mini-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.task-mini-card:last-child { border-bottom: none; }
.task-mini-priority { width: 4px; height: 20px; border-radius: 2px; flex-shrink: 0; }
.task-mini-priority.priority-low { background: var(--accent-blue); }
.task-mini-priority.priority-medium { background: var(--accent-orange); }
.task-mini-priority.priority-high { background: var(--accent-red); }

/* Toast Variants */
.toast-success { border-left: 3px solid var(--accent-green); }
.toast-error { border-left: 3px solid var(--accent-red); }
.toast-info { border-left: 3px solid var(--accent-blue); }

.toast-message { flex: 1; }

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
}

.toast-close:hover { color: var(--text-primary); }

/* Notification Items */
.notification-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  margin-bottom: 4px;
}

.notification-item:hover { background: var(--bg-input); }
.notification-item.read { opacity: 0.5; }
.notification-icon { font-size: 16px; flex-shrink: 0; margin-top: 2px; }
.notification-info { flex: 1; }
.notification-message { font-size: 13px; display: block; }
.notification-date { font-size: 11px; color: var(--text-muted); display: block; margin-top: 2px; }
.notifications-empty { padding: 20px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* Form Control */
.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
  resize: vertical;
}

.form-control:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-bg);
}

/* Text Utilities */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-danger { color: var(--accent-red); }
.hidden { display: none; }

/* Modal Body */
.modal-body { padding: 0 24px 20px; }

/* ===== Appeals Styles ===== */
.appeals-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.appeal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
}

.appeal-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.appeal-priority-bar {
  width: 4px;
  flex-shrink: 0;
}

.appeal-card-content {
  flex: 1;
  padding: 16px 18px;
  min-width: 0;
}

.appeal-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
  gap: 12px;
}

.appeal-card-info { flex: 1; min-width: 0; }
.appeal-card-name { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.appeal-card-subject { font-size: 12px; color: var(--text-muted); }

.appeal-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}

.appeal-card-meta span {
  font-size: 12px;
  color: var(--text-secondary);
}

.appeal-card-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
}

.appeal-card-footer {
  display: flex;
  align-items: center;
  gap: 12px;
}

.appeal-detail-header {
  margin-bottom: 20px;
}

.appeal-detail-info h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 10px;
}

.appeal-detail-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.appeal-status-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag-filter-blue { border-color: var(--accent-blue); color: var(--accent-blue); }
.tag-filter-orange { border-color: var(--accent-orange); color: var(--accent-orange); }
.tag-filter-green { border-color: var(--accent-green); color: var(--accent-green); }
.tag-filter-purple { border-color: var(--accent-purple); color: var(--accent-purple); }

.tag-filter-btn.active.tag-filter-blue,
.tag-filter-btn:hover.tag-filter-blue { background: var(--accent-blue-bg); }

.tag-filter-btn.active.tag-filter-orange,
.tag-filter-btn:hover.tag-filter-orange { background: var(--accent-orange-bg); }

.tag-filter-btn.active.tag-filter-green,
.tag-filter-btn:hover.tag-filter-green { background: var(--accent-green-bg); }

.tag-filter-btn.active.tag-filter-purple,
.tag-filter-btn:hover.tag-filter-purple { background: var(--accent-purple-bg); }

.add-note-form textarea {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  font-family: inherit;
  resize: none;
}

.add-note-form textarea:focus { border-color: var(--accent-blue); }

/* ===== V2 Styles ===== */

/* Auth View */
.auth-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1000px 700px at -10% -10%, var(--accent-purple-bg), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, var(--accent-blue-bg), transparent 60%),
    var(--bg-primary);
}

.auth-card {
  width: 400px;
  max-width: 92vw;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
}

.brand {
  text-align: center;
  margin-bottom: 24px;
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
  margin-bottom: 12px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  transition: var(--transition);
}

.auth-tab:hover { color: var(--text-primary); }

.auth-tab.active {
  background: var(--accent-blue-bg);
  color: var(--accent-blue);
}

.guest-enter-row {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.auth-form.active { display: flex; }

.auth-error {
  background: var(--accent-red-bg);
  color: var(--accent-red);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 8px;
}

.auth-card input, .auth-card select, .auth-card textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.auth-card input:focus, .auth-card select:focus, .auth-card textarea:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-bg);
}

/* Guest View */
.guest-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
}

.guest-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.guest-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.guest-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.guest-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.guest-layout {
  display: flex;
  flex: 1;
}

.guest-sidebar {
  width: 240px;
  padding: 20px 12px;
  border-right: 1px solid var(--border);
  background: var(--bg-card);
}

.guest-welcome {
  padding: 12px;
  margin-bottom: 16px;
}

.guest-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  width: 100%;
  text-align: left;
  transition: var(--transition);
}

.nav-btn:hover { background: var(--bg-input); color: var(--text-primary); }
.nav-btn.active { background: var(--accent-blue-bg); color: var(--accent-blue); font-weight: 600; }

.guest-content {
  flex: 1;
  padding: 32px 24px;
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
}

.guest-section { padding-bottom: 24px; }

/* Admin Additions */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: var(--header-height);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-red);
  color: white;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.search-result-meta {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
}

.modal-overlay.active { display: flex !important; }

/* Dashboard */
.stat-icon-blue { background: var(--accent-blue-bg); color: var(--accent-blue); }
.stat-icon-green { background: var(--accent-green-bg); color: var(--accent-green); }
.stat-icon-orange { background: var(--accent-orange-bg); color: var(--accent-orange); }
.stat-icon-purple { background: var(--accent-purple-bg); color: var(--accent-purple); }

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
}

.list-item:hover { background: var(--bg-input); }

.list-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.list-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* Modals / Details */
.contact-avatar.large {
  width: 56px;
  height: 56px;
  font-size: 20px;
}

.detail-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-input);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

.info-item label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
}

.info-item span {
  font-size: 14px;
  color: var(--text-primary);
}

.detail-text {
  color: var(--text-primary);
  white-space: pre-wrap;
  line-height: 1.6;
}

.related-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-xs {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-blue { background: var(--accent-blue-bg); color: var(--accent-blue); }
.btn-blue:hover { filter: brightness(0.85); }
.btn-green { background: var(--accent-green-bg); color: var(--accent-green); }
.btn-green:hover { filter: brightness(0.85); }
.btn-purple { background: var(--accent-purple-bg); color: var(--accent-purple); }
.btn-purple:hover { filter: brightness(0.85); }

.note-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.modal-body form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Tasks */
.task-item.completed { opacity: 0.6; }
.task-item.overdue { border-color: rgba(239,68,68,0.35); }

.task-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-green);
  cursor: pointer;
  flex-shrink: 0;
}

.task-info { flex: 1; min-width: 0; }

.task-description {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.due-date.overdue-text {
  color: var(--accent-red);
  font-weight: 600;
}

.text-line-through { text-decoration: line-through; }

.priority-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.priority-badge.priority-high { background: var(--accent-red-bg); color: var(--accent-red); }
.priority-badge.priority-medium { background: var(--accent-orange-bg); color: var(--accent-orange); }
.priority-badge.priority-low { background: var(--accent-green-bg); color: var(--accent-green); }

/* Deals */
.deal-total {
  color: var(--accent-green);
  font-size: 13px;
  font-weight: 600;
}

/* Calendar */
.calendar-nav span {
  font-size: 15px;
  font-weight: 600;
  min-width: 160px;
  text-align: center;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
  padding-bottom: 8px;
}

.calendar-weekday {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.event-count {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-blue);
  color: white;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

.event-icon { font-size: 18px; }
.event-info { display: flex; flex-direction: column; }
.event-title { color: var(--text-primary); font-weight: 500; }
.event-type { color: var(--text-muted); font-size: 12px; }

/* Notifications */
.notification-time {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
}

.notification-item {
  transition: var(--transition);
}

.notification-item.clickable {
  cursor: pointer;
}

.notification-item.clickable:hover {
  background: var(--bg-card-hover);
  border-radius: var(--radius-sm);
}

/* Backups */
.backup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.backup-row:last-child { border-bottom: none; }

.backup-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.backup-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-all;
}

.backup-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.backup-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Quick Add */
.quick-add-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  transition: var(--transition);
}

.quick-add-btn:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

#quickAddModal .modal-body {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

#quickAddModal .quick-add-btn {
  justify-content: center;
  min-height: 120px;
  padding: 16px 10px;
  text-align: center;
}

@media (max-width: 480px) {
  #quickAddModal .modal-body { grid-template-columns: 1fr; }
}

/* Deals drag & drop */
.deal-card { cursor: grab; user-select: none; }
.deal-card:active { cursor: grabbing; }
.deal-card.dragging {
  opacity: .45;
  transform: scale(.96) rotate(-1deg);
  box-shadow: var(--shadow);
}
.deal-column-body.drag-over {
  outline: 2px dashed var(--accent-blue);
  outline-offset: -6px;
  border-radius: var(--radius-sm);
}
.deal-column-body.drag-over .deal-card { pointer-events: none; }

/* Appeals */
.appeal-priority-bar.priority-high { background: var(--accent-red); }
.appeal-priority-bar.priority-medium { background: var(--accent-orange); }
.appeal-priority-bar.priority-low { background: var(--accent-green); }

.appeal-card { position: relative; }

.appeal-subject {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.appeal-meta-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.appeal-text-preview {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.file-attachment {
  font-size: 12px;
  color: var(--accent-blue);
}

.notes-count {
  font-size: 12px;
  color: var(--text-muted);
}

.time-ago {
  font-size: 12px;
  color: var(--text-muted);
}

/* Responsive v2 */
@media (max-width: 900px) {
  .filters-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-filter { width: 100%; }

  .guest-layout { flex-direction: column; }

  .guest-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .guest-content { padding: 24px 16px; }

  .detail-info-grid { grid-template-columns: 1fr; }

  .auth-card { padding: 24px; }
}

/* ===== V3: Chat + Users ===== */

.chat-messages {
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 4px;
  margin-bottom: 12px;
}

.admin-chat-messages {
  flex: 1;
  min-height: 0;
  max-height: none;
}

/* Chat page fills the whole viewport */
#page-chat.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

#page-chat.active > .page-header {
  flex-shrink: 0;
}

#page-chat.active > .card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#page-chat.active > .card > .card-body {
  flex: 1;
  min-height: 0;
  max-height: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 12px 16px 16px;
}

/* Chat layout: general chat + DMs */
.chat-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: minmax(0, 1fr);
  gap: 16px;
  min-height: 0;
  flex: 1;
}

.chat-sidebar {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  overflow-y: auto;
  padding: 8px;
  min-height: 0;
}

.chat-sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.chat-sidebar-item:hover { background: var(--bg-card-hover); }
.chat-sidebar-item.active { background: var(--primary-light); }

.chat-sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-purple);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.chat-sidebar-avatar.general {
  background: var(--accent-blue);
  color: #fff;
  font-size: 15px;
}

.chat-sidebar-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-sidebar-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-sidebar-sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-sidebar-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 12px 10px 4px;
}

.chat-window {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  padding: 12px 16px;
}

.chat-window-header {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.chat-window-header h3 {
  font-size: 14px;
  font-weight: 600;
}

@media (max-width: 768px) {
  .chat-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .chat-window { min-height: 55vh; }
  .admin-chat-messages { flex: none; max-height: 40vh; }
}

.chat-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 24px 12px;
  font-size: 14px;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

.chat-msg.them {
  align-self: flex-start;
  align-items: flex-start;
}

.chat-msg.me {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-msg-author {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0 6px 2px;
}

.chat-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--surface-2, #1e293b);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg.me .chat-msg-bubble {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
  border-bottom-right-radius: 4px;
}

.chat-msg.them .chat-msg-bubble {
  border-bottom-left-radius: 4px;
}

.chat-msg-time {
  font-size: 11px;
  color: var(--text-muted);
  margin: 3px 6px 0;
}

.chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-input-row textarea {
  flex: 1;
  resize: none;
}

.chat-last {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--surface-2, #1e293b);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Users page */

.user-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.user-row:last-child {
  border-bottom: none;
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.user-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .user-row {
    flex-wrap: wrap;
  }

  .user-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ===== Admin layout wrapper ===== */

.admin-view {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: auto 1fr;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(1100px 750px at -10% -10%, rgba(155, 109, 255, 0.20), transparent 58%),
    radial-gradient(1000px 700px at 112% 112%, rgba(76, 123, 245, 0.18), transparent 58%),
    radial-gradient(800px 520px at 55% 0%, rgba(34, 211, 238, 0.07), transparent 62%),
    linear-gradient(180deg, #151a2e 0%, #10131c 48%, #0f1117 100%);
}

.admin-view .sidebar {
  grid-row: 1 / 3;
}

.admin-view .header {
  grid-column: 2;
}

.admin-view .content {
  grid-column: 2;
  min-height: 0;
}

@media (max-width: 768px) {
  .admin-view {
    display: block;
  }

  .admin-view .content {
    height: calc(100vh - var(--header-height));
  }
}

/* Avatar + header polish */

.admin-avatar, .sidebar-avatar, .guest-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}

.guest-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo .brand-logo,
.brand-logo.brand-logo-box {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  margin-bottom: 0;
  font-size: 15px;
  flex-shrink: 0;
}

.sidebar-logo span {
  font-size: 14px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ===== Appeals v2 (note-style card grid) ===== */

.appeals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

.appeal-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  gap: 10px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.appeal-card:hover {
  border-color: var(--accent-blue);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.appeal-priority-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.appeal-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.appeal-card-header h4 {
  font-size: 15px;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appeal-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.appeal-subject {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.appeal-meta-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.appeal-text-preview {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.appeal-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== Calendar v2 ===== */

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  margin: 0;
}

#calendarMonthLabel {
  font-size: 15px;
  font-weight: 600;
  min-width: 150px;
  text-align: center;
}

.calendar-grid {
  display: block;
  margin: 0;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  padding-bottom: 10px;
}

.calendar-weekday {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 0;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.calendar-day {
  min-height: 82px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 4px;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-card);
}

.calendar-day.empty {
  border: none;
  background: transparent;
  cursor: default;
}

.calendar-day:hover { border-color: var(--border-light); background: var(--bg-card-hover); }
.calendar-day.today { border-color: var(--accent-blue); }
.calendar-day.selected { border-color: var(--accent-purple); background: var(--accent-purple-bg); }

.calendar-day-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.day-number {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.calendar-day.today .day-number {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.calendar-day.selected .day-number { color: var(--accent-purple); font-weight: 700; }

.cal-chip-count {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-blue);
  background: var(--accent-blue-bg);
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 16px;
  text-align: center;
}

.calendar-day-events {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
}

.cal-chip {
  font-size: 10px;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 5px;
  background: var(--bg-input);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.cal-chip:hover { color: var(--text-primary); }
.cal-chip.type-task { border-left: 2px solid var(--accent-orange); }
.cal-chip.type-deal { border-left: 2px solid var(--accent-green); }
.cal-chip.type-appeal { border-left: 2px solid var(--accent-blue); }
.cal-chip.more { text-align: center; font-weight: 700; color: var(--text-muted); cursor: default; }

.calendar-events-list {
  display: flex;
  flex-direction: column;
}

.cal-events-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.cal-events-date { font-size: 15px; font-weight: 700; }
.cal-events-count { font-size: 12px; color: var(--text-muted); }

.calendar-event-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.calendar-event-item:hover { border-color: var(--accent-blue); background: var(--bg-card-hover); }
.calendar-event-item.type-task { border-left: 3px solid var(--accent-orange); }
.calendar-event-item.type-deal { border-left: 3px solid var(--accent-green); }
.calendar-event-item.type-appeal { border-left: 3px solid var(--accent-blue); }

.event-go {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 16px;
}

@media (max-width: 1100px) {
  .calendar-layout { grid-template-columns: 1fr; }
  .calendar-day { min-height: 64px; }
}

/* ===== Notifications v2 dropdown ===== */

.notifications-panel {
  position: fixed;
  top: calc(var(--header-height) + 10px);
  right: 18px;
  width: 400px;
  max-width: calc(100vw - 36px);
  max-height: min(640px, calc(100vh - var(--header-height) - 40px));
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  z-index: 300;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: notifIn 0.18s ease;
}

.notifications-panel.open { display: flex; }

@keyframes notifIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.notif-header h3 { font-size: 14px; font-weight: 600; }

.notif-count-badge {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-input);
  border-radius: 20px;
  padding: 2px 10px;
}

.notif-list {
  padding: 8px;
  overflow-y: auto;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 4px;
}

.notification-item:hover { background: var(--bg-input); }

.notification-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.notification-item.n-appeal .notification-icon { background: var(--accent-blue-bg); }
.notification-item.n-task .notification-icon { background: var(--accent-orange-bg); }
.notification-item.n-deal .notification-icon { background: var(--accent-green-bg); }
.notification-item.n-activity .notification-icon { background: var(--bg-input); }

.notification-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notification-title { font-size: 13px; font-weight: 600; }
.notification-message { font-size: 12px; color: var(--text-secondary); line-height: 1.4; word-break: break-word; }
.notification-date { font-size: 11px; color: var(--text-muted); }
.notification-arrow { font-size: 16px; color: var(--text-muted); align-self: center; flex-shrink: 0; }

@media (max-width: 768px) {
  .notifications-panel { right: 8px; left: 8px; width: auto; }
}

/* ===== Sidebar collapse (desktop) ===== */

@media (min-width: 769px) {
  .admin-view {
    transition: grid-template-columns 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .admin-view .sidebar {
    transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.22s ease;
    overflow: hidden;
  }
  .admin-view.sidebar-collapsed {
    grid-template-columns: 0 1fr;
  }
  .admin-view.sidebar-collapsed .sidebar {
    margin-left: calc(-1 * var(--sidebar-width));
    opacity: 0;
    pointer-events: none;
  }
}

/* ===== Search results v2 (grouped) ===== */

.search-group-label {
  padding: 10px 14px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.search-result-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-input);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.search-result-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.search-result-name {
  font-size: 13px;
  font-weight: 500;
}

/* ===== Mobile v2 ===== */

html, body { height: 100%; }

@supports (height: 100dvh) {
  .app, .admin-view, .guest-layout { height: 100dvh; }
}

@media (max-width: 768px) {
  .header { padding: 0 12px; gap: 10px; }
  .header-left { flex: 1; min-width: 0; gap: 8px; }
  .header-right { gap: 8px; }
  .search-bar { width: auto; flex: 1; min-width: 0; padding: 8px 10px; }
  .content { padding: 12px; }

  .deals-board {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(240px, 74vw);
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }
  .deal-column { min-width: 0; }

  #page-calendar .card-body { overflow-x: auto; }
  .calendar-grid { min-width: 620px; }
  .calendar-layout { align-items: stretch; }

  .guest-content { padding: 16px 12px; }
  .guest-sidebar { padding: 12px; }
}

@media (max-width: 480px) {
  #quickAddBtn {
    font-size: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
  }
  #quickAddBtn::before { content: "+"; font-size: 20px; line-height: 1; }

  .search-bar svg { display: none; }
  .search-bar input { font-size: 12px; }
  .header { gap: 6px; }

  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 12px; }
  .stat-value { font-size: 17px; }

  .page-header h2 { font-size: 18px; }
  .page-header .btn-primary span { display: none; }
}
