/* ================================================================
   XCore ERP — Design System
   Inspired by: Stripe, Linear, Shopify Admin
   ================================================================ */

/* ─── CSS Variables: Light Mode ──────────────────────────────── */
:root {
  --color-primary:        #f97316;
  --color-primary-hover:  #ea6c0a;
  --color-primary-light:  #fff7ed;
  --color-primary-text:   #ffffff;

  --color-bg:             #fafafa;
  --color-bg-card:        #ffffff;
  --color-bg-sidebar:     #ffffff;
  --color-bg-topbar:      #ffffff;
  --color-bg-input:       #ffffff;
  --color-bg-hover:       #fef3e2;
  --color-bg-active:      #fff7ed;

  --color-border:         #e2e8f0;
  --color-border-light:   #f1f5f9;

  --color-text-primary:   #0f172a;
  --color-text-secondary: #64748b;
  --color-text-muted:     #94a3b8;
  --color-text-inverse:   #ffffff;

  --color-success:        #f97316;
  --color-success-bg:     #fff7ed;
  --color-success-border: #fed7aa;

  --color-warning:        #c2410c;
  --color-warning-bg:     #fff7ed;
  --color-warning-border: #fdba74;

  --color-danger:         #9a3412;
  --color-danger-bg:      #fff7ed;
  --color-danger-border:  #fed7aa;

  --color-info:           #ea580c;
  --color-info-bg:        #fff7ed;
  --color-info-border:    #fdba74;

  --shadow-xs:   0 1px 2px 0 rgba(0,0,0,.05);
  --shadow-sm:   0 1px 3px 0 rgba(0,0,0,.10), 0 1px 2px -1px rgba(0,0,0,.10);
  --shadow-md:   0 4px 6px -1px rgba(0,0,0,.10), 0 2px 4px -2px rgba(0,0,0,.10);
  --shadow-lg:   0 10px 15px -3px rgba(0,0,0,.10), 0 4px 6px -4px rgba(0,0,0,.10);

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;
  --radius-full: 9999px;

  --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

  --sidebar-width:       240px;
  --topbar-height:       60px;
  --bottom-nav-height:   64px;
  --transition:          150ms ease;
}

/* ─── Dark Mode ─────────────────────────────────────────────── */
[data-theme="dark"] {
  --color-bg:             #0f172a;
  --color-bg-card:        #1e293b;
  --color-bg-sidebar:     #1e293b;
  --color-bg-topbar:      #1e293b;
  --color-bg-input:       #0f172a;
  --color-bg-hover:       #3d2a1a;
  --color-bg-active:      #3d1f0a;

  --color-border:         #334155;
  --color-border-light:   #1e293b;

  --color-text-primary:   #f1f5f9;
  --color-text-secondary: #94a3b8;
  --color-text-muted:     #64748b;

  --color-success-bg:     #431407;
  --color-success-border: #9a3412;
  --color-warning-bg:     #431407;
  --color-warning-border: #c2410c;
  --color-danger-bg:      #431407;
  --color-danger-border:  #9a3412;
  --color-info-bg:        #431407;
  --color-info-border:    #c2410c;

  --shadow-xs:  0 1px 2px 0 rgba(0,0,0,.3);
  --shadow-sm:  0 1px 3px 0 rgba(0,0,0,.4);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,.4);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,.5);
}

/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--color-text-primary);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--transition), color var(--transition);
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-hover); }

