:root {
  --g-900: #06281d;
  --g-800: #0a3b2b;
  --g-700: #0f5138;
  --g-600: #157347;
  --g-500: #1e9e5f;
  --gold: #d9a441;
  --ink: #14201b;
  --muted: #5b655f;
  --line: #e4e9e5;
  --bg: #f6f8f6;
  --card: #ffffff;
  --danger: #c0392b;
  --radius: 14px;
  --shadow: 0 2px 14px rgba(6, 40, 29, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
}
a { color: var(--g-600); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* Header */
.topbar {
  background: var(--g-800);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}
.topbar .wrap {
  max-width: 1100px; margin: 0 auto; padding: 12px 18px;
  display: flex; align-items: center; gap: 16px;
}
.brand { font-weight: 800; font-size: 1.2rem; color: #fff; letter-spacing: .2px; }
.brand:hover { text-decoration: none; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nav a, .nav button {
  color: #eafaf1; font-size: .95rem; background: none; border: none;
  padding: 8px 12px; border-radius: 9px; cursor: pointer; font-family: inherit;
}
.nav a:hover, .nav button:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.cart-btn { position: relative; }
.cart-count {
  position: absolute; top: -2px; right: -2px; background: var(--gold); color: #3a2600;
  font-size: .7rem; font-weight: 800; min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 18px; }
h1 { font-size: 1.7rem; margin: 0 0 6px; }
.sub { color: var(--muted); margin: 0 0 22px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--g-600); color: #fff; border: none; border-radius: 10px;
  padding: 11px 18px; font-size: .98rem; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: background .15s, transform .05s;
}
.btn:hover { background: var(--g-700); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--g-700); border: 1.5px solid var(--line); }
.btn.ghost:hover { background: #eef4f0; }
.btn.gold { background: var(--gold); color: #3a2600; }
.btn.gold:hover { background: #c9962f; }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 7px 12px; font-size: .85rem; border-radius: 8px; }
.btn.block { width: 100%; }

/* Product grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.card .thumb { aspect-ratio: 4/3; background: #eef2ef; overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .thumb .ph {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: #b7c3bb; font-size: 2.2rem;
}
.card .body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.tag {
  display: inline-block; font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; padding: 3px 8px; border-radius: 20px; align-self: flex-start;
}
.tag.physical { background: #e7f1ff; color: #1c5aa8; }
.tag.class { background: #fdf0e0; color: #a5701a; }
.tag.digital { background: #e9f7ef; color: #157347; }
.card h3 { margin: 2px 0; font-size: 1.05rem; }
.card .desc { color: var(--muted); font-size: .88rem; margin: 0; flex: 1; }
.price { font-weight: 800; font-size: 1.15rem; color: var(--g-700); }
.stock-out { color: var(--danger); font-size: .82rem; font-weight: 600; }

/* Panels / forms */
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; max-width: 460px; margin: 0 auto;
}
.field { margin-bottom: 14px; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 5px; }
input, textarea, select {
  width: 100%; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 1rem; font-family: inherit; background: #fff; color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--g-500); }
textarea { resize: vertical; min-height: 70px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.msg { padding: 10px 14px; border-radius: 10px; font-size: .9rem; margin-bottom: 14px; }
.msg.err { background: #fdecea; color: var(--danger); border: 1px solid #f5c6c0; }
.msg.ok { background: #e9f7ef; color: var(--g-700); border: 1px solid #bfe6cf; }

/* Cart drawer */
.drawer-bg {
  position: fixed; inset: 0; background: rgba(6,40,29,.45); z-index: 100;
  display: none; opacity: 0; transition: opacity .2s;
}
.drawer-bg.open { display: block; opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(420px, 100%);
  background: var(--bg); z-index: 101; box-shadow: -4px 0 24px rgba(0,0,0,.2);
  transform: translateX(100%); transition: transform .25s; display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer header { padding: 16px 18px; background: var(--g-800); color: #fff; display: flex; align-items: center; }
.drawer header .x { margin-left: auto; background: none; border: none; color: #fff; font-size: 1.4rem; cursor: pointer; }
.drawer .items { flex: 1; overflow-y: auto; padding: 14px; }
.drawer footer { padding: 16px 18px; border-top: 1px solid var(--line); background: #fff; }
.citem { display: flex; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; }
.citem .ci-body { flex: 1; }
.citem h4 { margin: 0 0 3px; font-size: .95rem; }
.qty { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.qty button { width: 28px; height: 28px; border: 1px solid var(--line); background: #fff; border-radius: 7px; cursor: pointer; font-size: 1rem; }
.qty span { min-width: 22px; text-align: center; font-weight: 600; }
.link-x { color: var(--danger); background: none; border: none; cursor: pointer; font-size: .82rem; padding: 0; }
.totalrow { display: flex; justify-content: space-between; align-items: center; font-size: 1.15rem; font-weight: 800; margin-bottom: 12px; }

/* Table (admin) */
.tablewrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 11px 13px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #f0f4f1; font-size: .78rem; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
tr:last-child td { border-bottom: none; }
.badge { font-size: .74rem; font-weight: 700; padding: 3px 9px; border-radius: 20px; text-transform: uppercase; letter-spacing: .3px; }
.badge.pending { background: #fdf0e0; color: #a5701a; }
.badge.paid { background: #e7f1ff; color: #1c5aa8; }
.badge.processing { background: #ede7ff; color: #5a3ea8; }
.badge.shipped { background: #e0f2f5; color: #1a7a8a; }
.badge.completed { background: #e9f7ef; color: #157347; }
.badge.cancelled { background: #fdecea; color: var(--danger); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .n { font-size: 1.7rem; font-weight: 800; color: var(--g-700); }
.stat .l { color: var(--muted); font-size: .85rem; }

.tabs { display: flex; gap: 6px; margin-bottom: 20px; border-bottom: 2px solid var(--line); }
.tabs button { background: none; border: none; padding: 10px 16px; font-size: .95rem; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; font-family: inherit; }
.tabs button.active { color: var(--g-700); border-bottom-color: var(--g-600); }

.empty { text-align: center; color: var(--muted); padding: 50px 20px; }
.center-narrow { max-width: 460px; margin: 40px auto; }
.spacer { height: 10px; }
.muted { color: var(--muted); }
.right { text-align: right; }
footer.foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 30px 18px; }

@media (max-width: 560px) {
  .row2 { grid-template-columns: 1fr; }
  .nav a, .nav button { padding: 8px 9px; font-size: .88rem; }
  .brand { font-size: 1.05rem; }
}
