/* Southwest Desert theme */
:root {
  --primary: #c2703e;
  --secondary: #7a9a7a;
  --accent: #deb887;
  --bg: #faf5ef;
  --surface: #fffcf7;
  --text: #3d2b1f;
  --radius: 6px;
  --border: 2px solid var(--text);
  --shadow: 0 3px 0 rgba(61, 43, 31, 0.9);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.5;
}
h1, h2, h3, .brand { font-family: 'DM Sans', 'Inter', sans-serif; }
a { color: var(--primary); }
main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 48px; }

/* header */
.site-header {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 20px; background: var(--surface); border-bottom: var(--border);
  position: sticky; top: 0; z-index: 10; flex-wrap: wrap;
}
.brand { font-size: 1.35rem; font-weight: 700; color: var(--text); text-decoration: none; }
.site-nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.site-nav a { text-decoration: none; font-weight: 500; }
.nav-user { color: var(--text); opacity: .8; }
.site-footer { border-top: var(--border); background: var(--surface); padding: 16px 20px; text-align: center; }

/* buttons */
.btn {
  display: inline-block; padding: 8px 16px; border: var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; box-shadow: var(--shadow);
}
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-ghost { box-shadow: none; border-color: transparent; background: transparent; }
.btn-small { padding: 4px 10px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.inline { display: inline; }

/* hero + controls */
.hero { text-align: center; padding: 28px 8px 8px; }
.hero h1 { font-size: 2rem; margin: 0 0 16px; }
.steps { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.step { background: var(--surface); border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 14px; }
.step strong { color: var(--primary); }
.controls {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin: 22px 0 16px; padding: 12px; background: var(--surface);
  border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  position: sticky; top: 64px; z-index: 5;
}
.controls input[type="search"], .controls select {
  padding: 8px 10px; border: var(--border); border-radius: var(--radius); font: inherit; background: #fff;
}
.controls input[type="search"] { flex: 1 1 200px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.cur-toggle { display: inline-flex; border: var(--border); border-radius: var(--radius); overflow: hidden; }
.cur-btn { border: 0; background: var(--surface); padding: 7px 12px; font: inherit; font-weight: 600; cursor: pointer; }
.cur-btn.is-active { background: var(--accent); }
.count { margin-inline-start: auto; font-weight: 600; }

/* product grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.card {
  background: var(--surface); border: var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 10px;
}
.card.is-out { opacity: .65; }
.card-head { display: flex; align-items: center; gap: 10px; }
.card-cat { font-weight: 600; }
.card-title { margin: 0; font-size: 1.05rem; }
.card-desc, .card-desc-full { white-space: pre-wrap; word-break: break-word; }
.card-desc { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; margin: 0; }
.card-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.price-main { font-weight: 700; font-size: 1.1rem; }
.price-alt { opacity: .75; font-size: .9rem; }

/* logos */
.logo-wrap { position: relative; display: inline-flex; flex: 0 0 auto; }
.logo-tile {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--text); font-weight: 700;
  border: 2px solid var(--text); border-radius: var(--radius);
}
.logo-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--surface); border-radius: var(--radius); }

/* badges */
.badge { padding: 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; border: 2px solid var(--text); margin-inline-start: auto; }
.badge-in { background: var(--secondary); color: #fff; }
.badge-out { background: var(--primary); color: #fff; }

/* panels, forms, tables */
.panel {
  background: var(--surface); border: var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin: 20px auto;
}
.panel.narrow { max-width: 560px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-weight: 600; margin-bottom: 4px; }
.field input {
  width: 100%; padding: 9px 10px; border: var(--border); border-radius: var(--radius); font: inherit; background: #fff;
}
input.mini { width: 90px; padding: 5px 7px; border: var(--border); border-radius: var(--radius); }
.alert { background: #fdf0e2; border: var(--border); border-radius: var(--radius); padding: 10px 14px; }
.alert-error { background: #fbe3d8; }
.muted { opacity: .75; }
.small { font-size: .85rem; }
.table { width: 100%; border-collapse: collapse; background: var(--surface); }
.table th, .table td { border-bottom: 2px solid rgba(61,43,31,.25); padding: 9px 10px; text-align: start; vertical-align: top; }
.pay-box { border: var(--border); border-radius: var(--radius); background: #fdf6ec; padding: 16px; margin: 16px 0; }
.delivery-box { white-space: pre-wrap; word-break: break-word; background: #fff; border: var(--border); border-radius: var(--radius); padding: 10px; margin-top: 8px; }

/* admin */
.admin-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; flex: 0 0 230px; background: var(--surface); border-inline-end: var(--border);
  padding: 18px 14px; display: flex; flex-direction: column; gap: 6px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 4px; margin-top: 14px; }
.side-item { padding: 9px 12px; border-radius: var(--radius); text-decoration: none; color: var(--text); font-weight: 600; border: 2px solid transparent; }
.side-item.is-active { background: var(--accent); border-color: var(--text); box-shadow: var(--shadow); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.admin-main { flex: 1; padding: 20px 22px 48px; min-width: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.stat-num { font-size: 1.6rem; font-weight: 700; font-family: 'DM Sans', sans-serif; }
.group { background: var(--surface); border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; }
.group-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; flex-wrap: wrap; }
.group-name { font-weight: 700; }
.group .table { margin: 0 0 6px; }
.bulk-bar { display: flex; gap: 10px; margin-bottom: 16px; }
.row-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
td.actions { white-space: nowrap; }

@media (max-width: 720px) {
  .admin-shell { flex-direction: column; }
  .sidebar { width: auto; flex: none; border-inline-end: 0; border-bottom: var(--border); }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .controls { top: 0; position: static; }
}
