/* === ProLynkCRM - Main Stylesheet === */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  /* ProLynkCRM Navy Theme */
  --primary: #0f2345;
  --primary-dark: #0a1a35;
  --primary-mid: #163160;
  --primary-light: #e8edf5;
  --accent: #2b6cb0;
  --accent-light: #ebf4ff;
  --bg: #f4f6f9;
  --bg-card: #ffffff;
  --text: #0f2345;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --info: #2563eb;
  --info-light: #eff6ff;
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --sidebar-bg: #0f2345;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15,35,69,0.06), 0 1px 2px rgba(15,35,69,0.04);
  --shadow-lg: 0 10px 25px rgba(15,35,69,0.1);
  --transition-speed: 0.25s;
}

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

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   AUTH PAGES
   ============================================ */
.auth-body {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0a1a35 0%, #0f2345 40%, #163160 100%);
  padding: 2rem;
}
.auth-container { width: 100%; max-width: 440px; }
.auth-card {
  background: var(--bg-card); border-radius: 16px;
  padding: 2.5rem; box-shadow: 0 25px 60px rgba(0,0,0,0.3);
}
.auth-logo {
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 2rem;
}
.auth-logo-img {
  height: 42px; width: auto;
}
.auth-card h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; color: var(--primary); }
.auth-subtitle { color: var(--text-muted); margin-bottom: 1.5rem; font-size: 0.9rem; }
.auth-footer { text-align: center; margin-top: 1.5rem; font-size: 0.9rem; color: var(--text-muted); }
.auth-footer a { color: var(--accent); font-weight: 600; text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }
.auth-form .form-group { margin-bottom: 1rem; }
.auth-form label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.35rem; color: var(--text); }
.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
  width: 100%; padding: 0.7rem 0.9rem;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 0.95rem; font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s; background: #f8fafc;
}
.auth-form input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(43,108,176,0.12); background: #fff;
}
.form-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; font-size: 0.85rem; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.checkbox-label { display: flex; align-items: center; gap: 6px; cursor: pointer; color: var(--text-muted); }

/* ============================================
   ALERTS
   ============================================ */
.alert { padding: 0.75rem 1rem; border-radius: 8px; font-size: 0.9rem; margin-bottom: 1rem; }
.alert-error { background: var(--danger-light); color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: var(--success-light); color: #166534; border: 1px solid #bbf7d0; }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0.55rem 1.1rem; border-radius: 8px;
  font-size: 0.875rem; font-weight: 600; font-family: inherit;
  border: none; cursor: pointer; text-decoration: none;
  transition: all 0.15s; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15,35,69,0.3); }
.btn-secondary { background: #f1f5f9; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger { background: var(--danger-light); color: var(--danger); }
.btn-danger:hover { background: #fee2e2; }
.btn-success { background: var(--success-light); color: var(--success); }
.btn-success:hover { background: #dcfce7; }
.btn-full { width: 100%; justify-content: center; padding: 0.75rem; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; border-radius: 6px; }
.btn-xs { padding: 0.2rem 0.5rem; font-size: 0.75rem; border-radius: 5px; background: #f1f5f9; color: var(--text-muted); }
.btn-xs:hover { background: #e2e8f0; }
.btn-group { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.text-link { color: var(--accent); text-decoration: none; font-weight: 500; font-size: 0.85rem; }
.text-link:hover { text-decoration: underline; }

/* ============================================
   APP LAYOUT
   ============================================ */
.app-body { display: flex; min-height: 100vh; }

/* --- Sidebar Overlay (mobile) --- */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,35,69,0.6); z-index: 99;
  opacity: 0; transition: opacity 0.3s;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; opacity: 1; }

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: #cbd5e1;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width var(--transition-speed) ease;
  overflow: hidden;
}
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,0.08);
  min-height: 60px;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: #fff; white-space: nowrap; overflow: hidden;
}
.sidebar-logo-img {
  height: 30px; width: auto; flex-shrink: 0;
  filter: brightness(0) invert(1);
}
.sidebar-logo-text {
  font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em;
  transition: opacity var(--transition-speed);
}
.sidebar-collapse-btn {
  background: none; border: none; color: rgba(255,255,255,0.4);
  cursor: pointer; padding: 4px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.15s, background 0.15s; flex-shrink: 0;
}
.sidebar-collapse-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }

