:root {
  --bg: #f8fafc;
  --surface: #fff;
  --surface-soft: #f9fbff;
  --ink: #1e293b;
  --text: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --primary: #3a7ca5;
  --primary-hover: #2f6d95;
  --primary-active: #255b7d;
  --primary-soft: #eaf4fa;
  --primary-soft-strong: #d4e8f3;
  --primary-rgb: 58, 124, 165;
  --secondary: #4f6f9f;
  --secondary-rgb: 79, 111, 159;
  --theme-primary: var(--primary);
  --theme-primary-hover: var(--primary-hover);
  --theme-primary-active: var(--primary-active);
  --theme-primary-soft: var(--primary-soft);
  --theme-primary-soft-strong: var(--primary-soft-strong);
  --theme-primary-light-5: color-mix(in srgb, var(--theme-primary) 52%, white);
  --theme-primary-light-9: color-mix(in srgb, var(--theme-primary) 8%, white);
  --theme-primary-contrast: #ffffff;
  --theme-primary-shadow: rgba(var(--theme-primary-rgb), 0.16);
  --theme-gradient-primary: linear-gradient(135deg, var(--theme-primary), var(--theme-primary-active));
  --theme-primary-rgb: var(--primary-rgb);
  --theme-secondary: var(--secondary);
  --theme-secondary-rgb: var(--secondary-rgb);
  --theme-focus-ring: rgba(var(--theme-primary-rgb), 0.12);
  --purple: #8b5cf6;
  --orange: #f59e0b;
  --red: #ef4444;
  --success: #2f855a;
  --success-hover: #276749;
  --success-active: #22543d;
  --success-soft: #f0f7f2;
  --success-line: #cde6d5;
  --success-rgb: 47, 133, 90;
  --warning: #b7791f;
  --warning-hover: #975a16;
  --warning-active: #7b4514;
  --warning-soft: #fff8eb;
  --warning-line: #efd9af;
  --warning-rgb: 183, 121, 31;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-active: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-line: #fecaca;
  --danger-rgb: 239, 68, 68;
  --info: #475569;
  --info-hover: #334155;
  --info-active: #1e293b;
  --info-soft: #f1f5f9;
  --info-line: #cbd5e1;
  --info-rgb: 71, 85, 105;
  --chart-primary: var(--theme-primary);
  --chart-primary-rgb: var(--theme-primary-rgb);
  --chart-blue: #4f6f9f;
  --chart-purple: #6e7fa6;
  --chart-amber: #b58b4c;
  --chart-danger: var(--danger);
  --nav: #0b1220;
  --nav-muted: #7d89a5;
  --radius: 4px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --desktop-ui-scale: 1;
  --desktop-ui-inverse-scale: 1;
  --desktop-stage-width: 100vw;
  --desktop-stage-height: 100dvh;
  --desktop-viewport-width: 1440;
  --desktop-viewport-height: 900;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-family: var(--font-sans);
}

* { box-sizing: border-box; }
html, body, #app { min-height: 100%; }
body { margin: 0; min-height: 100dvh; color: var(--text); background: var(--bg); }
.mdi { line-height: 1; vertical-align: middle; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--theme-focus-ring, rgba(58,124,165,.18)); outline-offset: 2px; }

.eyebrow { color: var(--primary); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
h1, h2, h3, p { margin: 0; }
h1 { margin-top: 4px; color: var(--ink); font-size: 24px; line-height: 1.25; font-weight: 700; }

.btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-weight: 700;
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease), background 180ms var(--ease), border-color 180ms var(--ease);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(16,24,40,.08); }
.btn:active, .mini-btn:active, .chip:active, .nav-btn:active { transform: scale(.97); }
.btn.primary { border-color: transparent; background: var(--theme-primary); color: #fff; box-shadow: 0 10px 20px rgba(var(--theme-primary-rgb, 58, 124, 165), .18); }
.btn.success { border-color: transparent; background: var(--success); color: #fff; }
.btn.danger { border-color: rgba(180,35,24,.18); background: var(--danger-soft); color: var(--danger); }
.btn.ghost { background: transparent; }

.badge { display: inline-flex; min-height: 26px; align-items: center; padding: 4px 9px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 780; white-space: nowrap; }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }

.panel {
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  transition: box-shadow 160ms var(--ease);
}
.panel:hover { box-shadow: 0 4px 10px rgba(15,23,42,.08); }

.mini-btn { min-height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--text); font-size: 12px; font-weight: 750; }

@keyframes grow { from { transform: scaleX(0); transform-origin: left; } to { transform: scaleX(1); transform-origin: left; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.message-list-enter-active, .message-list-leave-active { transition: opacity 220ms var(--ease), transform 220ms var(--ease); }
.message-list-enter-from { opacity: 0; transform: translateY(8px) scale(.98); }
.message-list-leave-to { opacity: 0; transform: translateY(-6px) scale(.98); }

@media (max-width: 1180px) {
  .metric-strip, .overview-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .topbar { flex-direction: column; padding: 18px 16px; }
  .top-actions, .search, .btn { width: 100%; }
  .filters, .metric-strip, .overview-grid, .donut-layout, .dialog-body, .dialog-foot, .review-summary, .chat-hero { grid-template-columns: 1fr; }
  .filters, .workarea { padding-inline: 16px; }
  .bar-row { grid-template-columns: 1fr; gap: 6px; }
  .bar-row strong { text-align: left; }
  .case-panel { border-left: 0; border-top: 1px solid var(--line); }
  .review-summary { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}

.table-state:has(.table-loading.screen-floating),
.table-state:has(.table-loading-anchor),
.table-loading-row:has(.table-loading.screen-floating),
.table-loading-row:has(.table-loading-anchor) {
  min-height: 0 !important;
  padding: 0 !important;
  background: transparent !important;
}

tr:has(> .table-loading-row .table-loading.screen-floating),
tr:has(> .table-loading-row .table-loading-anchor),
tr:has(> .table-loading-row .table-loading.screen-floating) > td,
tr:has(> .table-loading-row .table-loading-anchor) > td,
.table-loading-row:has(.table-loading.screen-floating),
.table-loading-row:has(.table-loading-anchor) {
  height: 0 !important;
  border: 0 !important;
  line-height: 0 !important;
  background: transparent !important;
}

/* Global Scrollbar Styles */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
