/* ==========================================================================
   Components CSS — Reusable component styles
   ========================================================================== */

/* ===== Stat Cards ===== */
.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  height: 100%;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-primary);
}

.stat-card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: white;
  flex-shrink: 0;
}

.stat-card-icon-blue   { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-card-icon-purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.stat-card-icon-orange { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-card-icon-red    { background: linear-gradient(135deg, #ef4444, #dc2626); }
.stat-card-icon-green  { background: linear-gradient(135deg, #10b981, #059669); }
.stat-card-icon-pink   { background: linear-gradient(135deg, #ec4899, #db2777); }
.stat-card-icon-cyan   { background: linear-gradient(135deg, #06b6d4, #0891b2); }

.stat-card-body { flex: 1; min-width: 0; }

.stat-card-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.stat-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-card-trend {
  font-size: 0.75rem;
  margin-top: 0.2rem;
}

.stat-card-trend.up { color: var(--success); }
.stat-card-trend.down { color: var(--danger); }

/* ===== Activity Timeline ===== */
.activity-list { padding: 0.5rem 0; }

.activity-item {
  display: flex;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  transition: background-color var(--transition-fast);
}

.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background-color: var(--bg-hover); }

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.95rem;
  background-color: var(--bg-hover);
  color: var(--text-muted);
}

.activity-icon-created { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.activity-icon-updated { background: rgba(59, 130, 246, 0.1); color: var(--info); }
.activity-icon-deleted { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.activity-icon-status_changed { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.activity-icon-payment_received { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.activity-icon-document_uploaded { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.activity-icon-note_added { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.activity-icon-task_completed { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.activity-icon-case_hearing { background: rgba(236, 72, 153, 0.1); color: #ec4899; }
.activity-icon-invoice_sent { background: rgba(59, 130, 246, 0.1); color: var(--info); }
.activity-icon-login { background: rgba(100, 116, 139, 0.1); color: var(--text-secondary); }
.activity-icon-logout { background: rgba(100, 116, 139, 0.1); color: var(--text-secondary); }
.activity-icon-password_changed { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.activity-icon-password_reset { background: rgba(245, 158, 11, 0.1); color: var(--warning); }

.activity-content { flex: 1; min-width: 0; }

.activity-title {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-primary);
  margin-bottom: 0.1rem;
}

.activity-description {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

.activity-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.activity-meta i { margin-right: 0.25rem; }

/* ===== Empty state ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3rem;
  opacity: 0.3;
  margin-bottom: 1rem;
}

.empty-state h6 {
  color: var(--text-secondary);
  font-weight: 600;
}

/* ===== Error pages ===== */
.error-page {
  text-align: center;
  padding: 4rem 1.5rem;
  max-width: 600px;
  margin: 0 auto;
}

.error-code {
  font-size: 6rem;
  font-weight: 800;
  color: var(--brand-primary);
  line-height: 1;
  letter-spacing: -2px;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--brand-primary), #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.error-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.error-message {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.error-path code { font-size: 0.85rem; }

.error-stack {
  text-align: left;
  background: var(--bg-hover);
  padding: 1rem;
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  margin: 1.5rem 0;
  max-height: 300px;
  overflow-y: auto;
}

.error-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

/* ===== Phase banner ===== */
.alert-phase-banner {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.05), rgba(99, 102, 241, 0.05));
  border: 1px solid rgba(79, 70, 229, 0.2);
  border-left: 4px solid var(--brand-primary);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.alert-phase-banner .alert-heading { color: var(--brand-primary); font-weight: 600; }

/* ===== Chart cards ===== */
.stat-chart-card { height: 100%; }
.stat-chart-card .card-body { padding: 1.25rem; }
.stat-chart-card canvas { max-height: 240px; }

/* ===== Filter bar ===== */
.filter-bar {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.filter-bar .form-group { margin-bottom: 0; }
.filter-bar .form-control, .filter-bar .form-select { font-size: 0.8125rem; padding: 0.4rem 0.65rem; }

/* ===== Quick Notes Drawer ===== */
.quick-notes-drawer {
  position: fixed;
  top: 0;
  right: -380px;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-color);
  box-shadow: var(--shadow-xl);
  z-index: 1060;
  display: flex;
  flex-direction: column;
  transition: right var(--transition-base);
}

.quick-notes-drawer.open { right: 0; }

.quick-notes-header {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.quick-notes-header h5 { margin: 0; font-size: 1rem; font-weight: 600; }

.quick-notes-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1rem;
}

.quick-notes-toolbar {
  padding: 0.5rem 1rem;
  display: flex;
  gap: 0.4rem;
  border-bottom: 1px solid var(--border-color);
}

.quick-notes-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
}

.quick-notes-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.quick-notes-empty p { margin-top: 1rem; margin-bottom: 0.5rem; font-weight: 500; }

.quick-note-item {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quick-note-item:hover { border-color: var(--brand-primary); }

.quick-note-item.pinned { border-left: 3px solid var(--warning); }

.quick-note-content { font-size: 0.85rem; color: var(--text-primary); white-space: pre-wrap; }

.quick-note-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  display: flex;
  justify-content: space-between;
}

.quick-notes-input {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-color);
}

.quick-notes-input textarea {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.65rem;
  font-size: 0.85rem;
  resize: none;
  background: var(--bg-surface);
  color: var(--text-primary);
}

.quick-notes-input textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.quick-notes-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1055;
  display: none;
}

.quick-notes-backdrop.show { display: block; }

/* ===== Command Palette ===== */
.command-palette-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1070;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}

.command-palette-backdrop.show { display: flex; }

.command-palette {
  position: fixed;
  top: 12vh;
  left: 50%;
  transform: translateX(-50%);
  width: 640px;
  max-width: calc(100vw - 2rem);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  z-index: 1071;
  display: none;
}

.command-palette.show { display: block; }

.command-palette-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.command-palette-input-wrap i { color: var(--text-muted); font-size: 1.1rem; }

.command-palette-input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1rem;
  color: var(--text-primary);
}

.command-palette-results {
  max-height: 60vh;
  overflow-y: auto;
  padding: 0.5rem;
}

.command-palette-section { margin-bottom: 0.5rem; }

.command-palette-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem 0.35rem;
}

.command-palette-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.command-palette-item i { width: 22px; text-align: center; font-size: 1rem; color: var(--text-muted); }

.command-palette-item:hover,
.command-palette-item.selected {
  background-color: var(--bg-active);
  color: var(--brand-primary);
}

.command-palette-item:hover i,
.command-palette-item.selected i { color: var(--brand-primary); }

.command-palette-item kbd {
  margin-left: auto;
  font-size: 0.7rem;
}

/* ===== Auth pages ===== */
.auth-body {
  background: linear-gradient(135deg, #f1f5f9 0%, #e0e7ff 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

[data-theme="dark"] .auth-body { background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%); }

.auth-wrapper {
  width: 100%;
  max-width: 440px;
  padding: 1.5rem;
}

.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
  padding: 2.5rem;
}

.auth-brand { text-align: center; margin-bottom: 2rem; }

.auth-logo {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--brand-primary), #6366f1);
  color: white;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin: 0 auto 1rem;
  box-shadow: 0 10px 30px rgba(79, 70, 229, 0.3);
}

.auth-title { font-size: 1.5rem; font-weight: 700; margin: 0; color: var(--text-primary); }
.auth-subtitle { color: var(--text-muted); margin: 0.25rem 0 0; font-size: 0.875rem; }

.auth-form { margin-top: 1.5rem; }

.auth-footer { text-align: center; margin-top: 1.5rem; }

#togglePassword {
  background: var(--bg-surface);
  cursor: pointer;
}

/* ===== Toasts ===== */
.toast-container { z-index: 1090; }

/* ===== Avatar (reusable) ===== */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary), #6366f1);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 28px; height: 28px; font-size: 0.75rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.25rem; }
.avatar-xl { width: 96px; height: 96px; font-size: 2rem; }

/* ===== Searchable Select ===== */
.searchable-select {
  position: relative;
}

.searchable-select-input {
  padding-right: 2rem !important;
  cursor: text;
}

.searchable-select-chevron {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.85rem;
  transition: transform var(--transition-fast);
}

.searchable-select-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1050;
  padding: 4px;
}

.searchable-select-dropdown.show {
  display: block;
}

.searchable-select-option {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.searchable-select-option:hover,
.searchable-select-option.highlighted {
  background-color: var(--bg-active);
}

.searchable-select-option-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.searchable-select-option-sublabel {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.searchable-select-empty {
  padding: 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ===== Global Search Dropdown ===== */
.global-search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1050;
  padding: 4px;
}

.global-search-dropdown.show { display: block; }

.gs-section { margin-bottom: 4px; }
.gs-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem 0.25rem;
}

.gs-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--transition-fast);
  text-decoration: none;
  color: var(--text-primary);
}
.gs-item:hover { background-color: var(--bg-active); }

.gs-item-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary), #6366f1);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 600;
  overflow: hidden; flex-shrink: 0;
}
.gs-item-avatar img { width: 100%; height: 100%; object-fit: cover; }

.gs-item-icon {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  flex-shrink: 0;
}

.gs-item-body { flex: 1; min-width: 0; }
.gs-item-title { font-size: 0.8125rem; font-weight: 500; }
.gs-item-meta { font-size: 0.7rem; color: var(--text-muted); }

.gs-item mark {
  background: rgba(79, 70, 229, 0.15);
  color: var(--brand-primary);
  padding: 0 2px;
  border-radius: 2px;
}

.gs-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
}
.gs-empty i { font-size: 1.5rem; opacity: 0.3; }
.gs-empty p { margin: 0.5rem 0 0.25rem; font-weight: 500; }

.gs-footer {
  padding: 0.5rem;
  text-align: center;
  border-top: 1px solid var(--border-color);
  margin-top: 4px;
}
.gs-footer a { font-size: 0.8125rem; font-weight: 500; }

/* ===== Command Palette items ===== */
.cp-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.cp-item i { width: 22px; text-align: center; font-size: 1rem; color: var(--text-muted); }
.cp-item:hover, .cp-item.selected {
  background-color: var(--bg-active);
  color: var(--brand-primary);
}
.cp-item:hover i, .cp-item.selected i { color: var(--brand-primary); }
.cp-item kbd { margin-left: auto; font-size: 0.7rem; }

.cp-item-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary), #6366f1);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 600;
  overflow: hidden; flex-shrink: 0;
}
.cp-item-avatar img { width: 100%; height: 100%; object-fit: cover; }

