/* ==========================================================================
   OrbisX — Component Library
   ========================================================================== */

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 22px;
  border-radius: var(--radius-full);
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: var(--weight-semibold);
  line-height: 1;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
}
.btn:disabled, .btn.btn-loading {
  opacity: 0.75;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Anchor buttons must keep their button-text colour on hover — the global
   a:hover rule in base.css turns anchor text cyan, which collides with the
   darker-cyan primary-button hover bg and makes the label invisible. */
a.btn-primary,
a.btn-primary:hover,
a.btn-primary:focus,
a.btn-primary:active { color: #FFFFFF; }

a.btn-danger,
a.btn-danger:hover,
a.btn-danger:focus,
a.btn-danger:active { color: #FFFFFF; }

.btn-primary {
  background: var(--color-brand-emerald);
  color: #FFFFFF;
}
.btn-primary:hover:not(:disabled) {
  background: var(--color-brand-emerald-dark);
  color: #FFFFFF;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px -4px rgba(16, 185, 129, 0.45);
}
.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}
.btn-success {
  background: var(--color-success);
  color: #FFFFFF;
}
.btn-success:hover:not(:disabled) {
  background: var(--color-success-dark);
  color: #FFFFFF;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px -4px rgba(16, 185, 129, 0.45);
}
.btn-success:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

.btn-secondary {
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--color-brand-emerald);
  color: var(--color-brand-emerald);
}

.btn-danger {
  background: var(--color-danger);
  color: #FFFFFF;
}
.btn-danger:hover:not(:disabled) {
  background: #DC2626;
  color: #FFFFFF;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}
.btn-danger:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border: 1.5px solid var(--color-border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--color-bg-secondary);
  border-color: var(--color-text-disabled);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-secondary);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-icon:hover {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
}

.btn-sm { padding: 7px 16px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }

.btn-block { width: 100%; }

.btn-loading .btn-text { visibility: hidden; }
.btn-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn { position: relative; }

/* ── Form Fields ───────────────────────────────────────────────────────── */

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: var(--space-4);
}

.field-label {
  font-size: 14px;
  font-weight: var(--weight-medium);
  color: var(--color-text-body);
  margin-bottom: 6px;
  display: block;
}

.field-input,
.field-select,
.field-textarea {
  width: 100%;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-family: var(--font-primary);
  font-size: 14px;
  color: var(--color-text-primary);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.field-input:focus,
.field-select:focus,
.field-textarea:focus {
  outline: none;
  border-color: var(--color-brand-emerald);
  box-shadow: 0 0 0 3px var(--color-brand-emerald-glow);
  background: var(--color-bg-primary);
}

.field-input::placeholder,
.field-textarea::placeholder {
  color: var(--color-text-disabled);
}

.field-input.error,
.field-select.error,
.field-textarea.error {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.field-input:disabled,
.field-select:disabled,
.field-textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.field-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.field-textarea {
  min-height: 100px;
  resize: vertical;
}

.field-helper {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

.field-error {
  font-size: 13px;
  color: var(--color-danger);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.field-input-wrapper {
  position: relative;
}
.field-input-wrapper .field-icon-right {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-disabled);
  cursor: pointer;
  width: 20px;
  height: 20px;
}
.field-input-wrapper .field-input {
  padding-right: 40px;
}

/* Checkbox */
.checkbox-custom {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  user-select: none;
  font-size: var(--text-sm);
  color: var(--color-text-body);
}
.checkbox-custom input { display: none; }
.checkbox-custom .checkmark {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid #CBD5E1;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.checkbox-custom input:checked + .checkmark {
  background: var(--color-brand-emerald);
  border-color: var(--color-brand-emerald);
}
.checkbox-custom input:checked + .checkmark::after {
  content: '';
  width: 10px;
  height: 6px;
  border-left: 2px solid #FFFFFF;
  border-bottom: 2px solid #FFFFFF;
  transform: rotate(-45deg) translateY(-1px);
}

/* Radio */
.radio-custom {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  user-select: none;
  font-size: var(--text-sm);
  color: var(--color-text-body);
}
.radio-custom input { display: none; }
.radio-custom .radiomark {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid #CBD5E1;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.radio-custom input:checked + .radiomark {
  border-color: var(--color-brand-emerald);
}
.radio-custom input:checked + .radiomark::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-brand-emerald);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  user-select: none;
}
.toggle-switch input { display: none; }
.toggle-track {
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: #CBD5E1;
  position: relative;
  transition: background 0.2s ease;
  flex-shrink: 0;
}
.toggle-switch input:checked ~ .toggle-track {
  background: var(--color-brand-emerald);
}
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}
.toggle-switch input:checked ~ .toggle-track .toggle-thumb {
  transform: translateX(18px);
}

/* Small variant for dense grids (e.g. notification preference matrix) */
.toggle-switch.toggle-sm .toggle-track { width: 34px; height: 20px; border-radius: 10px; }
.toggle-switch.toggle-sm .toggle-thumb { width: 16px; height: 16px; top: 2px; left: 2px; }
.toggle-switch.toggle-sm input:checked ~ .toggle-track .toggle-thumb { transform: translateX(14px); }

/* ── Cards ─────────────────────────────────────────────────────────────── */

.card {
  background: var(--color-bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border-subtle);
  padding: var(--space-6);
}

.card-hover {
  transition: all 0.25s var(--ease-default);
  cursor: pointer;
}
.card-hover:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: var(--color-border);
}

