@import url('https://fonts.googleapis.com/css2?family=Inter:wght@200;300;400;500;600;700&display=swap');

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

:root {
  --bg: oklch(0.08 0.003 35);
  --surface: oklch(0.14 0.006 35);
  --surface-hover: oklch(0.18 0.008 35);
  --border: oklch(0.22 0.008 35);
  --text: oklch(0.9 0.005 35);
  --text-muted: oklch(0.55 0.02 35);
  --primary: oklch(0.59 0.20 34.8);
  --primary-hover: oklch(0.54 0.22 34.8);
  --primary-dim: oklch(0.45 0.15 34.8);
  --accent: oklch(0.72 0.15 75);
  --accent-dim: oklch(0.55 0.12 75);
  --danger: oklch(0.55 0.20 25);
  --success: oklch(0.6 0.18 145);
  --info: oklch(0.6 0.12 240);
  --radius: 16px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  --shadow: 0 4px 24px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 48px rgba(0,0,0,.5);
  --sidebar-width: 260px;
  --transition: 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  --transition-fast: 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

html {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

.icon-svg {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: rgba(18, 18, 24, .95);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
  backdrop-filter: blur(20px);
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dim));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  overflow: hidden;
  flex-shrink: 0;
}

.logo-icon svg {
  width: 20px;
  height: 20px;
}

.logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.logo-text h1 {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: -.02em;
  line-height: 1.2;
}

.logo-text span {
  font-size: .65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 400;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  display: none;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 400;
  color: var(--text-muted);
  transition: all var(--transition);
  position: relative;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px;
  height: 20px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
  transition: transform var(--transition);
}

.nav-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-item.active {
  background: rgba(196, 80, 50, .1);
  color: var(--primary);
  font-weight: 500;
}

.nav-item.active::before {
  transform: translateY(-50%) scaleY(1);
}

.nav-item .icon-svg { opacity: .7; transition: opacity var(--transition); }
.nav-item:hover .icon-svg { opacity: 1; }
.nav-item.active .icon-svg { opacity: 1; color: var(--primary); }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: .7rem;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 1px;
  text-transform: uppercase;
}

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

.bg-carousel {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.bg-carousel .slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1.5s ease;
  pointer-events: none;
}

.bg-carousel .slide.active {
  opacity: .06;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(18, 18, 24, .7);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
}

.topbar-title h2 {
  font-size: .95rem;
  font-weight: 500;
  letter-spacing: -.01em;
}

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

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 500;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: block;
}

.status-badge.online {
  background: rgba(98, 200, 120, .1);
  color: var(--success);
}

.status-badge.online::before {
  background: var(--success);
  box-shadow: 0 0 6px rgba(98, 200, 120, .5);
}

.status-badge.offline {
  background: rgba(196, 80, 50, .1);
  color: var(--danger);
}

.status-badge.offline::before {
  background: var(--danger);
  box-shadow: 0 0 6px rgba(196, 80, 50, .5);
}

.content {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

.page {
  display: none;
  animation: pageIn .4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.page.active { display: block; }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.welcome-card {
  position: relative;
  background: linear-gradient(135deg, rgba(196, 80, 50, .08), rgba(196, 80, 50, .02));
  border: 1px solid rgba(196, 80, 50, .15);
  border-radius: var(--radius);
  padding: 36px 40px;
  margin-bottom: 28px;
  overflow: hidden;
}

.welcome-card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(196, 80, 50, .08), transparent 70%);
  pointer-events: none;
}

.welcome-card h2 {
  font-size: 1.3rem;
  font-weight: 400;
  margin-bottom: 8px;
  color: #fff;
  letter-spacing: -.02em;
  position: relative;
}

.welcome-card p {
  color: var(--text-muted);
  font-size: .9rem;
  max-width: 560px;
  line-height: 1.7;
  position: relative;
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
  animation: cardIn .5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.stat-card:hover {
  border-color: rgba(196, 80, 50, .3);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  opacity: .7;
}

.stat-icon svg { width: 22px; height: 22px; }

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: -.03em;
}

.stat-label {
  font-size: .78rem;
  color: var(--text-muted);
  font-weight: 300;
}

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

.feature-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
  animation: cardIn .5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.feature-card:hover {
  border-color: rgba(196, 80, 50, .3);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.feature-card:hover::before { opacity: 1; }

.feature-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(196, 80, 50, .08);
  border-radius: var(--radius-sm);
  color: var(--primary);
}

.feature-icon svg { width: 20px; height: 20px; }

.feature-card h3 {
  font-size: 1rem;
  font-weight: 500;
  color: #fff;
}

