/* ============================================================
   ContactCayman Design System — GC-3
   Palette: Navy & Teal
   ============================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&display=swap');

/* --- CSS Variables --- */
:root {
  /* Brand Primary */
  --color-navy:        #171446;   /* Primary brand, headings */
  --color-teal:        #3acfa9;   /* Primary accent, CTAs */

  /* Brand Secondary */
  --color-dark-grey:   #343844;   /* Dark backgrounds, footer */
  --color-sage:        #889c9b;   /* Subtle UI, borders */
  --color-amber:       #f1a500;   /* Highlights, warnings */
  --color-coral:       #e65848;   /* Alerts, errors */

  /* Mapped to existing variable names for compatibility */
  --color-darkest:     #171446;   /* Navy — sidebar bg, deepest brand */
  --color-primary:     #171446;   /* Navy — primary buttons, links */
  --color-mid:         #3acfa9;   /* Teal — hover states, badges, accents */
  --color-pale:        #e8faf5;   /* Light teal background */
  --color-near-white:  #feffff;   /* Cards, modals, inputs */

  /* Text */
  --color-text:        #171446;   /* Navy body text */
  --color-text-muted:  #889c9b;   /* Sage — secondary text */
  --color-text-light:  #a8b5b4;   /* Placeholders, disabled states */
  --color-border:      #d8e0e0;   /* Borders, dividers */
  --color-border-dark: #889c9b;   /* Sage — stronger dividers */
  --color-bg:          #f6f8f8;   /* Page background */
  --color-bg-subtle:   #eef2f2;   /* Alternate row, subtle panels */

  /* Semantic */
  --color-success:     #3acfa9;
  --color-success-bg:  #e8faf5;
  --color-warning:     #f1a500;
  --color-warning-bg:  #fef3c7;
  --color-danger:      #e65848;
  --color-danger-bg:   #fee2e2;
  --color-info:        #3acfa9;
  --color-info-bg:     #e8faf5;

  /* Sidebar */
  --sidebar-width:     240px;
  --sidebar-bg:        #171446;
  --sidebar-text:      #b0aed0;
  --sidebar-text-hover:#e8faf5;
  --sidebar-active-bg: rgba(58, 207, 169, 0.18);
  --sidebar-active-text: #3acfa9;
  --sidebar-border:    rgba(58, 207, 169, 0.12);

  /* Typography */
  --font-body:         'Manrope', sans-serif;
  --font-mono:         'DM Mono', monospace;

  /* Sizing */
  --radius-sm:   4px;
  --radius-md:   6px;
  --radius-lg:   10px;
  --shadow-sm:   0 1px 3px rgba(23, 37, 42, 0.08), 0 1px 2px rgba(23, 37, 42, 0.04);
  --shadow-md:   0 4px 12px rgba(23, 37, 42, 0.10), 0 2px 4px rgba(23, 37, 42, 0.06);
  --shadow-lg:   0 8px 24px rgba(23, 37, 42, 0.12), 0 4px 8px rgba(23, 37, 42, 0.08);

  /* Transitions */
  --transition: 150ms ease;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: 0.9333rem; /* 14px */
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--color-mid); }

/* --- App Shell --- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid rgba(58, 175, 169, 0.08);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px 20px;
  border-bottom: 1px solid var(--sidebar-border);
  text-decoration: none;
}

.sidebar-brand-mark {
  width: 32px;
  height: 32px;
  background: var(--color-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-brand-mark svg {
  width: 18px;
  height: 18px;
  fill: white;
}

.sidebar-brand-name {
  font-size: 0.9333rem;
  font-weight: 700;
  color: #feffff;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 0.7333rem;
  color: var(--sidebar-text);
  font-weight: 400;
  display: block;
}

/* Nav sections */
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-section {
  margin-bottom: 4px;
}