.card-stat {
  background: var(--color-bg-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border-subtle);
  transition: all 0.25s var(--ease-default);
}
.card-stat:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card-stat .stat-tile {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}
.card-stat .stat-tile svg { width: 22px; height: 22px; }
.card-stat .stat-label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  font-weight: var(--weight-medium);
}
.card-stat .stat-value {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-top: var(--space-1);
}
.card-stat .stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  margin-top: var(--space-3);
  padding: 3px 8px;
  border-radius: var(--radius-full);
}
.card-stat .stat-trend.up   { color: var(--color-success); background: var(--color-success-light); }
.card-stat .stat-trend.down { color: var(--color-danger);  background: var(--color-danger-light); }
.card-stat .stat-trend.flat { color: var(--color-text-secondary); background: var(--color-bg-tertiary); }

/* Icon tile colour variants (for stats/project cards) */
.tile-emerald { background: var(--tile-emerald-bg); color: var(--tile-emerald-fg); }
.tile-cyan    { background: var(--tile-cyan-bg);    color: var(--tile-cyan-fg); }
.tile-violet  { background: var(--tile-violet-bg);  color: var(--tile-violet-fg); }
.tile-amber   { background: var(--tile-amber-bg);   color: var(--tile-amber-fg); }
.tile-rose    { background: var(--tile-rose-bg);    color: var(--tile-rose-fg); }
.tile-slate   { background: var(--tile-slate-bg);   color: var(--tile-slate-fg); }

.card-callout {
  background: var(--color-brand-emerald-50);
  border-left: 4px solid var(--color-brand-emerald);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 14px 16px;
  font-size: var(--text-sm);
  color: var(--color-brand-emerald-deep);
}

/* ── Modals ─────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.closing {
  animation: fadeOut 0.2s ease forwards;
}

.modal-panel {
  background: var(--color-bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: calc(100% - 32px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s var(--ease-spring);
}

.modal-sm { max-width: 480px; }
.modal-md { max-width: 640px; }
.modal-lg { max-width: 800px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5);
  border-bottom: 1px solid var(--color-border-subtle);
  flex-shrink: 0;
}
.modal-header h3 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
}
.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.modal-close:hover {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
}

.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
  overscroll-behavior-y: contain;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border-subtle);
  flex-shrink: 0;
}

/* Mobile: Bottom Sheet */
@media (max-width: 639px) {
  .modal-overlay {
    align-items: flex-end;
  }
  .modal-panel {
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    animation: slideUpSheet 0.3s var(--ease-spring);
  }
  .modal-panel::before {
    content: '';
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: #CBD5E1;
    margin: 10px auto 0;
    display: block;
    flex-shrink: 0;
  }
}

/* ── Toasts ────────────────────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: 200; /* above modal overlays (100) */
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 320px;
  max-width: 480px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
  background: var(--color-bg-primary);
  pointer-events: auto;
  animation: slideInRight 0.3s var(--ease-spring);
}
.toast.dismissing {
  animation: fadeOut 0.2s ease forwards;
}

.toast-success { border-left: 4px solid var(--color-success); }
.toast-error   { border-left: 4px solid var(--color-danger); }
.toast-warning { border-left: 4px solid var(--color-warning); }
.toast-info    { border-left: 4px solid var(--color-info); }

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.toast-success .toast-icon { color: var(--color-success); }
.toast-error .toast-icon   { color: var(--color-danger); }
.toast-warning .toast-icon { color: var(--color-warning); }
.toast-info .toast-icon    { color: var(--color-info); }

.toast-message { flex: 1; }

.toast-dismiss {
  background: none;
  border: none;
  color: var(--color-text-disabled);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  font-size: 18px;
}
.toast-dismiss:hover { color: var(--color-text-secondary); }

@media (max-width: 639px) {
  .toast-container {
    top: var(--space-4);
    right: var(--space-4);
    left: var(--space-4);
  }
  .toast {
    min-width: 0;
    max-width: 100%;
    animation: slideDown 0.3s var(--ease-spring);
  }
}

/* ── Alerts (Inline) ───────────────────────────────────────────────────── */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}
.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.alert-danger  { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.alert-info    { background: #DBEAFE; color: #1E40AF; border: 1px solid #BFDBFE; }

/* ── Tables ────────────────────────────────────────────────────────────── */

.table-wrapper {
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border-subtle);
  background: var(--color-bg-primary);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table thead th {
  background: var(--color-bg-secondary);
  font-size: 12px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  padding: 10px 16px;
  text-align: left;
  white-space: nowrap;
}

.table tbody td {
  font-size: var(--text-sm);
  color: var(--color-text-body);
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border-subtle);
}

.table tbody tr {
  transition: background var(--duration-fast) var(--ease-default);
}
.table tbody tr:hover {
  background: var(--color-bg-secondary);
}
.table tbody tr:last-child td {
  border-bottom: none;
}

.table-empty {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--color-text-secondary);
}
.table-empty td {
  border-bottom: none !important;
}

/* ── Badges & Tags ─────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: var(--weight-semibold);
  white-space: nowrap;
}

.badge-success  { background: var(--badge-success-bg);   color: var(--badge-success-text); }
.badge-info     { background: var(--badge-scheduled-bg);  color: var(--badge-scheduled-text); }
.badge-pending  { background: var(--badge-pending-bg);    color: var(--badge-pending-text); }
.badge-warning  { background: var(--badge-warning-bg);    color: var(--badge-warning-text); }
.badge-danger   { background: var(--badge-danger-bg);     color: var(--badge-danger-text); }
.badge-paused   { background: var(--badge-paused-bg);     color: var(--badge-paused-text); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: var(--weight-medium);
  background: var(--color-bg-secondary);
  color: var(--color-text-body);
  border: 1px solid var(--color-border);
}

/* ── Loading States ────────────────────────────────────────────────────── */

