:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --primary: #111827;
  --primary-hover: #1f2937;
  --danger: #dc2626;
  --warning: #d97706;
  --success: #16a34a;
  --radius: 18px;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 18px;
}

.brand {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 24px;
  letter-spacing: -0.03em;
}

.nav-section {
  margin-bottom: 24px;
}

.nav-title {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.nav-link {
  display: block;
  padding: 11px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  margin-bottom: 6px;
  transition: 0.2s ease;
  font-size: 14px;
}

.nav-link:hover {
  background: var(--surface-soft);
}

.user-pill {
  font-size: 13px;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-soft);
  margin-bottom: 8px;
}

.main {
  padding: 32px;
}

.main-auth {
  padding: 0;
  display: grid;
  place-items: center;
  min-height: 100vh;
}

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

.page-title {
  font-size: 30px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.04em;
}

.page-subtitle {
  color: var(--muted);
  font-size: 14px;
  margin-top: 6px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.grid {
  display: grid;
  gap: 20px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 12px;
  border: none;
  background: var(--primary);
  color: white;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
}

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

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

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

.btn-danger {
  background: var(--danger);
}

.btn-warning {
  background: var(--warning);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  padding: 14px 12px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 16px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

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

.form-group.full {
  grid-column: 1 / -1;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: white;
  font-size: 14px;
  color: var(--text);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #cbd5e1;
  box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.12);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.badge-success {
  background: #dcfce7;
  color: #166534;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.badge-neutral {
  background: #e5e7eb;
  color: #374151;
}

.flash {
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
}

.flash.success {
  background: #ecfdf5;
  color: #166534;
  border-color: #bbf7d0;
}

.flash.danger {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.flash.warning {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}

.auth-card {
  width: min(420px, 92vw);
}

.product-image {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.item-card {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  align-items: start;
}

.item-image {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.order-line {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  background: var(--surface-soft);
  margin-bottom: 14px;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.preview-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  background: white;
}

.preview-card img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  border-radius: 12px;
  background: var(--surface-soft);
}

.summary-box {
  background: var(--surface-soft);
  border: 1px dashed var(--border);
  border-radius: 16px;
  padding: 16px;
}

@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .main {
    padding: 20px;
  }

  .grid-2,
  .grid-3,
  .grid-4,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }
}