/* ============================================================
   CargoOS — Application styles (component library)
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: rgba(37, 99, 235, 0.18); }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- App layout ---------- */
#root { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  position: fixed; inset: 0 auto 0 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex; flex-direction: column;
  z-index: 40;
  transition: transform var(--dur-base) var(--ease-out);
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; }
.sidebar-logo .brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.02em; }
.sidebar-logo .brand-tag { font-size: var(--text-2xs); color: var(--text-tertiary); letter-spacing: 0.01em; margin-top: 1px; }

.org-switch {
  margin: 4px 12px 10px; padding: 8px 10px;
  display: flex; align-items: center; gap: 9px;
  border-radius: var(--radius-md); border: 1px solid var(--border-subtle);
  background: var(--bg-subtle); cursor: pointer;
  transition: border-color var(--dur-fast);
}
.org-switch:hover { border-color: var(--border-default); }
.org-avatar {
  width: 24px; height: 24px; border-radius: 7px;
  background: linear-gradient(135deg, var(--blue-600), var(--cyan-500));
  display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}
.org-switch .org-name { font-size: var(--text-xs); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-switch .org-plan { font-size: 10px; color: var(--text-tertiary); }

.nav-section { padding: 4px 12px; }
.nav-label { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-tertiary); padding: 10px 10px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; margin-bottom: 1px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm); font-weight: 500; color: var(--text-secondary);
  cursor: pointer; position: relative;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-soft); color: var(--text-brand); font-weight: 600; }
.nav-item.active svg { color: var(--text-brand); }
.nav-item svg { width: 16px; height: 16px; color: var(--text-tertiary); flex-shrink: 0; transition: color var(--dur-fast); }
.nav-item:hover svg { color: var(--text-secondary); }
.nav-badge {
  margin-left: auto; font-size: 10px; font-weight: 700;
  background: var(--critical-soft); color: var(--critical);
  border-radius: var(--radius-full); padding: 1px 7px; min-width: 18px; text-align: center;
}
.nav-badge.info { background: var(--accent-soft); color: var(--text-brand); }

.sidebar-footer { margin-top: auto; padding: 12px; border-top: 1px solid var(--border-subtle); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; }
.user-chip:hover { background: var(--bg-hover); }
.avatar {
  width: 28px; height: 28px; border-radius: var(--radius-full);
  display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.user-chip .u-name { font-size: var(--text-xs); font-weight: 600; }
.user-chip .u-role { font-size: 10px; color: var(--text-tertiary); }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--bg-base) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}
.topbar h1 { font-size: var(--text-md); font-weight: 650; letter-spacing: -0.01em; margin: 0; }
.topbar .crumb { color: var(--text-tertiary); font-size: var(--text-sm); }

.search-trigger {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto;
  padding: 6px 12px; min-width: 220px;
  border-radius: var(--radius-md); border: 1px solid var(--border-default);
  background: var(--bg-surface); color: var(--text-tertiary);
  font-size: var(--text-xs); cursor: pointer;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.search-trigger:hover { border-color: var(--border-strong); }
.search-trigger kbd {
  margin-left: auto; font-family: var(--font-sans); font-size: 10px;
  background: var(--bg-subtle); border: 1px solid var(--border-default);
  border-radius: 4px; padding: 1px 5px; color: var(--text-tertiary);
}

.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  background: transparent; color: var(--text-secondary); cursor: pointer;
  transition: background var(--dur-fast);
  position: relative;
}
.icon-btn:hover { background: var(--bg-hover); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn .dot {
  position: absolute; top: 6px; right: 6px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--critical); border: 2px solid var(--bg-base);
}

.content { padding: 24px; max-width: 1440px; width: 100%; margin: 0 auto; animation: pageIn var(--dur-slow) var(--ease-out); }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Cards / surfaces ---------- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.card-pad { padding: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border-subtle); }
.card-title { font-size: var(--text-sm); font-weight: 650; letter-spacing: -0.01em; }
.card-sub { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: 2px; }