.skeleton {
  background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  margin-bottom: var(--space-2);
}
.skeleton-text:last-child {
  width: 60%;
}

.skeleton-card {
  height: 120px;
  border-radius: var(--radius-md);
}

.skeleton-table {
  height: 48px;
  margin-bottom: 1px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #E2E8F0;
  border-top-color: var(--color-brand-emerald);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

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

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
}
.empty-state .empty-icon {
  width: 64px;
  height: 64px;
  color: var(--color-text-disabled);
  margin-bottom: var(--space-4);
}
.empty-state .empty-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}
.empty-state .empty-desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  max-width: 320px;
  margin-bottom: var(--space-5);
}

/* ── Page Header ───────────────────────────────────────────────────────── */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  gap: var(--space-4);
}
.page-header h1 {
  font-size: var(--text-3xl);
}
.page-header-actions {
  display: flex;
  gap: var(--space-3);
}

@media (max-width: 639px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .page-header h1 {
    font-size: var(--text-2xl);
  }
}

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

.grid {
  display: grid;
  gap: var(--space-4);
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 639px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* ── Quick Action List (for right quick-panel) ─────────────────────────── */

.quick-action-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.quick-action-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-default);
}
.quick-action-item:hover {
  border-color: var(--color-brand-emerald);
  background: var(--color-bg-secondary);
  transform: translateX(-2px);
}

.quick-action-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tile-emerald-bg);
  color: var(--tile-emerald-fg);
}

.quick-action-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.quick-action-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

.quick-action-desc {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.quick-action-chevron {
  color: var(--color-text-disabled);
  flex-shrink: 0;
}

/* ── Page Header ───────────────────────────────────────────────────────── */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}
.page-header h1 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  letter-spacing: -0.02em;
}
.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ── Badges (soft pastel pills) ────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  line-height: 1.4;
}
.badge-success   { background: var(--badge-success-bg);   color: var(--badge-success-text); }
.badge-scheduled { background: var(--badge-scheduled-bg); color: var(--badge-scheduled-text); }
.badge-pending   { background: var(--badge-pending-bg);   color: var(--badge-pending-text); }
.badge-warning   { background: var(--badge-warning-bg);   color: var(--badge-warning-text); }
.badge-danger    { background: var(--badge-danger-bg);    color: var(--badge-danger-text); }
.badge-paused    { background: var(--badge-paused-bg);    color: var(--badge-paused-text); }

/* ── Data Table (Dashly-style) ─────────────────────────────────────────── */

.data-table-wrap {
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.data-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border-subtle);
}
.data-table-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  padding: 12px var(--space-6);
  border-bottom: 1px solid var(--color-border-subtle);
  background: var(--color-bg-secondary);
}
.data-table tbody td {
  padding: 16px var(--space-6);
  font-size: var(--text-sm);
  color: var(--color-text-body);
  border-bottom: 1px solid var(--color-border-subtle);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--color-bg-secondary); }
.data-table td.cell-primary {
  color: var(--color-text-primary);
  font-weight: var(--weight-semibold);
}
.data-table td.cell-mono { font-variant-numeric: tabular-nums; }
.data-table .row-actions {
  display: inline-flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.data-table tr:hover .row-actions { opacity: 1; }

/* ── Project-style Feature Card ────────────────────────────────────────── */

.feature-card {
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
  transition: all 0.25s var(--ease-default);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-border);
}
.feature-card:hover .stat-tile {
  transform: scale(1.05) rotate(-3deg);
}
.feature-card .stat-tile {
  transition: transform 0.25s var(--ease-spring);
}
.feature-card-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}
.feature-card-desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
}
.feature-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-2);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border-subtle);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

/* ── Activity Row (dashboard list) ─────────────────────────────────────── */

.activity-list {
  display: flex;
  flex-direction: column;
}
.activity-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border-subtle);
}
.activity-row:last-child { border-bottom: none; }
.activity-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--color-bg-tertiary);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  flex-shrink: 0;
}
.activity-body { flex: 1; min-width: 0; }
.activity-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}
.activity-desc {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: 2px;
}
.activity-meta {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ── Card Header (reusable) ────────────────────────────────────────────── */

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  gap: var(--space-3);
}
.card-header h4,
.card-header h3 {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
}
.card-header-link {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-brand-emerald);
}

/* ── Stagger Animation ─────────────────────────────────────────────────── */

.stagger-item { animation: staggerIn 0.4s var(--ease-default) both; }
.stagger-item:nth-child(1) { animation-delay: 0.00s; }
.stagger-item:nth-child(2) { animation-delay: 0.05s; }
.stagger-item:nth-child(3) { animation-delay: 0.10s; }
.stagger-item:nth-child(4) { animation-delay: 0.15s; }
.stagger-item:nth-child(5) { animation-delay: 0.20s; }
.stagger-item:nth-child(6) { animation-delay: 0.25s; }

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

/* ── Changelog (What's New) ────────────────────────────────────────────── */

.changelog-groups {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  max-width: 780px;
}

.changelog-group-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 var(--space-3);
}

.changelog-card {
  padding: var(--space-6);
}

.changelog {
  position: relative;
  padding-left: var(--space-6);
}

.changelog::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: var(--color-border);
  border-radius: var(--radius-full);
}

.changelog-entry {
  position: relative;
  padding-bottom: var(--space-6);
}
.changelog-entry:last-child { padding-bottom: 0; }

.changelog-entry::before {
  content: '';
  position: absolute;
  left: calc(-1 * var(--space-6) + 1px);
  top: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #E11D48;
  box-shadow: 0 0 0 3px var(--color-bg-primary);
}

