/* ═══════════════════════════════════════════════════════════
   BuildOS — Components CSS
   Buttons, Badges, Cards, Tables, Modals, Forms, etc.
═══════════════════════════════════════════════════════════ */

/* ─── Buttons (iOS Style) ────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.12s ease, opacity 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.97);
  opacity: 0.88;
}

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

.btn-icon {
  font-size: 15px;
  flex-shrink: 0;
}

/* Primary & Accent Buttons - Apple System Blue */
.btn-primary, .btn-accent {
  background: #007AFF;
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.28);
}
.btn-primary:hover, .btn-accent:hover {
  background: #0066D6;
  color: #FFFFFF;
}

/* Secondary - iOS Tinted Fill */
.btn-secondary {
  background: rgba(118, 118, 128, 0.12);
  color: #007AFF;
}
.btn-secondary:hover {
  background: rgba(118, 118, 128, 0.18);
  color: #0066D6;
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: #007AFF;
  padding: 6px 10px;
}
.btn-ghost:hover {
  background: rgba(0, 122, 255, 0.08);
  color: #0066D6;
}

/* Danger - iOS System Red */
.btn-danger {
  background: #FF3B30;
  color: white;
  box-shadow: 0 2px 8px rgba(255, 59, 48, 0.25);
}
.btn-danger:hover {
  background: #E0352B;
}

/* Success - iOS System Green */
.btn-success {
  background: #34C759;
  color: white;
  box-shadow: 0 2px 8px rgba(52, 199, 89, 0.25);
}
.btn-success:hover {
  background: #2EB04E;
}

/* Warning - iOS System Orange */
.btn-warning {
  background: #FF9500;
  color: white;
  box-shadow: 0 2px 8px rgba(255, 149, 0, 0.25);
}
.btn-warning:hover {
  background: #E68600;
}

/* Info - iOS System Indigo */
.btn-info {
  background: #5856D6;
  color: white;
  box-shadow: 0 2px 8px rgba(88, 86, 214, 0.25);
}
.btn-info:hover {
  background: #4C4ABF;
}

/* Link style */
.btn-link {
  background: none;
  border: none;
  color: var(--clr-accent);
  padding: 0;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.btn-link:hover {
  color: var(--clr-accent-dark);
}

/* Sizes */
.btn-xs { padding: 4px 10px; font-size: var(--text-xs); border-radius: var(--radius-sm); }
.btn-sm { padding: 5px 12px; font-size: var(--text-sm); }
.btn-lg { padding: 10px 24px; font-size: var(--text-md); }
.btn-xl { padding: 14px 32px; font-size: var(--text-lg); }

/* Icon-only */
.btn-icon-only {
  padding: 7px;
  border-radius: var(--radius-md);
}
.btn-icon-only.btn-sm { padding: 5px; }

/* ─── Badges / Status Pills (iOS Capsule Style) ──────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
  letter-spacing: 0.02em;
  border: none;
}

.badge-success  { background: rgba(52, 199, 89, 0.14); color: #248A3D; }
.badge-warning  { background: rgba(255, 149, 0, 0.14); color: #C97200; }
.badge-danger   { background: rgba(255, 59, 48, 0.14); color: #D70015; }
.badge-info     { background: rgba(0, 122, 255, 0.14); color: #007AFF; }
.badge-muted    { background: rgba(142, 142, 147, 0.14); color: #636366; }
.badge-accent   { background: rgba(0, 122, 255, 0.14); color: #007AFF; }
.badge-primary  { background: rgba(0, 122, 255, 0.14); color: #007AFF; }

/* Status badge with iOS dot */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: rgba(118, 118, 128, 0.08);
  color: #3C3C43;
  border: 0.5px solid rgba(60, 60, 67, 0.1);
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8E8E93;
  flex-shrink: 0;
}

.status-badge.active::before,
.status-badge.completed::before,
.status-badge.pass::before,
.status-badge.paid::before,
.status-badge.delivered::before,
.status-badge.approved::before {
  background: #34C759;
}

.status-badge.pending::before,
.status-badge.draft::before,
.status-badge.submitted::before,
.status-badge.review::before {
  background: #FF9500;
}