.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 1rem 0; }
.nav-section { margin-bottom: 1.5rem; }
.nav-label {
  display: block; padding: 0 1.25rem; font-size: 0.68rem;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: rgba(255,255,255,0.3); margin-bottom: 0.5rem;
  white-space: nowrap; overflow: hidden;
  transition: opacity var(--transition-speed);
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 0.6rem 1.25rem; color: rgba(255,255,255,0.6);
  text-decoration: none; font-size: 0.9rem; font-weight: 500;
  transition: all 0.15s; border-left: 3px solid transparent;
  white-space: nowrap; overflow: hidden;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.06); }
.nav-item.active {
  color: #fff; background: rgba(43,108,176,0.2);
  border-left-color: #4a9eed;
}
.nav-item svg { flex-shrink: 0; opacity: 0.6; min-width: 20px; }
.nav-item.active svg { opacity: 1; }
.nav-text { transition: opacity var(--transition-speed); }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
}
.user-info { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 8px;
  background: linear-gradient(135deg, #2b6cb0, #4a9eed);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; flex-shrink: 0;
}
.user-details { display: flex; flex-direction: column; overflow: hidden; transition: opacity var(--transition-speed); }
.user-name { font-size: 0.85rem; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.75rem; color: rgba(255,255,255,0.45); }

/* --- Sidebar Collapsed State --- */
.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-width); }
.sidebar-collapsed .sidebar-logo-text,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .nav-text,
.sidebar-collapsed .user-details { opacity: 0; width: 0; }
.sidebar-collapsed .sidebar-header { justify-content: center; padding: 1rem 0.75rem; }
.sidebar-collapsed .sidebar-logo { justify-content: center; }
.sidebar-collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }
.sidebar-collapsed .nav-item { justify-content: center; padding: 0.6rem; border-left: none; }
.sidebar-collapsed .sidebar-footer { padding: 1rem 0.75rem; display: flex; justify-content: center; }
.sidebar-collapsed .user-info { justify-content: center; }
.sidebar-collapsed .main-content { margin-left: var(--sidebar-collapsed-width); }

/* --- Main Content --- */
.main-content {
  flex: 1; margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left var(--transition-speed) ease;
}

/* --- Top Bar --- */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2rem; height: 60px;
  background: var(--bg-card); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.top-bar-left { display: flex; align-items: center; gap: 1rem; }
.top-bar-title { font-size: 1rem; font-weight: 600; color: var(--text-muted); }
.sidebar-toggle {
  display: none; background: none; border: none; cursor: pointer;
  color: var(--text); padding: 4px; border-radius: 6px;
}
.sidebar-toggle:hover { background: #f1f5f9; }
.top-bar-right { display: flex; align-items: center; gap: 0.75rem; }

/* --- Top Bar Clock --- */
.top-bar-clock {
  font-size: 0.8rem; color: var(--text-muted); white-space: nowrap;
  font-weight: 500; letter-spacing: 0.01em;
}

/* --- Notification Button --- */
.notif-btn {
  position: relative; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); text-decoration: none;
  width: 38px; height: 38px; border-radius: 8px; transition: all 0.15s;
}
.notif-btn:hover { background: #f1f5f9; color: var(--text); }
.notif-badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--danger); color: #fff;
  font-size: 0.6rem; font-weight: 700;
  padding: 1px 5px; border-radius: 10px; line-height: 1.4;
  border: 2px solid var(--bg-card);
}