/* ---------- KPI tiles ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.kpi {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: 16px 18px;
  box-shadow: var(--shadow-xs); position: relative; overflow: hidden;
  transition: box-shadow var(--dur-base), transform var(--dur-base), border-color var(--dur-base);
}
.kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: var(--border-default); }
.kpi .k-label { font-size: var(--text-xs); font-weight: 550; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.kpi .k-label svg { width: 13px; height: 13px; color: var(--text-tertiary); }
.kpi .k-value { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.kpi .k-delta { font-size: var(--text-2xs); font-weight: 600; margin-top: 6px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius-full); }
.k-delta.up { color: var(--success); background: var(--success-soft); }
.k-delta.down { color: var(--critical); background: var(--critical-soft); }
.k-delta.flat { color: var(--text-tertiary); background: var(--bg-subtle); }
.kpi.hero { background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-700) 70%, #1E3A8A 100%); border-color: transparent; }
.kpi.hero .k-label { color: rgba(226, 232, 240, 0.75); }
.kpi.hero .k-label svg { color: var(--cyan-400); }
.kpi.hero .k-value { color: #fff; }
.kpi.hero .k-delta { background: rgba(34, 211, 238, 0.15); color: var(--cyan-300); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 7px 14px; border-radius: var(--radius-sm);
  font-size: var(--text-sm); font-weight: 600; letter-spacing: -0.005em;
  border: 1px solid transparent; cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255,255,255,0.12); }
.btn-primary:hover { background: var(--blue-500); }
.btn-secondary { background: var(--bg-surface); color: var(--text-primary); border-color: var(--border-default); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.08); }
.btn-danger { background: var(--critical-soft); color: var(--critical); border-color: transparent; }
.btn-danger:hover { background: var(--critical); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: var(--text-xs); border-radius: var(--radius-xs); }
.btn:disabled { opacity: 0.5; pointer-events: none; }

/* ---------- Badges / pills ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--text-2xs); font-weight: 600; letter-spacing: 0.01em;
  padding: 2.5px 9px; border-radius: var(--radius-full);
  white-space: nowrap;
}
.badge .b-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-blue { background: var(--accent-soft); color: var(--text-brand); }
.badge-green { background: var(--success-soft); color: var(--success); }
.badge-amber { background: var(--warning-soft); color: var(--warning); }
.badge-red { background: var(--critical-soft); color: var(--critical); }
.badge-gray { background: var(--bg-subtle); color: var(--text-secondary); }
.badge-violet { background: rgba(139, 92, 246, 0.12); color: var(--violet-500); }
.badge-cyan { background: var(--info-soft); color: var(--cyan-500); }

/* ---------- Confidence meter ---------- */
.conf { display: inline-flex; align-items: center; gap: 7px; font-size: var(--text-2xs); font-weight: 600; font-variant-numeric: tabular-nums; }
.conf-track { width: 44px; height: 4px; border-radius: 2px; background: var(--bg-active); overflow: hidden; }
.conf-fill { height: 100%; border-radius: 2px; transition: width var(--dur-slow) var(--ease-out); }

/* ---------- Tables & lists ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: var(--text-2xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-tertiary); padding: 10px 16px; border-bottom: 1px solid var(--border-subtle);
}
.table td { padding: 12px 16px; font-size: var(--text-sm); border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { cursor: pointer; transition: background var(--dur-fast); }
.table tbody tr:hover { background: var(--bg-hover); }

.row-item {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 20px; border-bottom: 1px solid var(--border-subtle);
  cursor: pointer; transition: background var(--dur-fast);
}
.row-item:hover { background: var(--bg-hover); }
.row-item:last-child { border-bottom: none; }

/* ---------- Filter bar ---------- */
.filter-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--bg-subtle); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 3px; gap: 2px; }
.seg button {
  padding: 5px 12px; border: none; background: transparent; border-radius: 7px;
  font-size: var(--text-xs); font-weight: 550; color: var(--text-secondary); cursor: pointer;
  transition: all var(--dur-fast);
}
.seg button.active { background: var(--bg-surface); color: var(--text-primary); box-shadow: var(--shadow-xs); font-weight: 600; }
.seg button:hover:not(.active) { color: var(--text-primary); }
.seg .cnt { font-size: 10px; color: var(--text-tertiary); margin-left: 4px; }