.changelog-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.changelog-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.changelog-version {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 11px;
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.01em;
}

.changelog-tag {
  font-size: 10px;
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}
.changelog-tag-new        { background: var(--badge-success-bg);      color: var(--badge-success-text); }
.changelog-tag-improved   { background: var(--color-brand-cyan-glow); color: var(--color-brand-cyan-dark); }
.changelog-tag-fixed      { background: var(--badge-scheduled-bg);    color: var(--badge-scheduled-text); }

.changelog-date {
  margin-left: auto;
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
}

.changelog-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  margin: var(--space-1) 0 0;
}

.changelog-body {
  font-size: var(--text-sm);
  color: var(--color-text-body);
  line-height: var(--leading-relaxed);
  margin: 0;
}

.changelog-note {
  font-size: var(--text-sm);
  color: var(--color-text-body);
  line-height: var(--leading-relaxed);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-top: var(--space-2);
}

/* ── Settings ──────────────────────────────────────────────────────────── */

.settings-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}

.settings-nav {
  position: sticky;
  top: calc(var(--topbar-height) + var(--space-4));
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-2);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-body);
  text-decoration: none;
  transition: background var(--duration-fast) var(--ease-default),
              color var(--duration-fast) var(--ease-default);
}
.settings-nav-item:hover {
  background: var(--color-sidebar-hover);
  color: var(--color-text-primary);
}
.settings-nav-item.active {
  background: var(--color-brand-emerald-50);
  color: var(--color-brand-emerald-deep);
}

.settings-nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--color-text-secondary);
}
.settings-nav-item.active .settings-nav-icon {
  color: var(--color-brand-emerald);
}

.settings-main {
  min-width: 0;
}

.settings-section-header {
  margin-bottom: var(--space-5);
}
.settings-section-header h2 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
}
.settings-section-header p {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
  max-width: 640px;
}

.settings-tabs {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
  scrollbar-width: none;
}
.settings-tabs::-webkit-scrollbar { display: none; }

.settings-tab {
  position: relative;
  padding: 10px var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--duration-fast) var(--ease-default),
              border-color var(--duration-fast) var(--ease-default);
}
.settings-tab:hover {
  color: var(--color-text-primary);
}
.settings-tab.active {
  color: var(--color-brand-emerald);
  border-bottom-color: var(--color-brand-emerald);
  font-weight: var(--weight-semibold);
}

@media (max-width: 900px) {
  .settings-layout {
    grid-template-columns: 1fr;
  }
  .settings-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    scrollbar-width: none;
    padding: var(--space-2);
  }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-nav-item {
    flex-shrink: 0;
  }
}

/* ── Contacts (Clients + Leads shared) ─────────────────────────────────── */

.page-back {
  display: inline-block;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  text-decoration: none;
  margin-bottom: var(--space-2);
}
.page-back:hover { color: var(--color-text-primary); }

.list-toolbar {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}
.list-toolbar-search {
  flex: 1 1 260px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}
.list-toolbar-search svg { width: 16px; height: 16px; color: var(--color-text-secondary); flex-shrink: 0; }
.list-toolbar-search .field-input { border: 0; box-shadow: none; padding: 6px 0; background: transparent; }
.list-toolbar-search .field-input:focus { outline: none; }
.list-toolbar-filters { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.list-toolbar-filters .field-select { min-width: 140px; }

.contact-list-card { padding: 0; overflow: hidden; }
.contact-list-table { width: 100%; border-collapse: collapse; }
.contact-list-table th,
.contact-list-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-border-subtle);
  vertical-align: middle;
}
.contact-list-table thead th {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-secondary);
  font-weight: var(--weight-semibold);
  background: var(--color-bg-secondary);
}
.contact-list-table tbody tr:last-child td { border-bottom: 0; }
.contact-list-table tbody tr.contact-row { cursor: pointer; transition: background 0.12s; }
.contact-list-table tbody tr.contact-row:hover { background: var(--color-bg-secondary); }

.contact-cell { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.contact-name { font-weight: var(--weight-semibold); }
.contact-name a { color: var(--color-text-primary); text-decoration: none; }
.contact-name a:hover { color: var(--color-brand-cyan-dark); }

.contact-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-brand-cyan-glow);
  color: var(--color-brand-cyan-dark);
  font-weight: var(--weight-semibold);
  overflow: hidden;
  flex-shrink: 0;
}
.contact-avatar img { width: 100%; height: 100%; object-fit: cover; }
.contact-avatar-sm { width: 32px; height: 32px; font-size: 11px; }
.contact-avatar-md { width: 48px; height: 48px; font-size: 14px; }
.contact-avatar-lg { width: 72px; height: 72px; font-size: 22px; }

.contact-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 8px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--tag, #888) 10%, transparent);
  color: color-mix(in srgb, var(--tag, #444) 75%, var(--color-text-primary));
  font-size: 11px;
  font-weight: var(--weight-medium);
  white-space: nowrap;
}
.contact-tag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tag, currentColor);
  flex-shrink: 0;
}
.contact-tags-row { display: flex; flex-wrap: wrap; gap: 4px; }

/* ── Profile page ──────────────────────────────────────────────────────── */

.profile-page { display: flex; flex-direction: column; gap: var(--space-4); }

