/* ─── Reset & Variables ──────────────────────────────────────────────────── */

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

:root {
  --bg:        #0d0d0d;
  --sidebar:   #111111;
  --card:      #161616;
  --card-hover:#1b1b1b;
  --border:    #232323;
  --border-focus: #6366f1;
  --accent:    #6366f1;
  --accent-dim: rgba(99, 102, 241, 0.12);
  --accent-hover: #5254cc;
  --text:      #f0f0f0;
  --text-2:    #888;
  --text-3:    #555;
  --success:   #22c55e;
  --success-dim: rgba(34, 197, 94, 0.12);
  --warning:   #f97316;
  --warning-dim: rgba(249, 115, 22, 0.12);
  --danger:    #ef4444;
  --danger-dim: rgba(239, 68, 68, 0.12);
  --sidebar-w: 240px;
  --radius:    10px;
  --radius-lg: 14px;
  --transition: 0.2s ease;
}

html { height: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100%;
  display: flex;
  -webkit-font-smoothing: antialiased;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: width var(--transition), transform var(--transition);
}

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

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

.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-text {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.04em;
  color: var(--text);
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  padding: 5px;
  border-radius: 6px;
  display: none;
  transition: color var(--transition), background var(--transition);
}

.sidebar-toggle:hover { color: var(--text); background: var(--card); }

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: var(--radius);
  background: none;
  color: var(--text-2);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
  text-align: left;
}

.nav-item:hover {
  color: var(--text);
  background: var(--card);
}

.nav-item.active {
  color: var(--text);
  background: var(--accent-dim);
}

.nav-item.active .nav-icon { stroke: var(--accent); }

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: stroke var(--transition);
}

.nav-label { flex: 1; }

.sidebar-footer {
  padding: 12px 8px 16px;
  border-top: 1px solid var(--border);
}

.calendar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: var(--radius);
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-2);
  transition: background var(--transition), color var(--transition);
}

.calendar-status:hover { background: var(--card); color: var(--text); }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
  transition: background var(--transition);
}

.status-dot.connected { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.disconnected { background: var(--warning); }

/* ─── Main Content ───────────────────────────────────────────────────────── */

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 32px 36px;
  min-height: 100vh;
}

/* ─── View Header ────────────────────────────────────────────────────────── */

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.view-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.view-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

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

/* ─── Search ─────────────────────────────────────────────────────────────── */

.search-wrap {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-3);
  pointer-events: none;
}

.search-input {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  padding: 8px 12px 8px 34px;
  width: 220px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input::placeholder { color: var(--text-3); }
.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-ghost {
  background: var(--card);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--card-hover); color: var(--text); }

.btn-full { width: 100%; justify-content: center; }

.btn-spinner {
  width: 15px;
  height: 15px;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text-2);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}
.icon-btn:hover { color: var(--text); background: var(--card); }

/* ─── Contacts Grid ──────────────────────────────────────────────────────── */

.contacts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.contact-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.contact-card:hover {
  background: var(--card-hover);
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.15), 0 4px 20px rgba(0, 0, 0, 0.3);
}

.card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-company {
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 18px;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-2);
  margin-top: 5px;
  overflow: hidden;
}

.card-meta svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: var(--text-3);
}

.card-meta span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Empty States ───────────────────────────────────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
  gap: 12px;
}

.empty-icon {
  color: var(--text-3);
  margin-bottom: 4px;
}

.empty-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-2);
}

.empty-sub {
  font-size: 13.5px;
  color: var(--text-3);
  max-width: 320px;
  margin-bottom: 8px;
}

/* ─── Appointments ───────────────────────────────────────────────────────── */

.appointments-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.appointment-row {
  display: grid;
  grid-template-columns: 160px 1fr 180px auto;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  transition: border-color var(--transition);
}

.appointment-row:hover { border-color: var(--border-focus); }

.appt-date {
  font-size: 13px;
  color: var(--text-2);
}

.appt-date strong {
  display: block;
  font-size: 13.5px;
  color: var(--text);
  font-weight: 600;
}

.appt-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.appt-contact {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-2);
}

.appt-contact-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.appt-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: opacity var(--transition);
}

.appt-link:hover { opacity: 0.75; }

/* ─── Modal ──────────────────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.18s ease;
}

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  animation: scaleIn 0.18s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 0;
}

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

.modal-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
}

.required { color: var(--accent); }

.form-input {
  background: #111;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  padding: 9px 11px;
  outline: none;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input::placeholder { color: var(--text-3); }

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-input.error { border-color: var(--danger); }

.form-textarea {
  min-height: 90px;
  resize: vertical;
  font-family: inherit;
}

.form-textarea-sm { min-height: 70px; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

/* ─── Drawer ─────────────────────────────────────────────────────────────── */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 150;
  animation: fadeIn 0.2s ease;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  background: var(--card);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.4);
  animation: slideIn 0.22s ease;
  overflow: hidden;
}

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

.drawer-header-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

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

.drawer-body::-webkit-scrollbar { width: 4px; }
.drawer-body::-webkit-scrollbar-track { background: transparent; }
.drawer-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.drawer-profile {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.drawer-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.drawer-name {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}

.drawer-company {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}

.drawer-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.drawer-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #111;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.drawer-field svg {
  width: 15px;
  height: 15px;
  color: var(--text-3);
  flex-shrink: 0;
}