.status-badge.overdue::before,
.status-badge.rejected::before,
.status-badge.failed::before,
.status-badge.danger::before,
.status-badge.critical::before {
  background: #FF3B30;
}

.status-badge.info::before,
.status-badge.in-progress::before,
.status-badge.processing::before,
.status-badge.partial::before {
  background: #007AFF;
}

.status-badge.cancelled::before,
.status-badge.inactive::before {
  background: #8E8E93;
}

/* ─── Cards (iOS Grouped Surfaces) ───────────────────────── */
.card {
  background: var(--clr-surface);
  border: 0.5px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 0.5px solid var(--clr-border);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: #000000;
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: 13px;
  color: var(--clr-text-muted);
  margin-top: 2px;
}

/* KPI Cards */
.kpi-card {
  background: var(--clr-surface);
  border: 0.5px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
  cursor: default;
}

.kpi-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: #8E8E93;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: #000000;
  letter-spacing: -0.025em;
  line-height: 1.1;
  font-feature-settings: 'tnum' 1;
}

.kpi-sub {
  font-size: var(--text-xs);
  color: var(--clr-text-muted);
  margin-top: var(--space-1);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.kpi-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: 600;
}
.kpi-trend.up   { color: var(--clr-success); }
.kpi-trend.down { color: var(--clr-danger); }

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

/* ─── Tables (iOS Inset Grouped) ─────────────────────────── */
.table-container {
  background: var(--clr-surface);
  border: 0.5px solid var(--clr-border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
  box-shadow: var(--shadow-sm);
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 0.5px solid var(--clr-border);
  gap: var(--space-3);
  flex-wrap: wrap;
}

.table-toolbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.table-toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table thead {
  background: #F8F8FC;
  border-bottom: 0.5px solid var(--clr-border);
}

.data-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  color: #8E8E93;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.data-table th:hover {
  color: var(--clr-text-primary);
}

.data-table th.sorted { color: var(--clr-accent); }

.data-table td {
  padding: 13px 16px;
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.08);
  color: #000000;
  vertical-align: middle;
}

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

.data-table tbody tr:hover {
  background: rgba(0, 122, 255, 0.04);
  cursor: pointer;
}

.data-table tbody tr.selected {
  background: rgba(0, 122, 255, 0.08);
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--clr-border);
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* ─── Forms ──────────────────────────────────────────────── */
.form-group {
  margin-bottom: var(--space-4);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-4);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--clr-text-primary);
  margin-bottom: var(--space-1);
}

.form-label span.required {
  color: var(--clr-danger);
  margin-left: 2px;
}

.form-control {
  display: block;
  width: 100%;
  padding: 9px 13px;
  font-size: 13.5px;
  color: var(--clr-text-primary);
  background: rgba(118, 118, 128, 0.08);
  border: 0.5px solid var(--clr-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  outline: none;
  font-family: inherit;
}

.form-control:focus {
  background: #FFFFFF;
  border-color: #007AFF;
  box-shadow: 0 0 0 3.5px rgba(0, 122, 255, 0.18);
}

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

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

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

select.form-control {
  cursor: pointer;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--clr-text-muted);
  margin-top: var(--space-1);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--clr-danger);
  margin-top: var(--space-1);
  display: none;
}

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

/* Input Group */
.input-group {
  position: relative;
}

.input-group-prefix,
.input-group-suffix {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--clr-text-muted);
  font-size: var(--text-sm);
  pointer-events: none;
}

.input-group-prefix { left: 12px; }
.input-group-suffix { right: 12px; }

.input-group .form-control.has-prefix  { padding-left: 32px; }
.input-group .form-control.has-suffix  { padding-right: 32px; }

/* Search input */
.search-input {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 7px 12px;
  background: rgba(118, 118, 128, 0.1);
  border: 0.5px solid var(--clr-border);
  border-radius: var(--radius-md);
  min-width: 240px;
}

.search-input input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13.5px;
  color: var(--clr-text-primary);
  width: 100%;
  font-family: inherit;
}

.search-input input::placeholder {
  color: var(--clr-text-muted);
}

.search-icon { color: var(--clr-text-muted); font-size: 15px; }

/* Filter Chip */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(118, 118, 128, 0.08);
  border: 0.5px solid var(--clr-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-base);
}