.cp-item-body { flex: 1; min-width: 0; }
.cp-item-body div { font-size: 0.8125rem; font-weight: 500; }
.cp-item-body mark {
  background: rgba(79, 70, 229, 0.15);
  color: var(--brand-primary);
  padding: 0 2px;
  border-radius: 2px;
}

.cp-footer {
  padding: 0.5rem 0.75rem;
  text-align: center;
  border-top: 1px solid var(--border-color);
  margin-top: 4px;
}
.cp-footer a { font-size: 0.8125rem; font-weight: 500; }

.cp-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
}
.cp-empty i { font-size: 1.5rem; opacity: 0.3; }
.cp-empty p { margin: 0.5rem 0 0; font-weight: 500; }

/* ===== Quick Notes items ===== */
.qn-loading, .qn-empty { padding: 1rem; text-align: center; }

.qn-empty-state {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
}
.qn-empty-state i { font-size: 2rem; opacity: 0.3; }
.qn-empty-state p { margin: 0.75rem 0 0.25rem; font-weight: 500; }
.qn-empty-state small { font-size: 0.75rem; }

.qn-item {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem;
  margin-bottom: 0.5rem;
  transition: border-color var(--transition-fast);
}
.qn-item.pinned { border-left: 3px solid var(--warning); }
.qn-item:hover { border-color: var(--brand-primary); }