/* ─── Layout ─────────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-bg-sidebar);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  transition: transform var(--transition), background var(--transition);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
}

.sidebar-logo-icon {
  width: 32px; height: 32px;
  background: var(--color-primary);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}

.sidebar-logo-version {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  font-weight: 400;
}

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

.nav-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 12px 8px 4px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
  text-decoration: none;
}

.nav-item.active {
  background: var(--color-bg-active);
  color: var(--color-primary);
}

.nav-item svg { flex-shrink: 0; width: 18px; height: 18px; }

.nav-item-badge {
  margin-left: auto;
  background: var(--color-danger);
  color: white;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

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

/* ─── Main Content ───────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Topbar ─────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--color-bg-topbar);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background var(--transition);
}

.topbar-search {
  flex: 1;
  max-width: 480px;
}

.topbar-search-input {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  cursor: text;
  transition: all var(--transition);
}

.topbar-search-input:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(249,115,22,.15);
}

.topbar-search-input input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--color-text-primary);
  font-size: 0.875rem;
  outline: none;
}

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

.topbar-search-kbd {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  background: var(--color-border);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.topbar-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  position: relative;
  transition: all var(--transition);
}

.topbar-btn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.topbar-btn-badge {
  position: absolute;
  top: -3px; right: -3px;
  width: 16px; height: 16px;
  background: var(--color-danger);
  border-radius: var(--radius-full);
  font-size: 0.6rem;
  font-weight: 700;
  color: white;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--color-bg-topbar);
}

.topbar-avatar {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid var(--color-border);
  transition: border-color var(--transition);
}
.topbar-avatar:hover { border-color: var(--color-primary); }

/* ─── Page Content ───────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 28px 28px;
  max-width: 1600px;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.page-title { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.02em; }
.page-subtitle { color: var(--color-text-secondary); font-size: 0.875rem; margin-top: 2px; }

/* ─── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-xs);
  transition: background var(--transition), border-color var(--transition);
}

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

.card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  margin-top: 1px;
}

/* ─── KPI Cards ─────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-xs);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

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

.kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--color-text-primary);
  line-height: 1;
  margin-bottom: 6px;
}

.kpi-value.positive { color: var(--color-primary); }
.kpi-value.negative { color: var(--color-danger); }

.kpi-change {
  font-size: 0.75rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.kpi-change.up   { color: var(--color-primary); }
.kpi-change.down { color: var(--color-danger); }

.kpi-icon {
  position: absolute;
  top: 16px; right: 16px;
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  opacity: 0.15;
}

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

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

.btn-secondary {
  background: var(--color-bg-card);
  color: var(--color-text-primary);
  border-color: var(--color-border);
}
.btn-secondary:hover { background: var(--color-bg-hover); }

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

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--color-bg-hover); color: var(--color-text-primary); }

.btn-sm { padding: 6px 12px; font-size: 0.8125rem; }
.btn-lg { padding: 12px 22px; font-size: 1rem; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }

/* ─── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}

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

.form-control {
  display: block;
  width: 100%;
  padding: 9px 13px;
  font-size: 0.875rem;
  font-family: var(--font-sans);
  color: var(--color-text-primary);
  background: var(--color-bg-input);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
  appearance: none;
  line-height: 1.5;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(249,115,22,.15);
}

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

.form-control.is-invalid { border-color: var(--color-danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(154,52,18,.15); }

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

.form-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* ─── Tables ─────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

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

.xc-table thead tr {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.xc-table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.xc-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-text-primary);
  vertical-align: middle;
}

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

.xc-table tbody tr:hover { background: var(--color-bg-hover); }

/* ─── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-success { background: var(--color-success-bg); color: var(--color-primary); border: 1px solid var(--color-success-border); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); border: 1px solid var(--color-warning-border); }
.badge-danger  { background: var(--color-danger-bg);  color: var(--color-danger);  border: 1px solid var(--color-danger-border);  }
.badge-info    { background: var(--color-info-bg);    color: var(--color-info);    border: 1px solid var(--color-info-border);    }
.badge-neutral { background: var(--color-bg-hover);   color: var(--color-text-secondary); border: 1px solid var(--color-border); }
.badge-primary { background: var(--color-primary-light); color: var(--color-primary); border: 1px solid rgba(249,115,22,.3); }

/* ─── Modals ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition);
}

.modal-overlay.open .modal { transform: scale(1) translateY(0); }

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

.modal-title { font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.01em; }

.modal-close {
  width: 30px; height: 30px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--color-bg-hover);
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--color-danger-bg); color: var(--color-danger); }

.modal-body { padding: 20px 24px; }
.modal-footer { padding: 0 24px 20px; display: flex; gap: 10px; justify-content: flex-end; }

/* ─── Toast Notifications ────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  max-width: 360px;
  pointer-events: all;
  transform: translateX(120%);
  transition: transform 300ms cubic-bezier(.34,1.56,.64,1);
  border-left: 3px solid var(--color-border);
}

.toast.show { transform: translateX(0); }
.toast.hiding { transform: translateX(120%); transition: transform 250ms ease-in; }

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

.toast-icon { width: 18px; height: 18px; flex-shrink: 0; }
.toast-success .toast-icon { color: var(--color-primary); }
.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; color: var(--color-text-primary); }
.toast-close {
  background: none; border: none; cursor: pointer;
  color: var(--color-text-muted); padding: 2px;
  transition: color var(--transition);
}
.toast-close:hover { color: var(--color-text-primary); }

/* ─── Progress Bar ───────────────────────────────────────────── */
.progress {
  height: 8px;
  background: var(--color-bg-hover);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  transition: width 600ms ease;
}

.progress-bar.success { background: var(--color-primary); }
.progress-bar.warning { background: var(--color-warning); }
.progress-bar.danger  { background: var(--color-danger);  }

/* ─── Skeleton Loading ───────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-bg-hover) 25%,
    var(--color-border) 50%,
    var(--color-bg-hover) 75%
  );
  background-size: 400% 100%;
  animation: skeleton-pulse 1.5s ease infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-pulse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Quick Actions ──────────────────────────────────────────── */
.quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-primary);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.quick-action-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-light);
  text-decoration: none;
}

.quick-action-btn svg { width: 15px; height: 15px; color: var(--color-primary); }

/* ─── Dropdown ───────────────────────────────────────────────── */
.dropdown { position: relative; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  padding: 6px;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95) translateY(-4px);
  transition: all 150ms ease;
  transform-origin: top right;
}

.dropdown-menu.open { opacity: 1; pointer-events: all; transform: scale(1) translateY(0); }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--color-text-primary);
  cursor: pointer;
  transition: background var(--transition);
  text-decoration: none;
}