.filter-chip:hover,
.filter-chip.active {
  background: rgba(0, 122, 255, 0.14);
  border-color: #007AFF;
  color: #007AFF;
  font-weight: 600;
}

/* ─── Modals (iOS Sheet Style) ───────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn 150ms ease;
}

.modal {
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-radius: var(--radius-2xl);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.18);
  border: 0.5px solid rgba(255, 255, 255, 0.8);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: scaleIn 150ms ease;
}

.modal-sm { max-width: 400px; }
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 960px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 0.5px solid var(--clr-border);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #000000;
  letter-spacing: -0.015em;
}

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(118, 118, 128, 0.12);
  color: #8E8E93;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-base);
}

.modal-close:hover {
  background: rgba(118, 118, 128, 0.22);
  color: #000000;
}

.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 0.5px solid var(--clr-border);
}

/* ─── Drawers ─────────────────────────────────────────────── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: var(--z-overlay);
  animation: fadeIn 200ms ease;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  max-width: 95vw;
  height: 100vh;
  background: var(--clr-surface);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  animation: slideInRight 200ms ease;
}

.drawer-lg {
  width: 680px;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 0.5px solid var(--clr-border);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
}

.drawer-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 0.5px solid var(--clr-border);
}

/* ─── Toast Notifications (iOS Dynamic Island Style) ──────── */
#toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px;
  background: rgba(28, 28, 30, 0.92);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  color: #FFFFFF;
  border-radius: var(--radius-full);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
  border: 0.5px solid rgba(255, 255, 255, 0.15);
  min-width: 280px;
  max-width: 440px;
  pointer-events: all;
  animation: fadeIn 200ms ease;
  transition: opacity 250ms ease, transform 250ms ease;
}

.toast.success  { border-left: 3px solid #34C759; }
.toast.warning  { border-left: 3px solid #FF9500; }
.toast.danger, .toast.error { border-left: 3px solid #FF3B30; }
.toast.info     { border-left: 3px solid #007AFF; }

.toast-icon { font-size: 16px; flex-shrink: 0; color: #FFFFFF; }
.toast-content { flex: 1; min-width: 0; }
.toast-title { font-weight: 600; font-size: 13px; color: #FFFFFF; }
.toast-message { font-size: 11.5px; opacity: 0.85; margin-top: 1px; color: #FFFFFF; }
.toast-dismiss {
  font-size: 16px;
  opacity: 0.6;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
}
.toast-dismiss:hover { opacity: 1; }

/* ─── Tabs (iOS Segmented Control) ───────────────────────── */
.tabs {
  display: inline-flex;
  background: rgba(118, 118, 128, 0.12);
  padding: 3px;
  border-radius: 10px;
  border: none;
  gap: 2px;
  margin-bottom: var(--space-5);
}

.tab {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #3C3C43;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.tab:hover {
  color: #000000;
}

.tab.active {
  background: #FFFFFF;
  color: #000000;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.06);
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ─── Empty States ───────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-8);
  text-align: center;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: var(--space-4);
  opacity: 0.4;
}

.empty-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--clr-text-primary);
  margin-bottom: var(--space-2);
}

.empty-message {
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
  max-width: 320px;
  margin-bottom: var(--space-5);
  line-height: 1.6;
}

/* ─── Stat Row ───────────────────────────────────────────── */
.stat-row {
  display: flex;
  gap: var(--space-6);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--clr-border);
}

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

.stat-item {
  flex: 1;
  text-align: center;
}

.stat-value {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--clr-text-primary);
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--clr-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

/* ─── Info List ──────────────────────────────────────────── */
.info-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.info-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--clr-border);
  font-size: var(--text-sm);
}

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

.info-key {
  color: var(--clr-text-muted);
  flex-shrink: 0;
  margin-right: var(--space-4);
}

.info-value {
  color: var(--clr-text-primary);
  font-weight: 500;
  text-align: right;
}

/* ─── Alert Boxes ────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
}

.alert-success { background: var(--clr-success-light); color: var(--clr-success); border: 1px solid var(--clr-success-100); }
.alert-warning { background: var(--clr-warning-light); color: var(--clr-warning); border: 1px solid var(--clr-warning-100); }
.alert-danger  { background: var(--clr-danger-light);  color: var(--clr-danger);  border: 1px solid var(--clr-danger-100); }
.alert-info    { background: var(--clr-info-light);    color: var(--clr-info);    border: 1px solid var(--clr-info-100); }

.alert-icon { font-size: 18px; flex-shrink: 0; }

/* ─── Tags ───────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-sm);
  background: var(--clr-primary-100);
  color: var(--clr-primary-700);
  white-space: nowrap;
}

/* ─── Risk Badge (Minimalist) ───────────────────────────── */
.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  color: var(--clr-text-secondary);
}