.input {
  padding: 7px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-default);
  background: var(--bg-surface); font-size: var(--text-sm); color: var(--text-primary);
  outline: none; transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  width: 100%;
}
.input:focus { border-color: var(--border-focus); box-shadow: var(--shadow-glow); }
.input::placeholder { color: var(--text-tertiary); }
select.input { appearance: none; cursor: pointer; }
label.field-label { display: block; font-size: var(--text-xs); font-weight: 600; color: var(--text-secondary); margin: 0 0 6px; }

/* ---------- Modal / drawer ---------- */
.overlay {
  position: fixed; inset: 0; background: var(--bg-overlay); z-index: 60;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn var(--dur-fast) ease-out;
  backdrop-filter: blur(3px);
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  background: var(--bg-surface); border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xl); width: min(560px, calc(100vw - 32px));
  max-height: 86vh; overflow: auto;
  animation: modalIn var(--dur-base) var(--ease-spring);
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.96) translateY(8px); } }
.modal-lg { width: min(860px, calc(100vw - 32px)); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
  width: min(560px, 100vw); background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle); box-shadow: var(--shadow-xl);
  animation: drawerIn var(--dur-base) var(--ease-out);
  overflow-y: auto;
}
@keyframes drawerIn { from { transform: translateX(40px); opacity: 0; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 24px 0; }
.modal-body { padding: 20px 24px 24px; }
.modal-title { font-size: var(--text-lg); font-weight: 700; letter-spacing: -0.02em; margin: 0; }

/* ---------- Command palette ---------- */
.cmdk {
  position: fixed; inset: 0; z-index: 80; background: var(--bg-overlay);
  display: flex; justify-content: center; padding-top: 14vh;
  animation: fadeIn var(--dur-fast) ease-out; backdrop-filter: blur(4px);
}
.cmdk-panel {
  width: min(600px, calc(100vw - 32px)); height: fit-content; max-height: 420px;
  background: var(--bg-surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border-default); box-shadow: var(--shadow-xl);
  overflow: hidden; display: flex; flex-direction: column;
  animation: modalIn var(--dur-base) var(--ease-spring);
}
.cmdk-input {
  width: 100%; padding: 16px 18px; border: none; outline: none;
  font-size: var(--text-md); background: transparent; color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
}
.cmdk-list { overflow-y: auto; padding: 6px; }
.cmdk-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: var(--radius-sm); cursor: pointer; font-size: var(--text-sm);
}
.cmdk-item.selected { background: var(--accent-soft); color: var(--text-brand); }
.cmdk-item svg { width: 15px; height: 15px; color: var(--text-tertiary); }
.cmdk-item.selected svg { color: var(--text-brand); }
.cmdk-item kbd { margin-left: auto; font-family: var(--font-sans); font-size: 10px; color: var(--text-tertiary); background: var(--bg-subtle); border: 1px solid var(--border-default); border-radius: 4px; padding: 1px 6px; }
.cmdk-empty { padding: 32px; text-align: center; color: var(--text-tertiary); font-size: var(--text-sm); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 90; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-inverse); color: var(--text-inverse);
  padding: 11px 16px; border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn var(--dur-base) var(--ease-spring);
  max-width: 380px;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(0.97); } }
.toast.out { animation: toastOut var(--dur-base) ease-in forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }
.toast svg { width: 15px; height: 15px; flex-shrink: 0; }
.toast.success svg { color: var(--emerald-500); }
.toast.error svg { color: var(--red-500); }