.qn-item-header {
  display: flex;
  align-items: center;
  margin-bottom: 0.35rem;
}

.qn-item-content {
  font-size: 0.8125rem;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  outline: none;
  padding: 2px 4px;
  border-radius: 3px;
  min-height: 1.2em;
}
.qn-item-content:focus {
  background: var(--bg-surface);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.qn-item-link {
  font-size: 0.7rem;
  margin-top: 0.35rem;
  color: var(--brand-primary);
}
.qn-item-link a { color: var(--brand-primary); }

.qn-item-converted {
  font-size: 0.7rem;
  margin-top: 0.35rem;
  color: var(--success);
}

.qn-item-actions {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.4rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border-color);
}
.qn-item-actions .btn-link { font-size: 0.8rem; padding: 0 0.25rem; }

/* ===== Notification Dropdown Items ===== */
.notification-loading, .notification-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
}
.notification-empty i { font-size: 1.5rem; opacity: 0.3; }
.notification-empty p { margin: 0.5rem 0 0.25rem; font-weight: 500; font-size: 0.875rem; }

.notification-dropdown-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background-color var(--transition-fast);
  position: relative;
}
.notification-dropdown-item:hover { background-color: var(--bg-hover); }
.notification-dropdown-item:last-child { border-bottom: none; }
.notification-dropdown-item.unread { background-color: rgba(79, 70, 229, 0.03); }

