:root {
  --green: #16a34a;
  --green-light: #dcfce7;
  --green-dark: #15803d;
  --sidebar-w: 240px;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #2563eb;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

/* ── Layout ─────────────────────────────────────────────────────────────────── */

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

.sidebar {
  width: var(--sidebar-w);
  background: #0f172a;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid #1e293b;
}

.sidebar-logo .logo-icon {
  font-size: 28px;
  display: block;
  margin-bottom: 4px;
}

.sidebar-logo .logo-name {
  font-size: 15px;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.2;
}

.sidebar-logo .logo-sub {
  font-size: 11px;
  color: #64748b;
}

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.nav-section {
  padding: 8px 16px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #475569;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: #94a3b8;
  text-decoration: none;
  border-radius: 0;
  transition: all .15s;
  font-size: 13.5px;
  position: relative;
}

.nav-item:hover { color: #f1f5f9; background: #1e293b; }

.nav-item.active {
  color: #fff;
  background: var(--green);
}

.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid #1e293b;
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 13px;
  padding: 6px 0;
  transition: color .15s;
}

.sidebar-footer a:hover { color: #f1f5f9; }

/* ── Main content ────────────────────────────────────────────────────────────── */

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

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title { font-size: 17px; font-weight: 600; }

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

.topbar-admin {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

.content { padding: 28px; flex: 1; }

/* ── Cards ───────────────────────────────────────────────────────────────────── */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

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

.card-title { font-size: 15px; font-weight: 600; }

.card-body { padding: 20px; }

/* ── Stat cards ──────────────────────────────────────────────────────────────── */

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

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

.stat-label { font-size: 12px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }

.stat-value { font-size: 28px; font-weight: 700; margin: 6px 0 2px; color: var(--text); }

.stat-icon { font-size: 24px; float: right; margin-top: -4px; }

/* ── Table ───────────────────────────────────────────────────────────────────── */

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

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

thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

tbody td { padding: 11px 14px; vertical-align: middle; }

.td-name { font-weight: 500; }

/* ── Badges ──────────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
}

.badge-green  { background: #dcfce7; color: #15803d; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-gray   { background: #f1f5f9; color: #475569; }
.badge-purple { background: #ede9fe; color: #6d28d9; }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all .15s;
  line-height: 1;
}

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

.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg); }

.btn-danger { background: transparent; color: var(--danger); border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }

.btn-sm { padding: 5px 11px; font-size: 12.5px; }

.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  justify-content: center;
  border-radius: 7px;
}

/* ── Forms ───────────────────────────────────────────────────────────────────── */

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.col-span-2 { grid-column: span 2; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

label { font-size: 13px; font-weight: 500; color: var(--text); }

.form-hint { font-size: 11.5px; color: var(--muted); }

input[type=text],
input[type=number],
input[type=email],
input[type=password],
input[type=url],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13.5px;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}

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

.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}

.toggle {
  position: relative;
  width: 40px; height: 22px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 22px;
  cursor: pointer;
  transition: .2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .2s;
}

.toggle input:checked + .toggle-slider { background: var(--green); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── Page header ─────────────────────────────────────────────────────────────── */

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

.page-header h1 { font-size: 20px; font-weight: 700; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 4px;
}

.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--green); }

/* ── Search bar ──────────────────────────────────────────────────────────────── */

.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.search-bar input { max-width: 320px; }

/* ── Alert ───────────────────────────────────────────────────────────────────── */

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13.5px;
}

.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Login page ──────────────────────────────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
}

.login-card {
  background: #fff;
  border-radius: 14px;
  padding: 40px;
  width: 360px;
  box-shadow: 0 20px 40px rgba(0,0,0,.3);
}

.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon { font-size: 40px; display: block; margin-bottom: 8px; }
.login-logo h1 { font-size: 20px; font-weight: 700; }
.login-logo p { font-size: 13px; color: var(--muted); }

/* ── Empty state ─────────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-state .icon { font-size: 48px; display: block; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 4px; }

/* ── Order status colors ─────────────────────────────────────────────────────── */

.status-new       { background: #dbeafe; color: #1d4ed8; }
.status-confirmed { background: #dcfce7; color: #15803d; }
.status-processing{ background: #fef3c7; color: #92400e; }
.status-shipped   { background: #ede9fe; color: #6d28d9; }
.status-delivered { background: #dcfce7; color: #166534; }
.status-cancelled { background: #fee2e2; color: #b91c1c; }

/* ── Misc ────────────────────────────────────────────────────────────────────── */

.text-muted { color: var(--muted); }
.text-sm { font-size: 12px; }
.text-right { text-align: right; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mb-2 { margin-bottom: 8px; }
.fw-600 { font-weight: 600; }
.w-100 { width: 100%; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

.actions { display: flex; gap: 6px; }

.order-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
}

.info-row { display: flex; flex-direction: column; gap: 2px; }
.info-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.info-value { font-size: 14px; }