.nav-section-label {
  font-size: 0.6667rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #4a6970;
  padding: 10px 20px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  color: var(--sidebar-text);
  font-size: 0.8667rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  position: relative;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: rgba(58, 175, 169, 0.10);
  color: var(--sidebar-text-hover);
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--color-mid);
  border-radius: 0 2px 2px 0;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-item.active svg { opacity: 1; }

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

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.sidebar-avatar {
  width: 30px;
  height: 30px;
  background: var(--color-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7333rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

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

.sidebar-user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: #feffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.7rem;
  color: var(--sidebar-text);
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: #4a6970;
  transition: color var(--transition);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  width: 100%;
  text-align: left;
}
.sidebar-logout:hover { color: #e57373; }
.sidebar-logout svg { width: 14px; height: 14px; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top bar */
.topbar {
  height: 56px;
  background: var(--color-near-white);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 0.9333rem;
  font-weight: 600;
  color: var(--color-text);
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Page content */
.page-content {
  padding: 28px;
  flex: 1;
}

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

.page-header-left {}

.page-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.page-subtitle {
  font-size: 0.8667rem;
  color: var(--color-text-muted);
  margin-top: 3px;
}

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

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--color-near-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

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

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  font-family: var(--font-body);
  font-size: 0.8667rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}

.btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Primary */
.btn-primary {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}
.btn-primary:hover:not(:disabled) {
  background: #225f5d;
  border-color: #225f5d;
  color: white;
  box-shadow: 0 2px 8px rgba(43, 122, 120, 0.30);
}

/* Secondary */
.btn-secondary {
  background: var(--color-near-white);
  color: var(--color-text);
  border-color: var(--color-border-dark);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--color-pale);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--color-bg-subtle);
  color: var(--color-text);
}

/* Danger */
.btn-danger {
  background: #dc2626;
  color: white;
  border-color: #dc2626;
}
.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
  border-color: #b91c1c;
}

/* Teal accent */
.btn-teal {
  background: var(--color-mid);
  color: white;
  border-color: var(--color-mid);
}
.btn-teal:hover:not(:disabled) {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

/* Sizes */
.btn-sm {
  padding: 4px 10px;
  font-size: 0.8rem;
}
.btn-sm svg { width: 13px; height: 13px; }

.btn-lg {
  padding: 10px 20px;
  font-size: 0.9333rem;
}

/* Icon only */
.btn-icon {
  padding: 6px;
  width: 32px;
  height: 32px;
  justify-content: center;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  margin-bottom: 18px;
}

label, .label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: 5px;
  letter-spacing: 0.01em;
}

.label-required::after {
  content: ' *';
  color: var(--color-danger);
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-text);
  background: var(--color-near-white);
  border: 1px solid var(--color-border-dark);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  line-height: 1.5;
}

.form-control::placeholder {
  color: var(--color-text-light);
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(43, 122, 120, 0.12);
}

.form-control:disabled {
  background: var(--color-bg);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

select.form-control {
  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='%235a7178' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

textarea.form-control {
  min-height: 80px;
  resize: vertical;
}

.form-text {
  font-size: 0.7867rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 0.7867rem;
  color: var(--color-danger);
  margin-top: 4px;
}

.form-control.is-invalid {
  border-color: var(--color-danger);
}

.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

/* Form row / grid */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

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

/* Checkbox / radio */
.form-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.form-check-input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--color-primary);
  flex-shrink: 0;
  cursor: pointer;
}

.form-check-label {
  font-size: 0.8667rem;
  color: var(--color-text);
  cursor: pointer;
  margin: 0;
  line-height: 1.5;
}

/* Fieldset / section */
.form-section {
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--color-border);
}

.form-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.form-section-title {
  font-size: 0.8667rem;
  font-weight: 600;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-near-white);
  font-size: 0.8667rem;
}

thead {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border-dark);
}