/* --- User Dropdown --- */
.user-dropdown { position: relative; }
.user-dropdown-trigger {
  display: flex; align-items: center; gap: 8px;
  background: none; border: 1px solid var(--border);
  cursor: pointer; padding: 5px 12px 5px 5px;
  border-radius: 8px; font-family: inherit; transition: all 0.15s;
}
.user-dropdown-trigger:hover { background: #f8fafc; border-color: #cbd5e1; }
.user-avatar-sm {
  width: 30px; height: 30px; border-radius: 6px;
  background: linear-gradient(135deg, #0f2345, #2b6cb0);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.75rem; flex-shrink: 0;
}
.user-dropdown-name { font-size: 0.85rem; font-weight: 500; color: var(--text); }
.user-dropdown-trigger svg:last-child { color: var(--text-muted); transition: transform 0.2s; }

.user-dropdown-menu {
  display: none; position: absolute;
  right: 0; top: calc(100% + 8px);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-lg);
  min-width: 220px; overflow: hidden; z-index: 200;
  animation: dropdownFadeIn 0.15s ease;
}
.user-dropdown-menu.open { display: block; }

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

.dropdown-user-info { padding: 0.85rem 1rem; display: flex; flex-direction: column; gap: 2px; }
.dropdown-user-info strong { font-size: 0.9rem; color: var(--text); }
.dropdown-user-info span { font-size: 0.8rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
.dropdown-divider { height: 1px; background: var(--border); }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 0.65rem 1rem; color: var(--text);
  text-decoration: none; font-size: 0.875rem; font-weight: 500; transition: background 0.1s;
}
.dropdown-item:hover { background: #f8fafc; }
.dropdown-item svg { color: var(--text-muted); flex-shrink: 0; }
.dropdown-item-danger { color: var(--danger); }
.dropdown-item-danger svg { color: var(--danger); }
.dropdown-item-danger:hover { background: var(--danger-light); }

/* ============================================
   PAGE CONTENT
   ============================================ */
.page-content { padding: 1.75rem 2rem; max-width: 1400px; }
.page-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 1.5rem; gap: 1rem; flex-wrap: wrap;
}
.page-header h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.15rem; color: var(--primary); }
.page-header .text-muted { font-size: 0.9rem; }

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1rem; padding: 20px;
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 0.95rem; font-weight: 600; color: var(--primary); }
.card-body { padding: 1.25rem; }

/* ============================================
   STATS
   ============================================ */
.dashboard-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  box-shadow: var(--shadow); position: relative;
}
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; color: var(--primary); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
.stat-sub { position: absolute; bottom: 0.75rem; right: 1rem; font-size: 0.75rem; color: var(--text-muted); }
.stat-sm { padding: 1rem; }
.stat-sm .stat-value { font-size: 1.25rem; }

/* ============================================
   DASHBOARD COLUMNS
   ============================================ */
.dashboard-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

/* ============================================
   FILTERS
   ============================================ */
.filters-bar { margin-bottom: 1rem; }
.filter-form { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.input-search {
  padding: 0.5rem 0.9rem; border: 1.5px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 0.9rem; min-width: 200px; background: #fff;
}
.input-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(43,108,176,0.1); }
select {
  padding: 0.5rem 0.9rem; border: 1.5px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 0.9rem; background: #fff; cursor: pointer;
}
select:focus { outline: none; border-color: var(--accent); }