.profile-header {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: var(--space-4) var(--space-6);
  padding: var(--space-6);
}
.profile-header-main { display: flex; gap: var(--space-5); align-items: flex-start; min-width: 0; }
.profile-identity { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.profile-name-row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.profile-name { font-size: var(--text-2xl); font-weight: var(--weight-semibold); margin: 0; }
.profile-meta { display: flex; flex-wrap: wrap; gap: var(--space-4); color: var(--color-text-secondary); font-size: var(--text-sm); }
.profile-meta-item { display: inline-flex; align-items: center; gap: 6px; }
.profile-meta-item svg { width: 14px; height: 14px; }
.profile-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.profile-stats {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border-subtle);
}
.profile-stat-label { font-size: var(--text-xs); color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.profile-stat-value { font-size: var(--text-xl); font-weight: var(--weight-semibold); color: var(--color-text-primary); margin-top: 2px; font-variant-numeric: tabular-nums; }

.profile-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border-subtle);
}
.profile-actions .btn svg { width: 14px; height: 14px; }

/* Tabs */
.profile-tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
  scrollbar-width: none;
}
.profile-tabs::-webkit-scrollbar { display: none; }
.profile-tab {
  background: transparent;
  border: 0;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  transition: color 0.12s, border-color 0.12s;
}
.profile-tab:hover { color: var(--color-text-primary); }
.profile-tab.active { color: var(--color-brand-cyan-dark); border-bottom-color: var(--color-brand-cyan-dark); }
.profile-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--color-bg-tertiary);
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: var(--weight-semibold);
}
.profile-tab.active .profile-tab-count { background: var(--color-brand-cyan-glow); color: var(--color-brand-cyan-dark); }

.profile-tab-content { display: flex; flex-direction: column; gap: var(--space-4); }

/* Two-column tab content */
.profile-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--space-4); }
.profile-main, .profile-side { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
@media (max-width: 900px) { .profile-grid { grid-template-columns: 1fr; } }

.section-card { padding: var(--space-5); }
.section-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.section-card-head h3 { font-size: var(--text-base); font-weight: var(--weight-semibold); margin: 0; }
.section-card-body { font-size: var(--text-sm); color: var(--color-text-body); }
.section-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }
.section-card-header h3 { font-size: var(--text-base); font-weight: var(--weight-semibold); margin: 0; }
.section-stack { display: flex; flex-direction: column; gap: var(--space-3); }

.detail-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-2); }
.detail-row { display: grid; grid-template-columns: 160px 1fr; gap: var(--space-3); padding: 6px 0; border-bottom: 1px dashed var(--color-border-subtle); }
.detail-row:last-child { border-bottom: 0; }
.detail-row dt { color: var(--color-text-secondary); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.04em; margin: 0; align-self: center; }
.detail-row dd { margin: 0; color: var(--color-text-primary); font-size: var(--text-sm); }
.detail-text { white-space: pre-wrap; line-height: var(--leading-relaxed); margin: 0; }
.text-muted { color: var(--color-text-secondary); }

/* Vehicles */
.vehicle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-3); }
.vehicle-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.vehicle-photo { aspect-ratio: 16 / 9; background: var(--color-bg-secondary); display: flex; align-items: center; justify-content: center; }
.vehicle-photo img { width: 100%; height: 100%; object-fit: cover; }
.vehicle-photo-ph svg { width: 48px; height: 48px; color: var(--color-text-disabled); }
.vehicle-body { padding: var(--space-4); display: flex; flex-direction: column; gap: 6px; }
.vehicle-title { font-weight: var(--weight-semibold); }
.vehicle-sub { color: var(--color-text-secondary); font-size: var(--text-sm); }
.vehicle-detail { display: flex; flex-direction: column; gap: 2px; font-size: var(--text-xs); color: var(--color-text-secondary); }
.vehicle-detail strong { color: var(--color-text-primary); font-weight: var(--weight-semibold); margin-right: 4px; }
.vehicle-notes { font-size: var(--text-sm); color: var(--color-text-body); margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--color-border-subtle); }

/* Addresses */
.address-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-3); }
.address-card { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); }
.address-card-head { display: flex; justify-content: space-between; align-items: center; }
.address-label { font-weight: var(--weight-semibold); }
.address-lines { font-size: var(--text-sm); line-height: var(--leading-relaxed); }