th {
  padding: 11px 16px;
  text-align: left;
  font-size: 0.7667rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

th a {
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
th a:hover { color: var(--color-primary); }

td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tr:hover td {
  background: var(--color-bg);
}

.table-clickable tr {
  cursor: pointer;
}

/* Column helpers */
.col-name { min-width: 180px; }
.col-email { min-width: 200px; }
.col-narrow { width: 100px; }
.col-actions { width: 80px; text-align: right; }

/* Contact name in table */
.contact-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.contact-avatar {
  width: 32px;
  height: 32px;
  background: var(--color-pale);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--color-primary);
  flex-shrink: 0;
}

.contact-full-name {
  font-weight: 600;
  color: var(--color-text);
  display: block;
  line-height: 1.3;
}

.contact-full-name a {
  color: var(--color-text);
}
.contact-full-name a:hover { color: var(--color-primary); }

.contact-meta {
  font-size: 0.7667rem;
  color: var(--color-text-muted);
  display: block;
  margin-top: 1px;
}

/* ============================================================
   BADGES / TAGS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.badge-teal    { background: var(--color-pale); color: var(--color-primary); border: 1px solid #b8dede; }
.badge-green   { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-amber   { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-red     { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.badge-grey    { background: var(--color-bg-subtle); color: var(--color-text-muted); border: 1px solid var(--color-border); }
.badge-blue    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* Status-specific */
.badge-status-active       { @apply badge badge-green; }
.badge-status-unverified   { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-status-confirmed    { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-status-bounced      { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.badge-status-inactive     { background: var(--color-bg-subtle); color: var(--color-text-muted); border: 1px solid var(--color-border); }

/* ============================================================
   FLASH MESSAGES / ALERTS
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.8667rem;
  margin-bottom: 16px;
}

.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

.alert-success {
  background: var(--color-success-bg);
  border-color: #a7d9d8;
  color: #1a4f4e;
}

.alert-danger, .alert-error {
  background: var(--color-danger-bg);
  border-color: #fca5a5;
  color: #7f1d1d;
}

.alert-warning {
  background: var(--color-warning-bg);
  border-color: #fde68a;
  color: #78350f;
}

.alert-info {
  background: var(--color-info-bg);
  border-color: #a7d9d8;
  color: #1a4f4e;
}

/* ============================================================
   FILTER / SEARCH BAR
   ============================================================ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 340px;
}

.search-input-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--color-text-light);
  pointer-events: none;
}

.search-input-wrap .form-control {
  padding-left: 33px;
}

.filter-select {
  min-width: 140px;
  max-width: 200px;
}

.filter-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: var(--color-pale);
  border: 1px solid #b8dede;
  border-radius: 20px;
  font-size: 0.7667rem;
  font-weight: 500;
  color: var(--color-primary);
}

.filter-tag button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-primary);
  padding: 0;
  line-height: 1;
  opacity: 0.7;
  font-size: 0.9rem;
}

.filter-tag button:hover { opacity: 1; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  font-size: 0.8333rem;
  font-weight: 500;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  background: var(--color-near-white);
  transition: all var(--transition);
  text-decoration: none;
}

.page-link:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-pale);
}

.page-link.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.page-link.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.page-info {
  font-size: 0.8333rem;
  color: var(--color-text-muted);
  margin-left: 8px;
}

/* ============================================================
   STATS / KPI CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--color-near-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 0.7333rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 1.7333rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.03em;
  line-height: 1;
}

.stat-sub {
  font-size: 0.7667rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.stat-card.stat-primary { border-left: 3px solid var(--color-primary); }
.stat-card.stat-teal    { border-left: 3px solid var(--color-mid); }
.stat-card.stat-amber   { border-left: 3px solid var(--color-warning); }
.stat-card.stat-green   { border-left: 3px solid #10b981; }

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 24px;
  gap: 0;
}

.tab-link {
  padding: 10px 18px;
  font-size: 0.8667rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
}

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

.tab-link.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(23, 37, 42, 0.55);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--color-near-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
}

.modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: var(--color-bg-subtle); color: var(--color-text); }

.modal-body { padding: 22px; }

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

/* ============================================================
   EMPTY STATES
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 56px 24px;
}

.empty-state-icon {
  width: 52px;
  height: 52px;
  background: var(--color-pale);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.empty-state-icon svg {
  width: 24px;
  height: 24px;
  color: var(--color-primary);
}

.empty-state-title {
  font-size: 0.9333rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
}

.empty-state-text {
  font-size: 0.8667rem;
  color: var(--color-text-muted);
  margin-bottom: 20px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

/* ============================================================
   DETAIL VIEW (Contact)
   ============================================================ */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}

.detail-header-card {
  background: var(--color-near-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 18px;
}

.detail-avatar {
  width: 52px;
  height: 52px;
  background: var(--color-pale);
  border: 2px solid var(--color-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-primary);
  flex-shrink: 0;
}

.detail-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.detail-role {
  font-size: 0.8667rem;
  color: var(--color-text-muted);
  margin-top: 3px;
}

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

/* Definition list */
.dl-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 16px;
  font-size: 0.8667rem;
}

.dl-label {
  font-weight: 500;
  color: var(--color-text-muted);
  white-space: nowrap;
  padding-top: 1px;
}

.dl-value {
  color: var(--color-text);
  word-break: break-word;
}

/* Email list within contact */
.email-list { list-style: none; }

.email-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
}
.email-item:last-child { border-bottom: none; }

.email-address {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-text);
  flex: 1;
}

/* ============================================================
   IMPORT / CSV WIZARD
   ============================================================ */
.wizard-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  position: relative;
}