.notif-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 0.85rem;
}

.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 0.8125rem; font-weight: 500; margin-bottom: 0.1rem; }
.notif-msg { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 0.2rem; }
.notif-time { font-size: 0.6875rem; color: var(--text-muted); }

.notif-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--brand-primary);
  flex-shrink: 0;
  margin-top: 6px;
}

/* ==========================================================================
   Mobile Responsive Enhancements
   ========================================================================== */

/* Make form rows stack on mobile */
@media (max-width: 768px) {
  .row.g-3 > [class*="col-md-"],
  .row.g-3 > [class*="col-lg-"] {
    margin-bottom: 0.75rem;
  }
  
  /* Cards in left/right column layout: stack vertically */
  .col-lg-8, .col-lg-4 {
    width: 100%;
  }
  
  /* Hearing date widgets: more compact */
  .hearing-item-widget,
  .task-item-widget,
  .invoice-item-widget {
    padding: 0.6rem 0.75rem !important;
  }
  
  .hearing-date-widget {
    width: 38px !important;
    padding: 0.25rem !important;
  }
  
  .hearing-date-day { font-size: 1rem !important; }
  .hearing-date-month { font-size: 0.65rem !important; }
  
  /* Dashboard widgets: full height auto */
  .card.h-100 { height: auto !important; }
  
  /* Nav tabs: scrollable on mobile */
  .nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .nav-tabs .nav-item { flex-shrink: 0; }
  
  /* Alert banners: smaller padding */
  .alert { padding: 0.6rem 0.75rem; font-size: 0.85rem; }
  
  /* Invoice/case detail: stack summary tables */
  .table-sm td, .table-sm th { padding: 0.3rem 0.4rem; }
  
  /* Btn groups: full width on mobile */
  .d-flex.gap-2 {
    flex-wrap: wrap;
  }
  
  .d-flex.gap-2 .btn {
    flex: 1;
    min-width: 120px;
  }
  
  .d-flex.gap-2 .btn-lg {
    width: 100%;
  }
}

@media (max-width: 576px) {
  /* Stat cards: 1 per row on very small screens if needed */
  .stat-card {
    flex-direction: row;
    align-items: center;
  }
  
  .stat-card-icon {
    width: 40px !important;
    height: 40px !important;
  }
  
  /* Hearing dates section: compact */
  .hearing-item-widget {
    flex-direction: row !important;
  }
  
  /* Copyable cells: show on single line */
  .copyable-cell {
    font-size: 0.75rem;
  }
  
  /* Hide some table columns on mobile (via CSS) */
  .hide-mobile { display: none !important; }
  
  /* Forms: inputs full width */
  .form-control, .form-select {
    font-size: 16px; /* Prevents iOS zoom */
  }
  
  /* Buttons: easier to tap */
  .btn-sm {
    padding: 0.4rem 0.65rem;
    font-size: 0.8rem;
  }
  
  .btn-lg {
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
  }
}