/* ============================================
   TABLES
   ============================================ */
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 0.75rem 1rem; text-align: left; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted);
  font-weight: 600; border-bottom: 1px solid var(--border); background: #f8fafc;
}
.data-table th a { color: inherit; text-decoration: none; }
.data-table td { padding: 0.75rem 1rem; border-bottom: 1px solid #f1f5f9; font-size: 0.9rem; vertical-align: middle; }
.data-table tr:hover { background: #f8fafc; }
.data-table tr:last-child td { border-bottom: none; }
.font-medium { font-weight: 600; }

/* ============================================
   BADGES
   ============================================ */
.badge {
  display: inline-block; padding: 0.2rem 0.6rem; border-radius: 20px;
  font-size: 0.72rem; font-weight: 600; color: #fff; text-transform: capitalize;
}
.badge-lead { background: #94a3b8; }
.badge-prospect { background: #3b82f6; }
.badge-customer { background: var(--success); }
.badge-inactive { background: #9ca3af; }

/* ============================================
   LIST ITEMS
   ============================================ */
.list-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.65rem 0; border-bottom: 1px solid #f1f5f9; font-size: 0.9rem;
}
.list-item:last-child { border-bottom: none; }
.list-item a { color: var(--accent); text-decoration: none; font-weight: 500; }
.list-item-info { display: flex; flex-direction: column; gap: 2px; }
.list-item-right { display: flex; align-items: center; gap: 0.75rem; }
.list-item.overdue { background: var(--danger-light); margin: 0 -1.25rem; padding: 0.65rem 1.25rem; border-radius: 6px; }
.priority-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ============================================
   EMPTY STATES
   ============================================ */
.empty-state { text-align: center; padding: 2rem; color: var(--text-muted); font-size: 0.9rem; }
.empty-state-large { text-align: center; padding: 4rem 2rem; }
.empty-state-large h3 { margin-bottom: 0.5rem; color: var(--primary); }

/* ============================================
   PIPELINE BARS
   ============================================ */
.pipeline-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.pipeline-label { font-size: 0.82rem; font-weight: 500; min-width: 90px; }
.pipeline-bar-wrap { flex: 1; height: 8px; background: #f1f5f9; border-radius: 4px; overflow: hidden; }
.pipeline-bar { height: 100%; border-radius: 4px; transition: width 0.5s; }
.pipeline-val { font-size: 0.78rem; color: var(--text-muted); min-width: 120px; text-align: right; }

/* ============================================
   ACTIVITY FEED
   ============================================ */
.activity-feed { max-height: 400px; overflow-y: auto; }
.activity-item { display: flex; gap: 12px; padding: 0.6rem 0; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex-shrink: 0; }
.activity-content { display: flex; flex-direction: column; gap: 1px; }
.activity-user { font-size: 0.82rem; font-weight: 600; color: var(--primary); }
.activity-text { font-size: 0.85rem; color: var(--text-muted); }
.activity-time { font-size: 0.75rem; color: #94a3b8; }

/* ============================================
   DETAIL PAGES
   ============================================ */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }
.detail-main, .detail-side { min-width: 0; }
.detail-rows { display: flex; flex-direction: column; }
.detail-row { display: flex; padding: 0.65rem 0; border-bottom: 1px solid #f1f5f9; }
.detail-label { font-size: 0.82rem; color: var(--text-muted); font-weight: 500; min-width: 120px; }
.detail-value { font-size: 0.9rem; }
.detail-value a { color: var(--accent); text-decoration: none; }
.detail-notes { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #f1f5f9; }
.detail-notes strong { font-size: 0.85rem; }
.detail-notes p { margin-top: 0.35rem; font-size: 0.9rem; color: var(--text-muted); white-space: pre-wrap; }
.compact-details { display: flex; gap: 1.5rem; margin-bottom: 0.5rem; font-size: 0.85rem; color: var(--text-muted); }

/* ============================================
   FORMS
   ============================================ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { display: flex; flex-direction: column; }
.form-group label { font-size: 0.82rem; font-weight: 500; margin-bottom: 0.3rem; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
  padding: 0.55rem 0.8rem; border: 1.5px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 0.9rem; transition: border-color 0.2s; background: #fff;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(43,108,176,0.1);
}
.form-group textarea { resize: vertical; min-height: 60px; }
.form-group.full-width { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 0.75rem; padding-top: 0.5rem; }
.form-stack { display: flex; flex-direction: column; gap: 1rem; }
.form-inline { display: flex; gap: 0.5rem; align-items: flex-end; flex-wrap: wrap; }

/* ============================================
   TABS
   ============================================ */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; }
.tab {
  padding: 0.75rem 1.25rem; background: none; border: none; font-family: inherit;
  font-size: 0.9rem; font-weight: 500; color: var(--text-muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============================================
   PROJECTS
   ============================================ */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.project-card { transition: transform 0.15s, box-shadow 0.15s; }
.project-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.project-card h3 a { color: var(--primary); text-decoration: none; font-size: 1.05rem; }
.project-card h3 a:hover { color: var(--accent); }
.project-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.project-meta { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); margin-top: 0.75rem; }
.progress-bar { height: 6px; background: #f1f5f9; border-radius: 3px; overflow: hidden; margin-top: 0.75rem; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 3px; transition: width 0.5s; }

/* ============================================
   KANBAN
   ============================================ */
.kanban-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 1rem; }
.kanban-column { background: #f8fafc; border-radius: var(--radius); padding: 0.75rem; min-height: 200px; }
.kanban-header { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem; margin-bottom: 0.5rem; }
.kanban-header h4 { font-size: 0.85rem; font-weight: 600; color: var(--primary); }
.kanban-count { background: var(--primary-light); color: var(--primary); padding: 0.1rem 0.5rem; border-radius: 10px; font-size: 0.75rem; font-weight: 600; }
.kanban-cards { display: flex; flex-direction: column; gap: 0.5rem; }
.kanban-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.75rem; box-shadow: var(--shadow); transition: box-shadow 0.15s;
}
.kanban-card:hover { box-shadow: var(--shadow-lg); }
.kanban-card-header { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 0.5rem; }
.kanban-title { font-size: 0.85rem; font-weight: 500; }
.kanban-card-meta { display: flex; gap: 0.5rem; font-size: 0.75rem; color: var(--text-muted); flex-wrap: wrap; align-items: center; }
.kanban-assignee { background: var(--accent-light); color: var(--accent); padding: 1px 6px; border-radius: 4px; font-weight: 500; }
.kanban-assignees { display: flex; gap: 3px; flex-wrap: wrap; }
.assignee-chip { background: var(--accent-light); color: var(--accent); padding: 1px 6px; border-radius: 4px; font-weight: 500; font-size: 0.72rem; }
.kanban-desc { font-size: 0.78rem; color: var(--text-muted); margin: 4px 0 2px; line-height: 1.4; }
.multi-select { min-height: 36px; max-height: 80px; }

/* Multi-Select Autocomplete */
.ms-wrap { position: relative; }
.ms-container { border: 1px solid var(--border); border-radius: 6px; background: var(--surface); cursor: text; transition: border-color 0.15s; }
.ms-container:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.ms-tags { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 8px; min-height: 36px; align-items: center; background: white; border-radius: 6px; }
.ms-tag { display: inline-flex; align-items: center; gap: 2px; background: var(--accent-light); color: var(--accent); font-size: 0.78rem; font-weight: 600; padding: 2px 6px 2px 8px; border-radius: 4px; white-space: nowrap; }
.ms-tag-x { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 2px; opacity: 0.6; }
.ms-tag-x:hover { opacity: 1; }
.ms-input { border: none; outline: none; background: white; font-size: 0.85rem; min-width: 80px; flex: 1; padding: 4px 0; color: var(--text); font-family: inherit; }
.ms-input::placeholder { color: var(--text-muted); }
.ms-dropdown { position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,0.12); z-index: 50; max-height: 180px; overflow-y: auto; display: none; margin-top: 4px; }
.ms-dropdown.open { display: block; }
.ms-option { padding: 8px 12px; font-size: 0.85rem; cursor: pointer; transition: background 0.1s; }
.ms-option:hover { background: var(--accent-light); color: var(--accent); }
.ms-no-results { padding: 8px 12px; font-size: 0.82rem; color: var(--text-muted); }

/* Time Badge on kanban */
.ts-badge { background: #dbeafe; color: #1e40af; font-size: 0.68rem; font-weight: 700; padding: 1px 6px; border-radius: 4px; margin-left: auto; white-space: nowrap; }

/* Task Detail Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay.open { display: flex; }
.modal-content { background: white; border-radius: 12px; width: 100%; max-width: 600px; max-height: 85vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.2); animation: modalIn 0.2s ease; }
@keyframes modalIn { from { opacity:0; transform:translateY(20px) scale(0.97); } to { opacity:1; transform:translateY(0) scale(1); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 1.15rem; margin: 0; color: var(--text); }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); padding: 0; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 1.5rem; overflow-y: auto; flex: 1; }
.modal-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 0.5rem; }
.modal-detail { display: flex; flex-direction: column; gap: 2px; }
.modal-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.modal-section { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.modal-section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.modal-section-header h3 { font-size: 0.95rem; margin: 0; color: var(--text); }
.modal-time-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.modal-time-table th { text-align: left; padding: 6px 8px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.modal-time-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); }
.modal-time-table tr:last-child td { border-bottom: none; }
.modal-footer { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }

/* Calendar Grid */
.cal-grid { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.cal-header-row { display: grid; grid-template-columns: repeat(7,1fr); border-bottom: 1px solid var(--border); }
.cal-header-cell { padding: 8px; text-align: center; font-size: 0.78rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; background: #f8fafc; }
.cal-row { display: grid; grid-template-columns: repeat(7,1fr); }
.cal-cell { min-height: 100px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px 6px; position: relative; }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-row:last-child .cal-cell { border-bottom: none; }
.cal-outside { background: #f9fafb; }
.cal-outside .cal-day-num { color: #c0c8d4; }
.cal-today { background: #eff6ff; }
.cal-today .cal-day-num { background: var(--accent); color: #fff; border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
.cal-day-num { font-size: 0.82rem; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.cal-event { display: block; font-size: 0.7rem; color: #fff; padding: 1px 5px; border-radius: 3px; margin-bottom: 2px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.cal-event:hover { filter: brightness(0.9); }
.cal-more { font-size: 0.68rem; color: var(--text-muted); font-weight: 500; }

/* Color Picker */
.color-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.color-opt { cursor: pointer; }
.color-opt input { display: none; }
.color-opt span { display: block; width: 28px; height: 28px; border-radius: 6px; border: 2px solid transparent; transition: border-color 0.15s, transform 0.15s; }
.color-opt input:checked + span { border-color: var(--text); transform: scale(1.15); }

/* Timesheet */
.ts-week { display: grid; grid-template-columns: repeat(7,1fr); gap: 8px; }
.ts-day { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; min-height: 200px; display: flex; flex-direction: column; }
.ts-today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ts-day-header { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: #f8fafc; border-radius: 8px 8px 0 0; }
.ts-day-name { font-size: 0.78rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.ts-day-date { font-size: 0.88rem; font-weight: 700; color: var(--text); }
.ts-day-total { margin-left: auto; font-size: 0.78rem; font-weight: 700; color: var(--accent); }
.ts-entries { flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.ts-entry { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 6px 8px; background: #f1f5f9; border-radius: 6px; }
.ts-entry-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.ts-entry-info strong { font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ts-entry-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.ts-hours { font-size: 0.78rem; font-weight: 700; color: var(--accent); }
.ts-quick-add { display: flex; gap: 4px; margin-top: auto; padding-top: 4px; border-top: 1px dashed var(--border); }
.ts-quick-add select, .ts-quick-add input { font-size: 0.75rem; padding: 4px; border: 1px solid var(--border); border-radius: 4px; }

/* Approval cards */
.approval-list { display: flex; flex-direction: column; gap: 1rem; }
.approval-card { padding: 1.25rem; }
.approval-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }

/* Permission Matrix */
.perm-matrix { overflow-x: auto; }
.perm-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.perm-table th { text-align: center; padding: 8px 12px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); border-bottom: 2px solid var(--border); }
.perm-table th:first-child { text-align: left; }
.perm-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.perm-table tr:last-child td { border-bottom: none; }
.perm-table tr:hover { background: #f8fafc; }
.perm-cell { text-align: center; }
.perm-check { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.perm-check input { display: none; }
.perm-box { width: 20px; height: 20px; border: 2px solid var(--border); border-radius: 4px; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.perm-check input:checked + .perm-box { background: var(--accent); border-color: var(--accent); }
.perm-check input:checked + .perm-box::after { content: '✓'; color: #fff; font-size: 0.75rem; font-weight: 700; }
.perm-check-inline { display: inline-flex; align-items: center; gap: 4px; font-size: 0.78rem; cursor: pointer; text-transform: capitalize; white-space: nowrap; }
.perm-check-inline input { accent-color: var(--accent); }

/* Responsive calendar/timesheet */
@media (max-width: 1024px) {
  .ts-week { grid-template-columns: 1fr; }
  .ts-day { min-height: auto; }
  .cal-cell { min-height: 70px; }
  .cal-event { font-size: 0.65rem; }
}
.kanban-due.overdue { color: var(--danger); font-weight: 600; }
.kanban-actions { display: flex; gap: 4px; margin-top: 0.5rem; }

.task-add-bar { margin-bottom: 0.5rem; }
.task-add-form { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.task-input {
  flex: 1; min-width: 200px; padding: 0.55rem 0.8rem;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 0.9rem;
}
.task-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(43,108,176,0.1); }

/* ============================================
   INVOICE
   ============================================ */
.invoice-preview {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow);
}
.invoice-header-row { display: flex; justify-content: space-between; margin-bottom: 2rem; }
.invoice-header-row h2 { color: var(--primary); }
.invoice-meta { text-align: right; font-size: 0.9rem; }
.invoice-meta p { margin-bottom: 0.25rem; }
.invoice-bill-to { margin-bottom: 2rem; }
.invoice-bill-to h4 { font-size: 0.8rem; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.5rem; }
.invoice-table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; }
.invoice-table th { padding: 0.75rem 1rem; text-align: left; font-size: 0.8rem; text-transform: uppercase; color: var(--text-muted); border-bottom: 2px solid var(--primary-light); }
.invoice-table td { padding: 0.75rem 1rem; border-bottom: 1px solid #f1f5f9; }
.invoice-table tfoot td { border-bottom: none; padding: 0.5rem 1rem; }
.invoice-table .total-row td { font-size: 1.1rem; padding-top: 0.75rem; border-top: 2px solid var(--primary); color: var(--primary); }
.text-right { text-align: right; }
.invoice-notes { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid #f1f5f9; }
.invoice-notes h4 { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.35rem; }

.invoice-form .invoice-item-row { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }
.item-desc { flex: 3; padding: 0.5rem 0.8rem; border: 1.5px solid var(--border); border-radius: 8px; font-family: inherit; font-size: 0.9rem; }
.item-qty { flex: 0.7; padding: 0.5rem 0.8rem; border: 1.5px solid var(--border); border-radius: 8px; font-family: inherit; font-size: 0.9rem; }
.item-price { flex: 1; padding: 0.5rem 0.8rem; border: 1.5px solid var(--border); border-radius: 8px; font-family: inherit; font-size: 0.9rem; }
.item-desc:focus, .item-qty:focus, .item-price:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(43,108,176,0.1); }
.item-amount { flex: 0.8; font-weight: 600; font-size: 0.9rem; text-align: right; min-width: 80px; color: var(--primary); }
.invoice-total { font-size: 1.5rem; font-weight: 700; color: var(--primary); padding: 0.5rem 0; }

/* ============================================
   NOTIFICATIONS
   ============================================ */
.notification-item {
  display: flex; gap: 1rem; align-items: flex-start; padding: 1rem;
  border-bottom: 1px solid #f1f5f9; transition: background 0.15s;
}
.notification-item:hover { background: #f8fafc; }
.notification-item.unread { background: var(--accent-light); }
.notif-icon { font-size: 1.25rem; }
.notif-content { flex: 1; }
.notif-content strong { font-size: 0.9rem; color: var(--primary); }
.notif-content p { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }

/* ============================================
   SETTINGS & ROLES
   ============================================ */
.settings-grid { display: flex; flex-direction: column; gap: 1rem; }
.role-card { padding: 1rem 0; border-bottom: 1px solid #f1f5f9; }
.role-card:last-child { border-bottom: none; }
.role-card h4 { margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.5rem; color: var(--primary); }
.role-perms { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.role-perms .badge { background: #f1f5f9; color: var(--text-muted); font-size: 0.7rem; }

/* ============================================
   PAGINATION
   ============================================ */
.pagination { display: flex; gap: 4px; justify-content: center; padding: 1rem; }
.page-btn { padding: 0.4rem 0.75rem; border-radius: 6px; font-size: 0.85rem; color: var(--text-muted); text-decoration: none; font-weight: 500; }
.page-btn:hover { background: #f1f5f9; }
.page-btn.active { background: var(--primary); color: #fff; }

/* ============================================
   UTILITIES
   ============================================ */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.82rem; }
.onboarding { max-width: 500px; margin: 3rem auto; text-align: center; }
.onboarding h1 { margin-bottom: 1.5rem; font-size: 1.3rem; color: var(--primary); }
.error-page { text-align: center; padding: 4rem 2rem; }
.error-page h1 { margin-bottom: 1rem; color: var(--primary); }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .dashboard-columns { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .kanban-board { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
    box-shadow: 4px 0 24px rgba(15,35,69,0.3);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-collapsed .sidebar { width: var(--sidebar-width) !important; }
  .sidebar-collapsed .sidebar-logo-text,
  .sidebar-collapsed .nav-label,
  .sidebar-collapsed .nav-text,
  .sidebar-collapsed .user-details { opacity: 1; width: auto; }
  .sidebar-collapsed .sidebar-header { justify-content: space-between; padding: 1rem 1.25rem; }
  .sidebar-collapsed .sidebar-logo { justify-content: flex-start; }
  .sidebar-collapsed .nav-item { justify-content: flex-start; padding: 0.6rem 1.25rem; border-left: 3px solid transparent; }
  .sidebar-collapsed .sidebar-footer { padding: 1rem 1.25rem; justify-content: flex-start; }
  .sidebar-collapsed .user-info { justify-content: flex-start; }
  .sidebar-collapse-btn { display: none; }
  .sidebar-toggle { display: flex; }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 1.25rem 1rem; }
  .top-bar { padding: 0 1rem; }
  .form-grid { grid-template-columns: 1fr; }
  .kanban-board { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .form-row-2 { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .invoice-header-row { flex-direction: column; gap: 1rem; }
  .invoice-form .invoice-item-row { flex-wrap: wrap; }
  .project-grid { grid-template-columns: 1fr; }
  .top-bar-title { display: none; }
  .top-bar-clock { display: none; }
  .user-dropdown-name { display: none; }
}

@media (max-width: 480px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 1.75rem; }
}

/* ─── Reports ──────────────────────────────────── */
.report-category { margin-bottom: 2rem; }
.report-category-title { font-size: 1rem; font-weight: 700; color: var(--navy, #0f2345); margin: 0 0 0.75rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--border, #e2e8f0); }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.report-card { display: block; background: #fff; border: 1px solid var(--border, #e2e8f0); border-radius: 10px; padding: 1.25rem; text-decoration: none; color: inherit; transition: border-color 0.2s, box-shadow 0.2s; }
.report-card:hover { border-color: var(--accent, #2b6cb0); box-shadow: 0 4px 16px rgba(0,0,0,0.06); }
.report-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 0.5rem; }
.report-card-icon { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; background: #eef2ff; color: var(--accent, #2b6cb0); flex-shrink: 0; }
.report-card h4 { margin: 0; font-size: 0.92rem; font-weight: 600; color: var(--navy, #0f2345); }
.report-card p { margin: 0; font-size: 0.82rem; color: #64748b; line-height: 1.45; }

.report-controls { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1.25rem; margin-bottom: 1rem; }
.report-filter-form { display: flex; align-items: flex-end; gap: 0.75rem; flex-wrap: wrap; }
.report-filter-form .form-group { margin-bottom: 0; min-width: 140px; }
.report-filter-form .form-label { font-size: 0.78rem; margin-bottom: 4px; }
.report-export-btns { display: flex; gap: 0.5rem; }
.report-export-btns .btn { display: inline-flex; align-items: center; gap: 6px; }

.report-stats { display: flex; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.stat-badge { background: #fff; border: 1px solid var(--border, #e2e8f0); border-radius: 8px; padding: 0.6rem 1rem; display: flex; align-items: baseline; gap: 6px; }
.stat-badge strong { font-size: 1.1rem; color: var(--navy, #0f2345); }
.stat-badge span { font-size: 0.78rem; color: #64748b; }

.table-container { overflow-x: auto; padding: 20px; }
.table-container .data-table { margin: 0; border-radius: 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table thead th { background: var(--navy, #0f2345); color: #fff; padding: 0.65rem 0.75rem; font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap; text-align: left; position: sticky; top: 0; }
.data-table tbody td { padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--border, #e2e8f0); color: #334155; }
.data-table tbody tr:nth-child(even) { background: #f8fafc; }
.data-table tbody tr:hover { background: #eef2ff; }

.empty-state { text-align: center; padding: 3rem 1rem; color: #64748b; }

@media (max-width: 768px) {
  .report-grid { grid-template-columns: 1fr; }
  .report-controls { flex-direction: column; align-items: stretch; }
  .report-filter-form { flex-direction: column; }
  .report-export-btns { justify-content: flex-start; }
  .report-stats { flex-direction: column; }
}