/* Notes composer */
.notes-composer { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); }
.notes-composer-actions { display: flex; justify-content: space-between; align-items: center; }
.note-entry { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); }
.note-entry-head { display: flex; gap: var(--space-2); align-items: baseline; }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-3); position: relative; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 2px; background: var(--color-border-subtle); }
.timeline-item { position: relative; padding-left: var(--space-5); }
.timeline-dot { position: absolute; left: 0; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--color-brand-cyan); box-shadow: 0 0 0 3px var(--color-bg-primary); }
.timeline-email .timeline-dot { background: #3B82F6; }
.timeline-call  .timeline-dot { background: #10B981; }
.timeline-sms   .timeline-dot { background: #14B8A6; }
.timeline-note  .timeline-dot { background: #9CA3AF; }
.timeline-invoice .timeline-dot { background: #F59E0B; }
.timeline-appointment .timeline-dot { background: var(--color-brand-cyan); }
.timeline-text { font-size: var(--text-sm); color: var(--color-text-primary); }
.timeline-detail { font-size: var(--text-xs); margin-top: 2px; }
.timeline-time { font-size: var(--text-xs); color: var(--color-text-secondary); margin-top: 2px; }
.timeline-lg .timeline-item { padding-bottom: var(--space-2); }

/* Form rows (reused with inv-section) */
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); margin-bottom: var(--space-3); }
.form-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-row-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.address-edit { padding: var(--space-3) 0; border-bottom: 1px dashed var(--color-border-subtle); margin-bottom: var(--space-3); }
.address-edit:last-of-type { border-bottom: 0; }
.checkbox-label { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); cursor: pointer; }

/* Follow-up task list */
.task-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.task-item { display: flex; gap: var(--space-3); align-items: flex-start; font-size: var(--text-sm); }

/* Segmented control */
.seg-control { display: inline-flex; background: var(--color-bg-secondary); border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 2px; }
.seg-btn { background: transparent; border: 0; padding: 4px 12px; font-size: var(--text-sm); color: var(--color-text-secondary); cursor: pointer; border-radius: calc(var(--radius-sm) - 2px); }
.seg-btn.active { background: var(--color-bg-primary); color: var(--color-text-primary); box-shadow: 0 1px 2px rgba(0,0,0,0.05); }

/* Lead stage strip */
.lead-stage-strip {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.lead-stage-tile {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-subtle);
}
.lead-stage-label { font-size: var(--text-xs); color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.lead-stage-count { font-size: var(--text-xl); font-weight: var(--weight-semibold); color: var(--color-text-primary); margin-top: 2px; }
@media (max-width: 900px) { .lead-stage-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Kanban */
.lead-kanban { display: grid; grid-template-columns: repeat(7, minmax(220px, 1fr)); gap: var(--space-3); overflow-x: auto; padding-bottom: var(--space-2); }
.kanban-col { background: var(--color-bg-secondary); border-radius: var(--radius-md); padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-3); min-width: 220px; }
.kanban-col-head { display: flex; justify-content: space-between; align-items: center; }
.kanban-col-body { display: flex; flex-direction: column; gap: var(--space-2); }
.kanban-card { display: flex; flex-direction: column; gap: 4px; padding: var(--space-3); background: var(--color-bg-primary); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-sm); font-size: var(--text-sm); color: var(--color-text-primary); text-decoration: none; transition: border-color 0.12s, box-shadow 0.12s; }
.kanban-card:hover { border-color: var(--color-brand-cyan); box-shadow: 0 2px 8px rgba(0,196,224,0.12); }
.kanban-card-name { font-weight: var(--weight-semibold); }
.kanban-card-meta { display: flex; justify-content: space-between; font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.kanban-empty { padding: var(--space-4); text-align: center; font-size: var(--text-sm); }

/* Actions dropdown */
.actions-wrap { position: relative; display: inline-block; }
.actions-trigger { display: inline-flex; align-items: center; gap: 6px; }
.actions-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(15, 17, 21, 0.12);
  padding: 4px;
  z-index: 30;
  display: none;
}
.actions-menu.open { display: block; animation: fadeIn 0.12s ease; }
.actions-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  text-align: left;
  cursor: pointer;
}
.actions-menu-item:hover { background: var(--color-bg-secondary); }
.actions-menu-item svg { width: 14px; height: 14px; color: var(--color-text-secondary); }

/* Search modal fields */
.search-field { margin-bottom: var(--space-4); }
.search-field:last-child { margin-bottom: 0; }
.search-field-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

/* Multi-check chip grid */
.multi-check {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.multi-check-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  color: var(--color-text-body);
  cursor: pointer;
  user-select: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.multi-check-item:hover { border-color: var(--color-brand-cyan); }
.multi-check-item input { display: none; }
.multi-check-item.checked {
  background: var(--color-brand-cyan-glow);
  border-color: var(--color-brand-cyan);
  color: var(--color-brand-cyan-dark);
  font-weight: var(--weight-medium);
}
.multi-check-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Link-style button */
.btn-link {
  background: transparent;
  border: 0;
  color: var(--color-brand-cyan-dark);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  cursor: pointer;
  padding: 0;
}
.btn-link:hover { text-decoration: underline; }

/* Services catalog (settings) */
.svc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}
.svc-header-actions { display: flex; gap: var(--space-2); }

.svc-category {
  padding: 0;
  margin-bottom: var(--space-3);
  overflow: hidden;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-bg-primary);
}
.svc-category-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border-subtle);
}
.svc-category-head h3 { margin: 0; font-size: var(--text-sm); font-weight: var(--weight-semibold); }

.svc-list-header {
  display: flex;
  justify-content: space-between;
  padding: var(--space-1) var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
}

.svc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
  cursor: pointer;
  transition: background 0.12s;
}
.svc-row:last-child { border-bottom: 0; }
.svc-row:hover { background: var(--color-bg-secondary); }
.svc-row-main { flex: 1; min-width: 0; }
.svc-name { font-size: var(--text-sm); font-weight: var(--weight-medium); }
.svc-meta { font-size: var(--text-xs); margin-top: 2px; }
.svc-desc { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }
.svc-toggles { display: flex; gap: var(--space-3); flex-shrink: 0; }
.svc-settings-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-5);
  align-items: start;
}
.svc-settings-left { min-width: 0; }
.svc-settings-right {
  border-inline-start: 1px solid var(--color-border-subtle);
  padding-inline-start: var(--space-5);
  min-width: 160px;
}
@media (max-width: 640px) {
  .svc-settings-row { grid-template-columns: 1fr; }
  .svc-settings-right { border-inline-start: 0; padding-inline-start: 0; border-top: 1px solid var(--color-border-subtle); padding-top: var(--space-3); }
}
.svc-toggles-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2) var(--space-5);
  padding: var(--space-3) 0;
}
.svc-toggle-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-body);
}

.svc-colour-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 4px;
  border: 1px solid rgba(0,0,0,0.1);
}
.pricing-rule-row { cursor: pointer; transition: background 0.12s; }
.pricing-rule-row:hover { background: var(--color-bg-secondary); }
.svc-starting-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-brand-cyan-dark);
  background: var(--color-brand-cyan-glow);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  vertical-align: middle;
  margin-right: 2px;
}