/* ---------- Skeletons & empty states ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-subtle) 25%, var(--bg-active) 50%, var(--bg-subtle) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

.empty-state { text-align: center; padding: 56px 24px; }
.empty-icon {
  width: 52px; height: 52px; margin: 0 auto 16px;
  border-radius: var(--radius-lg);
  background: var(--accent-soft); border: 1px solid var(--accent-soft-border);
  display: grid; place-items: center; color: var(--text-brand);
}
.empty-icon svg { width: 22px; height: 22px; }
.empty-state h3 { font-size: var(--text-md); font-weight: 650; margin: 0 0 6px; }
.empty-state p { font-size: var(--text-sm); color: var(--text-tertiary); margin: 0 0 18px; max-width: 340px; margin-inline: auto; }

/* ---------- Worker cards ---------- */
.worker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.worker-card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: 18px; cursor: pointer;
  box-shadow: var(--shadow-xs); position: relative; overflow: hidden;
  transition: box-shadow var(--dur-base), transform var(--dur-base), border-color var(--dur-base);
}
.worker-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-default); }
.worker-avatar {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; color: #fff; flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}
.worker-avatar svg { width: 19px; height: 19px; }
.metric-mini { text-align: left; }
.metric-mini .m-val { font-size: var(--text-md); font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.metric-mini .m-lab { font-size: 10px; color: var(--text-tertiary); font-weight: 550; margin-top: 1px; }
.progress { height: 5px; background: var(--bg-active); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width 0.8s var(--ease-out); }

/* ---------- Workflow canvas ---------- */
.wf-canvas {
  position: relative; overflow-x: auto; overflow-y: hidden;
  background: var(--bg-subtle);
  background-image: radial-gradient(circle, var(--border-default) 1px, transparent 1px);
  background-size: 22px 22px;
  border-radius: var(--radius-lg); border: 1px solid var(--border-subtle);
  min-height: 340px;
}
.wf-node {
  position: absolute; width: 178px;
  background: var(--bg-surface); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); padding: 10px 12px;
  box-shadow: var(--shadow-sm); cursor: grab; user-select: none;
  transition: box-shadow var(--dur-fast), transform var(--dur-fast);
}
.wf-node:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); z-index: 5; }
.wf-node .n-type { display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.wf-node .n-type svg { width: 11px; height: 11px; }
.wf-node .n-label { font-size: var(--text-xs); font-weight: 650; margin-top: 5px; }
.wf-node .n-sub { font-size: 10px; color: var(--text-tertiary); margin-top: 2px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border-subtle); margin-bottom: 20px; overflow-x: auto; }
.tab {
  padding: 9px 14px; font-size: var(--text-sm); font-weight: 550; color: var(--text-secondary);
  border: none; background: none; cursor: pointer; position: relative; white-space: nowrap;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--text-brand); font-weight: 650; }
.tab.active::after {
  content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px;
  background: var(--accent); border-radius: 2px 2px 0 0;
}

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--border-subtle); border-radius: 1px; }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute; left: -22px; top: 4px; width: 16px; height: 16px;
  border-radius: 50%; display: grid; place-items: center;
  background: var(--bg-surface); border: 2px solid var(--border-default);
}
.tl-dot .inner { width: 6px; height: 6px; border-radius: 50%; }

/* ---------- Dropzone ---------- */
.dropzone {
  border: 2px dashed var(--border-default); border-radius: var(--radius-lg);
  padding: 40px 24px; text-align: center; cursor: pointer;
  transition: all var(--dur-base);
  background: var(--bg-surface);
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--accent); background: var(--accent-soft);
}
.dropzone .dz-icon {
  width: 46px; height: 46px; margin: 0 auto 12px; border-radius: var(--radius-md);
  background: var(--accent-soft); display: grid; place-items: center; color: var(--text-brand);
}
.dropzone .dz-icon svg { width: 20px; height: 20px; }

/* ---------- Misc ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mono { font-family: var(--font-mono); font-size: 0.92em; }
.text-sec { color: var(--text-secondary); }
.text-ter { color: var(--text-tertiary); }
.dot-live { width: 7px; height: 7px; border-radius: 50%; background: var(--emerald-500); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.45);} 50% { box-shadow: 0 0 0 5px rgba(16,185,129,0);} }
.divider { height: 1px; background: var(--border-subtle); margin: 16px 0; }
.chip-ai {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.03em;
  background: linear-gradient(135deg, var(--blue-600), var(--cyan-500));
  color: #fff; padding: 2.5px 9px; border-radius: var(--radius-full);
}
.chip-ai svg { width: 10px; height: 10px; }

.ai-panel {
  background: linear-gradient(135deg, var(--accent-soft), var(--info-soft));
  border: 1px solid var(--accent-soft-border);
  border-radius: var(--radius-md); padding: 14px 16px;
}

/* Responsive */
@media (max-width: 1080px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: var(--shadow-xl); }
  .main { margin-left: 0; }
  .search-trigger { min-width: 0; }
  .search-trigger span { display: none; }
  .content { padding: 16px; }
  .menu-btn { display: grid !important; }
}
.menu-btn { display: none; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ============================================================
   Mission Control — live animations
   ============================================================ */

/* Count-up values get tabular nums to avoid jitter */
.k-value { font-variant-numeric: tabular-nums; }

/* Live pulse ring on status dots */
.pulse-ring { position: relative; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.pulse-ring::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--green); opacity: 0; animation: pulseRing 2.2s ease-out infinite; }
@keyframes pulseRing { 0% { transform: scale(.5); opacity: .7; } 70% { transform: scale(1.3); opacity: 0; } 100% { opacity: 0; } }

