@font-face {
  font-family: 'InterLocal';
  src: url('../fonts/Inter-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'InterLocal';
  src: url('../fonts/Inter-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'InterLocal';
  src: url('../fonts/Inter-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'InterLocal';
  src: url('../fonts/Inter-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --brand: #FF6C0C;
  --brand-soft: rgba(255, 108, 12, 0.15);
  --brand-glow: rgba(255, 108, 12, 0.45);
  --bg: #f4f6f9;
  --bg-elevated: #ffffff;
  --sidebar: #1c1f26;
  --sidebar-text: #c9d1d9;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --success: #16a34a;
  --info: #2563eb;
  --warning: #FF6C0C;
  --danger: #dc2626;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --radius: 14px;
  --sidebar-width: 260px;
  --sidebar-collapsed: 78px;
  --header-h: 64px;
}

html[data-theme="dark"] {
  --bg: #0f1115;
  --bg-elevated: #1a1d24;
  --sidebar: #0b0d11;
  --sidebar-text: #d1d5db;
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --border: #2a2f3a;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'InterLocal', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

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

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

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar);
  color: var(--sidebar-text);
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
  transition: width .25s ease, transform .25s ease;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.04);
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .brand-tagline { display: none; }
.sidebar.collapsed .nav-link { justify-content: center; padding: 12px; }
.sidebar.collapsed .brand { padding: 16px 10px; }
.sidebar.collapsed .brand img { width: 48px; height: 48px; }

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  text-decoration: none;
}
.brand:hover { text-decoration: none; opacity: .92; }
.brand img {
  width: 150px;
  height: auto;
  max-height: 72px;
  object-fit: contain;
}
.brand-tagline {
  color: var(--brand);
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .04em;
}

.nav { padding: 12px 10px 24px; overflow-y: auto; flex: 1; }
.nav-section-title {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #7a8494;
  padding: 14px 12px 6px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  color: var(--sidebar-text);
  margin-bottom: 2px;
  transition: .15s ease;
}
.nav-link:hover { background: rgba(255,108,12,.12); color: #fff; text-decoration: none; }
.nav-link.active {
  background: linear-gradient(90deg, rgba(255,108,12,.28), rgba(255,108,12,.08));
  color: #fff;
  box-shadow: inset 3px 0 0 var(--brand);
}
.nav-ico {
  width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--brand); flex-shrink: 0;
}
.nav-ico svg { width: 18px; height: 18px; fill: currentColor; }

.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  transition: margin-left .25s ease;
}
.sidebar.collapsed ~ .main { margin-left: var(--sidebar-collapsed); }

.topbar {
  height: var(--header-h);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  width: 40px; height: 40px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--brand-soft); color: var(--text); font-size: .9rem;
}