/* File upload component */
.file-upload {
  position: relative;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-secondary);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  overflow: hidden;
  min-height: 100px;
}
.file-upload:hover, .file-upload.dragover {
  border-color: var(--color-brand-cyan);
  background: var(--color-brand-cyan-glow);
}
.file-upload.has-file {
  border-style: solid;
  border-color: var(--color-border-subtle);
  background: var(--color-bg-primary);
}
.file-upload-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-4);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}
.file-upload-drop svg { color: var(--color-text-disabled); }
.file-upload-preview {
  display: block;
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  background: var(--color-bg-secondary);
  padding: var(--space-2);
}
.file-upload.has-file { min-height: auto; }
.file-upload-actions {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  display: flex;
  gap: 4px;
}
.file-upload-actions .btn {
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(4px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.file-upload-progress {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
}
.file-upload-bar {
  flex: 1;
  height: 6px;
  background: var(--color-bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}
.file-upload-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--color-brand-cyan);
  border-radius: 3px;
  transition: width 0.15s ease;
}
.file-upload-pct {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 36px;
}

/* Lightbox (full-screen image viewer) */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.lightbox.is-open { opacity: 1; }
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}
.lightbox-img {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.25s var(--ease-spring);
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  border: 0;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.3); }

/* Copy button (inline icon next to email/phone) */
.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  margin-inline-start: 4px;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: color 0.12s, background 0.12s;
  vertical-align: middle;
}
.copy-btn:hover { color: var(--color-brand-cyan-dark); background: var(--color-bg-secondary); }
.copy-btn.copied { color: var(--color-success); }

/* Tag picker */
.tag-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 340px;
  overflow-y: auto;
}
.tag-picker-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 2px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.tag-picker-item:hover { border-color: var(--color-brand-cyan); }
.tag-picker-item.checked {
  border-color: var(--color-brand-cyan);
  background: var(--color-brand-cyan-glow);
}
.tag-picker-check {
  width: 16px;
  text-align: center;
  font-size: 12px;
  font-weight: var(--weight-bold);
  color: var(--color-brand-cyan-dark);
}
.tag-picker-create-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.tag-colour-swatches {
  display: flex;
  gap: 4px;
}
.tag-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.12s, transform 0.1s;
  padding: 0;
}
.tag-swatch:hover { transform: scale(1.15); }
.tag-swatch.active { border-color: var(--color-text-primary); }

/* Pill selector (radio group styled as toggleable cards — like roadmap type picker) */
.pill-select {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pill-select-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1.5px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-body);
  user-select: none;
}
.pill-select-item input { display: none; }
.pill-select-item:hover { border-color: var(--color-border); }
.pill-select-item.active {
  border-color: var(--color-brand-emerald);
  background: var(--badge-success-bg);
  color: var(--badge-success-text);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

/* Form sidebar spacing */
.inv-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Ghost button with danger tone (used in edit modal footers for Delete) */
.btn-ghost.btn-danger-link {
  color: var(--badge-danger-text, #991B1B);
}
.btn-ghost.btn-danger-link:hover {
  background: var(--badge-danger-bg, #FEE2E2);
  color: var(--badge-danger-text, #991B1B);
}

/* Bulk delete picker */
.bulk-picker { display: flex; flex-direction: column; gap: var(--space-3); }
.bulk-picker-toolbar {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}
.bulk-picker-search { flex: 1; }
.bulk-picker-all { flex-shrink: 0; }
.bulk-picker-list {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-bg-primary);
}
.bulk-picker-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border-subtle);
  cursor: pointer;
  transition: background 0.1s;
}
.bulk-picker-row:last-child { border-bottom: 0; }
.bulk-picker-row:hover { background: var(--color-bg-secondary); }
.bulk-picker-row.checked { background: var(--color-brand-cyan-glow); }
.bulk-picker-row input { flex-shrink: 0; }
.bulk-picker-body { flex: 1; min-width: 0; }
.bulk-picker-name { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text-primary); }
.bulk-picker-sub { font-size: var(--text-xs); color: var(--color-text-secondary); }
.bulk-picker-meta {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  flex-shrink: 0;
  padding: 2px 8px;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-full);
}
.bulk-picker-count {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
}

/* Filter summary strip */
.filter-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-full);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
}

/* Generic orbis table */
.orbis-table { width: 100%; border-collapse: collapse; }
.orbis-table th, .orbis-table td { padding: var(--space-3) var(--space-4); text-align: left; font-size: var(--text-sm); border-bottom: 1px solid var(--color-border-subtle); }
.orbis-table thead th { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-secondary); background: var(--color-bg-secondary); font-weight: var(--weight-semibold); }
.orbis-table tbody tr:last-child td { border-bottom: 0; }

/* Language switcher (topbar) */
.topbar-lang { position: relative; }
.topbar-lang .topbar-btn { gap: 6px; padding: 0 10px; width: auto; }
.lang-code {
  font-size: 11px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  color: var(--color-text-secondary);
}
.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(15, 17, 21, 0.12);
  padding: 4px;
  z-index: 40;
  display: none;
}
.lang-menu.open { display: block; animation: fadeIn 0.12s ease; }
.lang-menu-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
}
.lang-menu-item:hover { background: var(--color-bg-secondary); }
.lang-menu-item.active { background: var(--color-brand-cyan-glow); }
.lang-menu-code {
  font-size: 10px;
  font-weight: var(--weight-bold);
  letter-spacing: 0.06em;
  color: var(--color-brand-cyan-dark);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--color-brand-cyan-glow);
  text-align: center;
}
.lang-menu-native { font-size: var(--text-sm); color: var(--color-text-primary); }
.lang-menu-en { font-size: var(--text-xs); }

