/* Limitless Leadership CRM — Deep Navy + Amber/Gold theme */
:root {
  --bg-page: #F3F4F6;
  --bg-card: #0A0F1A;
  --bg-card-hover: #131A2B;
  --bg-card-deep: #060A14;
  --bg-sidebar: #060A14;
  --bg-input: #0E1322;
  --bg-input-light: #FFFFFF;
  --accent: #D4A84B;
  --accent-bright: #E0B85C;
  --accent-dim: rgba(212, 168, 75, 0.15);
  --accent-glow: rgba(212, 168, 75, 0.25);
  --accent-light: rgba(212, 168, 75, 0.08);
  --green: #22C55E;
  --green-dim: rgba(34, 197, 94, 0.15);
  --yellow: #EAB308;
  --yellow-dim: rgba(234, 179, 8, 0.15);
  --red: #EF4444;
  --red-dim: rgba(239, 68, 68, 0.12);
  --blue: #3B82F6;
  --blue-dim: rgba(59, 130, 246, 0.12);
  --teal: #14B8A6;
  --teal-dim: rgba(20, 184, 166, 0.12);
  /* Text on dark cards */
  --text-on-card: #F0F2F1;
  --text-on-card-secondary: #A8B0AF;
  --text-on-card-muted: #6B7370;
  /* Text on light page background */
  --text-page: #111827;
  --text-page-secondary: #4B5563;
  --text-page-muted: #9CA3AF;
  /* Legacy aliases */
  --text-primary: #F0F2F1;
  --text-secondary: #A8B0AF;
  --text-muted: #6B7370;
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);
  --border-light: rgba(0, 0, 0, 0.08);
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-page);
  color: var(--text-page);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

.app-layout.no-shell {
  display: block;
}

/* Sidebar */
.sidebar {
  width: 240px;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo-icon {
  color: var(--accent);
  flex-shrink: 0;
}

.sidebar-logo-text h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.01em;
}

.sidebar-logo-text span {
  font-size: 11px;
  color: var(--text-on-card-muted);
  display: block;
  margin-top: 2px;
  font-weight: 400;
}

.sidebar-logo h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.01em;
}

.sidebar-logo span {
  font-size: 11px;
  color: var(--text-on-card-muted);
  display: block;
  margin-top: 2px;
  font-weight: 400;
}

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-on-card-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-nav a.active {
  color: #FFFFFF;
  background: var(--accent-dim);
  border-left-color: var(--accent);
}

.sidebar-nav a svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-nav .nav-badge {
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: auto;
}

.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

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

.sidebar-user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-on-card);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px;
  color: var(--text-on-card-muted);
  text-transform: capitalize;
}

.sidebar-logout {
  background: none;
  border: none;
  color: var(--text-on-card-muted);
  cursor: pointer;
  padding: 4px;
  transition: color 0.15s;
}

.sidebar-logout:hover { color: var(--red); }

/* Main content */
.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 28px 36px;
  min-width: 0;
  background: var(--bg-page);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.main-content:has(.stats-row),
.main-content:has(.import-page) {
  overflow: auto;
}

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

.page-header h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-page);
  letter-spacing: -0.02em;
}

.page-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.card h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-on-card);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #000000;
}

.btn-primary:hover { background: var(--accent-bright); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--bg-card-deep);
  color: var(--text-on-card-secondary);
  border: 1px solid var(--border);
}

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

.btn-danger {
  background: #c0392b;
  color: #FFFFFF;
}

.btn-danger:hover { background: #a93226; }
.btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-sm { padding: 5px 10px; font-size: 12px; }

.page-header .btn-primary {
  box-shadow: 0 1px 3px rgba(212, 168, 75, 0.3);
}

/* Form elements */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--text-on-card);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 168, 75, 0.15);
}

select { cursor: pointer; appearance: auto; }
textarea { resize: vertical; min-height: 72px; }

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-on-card-secondary);
  margin-bottom: 6px;
}

.field-group { margin-bottom: 16px; }
.field-group:last-child { margin-bottom: 0; }

/* Filter bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.filter-bar .search-input {
  flex: 1;
  min-width: 200px;
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  color: var(--text-page);
}

.filter-bar .search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 168, 75, 0.1);
}

.filter-bar .search-input::placeholder {
  color: var(--text-page-muted);
}

.filter-bar select {
  width: auto;
  min-width: 140px;
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  color: var(--text-page);
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-new { background: var(--blue-dim); color: var(--blue); }
.badge-active { background: var(--green-dim); color: var(--green); }
.badge-warning { background: var(--yellow-dim); color: var(--yellow); }
.badge-error { background: var(--red-dim); color: var(--red); }
.badge-complete { background: var(--teal-dim); color: var(--teal); }
.badge-action { background: rgba(212, 168, 75, 0.15); color: #D4A84B; font-weight: 600; animation: pulse-badge 2s ease-in-out infinite; }
@keyframes pulse-badge { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }
.badge-default { background: var(--accent-dim); color: var(--accent-bright); }
.badge-purple { background: rgba(139, 92, 246, 0.15); color: #8B5CF6; }
.badge-amber { background: rgba(212, 168, 75, 0.15); color: #D4A84B; }

/* Stat cards row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-on-card-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.stat-card .stat-value {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-on-card);
  letter-spacing: -0.02em;
}

.stat-card .stat-sub {
  font-size: 12px;
  color: var(--text-on-card-secondary);
  margin-top: 2px;
}

/* Login page */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: #060A14;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(212, 168, 75, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(212, 168, 75, 0.04) 0%, transparent 50%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 30h60M30 0v60' stroke='%23ffffff' stroke-width='0.3' opacity='0.04'/%3E%3C/svg%3E");
  z-index: 0;
}