.risk-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.risk-badge.LOW::before      { background: #10B981; }
.risk-badge.MEDIUM::before   { background: #F59E0B; }
.risk-badge.HIGH::before     { background: #EF4444; }
.risk-badge.CRITICAL::before { background: #DC2626; }

/* ─── Action Row ─────────────────────────────────────────── */
.action-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ─── Timeline ───────────────────────────────────────────── */
.timeline {
  position: relative;
  padding-left: var(--space-8);
}

.timeline::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--clr-border);
}

.timeline-item {
  position: relative;
  margin-bottom: var(--space-5);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: calc(-2rem - 5px);
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--clr-border);
  background: var(--clr-surface);
}

.timeline-item.success::before { border-color: var(--clr-success); background: var(--clr-success); }
.timeline-item.warning::before { border-color: var(--clr-warning); background: var(--clr-warning); }
.timeline-item.danger::before  { border-color: var(--clr-danger);  background: var(--clr-danger); }
.timeline-item.active::before  { border-color: var(--clr-accent);  background: var(--clr-accent); }

.timeline-date { font-size: var(--text-xs); color: var(--clr-text-muted); }
.timeline-title { font-size: var(--text-sm); font-weight: 500; color: var(--clr-text-primary); margin-top: 2px; }
.timeline-desc  { font-size: var(--text-xs); color: var(--clr-text-secondary); margin-top: 2px; }

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

.spinner-sm {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

/* ─── Command Palette (macOS Spotlight Style) ────────────── */
#command-palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: calc(var(--z-modal) + 50);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 100px;
}

#command-palette {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 0.5px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-2xl);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.22);
  width: 100%;
  max-width: 580px;
  overflow: hidden;
  animation: scaleIn 150ms ease;
}

#command-palette-input {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 16px 20px;
  border-bottom: 0.5px solid var(--clr-border);
}

#command-palette-input input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  font-family: inherit;
  color: #000000;
  background: transparent;
}

#command-palette-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 6px;
}

.cp-section-title {
  font-size: 11px;
  font-weight: 600;
  color: #8E8E93;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 14px 4px;
}

.cp-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 9px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.cp-item:hover,
.cp-item.active {
  background: rgba(0, 122, 255, 0.12);
}

.cp-item.active .cp-item-label {
  color: #007AFF;
  font-weight: 600;
}