/* ── My Account / Profile ───────────────────────────────────────────── */

.account-page { display: flex; flex-direction: column; gap: var(--space-4); }
.account-page #account-tab-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.account-header {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-5) var(--space-6);
}
.account-avatar {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--color-brand-cyan-glow);
  color: var(--color-brand-cyan-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: var(--weight-semibold);
  overflow: hidden;
}
.account-avatar img { width: 100%; height: 100%; object-fit: cover; }
.account-identity { min-width: 0; flex: 1; }
.account-name {
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  margin: 0 0 4px;
  color: var(--color-text-primary);
}
.account-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--color-text-body);
}

.account-section { padding: var(--space-4) var(--space-5); }
.account-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.account-section-head h3 {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  margin: 0;
}
.account-section-body { display: flex; flex-direction: column; gap: var(--space-3); }
.account-section-body .form-row { margin-bottom: 0; }

.field-hint { margin-top: 4px; font-size: var(--text-xs); }

/* Save indicator pill */
.save-status {
  font-size: 11px;
  font-weight: var(--weight-medium);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
  min-height: 18px;
  transition: opacity 0.15s ease;
}
.save-status.saving { background: var(--color-bg-tertiary); color: var(--color-text-secondary); }
.save-status.saved  { background: var(--badge-success-bg); color: var(--badge-success-text); }
.save-status.local  { background: var(--color-brand-cyan-glow); color: var(--color-brand-cyan-dark); }
.save-status.error  { background: var(--badge-danger-bg, #FEE2E2); color: var(--badge-danger-text, #991B1B); }

.local-tag {
  display: inline-block;
  margin-inline-start: 6px;
  padding: 1px 6px;
  font-size: 10px;
  background: var(--color-brand-cyan-glow);
  color: var(--color-brand-cyan-dark);
  border-radius: var(--radius-full);
}

/* Notification preference grid */
.notif-grid { width: 100%; border-collapse: collapse; }
.notif-grid th, .notif-grid td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border-subtle);
  text-align: left;
  font-size: var(--text-sm);
}
.notif-grid thead th {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-secondary);
  font-weight: var(--weight-semibold);
}
.notif-grid th:not(:first-child),
.notif-grid td:not(:first-child) { text-align: center; width: 92px; }
.notif-grid td:not(:first-child) .toggle-switch { display: inline-flex; }
.notif-grid tbody tr:last-child td { border-bottom: 0; }

/* Active sessions list */
.session-list { list-style: none; padding: 0; margin: 0; }
.session-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border-subtle);
  gap: var(--space-3);
}
.session-row:last-child { border-bottom: 0; }
.session-device { font-size: var(--text-sm); font-weight: var(--weight-medium); display: flex; align-items: center; gap: 8px; }
.session-meta   { font-size: var(--text-xs); margin-top: 2px; }

@media (max-width: 720px) {
  .account-header { flex-direction: column; align-items: flex-start; }
}

/* ── RTL adjustments (Arabic, etc.) ────────────────────────────────────
   New CSS should prefer logical properties (margin-inline-start,
   padding-inline-end, inset-inline-*) so RTL works without overrides.
   These rules only fix existing physical-direction styles. */

[dir="rtl"] {
  /* Tables/cells flip their natural text alignment */
  text-align: right;
}
[dir="rtl"] .orbis-table th,
[dir="rtl"] .orbis-table td,
[dir="rtl"] .contact-list-table th,
[dir="rtl"] .contact-list-table td { text-align: right; }

/* Toolbar search icon sits on the start edge */
[dir="rtl"] .list-toolbar-search svg { left: auto; right: 12px; }
[dir="rtl"] .list-toolbar-search .field-input { padding-left: var(--space-3); padding-right: 36px; }

/* Profile header stats border moves to the start edge */
[dir="rtl"] .profile-stats {
  border-left: 0;
  border-right: 1px solid var(--color-border-subtle);
  padding-left: 0;
  padding-right: var(--space-6);
}

/* Timeline vertical line flips to the start edge */
[dir="rtl"] .timeline::before { left: auto; right: 5px; }
[dir="rtl"] .timeline-item { padding-left: 0; padding-right: var(--space-5); }
[dir="rtl"] .timeline-dot { left: auto; right: 0; }

/* Changelog timeline (What's new) */
[dir="rtl"] .changelog { padding-left: 0; padding-right: var(--space-6); }
[dir="rtl"] .changelog::before { left: auto; right: 5px; }
[dir="rtl"] .changelog-entry::before {
  left: auto;
  right: calc(-1 * var(--space-6) + 1px);
}
[dir="rtl"] .changelog-date { margin-left: 0; margin-right: auto; }

/* Actions dropdown aligns to the start edge */
[dir="rtl"] .actions-menu { right: auto; left: 0; }

/* Back-link arrow — flip the glyph so "← Back" reads "→ Back" in RTL */
[dir="rtl"] .page-back { direction: rtl; }

/* Sidebar submenu indentation */
[dir="rtl"] .nav-item-sub { padding-left: var(--space-4); padding-right: var(--space-10); }

/* Tabs underline stays on the bottom — no directional change needed */

/* Numbers, times, and money stay LTR even inside RTL copy */
[dir="rtl"] .profile-stat-value,
[dir="rtl"] .kanban-card-meta,
[dir="rtl"] .orbis-table td .money,
[dir="rtl"] .timeline-time { direction: ltr; unicode-bidi: isolate; }