/* Pipeline flow — animated dots travelling along the lanes */
.pipeline { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr; align-items: center; gap: 0; padding: 18px 20px 22px; }
.pipe-stage { text-align: center; position: relative; z-index: 1; }
.pipe-stage .pipe-icon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; margin: 0 auto 8px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-soft-border); position: relative; }
.pipe-stage.working .pipe-icon { animation: breathe 2.6s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, .25); } 50% { box-shadow: 0 0 0 7px rgba(37, 99, 235, 0); } }
.pipe-stage .pipe-n { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.pipe-stage .pipe-l { font-size: 10.5px; color: var(--text-tertiary); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.pipe-link { position: relative; height: 2px; min-width: 34px; background: var(--border-subtle); overflow: visible; }
.pipe-link .flow-dot { position: absolute; top: -2.5px; left: 0; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 6px rgba(37, 99, 235, .6); animation: flowDot 2.8s linear infinite; }
.pipe-link .flow-dot:nth-child(2) { animation-delay: 1.4s; }
@keyframes flowDot { 0% { left: -4px; opacity: 0; } 12% { opacity: 1; } 88% { opacity: 1; } 100% { left: calc(100% - 3px); opacity: 0; } }

/* Live ticker feed — new items slide in */
.ticker-item { animation: tickerIn .45s cubic-bezier(.2, .9, .3, 1); }
@keyframes tickerIn { from { opacity: 0; transform: translateY(-9px); } to { opacity: 1; transform: none; } }
.ticker-new { background: var(--accent-soft); border-radius: 10px; }
.ticker-fade { transition: background 1.8s ease; background: transparent !important; }

/* Digital employee cards */
.employee-card { position: relative; overflow: hidden; }
.employee-card .emp-status { position: absolute; top: 14px; right: 14px; display: flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.emp-avatar { width: 58px; height: 58px; border-radius: 17px; display: grid; place-items: center; color: #fff; position: relative; }
.emp-avatar svg { width: 26px; height: 26px; }
.emp-avatar.working::before { content: ''; position: absolute; inset: -5px; border-radius: 21px; border: 2px solid currentColor; opacity: .35; animation: pulseRing 2.4s ease-out infinite; }
.emp-activity { font-size: 11.5px; color: var(--text-secondary); display: flex; align-items: center; gap: 7px; min-height: 18px; }
.emp-activity .typing { display: inline-flex; gap: 3px; }
.emp-activity .typing i { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); animation: typingDot 1.2s ease-in-out infinite; }
.emp-activity .typing i:nth-child(2) { animation-delay: .18s; }
.emp-activity .typing i:nth-child(3) { animation-delay: .36s; }
@keyframes typingDot { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Sparkline bars under employees */
.spark { display: flex; align-items: flex-end; gap: 2.5px; height: 26px; }
.spark i { flex: 1; border-radius: 2px 2px 0 0; background: var(--accent-soft-border); min-height: 3px; animation: sparkGrow .7s cubic-bezier(.2, .9, .3, 1) backwards; }
.spark i.hot { background: var(--accent); }
@keyframes sparkGrow { from { transform: scaleY(0); } }
.spark i { transform-origin: bottom; }
@media (prefers-reduced-motion: reduce) { .spark i { animation: none; } }

/* Mission control hero band */
.mc-hero { border-radius: var(--radius-lg); border: 1px solid var(--border-subtle); position: relative; overflow: hidden;
  background: linear-gradient(120deg, var(--bg-surface) 55%, var(--accent-soft)); padding: 20px 24px; }
[data-theme="dark"] .mc-hero { background: linear-gradient(120deg, var(--bg-surface) 45%, rgba(37, 99, 235, .12)); }
.mc-hero::after { content: ''; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, .12), transparent 65%); pointer-events: none; }

@media (max-width: 900px) {
  .pipeline { grid-template-columns: 1fr; gap: 14px; }
  .pipe-link { display: none; }
}