.cp-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(118, 118, 128, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.cp-item.active .cp-item-icon {
  background: #007AFF;
  color: #FFFFFF;
}

.cp-item-label { font-size: 13.5px; font-weight: 500; color: #000000; }
.cp-item-desc  { font-size: 11.5px; color: #8E8E93; }
.cp-item-shortcut {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: #8E8E93;
  background: rgba(118, 118, 128, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.cp-footer {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--clr-border);
  font-size: var(--text-xs);
  color: var(--clr-text-muted);
  background: var(--clr-surface-2);
}

/* ─── Dropdown (iOS Popover Style) ───────────────────────── */
.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 0.5px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.14);
  min-width: 190px;
  z-index: var(--z-dropdown);
  animation: scaleIn 100ms ease;
  overflow: hidden;
}

.dropdown-menu.left {
  right: auto;
  left: 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 9px var(--space-4);
  font-size: 13.5px;
  color: #000000;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.dropdown-item:hover { background: rgba(0, 122, 255, 0.1); color: #007AFF; }
.dropdown-item.danger { color: #FF3B30; }
.dropdown-item.danger:hover { background: rgba(255, 59, 48, 0.1); }
.dropdown-divider { height: 0.5px; background: rgba(60, 60, 67, 0.12); margin: var(--space-1) 0; }

/* ─── Summary Box ────────────────────────────────────────── */
.summary-box {
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
  padding: 5px 0;
}

.summary-row.total {
  font-size: var(--text-base);
  font-weight: 700;
  border-top: 1px solid var(--clr-border);
  margin-top: var(--space-2);
  padding-top: var(--space-3);
}

/* ─── Print button ───────────────────────────────────────── */
.print-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

/* ─── Notification Bell ──────────────────────────────────── */
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--clr-danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

/* ─── WhatsApp UI ─────────────────────────────────────────── */
.wa-bubble {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  gap: 4px;
  margin-bottom: var(--space-3);
}

.wa-bubble.out {
  align-self: flex-end;
  align-items: flex-end;
}

.wa-bubble.in {
  align-self: flex-start;
  align-items: flex-start;
}

.wa-message {
  background: #DCF8C6;
  color: var(--clr-text-primary);
  padding: 8px 12px;
  border-radius: 12px 12px 0px 12px;
  font-size: var(--text-sm);
  line-height: 1.5;
  white-space: pre-wrap;
  box-shadow: var(--shadow-xs);
}

.wa-bubble.in .wa-message {
  background: white;
  border-radius: 12px 12px 12px 0px;
}

.wa-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--clr-text-muted);
}

.wa-status {
  font-size: 13px;
}
.wa-status.sent       { color: var(--clr-text-muted); }
.wa-status.delivered  { color: var(--clr-info); }
.wa-status.read       { color: var(--clr-info); }
.wa-status.failed     { color: var(--clr-danger); }

/* ─── Topbar Layout & Elements (iOS Style) ────────────────── */
.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

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

.breadcrumb-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(0, 122, 255, 0.1);
  color: #007AFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.breadcrumb-text {
  display: flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb-group {
  font-size: 11px;
  font-weight: 600;
  color: #8E8E93;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.breadcrumb-sep {
  color: #C7C7CC;
  font-size: 12px;
  font-weight: 400;
}

.breadcrumb-current {
  font-size: 14.5px;
  font-weight: 700;
  color: #000000;
  letter-spacing: -0.015em;
}

/* Center Search */
.topbar-center {
  flex: 1;
  display: flex;
  justify-content: center;
  max-width: 440px;
  margin: 0 var(--space-4);
}

.topbar-search {
  width: 100%;
  position: relative;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: rgba(118, 118, 128, 0.1);
  border: 0.5px solid rgba(60, 60, 67, 0.12);
  border-radius: 10px;
  padding: 6px 12px;
  transition: all var(--transition-fast);
}

.search-input-wrapper:focus-within {
  background: #FFFFFF;
  border-color: #007AFF;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.18);
}

.search-input-wrapper input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13.5px;
  color: #000000;
  width: 100%;
  font-family: inherit;
}

.search-input-wrapper input::placeholder {
  color: #8E8E93;
}

.search-kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  color: #8E8E93;
  background: rgba(255, 255, 255, 0.9);
  border: 0.5px solid rgba(60, 60, 67, 0.2);
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  padding: 2px 6px;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
  line-height: 1.2;
}

.search-kbd:hover {
  background: #FFFFFF;
  color: #007AFF;
}

/* Right Actions */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

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

.topbar-divider {
  width: 1px;
  height: 20px;
  background: rgba(60, 60, 67, 0.15);
  margin: 0 4px;
}

.topbar-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  border: none;
  background: rgba(118, 118, 128, 0.08);
  color: #3C3C43;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.topbar-icon-btn:hover {
  background: rgba(0, 122, 255, 0.12);
  color: #007AFF;
}

.topbar-date {
  font-size: 12px;
  font-weight: 500;
  color: #8E8E93;
  white-space: nowrap;
  padding: 0 4px;
}

/* User profile button */
.topbar-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 6px;
  border-radius: 10px;
  border: 0.5px solid rgba(60, 60, 67, 0.1);
  background: rgba(118, 118, 128, 0.08);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.topbar-user-btn:hover {
  background: rgba(118, 118, 128, 0.15);
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}

.user-label {
  font-size: 12px;
  font-weight: 600;
  color: #000000;
}

.user-role-badge {
  font-size: 9px;
  font-weight: 600;
  color: #007AFF;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dropdown-chevron {
  font-size: 10px;
  color: #8E8E93;
  margin-left: 2px;
}