.wizard-step::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
  margin: 0 8px;
}

.wizard-step:last-child::after { display: none; }

.step-number {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7333rem;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  color: var(--color-text-muted);
}

.step-label {
  font-size: 0.7667rem;
  font-weight: 500;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.wizard-step.active .step-number {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.wizard-step.active .step-label { color: var(--color-primary); font-weight: 600; }

.wizard-step.complete .step-number {
  background: var(--color-pale);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--color-border-dark);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--color-bg);
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--color-primary);
  background: var(--color-pale);
}

.drop-zone-icon {
  width: 44px;
  height: 44px;
  background: var(--color-pale);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}

.drop-zone-icon svg {
  width: 22px;
  height: 22px;
  color: var(--color-primary);
}

/* Field mapping table */
.mapping-table th { background: var(--color-pale); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  background: var(--color-darkest);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -200px;
  right: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(43, 122, 120, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.login-page::after {
  content: '';
  position: absolute;
  bottom: -150px;
  left: -150px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(58, 175, 169, 0.10) 0%, transparent 70%);
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--color-near-white);
  border-radius: 14px;
  box-shadow: var(--shadow-lg), 0 20px 60px rgba(0,0,0,0.3);
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.login-card-top {
  background: var(--color-primary);
  padding: 28px 32px 24px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.login-logo-mark {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-logo-mark svg { width: 20px; height: 20px; fill: white; }

.login-logo-text {
  font-size: 1rem;
  font-weight: 700;
  color: white;
  letter-spacing: -0.01em;
}

.login-headline {
  font-size: 1.0667rem;
  font-weight: 700;
  color: white;
  letter-spacing: -0.02em;
}

.login-subline {
  font-size: 0.8333rem;
  color: rgba(222, 242, 241, 0.8);
  margin-top: 3px;
}

.login-form-body {
  padding: 28px 32px 32px;
}

/* ============================================================
   ADMIN / SUPER ADMIN PANELS
   ============================================================ */
.admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  background: rgba(58, 175, 169, 0.12);
  border: 1px solid rgba(58, 175, 169, 0.25);
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-mid);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-muted   { color: var(--color-text-muted); }
.text-primary { color: var(--color-primary); }
.text-danger  { color: var(--color-danger); }
.text-small   { font-size: 0.8rem; }
.text-mono    { font-family: var(--font-mono); font-size: 0.85em; }
.text-right   { text-align: right; }
.text-center  { text-align: center; }

.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.mb-0  { margin-bottom: 0; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }

.mt-0  { margin-top: 0; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex-1 { flex: 1; }

.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 20px 0;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.breadcrumb a { color: var(--color-text-muted); }
.breadcrumb a:hover { color: var(--color-primary); }
.breadcrumb-sep { color: var(--color-text-light); }
.breadcrumb-current { color: var(--color-text); font-weight: 500; }

/* Monospace data */
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--color-bg-subtle);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  color: var(--color-primary);
  border: 1px solid var(--color-border);
}

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

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

/* Responsive */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .detail-layout { grid-template-columns: 1fr; }
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
}

.navbar { background-color: #17252a; }
body { font-size: 1rem; }
