@font-face {
  font-family: 'Cooper Hewitt';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(https://cdn.jsdelivr.net/fontsource/fonts/cooper-hewitt@latest/latin-400-normal.woff2) format('woff2'),
       url(https://cdn.jsdelivr.net/fontsource/fonts/cooper-hewitt@latest/latin-400-normal.woff) format('woff');
}
@font-face {
  font-family: 'Cooper Hewitt';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url(https://cdn.jsdelivr.net/fontsource/fonts/cooper-hewitt@latest/latin-500-normal.woff2) format('woff2'),
       url(https://cdn.jsdelivr.net/fontsource/fonts/cooper-hewitt@latest/latin-500-normal.woff) format('woff');
}
@font-face {
  font-family: 'Cooper Hewitt';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(https://cdn.jsdelivr.net/fontsource/fonts/cooper-hewitt@latest/latin-600-normal.woff2) format('woff2'),
       url(https://cdn.jsdelivr.net/fontsource/fonts/cooper-hewitt@latest/latin-600-normal.woff) format('woff');
}
@font-face {
  font-family: 'Cooper Hewitt';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url(https://cdn.jsdelivr.net/fontsource/fonts/cooper-hewitt@latest/latin-700-normal.woff2) format('woff2'),
       url(https://cdn.jsdelivr.net/fontsource/fonts/cooper-hewitt@latest/latin-700-normal.woff) format('woff');
}

:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --ink: #1A1A1A;
  --ink-soft: #55505A;
  --muted: #9C97A0;
  --line: #ECE3EA;
  --brand-rose: #CCAFC6;   /* logo script color */
  --rose-deep: #9C6B8F;    /* buttons / active states, darkened for contrast */
  --rose-darker: #7A4F71;  /* links, active tab */
  --lilac: #E0CFDD;        /* business card panel */
  --warn: #C15B4A;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Cooper Hewitt', -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: 'Cooper Hewitt', -apple-system, sans-serif; font-weight: 600; margin: 0; letter-spacing: normal; }
h1 { font-size: 24px; line-height: 1.25; }
h2 { font-size: 18px; line-height: 1.3; }
h3 { font-size: 15px; line-height: 1.3; }

button { font-family: inherit; cursor: pointer; }

.brand-home {
  border: none;
  background: transparent;
  padding: 4px;
  border-radius: 50%;
  margin-bottom: 18px;
}

.brand-home:active { opacity: 0.8; }

.brand-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.brand-badge {
  width: 68%;
  height: 68%;
  object-fit: contain;
  display: block;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 92px;
  background: var(--bg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: calc(18px + env(safe-area-inset-top));
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 10;
}

.tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  overflow-y: auto;
}

.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  padding: 13px 6px;
  width: 100%;
  border-left: 3px solid transparent;
  text-align: center;
}

.tab-label { font-size: 12.5px; font-weight: 500; letter-spacing: 0.1px; line-height: 1.3; }

.tab.active {
  color: var(--rose-darker);
  border-left-color: var(--rose-deep);
  background: var(--lilac);
  font-weight: 600;
}

@media (max-width: 360px) {
  .sidebar { width: 76px; }
  main#view { margin-left: 76px; }
  .tab-label { font-size: 11px; }
  .brand-circle { width: 46px; height: 46px; }
}

main#view {
  margin-left: 92px;
  padding: 18px 16px 100px;
  max-width: 720px;
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}

.btn {
  border: 1px solid var(--sage);
  background: var(--sage);
  color: #fff;
  border-radius: var(--radius);
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 500;
}

.btn.secondary {
  background: transparent;
  color: var(--sage-dark);
}

.btn.small { padding: 6px 11px; font-size: 13px; }

.btn.danger {
  background: transparent;
  border-color: var(--warn);
  color: var(--warn);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.card-title { font-weight: 600; font-size: 15px; }
.card-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card-meta { color: var(--ink-soft); font-size: 13px; text-align: right; white-space: nowrap; }

.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.pill.pending { background: var(--rose-soft); color: var(--rose); }
.pill.paid { background: #E6ECE0; color: var(--sage-dark); }
.pill.fulfilled { background: #DDEAE6; color: #2E6B5C; }
.pill.cancelled { background: #EFEFEF; color: var(--muted); }
.pill.low-stock { background: #FBE7E2; color: var(--warn); }

.filter-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 16px;
  padding-bottom: 2px;
}

.filter-tab {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  padding: 7px 13px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}

.filter-tab.active {
  background: var(--rose-deep);
  border-color: var(--rose-deep);
  color: #fff;
}

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

.empty h3 { color: var(--ink-soft); margin-bottom: 6px; }

/* Modal / form sheet */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(38, 42, 34, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}

.sheet {
  background: var(--surface);
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 16px 16px 0 0;
  padding: 20px 20px 28px;
}

@media (min-width: 640px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 16px; }
}

.sheet h2 { margin-bottom: 16px; font-size: 19px; }

.field { margin-bottom: 13px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
}

.field textarea { resize: vertical; min-height: 60px; }

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.sheet-actions .btn { flex: 1; text-align: center; }

.line-item-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.line-item-row select { flex: 2; }
.line-item-row input { flex: 1; }

.total-line {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 4px 0;
  color: var(--ink-soft);
}

.total-line.grand {
  font-weight: 600;
  color: var(--ink);
  font-size: 16px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  margin-top: 4px;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: calc(50% + 46px);
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 30px;
  font-size: 13px;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.toast.show { opacity: 1; }

/* Scan & Sell */
.scanner-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #1c1e18;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
}

.scanner-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-frame .reticle {
  position: absolute;
  inset: 22% 14%;
  border: 2px solid rgba(255,255,255,0.75);
  border-radius: 12px;
  pointer-events: none;
}

.scanner-status {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  text-align: center;
  color: #fff;
  font-size: 12px;
  background: rgba(0,0,0,0.4);
  border-radius: 20px;
  padding: 6px 10px;
}

.manual-sku {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.manual-sku input { flex: 1; }

.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.cart-item:last-child { border-bottom: none; }
.cart-item .name { flex: 1; font-size: 14px; font-weight: 500; }
.cart-item .qty-controls { display: flex; align-items: center; gap: 8px; }
.cart-item .qty-controls button {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff; font-size: 15px; line-height: 1;
}
.cart-item .price { font-size: 13px; color: var(--muted); min-width: 60px; text-align: right; }

.cart-summary {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  margin: 0 -16px;
}

/* Donut chart */
.chart-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 4px;
}

.chart-legend { font-size: 13px; flex: 1; }
.legend-item { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.stat-box .value { font-family: 'Cooper Hewitt', -apple-system, sans-serif; font-weight: 600; font-size: 22px; }
.stat-box .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.3px; margin-top: 2px; }

.sample-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.sample-row:last-child { border-bottom: none; }

.checkbox-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-soft);
}

.section-title {
  font-family: 'Cooper Hewitt', -apple-system, sans-serif; font-weight: 600;
  font-size: 15px;
  margin: 22px 0 10px;
}

.btn.small.secondary.pill-selected {
  background: var(--sage);
  color: #fff;
  border-color: var(--sage);
}

.back-link {
  color: var(--sage-dark);
  font-size: 13px;
  font-weight: 500;
  display: inline-block;
  margin-bottom: 12px;
}