.login-accent {
  position: absolute;
  top: -20%;
  right: -10%;
  width: 55%;
  height: 140%;
  background: linear-gradient(135deg, rgba(212, 168, 75, 0.06) 0%, rgba(212, 168, 75, 0.01) 100%);
  transform: skewX(-12deg);
  border-left: 1px solid rgba(212, 168, 75, 0.1);
  z-index: 0;
}

.login-card {
  background: #FFFFFF;
  border: none;
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.05);
  position: relative;
  z-index: 1;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.login-logo-icon {
  width: 44px;
  height: 44px;
  background: #0A0F1A;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.login-logo-icon svg {
  width: 26px;
  height: 26px;
  color: var(--accent);
}

.login-card h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 26px;
  font-weight: 800;
  color: #0A0F1A;
  text-align: center;
  margin-bottom: 4px;
  letter-spacing: -0.03em;
}

.login-card .login-subtitle {
  font-size: 14px;
  color: #6B7280;
  text-align: center;
  margin-bottom: 32px;
  font-weight: 400;
}

.login-card .field-group label {
  color: #374151;
  font-weight: 500;
  font-size: 13px;
}

.login-card input[type="email"],
.login-card input[type="password"] {
  background: #F9FAFB;
  border: 1px solid #D1D5DB;
  color: #111827;
  padding: 11px 14px;
  font-size: 14px;
  border-radius: 8px;
}

.login-card input:focus {
  background: #FFFFFF;
  border-color: #D4A84B;
  box-shadow: 0 0 0 3px rgba(212, 168, 75, 0.12);
}

.login-card input::placeholder {
  color: #9CA3AF;
}

.login-card .btn-primary {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  margin-top: 8px;
  border-radius: 8px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(212, 168, 75, 0.3);
  letter-spacing: -0.01em;
}

.login-card .btn-primary:hover {
  background: var(--accent-bright);
  box-shadow: 0 4px 12px rgba(212, 168, 75, 0.4);
  transform: translateY(-1px);
}

.login-error {
  background: #FEF2F2;
  color: #DC2626;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
  border: 1px solid rgba(220, 38, 38, 0.15);
}

.login-error.visible { display: block; }

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 12px;
  color: #9CA3AF;
}

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-page);
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s ease;
  min-width: 260px;
  max-width: 380px;
}

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

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

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--text-page-muted);
  gap: 12px;
  font-size: 14px;
}

/* Empty states */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-on-card-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state p {
  font-size: 14px;
  margin-bottom: 16px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fade-in 0.15s ease;
  backdrop-filter: blur(4px);
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-on-card-muted);
  cursor: pointer;
  font-size: 20px;
  padding: 4px;
  line-height: 1;
}

.modal-close:hover { color: var(--text-on-card); }

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

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

/* Action bar for bulk actions */
.action-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px 16px;
  min-height: 49px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-shrink: 0;
}

.action-bar .selected-count {
  font-size: 13px;
  color: var(--text-on-card-secondary);
  font-weight: 500;
}

.action-bar .selected-count strong {
  color: var(--accent-bright);
}

/* Custom checkbox styling */
.row-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.data-table th.col-check,
.data-table td.col-check {
  width: 40px;
  text-align: center;
  padding-left: 12px;
  padding-right: 4px;
}

.data-table td.col-check {
  cursor: default;
}

/* Activity feed */
.activity-feed {
  list-style: none;
  padding: 0;
  margin: 0;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.activity-icon svg {
  width: 16px;
  height: 16px;
}

.activity-icon.icon-email { background: var(--blue-dim); color: var(--blue); }
.activity-icon.icon-classify { background: var(--accent-dim); color: var(--accent-bright); }
.activity-icon.icon-status { background: var(--yellow-dim); color: var(--yellow); }
.activity-icon.icon-followup { background: var(--teal-dim); color: var(--teal); }
.activity-icon.icon-send { background: var(--green-dim); color: var(--green); }
.activity-icon.icon-error { background: var(--red-dim); color: var(--red); }
.activity-icon.icon-default { background: var(--accent-dim); color: var(--accent-bright); }

.activity-body {
  flex: 1;
  min-width: 0;
}

.activity-text {
  font-size: 13px;
  color: var(--text-on-card-secondary);
  line-height: 1.5;
}

.activity-text strong {
  color: var(--text-on-card);
  font-weight: 600;
}

.activity-time {
  font-size: 11px;
  color: var(--text-on-card-muted);
  margin-top: 3px;
}

/* Tabs */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab-bar button {
  background: none;
  border: none;
  padding: 10px 18px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-on-card-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}

.tab-bar button:hover { color: var(--text-on-card-secondary); }

.tab-bar button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-logo span, .sidebar-nav a span, .sidebar-user-info, .sidebar-nav .nav-badge { display: none; }
  .sidebar-logo h1 { font-size: 14px; }
  .sidebar-nav a { justify-content: center; padding: 12px; }
  .main-content { margin-left: 60px; padding: 16px; }

  .login-card { padding: 36px 24px; }
  .login-accent { display: none; }
}
