:root {
  --bg: #0f172a;
  --bg-soft: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --brand: #1d4ed8;
  --brand-dark: #1e3a8a;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --success: #047857;
  --success-bg: #ecfdf5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg-soft);
  color: var(--text);
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg);
  color: white;
}

.topbar .brand {
  color: white;
  font-weight: 700;
  text-decoration: none;
  font-size: 1.1rem;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar nav a, .topbar nav .link-btn {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.95rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.topbar nav a:hover, .topbar nav .link-btn:hover { color: white; }

.nav-user { color: white; font-size: 0.9rem; margin-right: 8px; }

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 20px;
}

h1 { font-size: 1.6rem; margin-bottom: 8px; }
h2 { font-size: 1.15rem; margin-bottom: 10px; }

.muted { color: var(--muted); }
.small { font-size: 0.82rem; }

.hero {
  text-align: center;
  padding: 60px 20px;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.hero h1 { font-size: 2rem; }

.btn, .btn-outline, button[type="submit"], button:not(.link-btn):not(.small-btn) {
  display: inline-block;
  background: var(--brand);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  text-decoration: none;
  margin-top: 8px;
}

.btn:hover, button[type="submit"]:hover { background: var(--brand-dark); }

.btn-outline {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--brand);
  margin-left: 8px;
}

.auth-card, .card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  max-width: 480px;
}

.card { max-width: none; }

.stack { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }

.stack label, .grid-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

input, select {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}

.grid-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}
.grid-form .full { grid-column: 1 / -1; }

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 0.92rem;
}

.table th, .table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.table th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
.right { text-align: right; }

.badge {
  display: inline-block;
  background: #dbeafe;
  color: var(--brand-dark);
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-status { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.badge-new { background: #e0e7ff; color: #3730a3; }
.badge-processing { background: #fef3c7; color: #92400e; }
.badge-shipped { background: #dbeafe; color: #1e3a8a; }
.badge-completed { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }

.order-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}
.order-progress-cancelled { color: #991b1b; font-weight: 600; }
.order-step { display: flex; align-items: center; gap: 4px; }
.order-step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  display: inline-block;
}
.order-step.done { color: var(--success); }
.order-step.done .order-step-dot { background: var(--success); }
.order-step.current { color: var(--brand); font-weight: 700; }
.order-step.current .order-step-dot { background: var(--brand); }

.kv { display: grid; grid-template-columns: 220px 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.flash {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: 0.92rem;
}
.flash-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; }
.flash-success { background: var(--success-bg); color: var(--success); border: 1px solid #a7f3d0; }

.qty-input { width: 70px; }
.price-input { width: 90px; }
.manager-input { width: 170px; }

.inline-form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.small-btn {
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
}
.danger-btn { background: var(--danger); }

.stack-row { display: flex; gap: 8px; align-items: center; margin-top: 16px; }

@media (max-width: 640px) {
  .grid-form { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; gap: 10px; align-items: flex-start; }
}
