:root {
  --ink: #121212; --muted: #6b6b6b; --line: #e6e4df; --bg: #faf9f6; --card: #fff;
  --accent: #121212; --accent-ink: #fff; --ok: #1f7a4d; --warn: #9a6400; --err: #b42318;
  --radius: 12px; --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
h2 { font-size: 1.3rem; margin-top: 1.5em; }
h3 { font-size: 1rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
img { max-width: 100%; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 1200px; }
main.wrap { padding-top: 28px; padding-bottom: 120px; min-height: 70vh; }

.site-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; }
.brand span { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); border-left: 1px solid var(--line); padding-left: 10px; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: .95rem; }
.nav a { text-decoration: none; }
.nav a:hover { text-decoration: underline; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 0; font-size: 1.5rem; cursor: pointer; }
.site-footer { border-top: 1px solid var(--line); padding: 24px 0; color: var(--muted); font-size: .85rem; }
body.bare main.wrap { padding-top: 24px; }

.btn { display: inline-block; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); padding: 10px 18px;
  border-radius: 999px; font: 600 .95rem var(--font); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { opacity: .88; }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn-sm { padding: 6px 14px; font-size: .85rem; color: var(--accent-ink) !important; }
.btn-lg { padding: 14px 26px; font-size: 1rem; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-danger { background: var(--err); border-color: var(--err); }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.linklike:hover { text-decoration: underline; }
form.inline { display: inline; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.card.narrow { max-width: 440px; margin: 20px auto; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.row-between h1 { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 20px; }
.align-end { align-items: end; }
.grid2 > .card, .grid3 > .card { margin-bottom: 20px; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 20px; background: #e9f6ef; color: var(--ok); border: 1px solid #bfe3cf; }
.flash-error { background: #fdecea; color: var(--err); border-color: #f5c2bd; }
.flash-warn { background: #fff5e0; color: var(--warn); border-color: #f1d79e; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.narrow-form { max-width: 420px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.stack .field { margin-bottom: 0; }
.field span { font-size: .9rem; font-weight: 500; }
.field em { color: var(--err); font-style: normal; margin-left: 2px; }
input, select, textarea { font: inherit; padding: 10px 12px; border: 1px solid #cfccc5; border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
input[type=checkbox] { width: auto; }
.has-error input, .has-error select { border-color: var(--err); }
.error { color: var(--err); }
.check { display: flex; gap: 8px; align-items: center; font-size: .95rem; }
.search { max-width: 320px; }

.hero { padding: 40px 0 24px; max-width: 760px; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .8rem; color: var(--muted); margin: 0 0 12px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.1rem); }
.lead { font-size: 1.15rem; color: #3d3d3d; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.perks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 32px 0; }
.perks div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.perks h3 { color: var(--ink); text-transform: none; letter-spacing: 0; font-size: 1.05rem; }
.perks p { margin: 0; color: var(--muted); }
.section-title { margin-top: 40px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.product-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.product-card img { aspect-ratio: 1; object-fit: contain; width: 100%; background: #f3f2ee; border-radius: 8px; }
.product-card h3 { color: var(--ink); text-transform: none; letter-spacing: 0; font-size: .98rem; margin: 10px 0 4px; }
.product-card p { margin: 0; font-size: .9rem; }

.og-product { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.og-product header { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.og-product header img { width: 56px; height: 56px; object-fit: contain; background: #f3f2ee; border-radius: 8px; }
.og-product header h2 { margin: 0; font-size: 1.05rem; flex: 1; }
.og-table, .list { width: 100%; border-collapse: collapse; font-size: .95rem; }
.og-table th, .og-table td, .list th, .list td { padding: 8px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.og-table th, .list th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; background: #fcfbf8; }
.og-table tr:last-child td { border-bottom: 0; }
.og-table tr.has-qty { background: #f4f9f6; }
.og-table tr.inactive td { color: #aaa; }
.num { text-align: right !important; white-space: nowrap; }
.qty { width: 86px; text-align: right; padding: 7px 8px; }
.price { width: 96px; text-align: right; padding: 7px 8px; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; border-collapse: separate; border-spacing: 0; }
.card .list { border: 0; }
.list tfoot td { border-bottom: 0; }
.list tfoot .total td { font-weight: 700; font-size: 1.05rem; }

.order-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(0,0,0,.06); padding: 12px max(16px, calc((100vw - 1200px) / 2 + 16px));
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
.order-bar .po { display: flex; align-items: center; gap: 8px; font-size: .9rem; margin-left: auto; }
.order-bar .po input { width: 140px; padding: 7px 10px; }

.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: #eee; color: #444;
  vertical-align: middle; letter-spacing: .02em; }
.badge-paid, .badge-approved { background: #e3f4ea; color: var(--ok); }
.badge-shipped { background: #e4ecfb; color: #1d4ed8; }
.badge-processing { background: #efe7fb; color: #6d28d9; }
.badge-pending, .badge-pending_payment { background: #fff3d6; color: var(--warn); }
.badge-cancelled, .badge-rejected { background: #fdecea; color: var(--err); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 16px 0 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--muted); font-size: .9rem; }
.stat span { display: block; font-size: 1.7rem; font-weight: 700; color: var(--ink); }
a.stat:hover { border-color: var(--ink); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 8px 0 16px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--ink); border-color: var(--ink); font-weight: 600; }
.count { background: #eee; border-radius: 999px; padding: 1px 8px; font-size: .78rem; margin-left: 4px; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }

.invoice { max-width: 860px; margin: 0 auto; background: #fff; padding: 32px; border: 1px solid var(--line); border-radius: var(--radius); }
.invoice h1 { margin: 0; }
@media print {
  body { background: #fff; }
  .no-print, .site-header, .site-footer { display: none !important; }
  .invoice { border: 0; padding: 0; }
}

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--line);
    flex-direction: column; align-items: flex-start; padding: 12px 16px 16px; gap: 12px; }
  .nav-open .nav { display: flex; }
  .grid2, .grid3, .perks { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .hide-sm { display: none; }
  .og-table th, .og-table td, .list th, .list td { padding: 8px 10px; }
  .qty { width: 64px; }
  .card { padding: 18px; }
  .order-bar { gap: 8px; }
  .order-bar .po { display: none; }
  .search { max-width: none; width: 100%; }
}

.approve-form { display: inline-flex; gap: 8px; align-items: center; }
.approve-form select { width: auto; padding: 8px 10px; }
.table-scroll { overflow-x: auto; }
.level-add { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-top: 16px; }
.level-add .field { margin: 0; }
.list input:not([type=radio]) { padding: 6px 8px; }
