:root {
  --primary: #1a56db;
  --primary-hover: #1444b0;
  --dark: #1e293b;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-600: #475569;
  --gray-800: #1e293b;
  --white: #ffffff;
  --error: #dc2626;
  --success: #16a34a;
  --sidebar-width: 220px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--gray-800);
  line-height: 1.5;
}

/* Auth pages (login, forgot, reset) */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
}

.auth-card {
  background: var(--white);
  padding: 2.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.auth-logo {
  width: 280px;
  max-width: 100%;
  margin-bottom: 1.5rem;
}

.auth-card h1 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--dark);
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
  text-align: left;
  flex: 1;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--gray-600);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 0.9375rem;
  font-family: inherit;
  transition: border-color 0.15s;
  background: var(--white);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}

.form-group label {
  color: var(--gray-600);
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: var(--white);
  max-height: 120px;
  overflow-y: auto;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  cursor: pointer;
  white-space: nowrap;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.color-picker-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.color-picker-row input[type="color"] {
  width: 40px;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.color-hex-input {
  flex: 1;
  font-family: monospace;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-group-narrow {
  flex: 0 0 90px;
}

.form-row-2 {
  display: flex;
  gap: 1rem;
}

.form-row-2 .form-group {
  flex: 1;
}

.form-row-3 {
  display: flex;
  gap: 1rem;
}

.form-row-3 .form-group {
  flex: 1;
}

.form-row-4 {
  display: flex;
  gap: 1rem;
}

.form-row-4 .form-group {
  flex: 1;
}

.form-row-5 {
  display: flex;
  gap: 1rem;
}

.form-row-5 .form-group {
  flex: 1;
}

.form-group.flex-shrink {
  flex: 0 0 120px;
}

.form-group.flex-grow {
  flex: 3;
}

.status-select {
  appearance: auto;
  font-weight: 600;
}

.status-select option[value="Unverified"] {
  color: #991b1b;
  background: #fef2f2;
}

.status-select option[value="Verified"] {
  color: #854d0e;
  background: #fefce8;
}

.status-select option[value="Promoted"] {
  color: #166534;
  background: #f0fdf4;
}

.form-card {
  background: var(--white);
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  margin-top: 1rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--gray-200);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: 6px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-block {
  width: 100%;
  margin-top: 0.5rem;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-outline {
  background: var(--gray-50, #f9fafb);
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn-outline:hover {
  background: var(--gray-100);
}

/* Alerts */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.alert-error {
  background: #fef2f2;
  color: var(--error);
  border: 1px solid #fecaca;
}

.alert-success {
  background: #f0fdf4;
  color: var(--success);
  border: 1px solid #bbf7d0;
}

.alert-warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* Auth links */
.auth-links {
  margin-top: 1.25rem;
}

.auth-links a {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.875rem;
}

.auth-links a:hover {
  text-decoration: underline;
}

/* ===================== */
/* Sidebar               */
/* ===================== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-logo {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
  height: 56px;
  display: flex;
  align-items: center;
}

.sidebar-logo a {
  display: block;
  line-height: 0;
}

.sidebar-logo-img {
  height: 32px;
  width: auto;
}

.sidebar-nav {
  flex: 1;
  padding: 0.5rem 0;
  overflow-y: auto;
}

.sidebar-divider {
  margin: 0.5rem 0.625rem;
  border: none;
  border-top: 1px solid var(--gray-200);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.25rem 0.625rem;
  padding: 0.625rem 0.75rem;
  color: var(--gray-600);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: 6px;
  transition: background-color 0.1s, color 0.1s;
}

.sidebar-link:hover {
  background: var(--gray-100);
}

/* Category colors */
.sidebar-link.cat-dashboard { color: #6366f1; }
.sidebar-link.cat-dashboard .sidebar-icon { stroke: #6366f1; }
.sidebar-link.cat-crm { color: #0891b2; }
.sidebar-link.cat-crm .sidebar-icon { stroke: #0891b2; }
.sidebar-link.cat-projects { color: #d97706; }
.sidebar-link.cat-projects .sidebar-icon { stroke: #d97706; }
.sidebar-link.cat-comms { color: #059669; }
.sidebar-link.cat-comms .sidebar-icon { stroke: #059669; }
.sidebar-link.cat-admin { color: #9333ea; }
.sidebar-link.cat-admin .sidebar-icon { stroke: #9333ea; }

.sidebar-link:hover.cat-dashboard { color: #4f46e5; }
.sidebar-link:hover.cat-crm { color: #0e7490; }
.sidebar-link:hover.cat-projects { color: #b45309; }
.sidebar-link:hover.cat-comms { color: #047857; }
.sidebar-link:hover.cat-admin { color: #7e22ce; }

.sidebar-link.active {
  background: var(--primary);
  color: var(--white) !important;
  font-weight: 600;
}

.sidebar-link.active .sidebar-icon {
  stroke: var(--white) !important;
}

.sidebar-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ===================== */
/* Top bar               */
/* ===================== */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: 56px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 99;
}

.topbar-left {
  display: flex;
  align-items: center;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.dev-badge {
  font-size: 1.75rem;
  font-weight: 900;
  color: #dc2626;
  letter-spacing: 0.15em;
  text-shadow: 0 0 1px rgba(220, 38, 38, 0.4);
  user-select: none;
}

.topbar-user-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  color: var(--gray-600);
  font-size: 0.8125rem;
  font-weight: 500;
}

.topbar-logout {
  display: inline;
}

.btn-active {
  background: var(--gray-100);
  border-color: var(--gray-300);
}

/* ===================== */
/* App layout            */
/* ===================== */
.app-page {
  min-height: 100vh;
  background: var(--gray-100);
}

.app-content {
  margin-left: var(--sidebar-width);
  margin-top: 56px;
  padding: 1.5rem 2rem;
  min-height: calc(100vh - 56px);
}

.app-content h1 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--dark);
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.content-header h1 {
  margin-bottom: 0;
}

.content-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--gray-400);
  text-decoration: none;
  font-size: 0.8125rem;
}

.back-link:hover {
  color: var(--primary);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

/* ===================== */
/* Detail view           */
/* ===================== */
.detail-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  margin-top: 1rem;
}

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

.detail-grid-3 {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
}

.detail-section {
  padding: 1rem 1.25rem;
}

.detail-section:not(:last-child) {
  border-right: 1px solid var(--gray-200);
}

.detail-section-middle {
  min-width: 220px;
}

.address-display {
  font-size: 0.875rem;
  color: var(--gray-800);
  line-height: 1.5;
}

.address-country {
  color: var(--gray-400);
}

.address-coords {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 0.375rem;
}

.text-muted {
  font-size: 0.875rem;
  color: var(--gray-400);
}

.detail-subsection-title {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--gray-100);
}

.phone-display {
  font-size: 0.875rem;
  color: var(--gray-800);
}

.phone-type {
  color: var(--gray-400);
  font-size: 0.8125rem;
}

.detail-section h2 {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  margin-bottom: 0.75rem;
}

.detail-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.detail-section-header h2 {
  margin-bottom: 0;
}

.detail-section-header + p,
.detail-section-header + .text-muted {
  margin-top: 0.75rem;
}

.detail-section-header .btn-icon-sm {
  text-decoration: none;
}

.detail-row {
  display: flex;
  padding: 0.375rem 0;
  border-bottom: 1px solid var(--gray-100);
}

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

.detail-label {
  width: 100px;
  flex-shrink: 0;
  font-size: 0.8125rem;
  color: var(--gray-400);
}

.detail-value {
  font-size: 0.875rem;
  color: var(--gray-800);
}

.detail-value a {
  color: var(--primary);
  text-decoration: none;
}

.detail-value a:hover {
  text-decoration: underline;
}

.detail-extra-row {
  display: flex;
  border-top: 1px solid var(--gray-200);
}

.detail-extra-block {
  flex: 1;
  padding: 0.75rem 1.25rem;
}

.detail-extra-block:not(:last-child) {
  border-right: 1px solid var(--gray-200);
}

.detail-extra-block h2 {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  margin-bottom: 0.5rem;
}

.detail-extra-desc {
  flex: 2;
}

.description-text {
  font-size: 0.875rem;
  color: var(--gray-700);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  line-height: 1.5;
  white-space: pre-line;
}

.services-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.service-tag {
  font-size: 0.75rem;
}

.bh-display {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.bh-display-row {
  display: flex;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.bh-display-day {
  width: 36px;
  flex-shrink: 0;
  font-weight: 600;
  color: var(--gray-600);
}

.bh-display-time {
  color: var(--gray-700);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.bh-closed .bh-display-day,
.bh-closed .bh-display-time {
  color: var(--gray-300);
}

.detail-meta {
  display: flex;
  gap: 2rem;
  padding: 0.75rem 1.5rem;
  border-top: 1px solid var(--gray-200);
  font-size: 0.8125rem;
  color: var(--gray-400);
}

.tag {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  background: var(--gray-100);
  border-radius: 4px;
  font-size: 0.8125rem;
  margin-right: 0.25rem;
}

.app-footer {
  margin-left: var(--sidebar-width);
  text-align: center;
  padding: 1rem;
  color: var(--gray-400);
  font-size: 0.8rem;
}

/* ===================== */
/* Data table            */
/* ===================== */
.table-wrapper {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead {
  background: var(--gray-50);
}

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-100);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.table-row-link {
  cursor: pointer;
  transition: background-color 0.1s;
}

.table-row-link:hover {
  background: var(--gray-50);
}

.td-primary {
  font-weight: 600;
  color: var(--primary);
}

.table-empty {
  text-align: center;
  color: var(--gray-400);
  padding: 2rem 1rem !important;
}

.th-actions {
  width: 1%;
  white-space: nowrap;
}

.td-actions {
  white-space: nowrap;
  text-align: right;
}

.btn-icon-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: var(--white);
  color: var(--gray-400);
  cursor: pointer;
  transition: background-color 0.1s, color 0.1s;
}

.btn-icon-sm:hover {
  background: var(--gray-100);
  color: var(--gray-800);
}

.btn-icon-danger {
  color: #ff0000;
  border-color: #fecaca;
}
.btn-icon-danger:hover {
  background: #fff0f0;
  color: #cc0000;
  border-color: #ff0000;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-unverified {
  background: #fef2f2;
  color: #991b1b;
}

.badge-verified {
  background: #fefce8;
  color: #854d0e;
}

.badge-promoted {
  background: #f0fdf4;
  color: #166534;
}

/* ===================== */
/* Tabs                  */
/* ===================== */
.tabs {
  display: flex;
  gap: 0;
  margin-top: 0.75rem;
}

.tab {
  padding: 0.5rem 1.25rem;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-400);
  cursor: pointer;
  transition: background-color 0.1s, color 0.1s;
  margin-right: -1px;
}

.tab:hover {
  background: var(--gray-200);
  color: var(--gray-800);
}


/* Admin-only tabs - purple accent */
.tab.tab-admin {
  color: #9333ea;
  background: #faf5ff;
  border-color: #e9d5ff;
}
.tab.tab-admin:hover {
  background: #f3e8ff;
  color: #7e22ce;
}

/* Admin-only icon button (purple) */
.btn-icon-sm.btn-icon-admin {
  color: #9333ea;
}
.btn-icon-sm.btn-icon-admin:hover {
  color: #7e22ce;
}
/* Admin-only outline button (purple) */
.btn.btn-admin {
  color: #9333ea !important;
  border-color: #d8b4fe !important;
}
.btn.btn-admin:hover {
  background: #faf5ff;
  color: #7e22ce !important;
}

.tab.tab-admin.active {
  background: var(--white);
  color: #7e22ce;
  border-color: #d8b4fe;
  border-top: 2px solid #9333ea;
}

.tab.active {
  background: var(--white);
  color: var(--gray-800);
  font-weight: 600;
  border-color: var(--gray-200);
  position: relative;
}

.tab-panel {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 0 8px 8px 8px;
  padding: 1rem 1.25rem;
}

.tab-panel-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 0.75rem;
}

/* ===================== */
/* Inline form           */
/* ===================== */
.inline-form {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.form-help {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 0.25rem;
}

.form-help a {
  color: var(--primary);
}

.form-section-title {
  font-size: 0.9375rem;
  color: var(--gray-800);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--gray-200);
}

.places-search-input {
  border: 1px solid var(--primary) !important;
  background: #f0f5ff !important;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--gray-600);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
}

/* ===================== */
/* Multi-select dropdown */
/* ===================== */
.multiselect {
  position: relative;
}

.multiselect-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 0.9375rem;
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.15s;
  min-height: 40px;
}

.multiselect-display:hover {
  border-color: var(--gray-300);
}

.multiselect.open .multiselect-display {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}

.multiselect-text {
  color: var(--gray-400);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multiselect-text.has-value {
  color: var(--gray-800);
}

.multiselect-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  margin-top: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
}

.multiselect.open .multiselect-dropdown {
  display: block;
}

.multiselect-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--gray-800);
  cursor: pointer;
  transition: background-color 0.1s;
}

.multiselect-option:hover {
  background: var(--gray-50);
}

.multiselect-option input[type="checkbox"] {
  width: auto;
  margin: 0;
}

/* ===================== */
/* Address cards         */
/* ===================== */
.address-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.75rem;
}

.address-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.address-card-body {
  flex: 1;
}

.address-line {
  font-size: 0.875rem;
  color: var(--gray-800);
  line-height: 1.4;
}

.address-country {
  color: var(--gray-400);
}

.address-coords {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 0.25rem;
}

.address-card .badge {
  margin-bottom: 0.375rem;
}

.address-card-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--gray-100);
}

.btn-danger {
  color: var(--error);
  border-color: #fecaca;
}

.btn-danger:hover {
  background: #fef2f2;
}

.empty-state {
  text-align: center;
  color: var(--gray-400);
  padding: 2rem 1rem;
  font-size: 0.875rem;
}

/* ===================== */
/* Table sort & filter   */
/* ===================== */
.sortable-th {
  cursor: pointer;
  user-select: none;
  position: relative;
}

.sortable-th:hover {
  background: var(--gray-100);
}

.sort-arrow {
  font-size: 0.7rem;
  color: var(--gray-400);
}

.sort-active {
  color: var(--primary);
}

.sort-active .sort-arrow {
  color: var(--primary);
}

.table-filter-row {
  background: var(--white);
}

.table-filter-cell {
  padding: 0.375rem 0.5rem !important;
  border-bottom: 1px solid var(--gray-200) !important;
}

.table-filter-input {
  width: 100%;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  font-size: 0.8125rem;
  font-family: inherit;
  color: var(--gray-800);
  background: var(--gray-50);
  transition: border-color 0.15s;
}

.table-filter-input::placeholder {
  color: var(--gray-300);
}

.table-filter-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--white);
  box-shadow: 0 0 0 2px rgba(26, 86, 219, 0.1);
}

/* Media Grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  padding: 1rem 0;
}
.media-card {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  transition: box-shadow 0.15s;
}
.media-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.media-thumb {
  position: relative;
  width: 100%;
  padding-top: 75%;
  background: var(--gray-100);
  overflow: hidden;
  cursor: pointer;
}
.media-thumb-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-badge-video {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  z-index: 1;
}
.media-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  opacity: 0;
  transition: opacity 0.15s;
}
.media-card:hover .media-overlay {
  opacity: 1;
}
.media-overlay-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  border: none;
  cursor: pointer;
  color: var(--gray-700);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  text-decoration: none;
  transition: background 0.1s;
}
.media-overlay-btn:hover {
  background: #fff;
}
.media-overlay-danger:hover {
  background: var(--error);
  color: #fff;
}
.media-info {
  padding: 0.5rem 0.75rem 0.75rem;
}
.media-info-title {
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}
.media-info-meta {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.25rem;
}
.media-info-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  margin-bottom: 0.35rem;
}
.media-info-url {
  margin-top: 0.25rem;
}
.media-url-input {
  width: 100%;
  font-size: 0.6875rem;
  padding: 0.2rem 0.4rem;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  background: var(--gray-50);
  color: var(--gray-500);
  cursor: pointer;
  outline: none;
}
.media-url-input:focus {
  border-color: var(--primary);
  background: #fff;
}

/* Lightbox */
.lightbox-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.lightbox-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}
.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-content img,
.lightbox-content video {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
.lightbox-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 10000;
}
.lightbox-btn:hover {
  background: rgba(255,255,255,0.3);
}
.lightbox-prev {
  left: 1rem;
}
.lightbox-next {
  right: 1rem;
}
.lightbox-close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 10000;
}
.lightbox-close:hover {
  background: rgba(255,255,255,0.3);
}
.lightbox-caption {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 0.875rem;
  text-align: center;
  max-width: 80vw;
  z-index: 10000;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

/* Responsive */
@media (max-width: 480px) {
  .auth-card {
    margin: 1rem;
    padding: 1.5rem;
  }
  .auth-logo {
    width: 200px;
  }
}

@media (max-width: 768px) {
  .form-row, .form-row-2, .form-row-3, .form-row-4 {
    flex-direction: column;
    gap: 0;
  }
  .form-group.flex-shrink {
    flex: 1;
  }
  .detail-extra-row {
    flex-direction: column;
  }
  .detail-extra-block:not(:last-child) {
    border-right: none;
    border-bottom: 1px solid var(--gray-200);
  }
  .sidebar {
    width: 60px;
  }
  .sidebar-logo-img {
    width: 36px;
  }
  .sidebar-link {
    justify-content: center;
    padding: 0.75rem;
    font-size: 0;
  }
  .sidebar-icon {
    width: 22px;
    height: 22px;
  }
  .app-content,
  .app-footer {
    margin-left: 60px;
  }
  .topbar {
    left: 60px;
  }
}

/* Document drop zone */
.doc-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  border: 2px dashed var(--gray-300);
  border-radius: 8px;
  background: var(--gray-50);
  margin-bottom: 1rem;
  transition: border-color 0.2s, background 0.2s;
  cursor: default;
}
.doc-dropzone-active {
  border-color: var(--primary);
  background: #eff6ff;
}

/* Activity type badges — matches calendar color map */
.badge-activity-phone   { background: #3b82f6; color: #fff; }
.badge-activity-text    { background: #14b8a6; color: #fff; }
.badge-activity-email   { background: #6366f1; color: #fff; }
.badge-activity-note    { background: #f59e0b; color: #fff; }
.badge-activity-meeting { background: #ef4444; color: #fff; }
.badge-activity-task    { background: #22c55e; color: #fff; }
.badge-activity-other   { background: #64748b; color: #fff; }

/* View icon colors — applied via attribute selector to all View buttons */
.btn-icon-sm[title*="View"] { color: #00ff00; border-color: #bbffbb; }
.btn-icon-sm[title*="View"]:hover { color: #00cc00; background: #f0fff0; border-color: #00ff00; }