.content { padding: 22px; }
.page-head { margin-bottom: 18px; }
.page-head h1 { margin: 0 0 4px; font-size: 1.55rem; }
.breadcrumb { color: var(--text-muted); font-size: .85rem; }

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card + .card { margin-top: 16px; }
.card-title { margin: 0 0 14px; font-size: 1.05rem; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.kpi-grid.small { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.kpi {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform .25s ease, box-shadow .25s ease;
}
.kpi::before {
  content: '';
  position: absolute; inset: auto -20% -40% auto;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, var(--brand-glow), transparent 70%);
  opacity: .35;
}
.kpi:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px var(--brand-glow);
  border-color: rgba(255,108,12,.45);
}
.kpi .label { color: var(--text-muted); font-size: .85rem; margin-bottom: 8px; }
.kpi .value { font-size: 2rem; font-weight: 700; color: var(--text); }
.kpi.neon { border-color: rgba(255,108,12,.35); box-shadow: 0 0 0 1px rgba(255,108,12,.12), var(--shadow); }
.kpi.neon .value { color: var(--brand); text-shadow: 0 0 18px var(--brand-glow); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; cursor: pointer; font-size: .92rem; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { filter: brightness(1.05); box-shadow: 0 8px 20px var(--brand-glow); }
.btn-secondary { background: transparent; border-color: var(--border); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 12px; font-size: .82rem; }
.btn-block { width: 100%; }

.table-wrap { overflow-x: auto; }
table.data {
  width: 100%; border-collapse: collapse; min-width: 640px;
}
table.data th, table.data td {
  padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: left; font-size: .92rem;
}
table.data th { color: var(--text-muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
table.data tr:hover td { background: var(--brand-soft); }

.badge {
  display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px;
  font-size: .75rem; font-weight: 600;
}
.badge-warning { background: rgba(255,108,12,.15); color: var(--brand); }
.badge-info { background: rgba(37,99,235,.15); color: #3b82f6; }
.badge-success { background: rgba(22,163,74,.15); color: #16a34a; }
.badge-muted { background: rgba(107,114,128,.15); color: #9ca3af; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: .85rem; color: var(--text-muted); font-weight: 500; }
.form-group label .req { color: var(--brand); }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=file], select, textarea {
  width: 100%; padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
textarea { min-height: 90px; resize: vertical; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: center; justify-content: space-between; }
.toolbar .search { display: flex; gap: 8px; flex-wrap: wrap; }

.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tab-btn {
  border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text);
  padding: 10px 14px; border-radius: 999px; cursor: pointer; font-weight: 600;
}
.tab-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.toast-wrap {
  position: fixed; right: 18px; top: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  min-width: 260px; max-width: 360px; padding: 12px 14px; border-radius: 12px;
  background: var(--bg-elevated); border: 1px solid var(--border); box-shadow: var(--shadow);
  animation: slideIn .25s ease;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info { border-left: 4px solid var(--info); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 150;
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: min(480px, 100%); background: var(--bg-elevated); border-radius: 16px;
  border: 1px solid var(--border); padding: 20px; box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative; padding: 0 0 18px 28px; border-left: 2px solid var(--border);
}
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before {
  content: ''; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft);
}
.timeline .meta { color: var(--text-muted); font-size: .82rem; }

.progress {
  height: 10px; background: var(--border); border-radius: 999px; overflow: hidden;
}
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #ff944d); }

.countdown {
  font-weight: 700; color: var(--brand);
  font-variant-numeric: tabular-nums;
}
.countdown.done { color: var(--success); }

.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.muted { color: var(--text-muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.qty-with-unit {
  display: flex;
  align-items: center;
  gap: 8px;
}
.qty-with-unit .qty-input { flex: 1; min-width: 70px; }
.qty-with-unit .unit-label {
  min-width: 36px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--brand);
  white-space: nowrap;
}
.line-total-input {
  background: var(--brand-soft);
  font-weight: 600;
  border-color: rgba(255,108,12,.25);
}
.order-items-table tfoot td {
  border-top: 2px solid var(--border);
  padding-top: 14px;
}

.login-page {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(255,108,12,.25), transparent),
    radial-gradient(900px 500px at 100% 100%, rgba(255,108,12,.12), transparent),
    linear-gradient(160deg, #111827, #1f2937);
  padding: 20px;
}
.login-card {
  width: min(420px, 100%); background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08); backdrop-filter: blur(8px);
  border-radius: 20px; padding: 28px; color: #fff; box-shadow: 0 30px 80px rgba(0,0,0,.35);
}
.login-card img { width: 72px; height: 72px; object-fit: contain; display: block; margin: 0 auto 12px; }
.login-card h1 { text-align: center; margin: 0 0 4px; font-size: 1.5rem; }
.login-card p { text-align: center; color: #9ca3af; margin: 0 0 20px; }
.login-card input { background: #0b1220; border-color: #374151; color: #fff; }
.overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 90;
}
.overlay.open { display: block; }

@media (max-width: 980px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .form-grid, .split-2 { grid-template-columns: 1fr; }
  .sidebar {
    transform: translateX(-105%);
    width: min(280px, 86vw);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar.collapsed { width: min(280px, 86vw); }
  .sidebar.collapsed .nav-label,
  .sidebar.collapsed .brand-tagline { display: inline; }
  .sidebar.collapsed .brand { flex-direction: column; }
  .sidebar.collapsed .brand img { width: 150px; max-height: 72px; }
  .main, .sidebar.collapsed ~ .main { margin-left: 0; }
}

@media print {
  .sidebar, .topbar, .no-print, .toast-wrap { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0 !important; }
  body { background: #fff; color: #000; }
}