.feature-card p {
  font-size: .82rem;
  color: var(--text-muted);
  line-height: 1.6;
  font-weight: 300;
}

.stat-card:nth-child(1) { animation-delay: .05s; }
.stat-card:nth-child(2) { animation-delay: .1s; }
.stat-card:nth-child(3) { animation-delay: .15s; }
.stat-card:nth-child(4) { animation-delay: .2s; }

.feature-card:nth-child(1) { animation-delay: .15s; }
.feature-card:nth-child(2) { animation-delay: .2s; }
.feature-card:nth-child(3) { animation-delay: .25s; }
.feature-card:nth-child(4) { animation-delay: .3s; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 20px rgba(196, 80, 50, .3);
}

.btn-secondary {
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--border); }

.btn-sm {
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-xs);
  font-family: 'Inter', sans-serif;
  font-size: .75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-edit {
  background: rgba(98, 140, 220, .12);
  color: var(--info);
}
.btn-edit:hover { background: rgba(98, 140, 220, .2); }

.btn-delete {
  background: rgba(196, 80, 50, .12);
  color: var(--primary);
}
.btn-delete:hover { background: rgba(196, 80, 50, .2); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

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

.card-header h3 { font-size: .9rem; font-weight: 500; color: #fff; }
.card-half { max-width: 480px; }
.benchmark-card { margin-top: 24px; }

.table-container { overflow-x: auto; }

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

.table th {
  text-align: left;
  padding: 12px 12px;
  color: var(--text-muted);
  font-weight: 400;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 12px;
  border-bottom: 1px solid rgba(42, 42, 54, .4);
  vertical-align: middle;
  font-weight: 300;
}

.table tr:last-child td { border-bottom: none; }
.table tr.low-stock td { background: rgba(196, 80, 50, .04); }

.text-danger { color: var(--primary); }
.text-warning { color: var(--accent); }
.text-success { color: var(--success); }

.actions-cell { white-space: nowrap; display: flex; gap: 6px; }

.search-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: .85rem;
  width: 100%;
  outline: none;
  transition: border-color var(--transition);
  font-weight: 300;
}

.search-input:focus { border-color: var(--primary); }
.search-input::placeholder { color: var(--text-muted); }

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn .35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-header h3 { font-size: 1rem; font-weight: 500; color: #fff; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  transition: color var(--transition);
}

.modal-close:hover { color: var(--text); }

.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: .78rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: .3px;
}

.form-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: .88rem;
  outline: none;
  transition: border-color var(--transition);
  font-weight: 300;
}

.form-input:focus { border-color: var(--primary); }
.form-input::placeholder { color: var(--text-muted); }

select.form-input { cursor: pointer; appearance: auto; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 300;
}

.alert-warning {
  background: rgba(196, 80, 50, .1);
  border: 1px solid rgba(196, 80, 50, .2);
  color: var(--primary);
}

.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kanban-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.kanban-col h3 { font-size: .85rem; font-weight: 500; margin-bottom: 12px; color: #fff; }
.kanban-col h3 span { color: var(--text-muted); font-weight: 400; }
.kanban-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
  transition: all var(--transition-fast);
}
.kanban-card:hover {
  border-color: rgba(196, 80, 50, .3);
  transform: translateX(2px);
}

.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: all var(--transition-fast);
}
.order-card:hover {
  border-color: rgba(196, 80, 50, .2);
}

@media (prefers-reduced-motion: reduce) {
  .stat-card, .feature-card, .page { animation: none; }
  .modal-content { animation: none; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: block; }
  .hamburger { display: block; }
  .main-content { margin-left: 0; }
  .main-content::before { background-attachment: scroll; }
  .quick-stats { grid-template-columns: repeat(2, 1fr); }
  .feature-grid { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .welcome-card { padding: 24px; }
}

@media (max-width: 480px) {
  .quick-stats { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
}

/* ── Drag & Drop on Kanban ── */
.kanban-card:active {
  cursor: grabbing;
  opacity: .6 !important;
}

.kanban-col-body.drag-over {
  background: rgba(196, 80, 50, 0.08) !important;
}

.kanban-col-body {
  transition: background 0.2s ease;
}

/* ── Skeleton Loading ── */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-hover) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-xs);
}

.skeleton-text {
  height: 14px;
  width: 80%;
  margin-bottom: 8px;
}

.skeleton-value {
  height: 28px;
  width: 60%;
  margin-bottom: 4px;
}

/* ── Status indicators ── */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online { background: var(--success); box-shadow: 0 0 8px rgba(98, 200, 120, .5); }
.status-dot.offline { background: var(--danger); }
.status-dot.checking { background: var(--accent); animation: pulse 1s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}