.dropdown-item:hover { background: var(--color-bg-hover); text-decoration: none; }
.dropdown-item.danger { color: var(--color-danger); }
.dropdown-item.danger:hover { background: var(--color-danger-bg); }
.dropdown-divider { height: 1px; background: var(--color-border); margin: 4px 0; }

/* ─── Search Results ─────────────────────────────────────────── */
.search-results {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  margin-top: 6px;
  max-height: 420px;
  overflow-y: auto;
  display: none;
}

.search-results.visible { display: block; }

.search-result-group-title {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 10px 14px 4px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition);
  text-decoration: none;
  color: var(--color-text-primary);
}

.search-result-item:hover { background: var(--color-bg-hover); }

/* ─── Status dots ────────────────────────────────────────────── */
.status-dot {
  width: 8px; height: 8px;
  border-radius: var(--radius-full);
  display: inline-block;
  flex-shrink: 0;
}
.dot-success { background: var(--color-primary); }
.dot-warning { background: var(--color-warning); }
.dot-danger  { background: var(--color-danger);  }
.dot-info    { background: var(--color-info);    }
.dot-neutral { background: var(--color-text-muted); }

/* ─── Timeline ───────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 8px; top: 0; bottom: 0;
  width: 1px;
  background: var(--color-border);
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -20px; top: 5px;
  width: 10px; height: 10px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  border: 2px solid var(--color-bg-card);
  z-index: 1;
}

.timeline-date {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.timeline-content {
  font-size: 0.875rem;
  color: var(--color-text-primary);
}

/* ─── Filters bar ────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-btn {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.filter-btn.active { background: var(--color-primary); border-color: var(--color-primary); color: white; }

/* ─── Empty State ────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
  color: var(--color-text-secondary);
  gap: 12px;
}

.empty-state-icon { color: var(--color-text-muted); opacity: .5; margin-bottom: 4px; }
.empty-state-title { font-size: 1rem; font-weight: 600; color: var(--color-text-primary); }
.empty-state-text  { font-size: 0.875rem; max-width: 300px; }

/* ─── Mobile: Bottom Navigation ──────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-height);
  background: var(--color-bg-card);
  border-top: 1px solid var(--color-border);
  z-index: 100;
  padding: 0 8px;
  align-items: center;
  justify-content: space-around;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-size: 0.6875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  flex: 1;
  max-width: 80px;
}

.bottom-nav-item svg { width: 22px; height: 22px; }
.bottom-nav-item.active { color: var(--color-primary); }

.bottom-nav-fab {
  width: 48px; height: 48px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(249,115,22,.4);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.bottom-nav-fab:hover { background: var(--color-primary-hover); transform: scale(1.05); }
.bottom-nav-fab:active { transform: scale(0.97); }

/* ─── Bottom Sheet ───────────────────────────────────────────── */
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.bottom-sheet-overlay.open { opacity: 1; pointer-events: all; }

.bottom-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--color-bg-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  z-index: 501;
  padding: 20px;
  transform: translateY(100%);
  transition: transform 300ms cubic-bezier(.34,1.56,.64,1);
  max-height: 90vh;
  overflow-y: auto;
}

.bottom-sheet-overlay.open .bottom-sheet { transform: translateY(0); }

.bottom-sheet-handle {
  width: 36px; height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  margin: 0 auto 20px;
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main-content { margin-left: 0; }
  .topbar { padding: 0 16px; }
}

@media (max-width: 768px) {
  .bottom-nav { display: flex; }
  .page-content { padding: 16px; padding-bottom: calc(var(--bottom-nav-height) + 16px); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .kpi-value { font-size: 1.25rem; }
  .quick-actions { gap: 8px; }
  .quick-action-btn { padding: 8px 12px; font-size: 0.8125rem; }
  .form-row { grid-template-columns: 1fr; }
  #toast-container { bottom: calc(var(--bottom-nav-height) + 12px); right: 12px; left: 12px; }
  .toast { max-width: 100%; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .page-title { font-size: 1.125rem; }
}

/* ─── Utilities ──────────────────────────────────────────────── */
.text-primary   { color: var(--color-primary) !important; }
.text-success   { color: var(--color-primary) !important; }
.text-danger    { color: var(--color-danger) !important; }
.text-warning   { color: var(--color-warning) !important; }
.text-muted     { color: var(--color-text-muted) !important; }
.text-secondary { color: var(--color-text-secondary) !important; }
.text-mono      { font-family: var(--font-mono) !important; }
.text-sm        { font-size: 0.8125rem !important; }
.text-xs        { font-size: 0.75rem !important; }
.fw-600         { font-weight: 600 !important; }
.fw-700         { font-weight: 700 !important; }
.d-flex         { display: flex !important; }
.align-center   { align-items: center !important; }
.justify-between { justify-content: space-between !important; }
.gap-8          { gap: 8px !important; }
.gap-12         { gap: 12px !important; }
.gap-16         { gap: 16px !important; }
.mb-0           { margin-bottom: 0 !important; }
.mb-8           { margin-bottom: 8px !important; }
.mb-16          { margin-bottom: 16px !important; }
.mb-24          { margin-bottom: 24px !important; }
.mt-auto        { margin-top: auto !important; }
.w-100          { width: 100% !important; }
.truncate       { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
