/* Main & Global Theme Variables */
:root {
  --bg-app: #090d16;
  --bg-sidebar: #0f172a;
  --bg-header: #111827;
  --bg-card: #141e33;
  --bg-card-hover: #1a2744;
  --bg-surface: #1e293b;
  --bg-input: #0b1120;

  --border-color: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.05);
  --border-focus: #3b82f6;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* 6 Workshop Colors */
  --ws-sc1: #f59e0b;
  --ws-sc1-bg: rgba(245, 158, 11, 0.12);
  --ws-sc2: #6366f1;
  --ws-sc2-bg: rgba(99, 102, 241, 0.12);
  --ws-tc1: #06b6d4;
  --ws-tc1-bg: rgba(6, 182, 212, 0.12);
  --ws-tc2: #10b981;
  --ws-tc2-bg: rgba(16, 185, 129, 0.12);
  --ws-ht: #cbd5e1;
  --ws-ht-bg: rgba(203, 213, 225, 0.12);
  --ws-hs: #ec4899;
  --ws-hs-bg: rgba(236, 72, 153, 0.12);

  --accent-primary: #3b82f6;
  --accent-emerald: #10b981;
  --accent-danger: #ef4444;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --sidebar-width: 260px;
  --header-height: 64px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header Bar */
.main-header {
  height: var(--header-height);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-search-wrap {
  position: relative;
  width: 440px;
  display: flex;
  align-items: center;
}

.header-search-wrap svg {
  position: absolute;
  left: 12px;
  color: var(--text-dim);
  pointer-events: none;
}

.header-search-wrap input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  padding: 0.55rem 2.2rem 0.55rem 2.5rem;
  border-radius: var(--radius-md);
  outline: none;
  transition: all 0.2s ease;
}

.header-search-wrap input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.btn-clear-search {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}
.btn-clear-search.hidden { display: none; }

.header-right-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.factory-tag-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
}

.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

/* Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.825rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-export-excel {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}
.btn-export-excel:hover {
  background: #059669;
  transform: translateY(-1px);
}

.btn-primary {
  background: #3b82f6;
  color: #fff;
}
.btn-primary:hover {
  background: #2563eb;
}

.btn-outline {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}
.btn-outline:hover {
  background: #334155;
  border-color: rgba(255, 255, 255, 0.2);
}

/* Content Body */
.content-body {
  padding: 1.75rem 2rem;
  flex: 1;
}

.view-header {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.view-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.view-header p {
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.loading-spinner-wrap {
  text-align: center;
  padding: 4rem 0;
  color: var(--text-muted);
}

.spinner {
  width: 26px;
  height: 26px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 0.75rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.font-bold { font-weight: 700; }
.num-cell { font-family: var(--font-mono); }
.text-right { text-align: right; }
.text-center { text-align: center; }
