/* Reset & base */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #0f0f12;
  color: #e4e4e7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top header */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: #18181b;
  border-bottom: 1px solid #27272a;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}
.logo {
  font-weight: 600;
  font-size: 1.1rem;
}
.logo span { color: #a1a1aa; font-weight: 400; }
.header-links {
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-links a {
  color: #a1a1aa;
  text-decoration: none;
  font-size: 0.9rem;
}
.header-links a:hover { color: #fff; }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #3f3f46;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 600;
}
.avatar.small { width: 24px; height: 24px; font-size: 0.75rem; }

/* Sidebar */
.sidebar {
  width: 220px;
  background: #18181b;
  border-right: 1px solid #27272a;
  padding-top: 56px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
}
.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: #a1a1aa;
  text-decoration: none;
  font-size: 0.95rem;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: #27272a; color: #fff; }
.nav-item.active {
  background: #27272a;
  color: #fff;
  border-left-color: #3b82f6;
}
.nav-item .icon { font-size: 1rem; }
.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid #27272a;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #a1a1aa;
}
.sidebar-user .dropdown-arrow { font-size: 0.7rem; margin-left: auto; }

/* Main content */
.main-content {
  margin-left: 220px;
  margin-top: 56px;
  padding: 24px 32px 48px;
  flex: 1;
}
.page-header { margin-bottom: 20px; }
.page-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 12px 0;
}
.tabs {
  display: flex;
  gap: 4px;
}
.tab {
  background: none;
  border: none;
  color: #a1a1aa;
  padding: 8px 16px;
  font-size: 0.95rem;
  cursor: pointer;
  border-radius: 6px;
}
.tab:hover { color: #fff; background: #27272a; }
.tab.active { color: #3b82f6; background: #27272a; }

/* Summary row */
.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}
.summary-cards { display: flex; gap: 24px; flex-wrap: wrap; }
.summary-card {
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 8px;
  padding: 12px 20px;
  min-width: 140px;
}
.summary-card .label {
  display: block;
  font-size: 0.75rem;
  color: #71717a;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.summary-card .count { font-size: 1.25rem; font-weight: 600; }
.summary-actions { display: flex; gap: 8px; align-items: center; }

/* Buttons */
.btn {
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
}
.btn-primary {
  background: #fff;
  color: #18181b;
}
.btn-primary:hover { background: #e4e4e7; }
.btn-secondary {
  background: #3f3f46;
  color: #e4e4e7;
}
.btn-secondary:hover { background: #52525b; }
.btn-icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #27272a;
  color: #a1a1aa;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}
.btn-icon:hover { background: #3f3f46; color: #fff; }

/* Toolbar & search */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-wrap {
  flex: 1;
  min-width: 280px;
  position: relative;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  opacity: 0.6;
}
.search-input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 8px;
  color: #e4e4e7;
  font-size: 0.95rem;
}
.search-input::placeholder { color: #71717a; }
.search-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
.filter-select {
  padding: 12px 36px 12px 14px;
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 8px;
  color: #e4e4e7;
  font-size: 0.9rem;
  cursor: pointer;
}
.filter-select:focus { outline: none; border-color: #3b82f6; }

/* Table */
.table-wrap {
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  min-height: 200px;
}
.contacts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.contacts-table th {
  text-align: left;
  padding: 14px 16px;
  background: #27272a;
  color: #a1a1aa;
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.contacts-table td {
  padding: 14px 16px;
  border-top: 1px solid #27272a;
}
.contacts-table tbody tr:hover { background: #27272a; }
.contact-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #3f3f46;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  margin-right: 12px;
  vertical-align: middle;
}
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
}
.status-badge.subscribed { background: rgba(34, 197, 94, 0.2); color: #22c55e; }
.status-badge.unsubscribed { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.row-menu {
  background: none;
  border: none;
  color: #71717a;
  cursor: pointer;
  padding: 4px;
  font-size: 1.2rem;
  line-height: 1;
}
.row-menu:hover { color: #fff; }

/* Empty state */
.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: #71717a;
  text-align: center;
}
.empty-state.hidden { display: none; }
.empty-state p { margin: 0 0 16px 0; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}
.modal {
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #27272a;
}
.modal-header h2 { margin: 0; font-size: 1.25rem; }
.modal-close {
  background: none;
  border: none;
  color: #a1a1aa;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.modal-close:hover { color: #fff; }
.modal-body { padding: 24px; }
.modal-hint {
  color: #a1a1aa;
  font-size: 0.9rem;
  margin: 0 0 20px 0;
  line-height: 1.5;
}
.file-upload {
  display: block;
  margin-bottom: 16px;
}
.file-upload input[type="file"] { display: none; }
.file-upload-label {
  display: inline-block;
  padding: 12px 20px;
  background: #27272a;
  border: 1px dashed #52525b;
  border-radius: 8px;
  cursor: pointer;
  color: #a1a1aa;
  font-size: 0.95rem;
}
.file-upload-label:hover { background: #3f3f46; color: #fff; }
.import-status {
  font-size: 0.9rem;
  color: #22c55e;
  min-height: 24px;
}
.import-status.error { color: #ef4444; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid #27272a;
}