.drawer-field-text {
  font-size: 13.5px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-section-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 10px;
}

.drawer-notes-section {
  border-top: 1px solid var(--border);
  padding-top: 18px;
}

.drawer-notes {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.6;
  white-space: pre-wrap;
}

.drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex-shrink: 0;
}

.booking-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.booking-divider::before,
.booking-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.booking-divider span {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.booking-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeIn 0.18s ease;
}

/* ─── Toast ──────────────────────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  min-width: 260px;
  max-width: 360px;
  animation: toastIn 0.25s ease;
}

.toast.toast-exit { animation: toastOut 0.25s ease forwards; }

.toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.toast.success .toast-dot { background: var(--success); }
.toast.error .toast-dot { background: var(--danger); }
.toast.info .toast-dot { background: var(--accent); }

/* ─── Keyframes ──────────────────────────────────────────────────────────── */

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

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

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .contacts-grid { grid-template-columns: repeat(2, 1fr); }
  .appointment-row { grid-template-columns: 140px 1fr auto; }
  .appt-contact { display: none; }
}

@media (max-width: 860px) {
  :root { --sidebar-w: 60px; }

  .logo-text,
  .nav-label,
  .status-label { display: none; }

  .sidebar-toggle { display: flex; }

  .nav-item { justify-content: center; padding: 10px; }
  .nav-icon { width: 20px; height: 20px; }

  .calendar-status { justify-content: center; padding: 10px; }

  .main { padding: 24px 20px; }
}

@media (max-width: 640px) {
  .contacts-grid { grid-template-columns: 1fr; }

  .view-header { flex-direction: column; align-items: flex-start; }
  .view-actions { width: 100%; }
  .search-input { width: 100%; }
  .search-wrap { flex: 1; }

  .appointment-row { grid-template-columns: 1fr; }
  .appt-date strong { display: inline; }

  .drawer { width: 100%; }
  .form-row { grid-template-columns: 1fr; }
}

/* ─── Paste Importer ─────────────────────────────────────────────────────── */

.import-fab {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(99,102,241,0.45);
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 900;
}
.import-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 32px rgba(99,102,241,0.6);
}

.import-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 24px;
}

.import-drawer {
  background: #161616;
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 480px;
  max-width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.import-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.import-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.import-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}

.import-textarea {
  width: 100%;
  min-height: 160px;
  background: #0d0d0d;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  padding: 14px;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.6;
}
.import-textarea:focus { border-color: var(--accent); }

.import-parse-btn { width: 100%; justify-content: center; }

.import-preview { display: flex; flex-direction: column; gap: 12px; }

.preview-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.preview-card {
  background: #1e1e1e;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.preview-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.preview-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.preview-badge.contact { background: rgba(99,102,241,0.2); color: #818cf8; }
.preview-badge.appointment { background: rgba(34,197,94,0.15); color: #4ade80; }

.preview-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.preview-card-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.import-actions {
  display: flex;
  gap: 10px;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-ghost:hover { border-color: var(--text-muted); color: var(--text-primary); }

/* ─── Tags ───────────────────────────────────────────────────────────────── */

.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.tag-badge.removable {
  padding-right: 4px;
}

.tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.7;
  border-radius: 50%;
  transition: opacity 0.15s;
}
.tag-remove:hover { opacity: 1; }

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

/* ─── Drawer Tags Section ────────────────────────────────────────────────── */

.drawer-tags-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.drawer-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  min-height: 8px;
}

.drawer-tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-add-btn {
  background: none;
  border: 1px solid;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
  opacity: 0.6;
}
.tag-add-btn:hover { opacity: 1; background: rgba(255,255,255,0.04); }

.drawer-field-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
}
.drawer-field-link:hover { text-decoration: underline; }

/* ─── Freebusy indicator ─────────────────────────────────────────────────── */

.freebusy-indicator {
  font-size: 12px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  margin-top: 8px;
}
.freebusy-indicator.checking { background: rgba(99,102,241,0.08); color: #888; }
.freebusy-indicator.free     { background: rgba(34,197,94,0.1);   color: #22c55e; }
.freebusy-indicator.busy     { background: rgba(239,68,68,0.1);   color: #ef4444; }

/* ─── Appointment redesign ───────────────────────────────────────────────── */

.appt-day-header {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  padding: 18px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.appointment-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.appt-time {
  font-size: 12px;
  color: var(--text-2);
  padding-top: 2px;
  white-space: nowrap;
}

.appt-body { display: flex; flex-direction: column; gap: 4px; }

.appt-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.appt-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.appt-source-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
}
.appt-source-badge.google { background: rgba(66,133,244,0.15); color: #4285f4; }
.appt-source-badge.crm    { background: rgba(99,102,241,0.15); color: #6366f1; }

.appt-contact {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
}

.appt-contact-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.appt-desc {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.4;
}

.appt-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  padding-top: 3px;
}
.appt-link:hover { text-decoration: underline; }

#syncCalBtn {
  font-size: 12px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
