:root {
  --brand: #0d6e6e;
  --brand-dark: #094d4d;
  --gold: #c9a227;
  --bg: #f7f8f6;
  --card: #ffffff;
  --text: #1d2424;
  --muted: #667070;
  --line: #e2e6e4;
  --danger: #b3261e;
  --ok: #1b7f3b;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1716; --card: #17201f; --text: #e8efed; --muted: #9bb0ac; --line: #263332;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.45;
  padding-bottom: 70px;
}
a { color: var(--brand); text-decoration: none; }
img { max-width: 100%; }
.container { max-width: 1100px; margin: 0 auto; padding: 16px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10; background: var(--brand); color: #fff;
  display: flex; align-items: center; gap: 16px; padding: 12px 16px;
}
.topbar a { color: #fff; }
.brand { font-weight: 700; font-size: 1.25rem; letter-spacing: .3px; }
.brand span { color: var(--gold); }
.topnav { display: flex; gap: 16px; flex: 1; }
.topnav a { opacity: .92; font-size: .95rem; }
.topnav a:hover { opacity: 1; text-decoration: underline; }
.cartbtn { background: #fff1; padding: 6px 12px; border-radius: 999px; font-weight: 600; }
.cartbtn b { background: var(--gold); color: #1d1d1d; border-radius: 999px; padding: 0 7px; }
@media (max-width: 760px) {
  .topnav { display: none; }
  .topbar { justify-content: space-between; }
}
.bottomnav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; background: var(--card);
  border-top: 1px solid var(--line); z-index: 10;
}
.bottomnav a { flex: 1; text-align: center; padding: 12px 0; font-size: .8rem; color: var(--muted); }
@media (max-width: 760px) { .bottomnav { display: flex; } }

/* Generic */
h1 { font-size: 1.6rem; margin: 8px 0 12px; }
h2 { font-size: 1.2rem; margin: 18px 0 10px; }
.muted { color: var(--muted); font-size: .92rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.btn {
  display: inline-block; border: 0; border-radius: 10px; padding: 10px 16px; cursor: pointer;
  background: var(--brand); color: #fff; font-weight: 600; font-size: .95rem;
}
.btn:hover { background: var(--brand-dark); }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.btn.gold { background: var(--gold); color: #1d1d1d; }
.btn.danger { background: var(--danger); }
.btn.small { padding: 6px 10px; font-size: .85rem; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; background: var(--card); color: var(--text);
}
textarea { min-height: 80px; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.form-grid { display: grid; gap: 4px 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.badge { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: var(--line); color: var(--text); }
.badge.ok { background: #d8f3e1; color: var(--ok); }
.badge.warn { background: #fff0c8; color: #7a5a00; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }

/* Hero */
.hero {
  background: linear-gradient(120deg, var(--brand), #14a0a0); color: #fff; border-radius: 18px;
  padding: 36px 24px; margin-top: 8px;
}
.hero h1 { color: #fff; font-size: 2rem; margin-top: 0; }
.hero p { max-width: 560px; opacity: .95; }
.hero .btn { background: var(--gold); color: #1d1d1d; }
.services { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-top: 18px; }
.service { display: block; color: var(--text); }
.service b { display: block; font-size: 1.05rem; margin-bottom: 4px; color: var(--brand); }

/* Product */
.pcard { display: flex; flex-direction: column; gap: 8px; }
.pimg {
  aspect-ratio: 4 / 3; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 700; color: #fff; background: linear-gradient(135deg, #0d6e6e, #c9a227);
}
.pimg img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.price { font-weight: 700; font-size: 1.05rem; }
.price s { color: var(--muted); font-weight: 400; font-size: .85rem; margin-left: 4px; }
.filters { display: grid; gap: 10px; grid-template-columns: 2fr 1fr 1fr; margin-bottom: 14px; }
@media (max-width: 640px) { .filters { grid-template-columns: 1fr; } }
.detail { display: grid; gap: 22px; grid-template-columns: 1fr 1fr; }
@media (max-width: 760px) { .detail { grid-template-columns: 1fr; } }

/* Cart */
.line { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.summary { font-size: 1.05rem; }
.summary div { display: flex; justify-content: space-between; padding: 4px 0; }

/* Admin */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs .btn.ghost.active { background: var(--brand); color: #fff; }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 12px; }
.kpi b { display: block; font-size: 1.5rem; }
.tablewrap { overflow-x: auto; }

.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(20px);
  background: #1d2424; color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0;
  transition: .25s; pointer-events: none; z-index: 20; max-width: 90%;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 761px) { .toast { bottom: 24px; } }

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

/* Invoice: always black on white, on screen and on paper */
.invoice {
  background: #fff; color: #000; max-width: 760px; margin: 0 auto; padding: 18px;
  border: 1px solid #333; font-size: 13px; line-height: 1.4;
}
.invoice p { margin: 8px 0; }
.invoice .right { text-align: right; }
.invoice .center { text-align: center; }
.invoice .inv-head { text-align: center; border-bottom: 1px solid #333; padding-bottom: 8px; }
.invoice .inv-title { font-size: 11px; font-weight: 700; border: 1px solid #333; display: inline-block; padding: 1px 10px; border-radius: 999px; }
.invoice .inv-mobile { text-align: right; font-size: 12px; }
.invoice .inv-shop { font-size: 26px; font-weight: 800; letter-spacing: .3px; }
.invoice .inv-tag { font-size: 14px; font-weight: 700; }
.invoice .inv-sub, .invoice .inv-gstin { font-size: 12px; }
.invoice .inv-addr { background: #222; color: #fff; font-weight: 700; padding: 3px; margin: 4px 0; }
.invoice .inv-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; padding: 8px 0; border-bottom: 1px solid #333; }
.invoice .inv-meta div { overflow-wrap: anywhere; }
.invoice .inv-table { margin-top: 8px; border: 1px solid #333; font-size: 13px; }
.invoice .inv-table th, .invoice .inv-table td { border: 1px solid #333; border-bottom: 1px solid #333; color: #000; padding: 5px 6px; }
.invoice .inv-table th { background: #f0f0f0; }
.invoice .inv-foot { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid #333; padding-top: 8px; font-size: 12px; }

@media print {
  body * { visibility: hidden; }
  .invoice, .invoice * { visibility: visible; }
  .invoice { position: absolute; left: 0; top: 0; width: 100%; max-width: none; border: none; padding: 0; }
  .no-print { display: none !important; }
  body { background: #fff; padding: 0; }
}
@media (max-width: 560px) {
  .invoice .inv-meta { grid-template-columns: 1fr; }
  .invoice .inv-shop { font-size: 20px; }
  .invoice .inv-table { font-size: 12px; }
}
