:root {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --ink: #1c1b1a;
  --muted: #6b6862;
  --line: #e4e0d9;
  --accent: #3f4d3a;
  --accent-soft: #eef1ec;
  --warn: #8a5a00;
  --warn-soft: #fdf4e3;
  --danger: #8f2d2d;
  --danger-soft: #fbeeee;
  --good: #2f5d3a;
  --good-soft: #eaf2ec;
  --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px 64px; }

header.site {
  border-bottom: 1px solid var(--line); background: var(--surface);
  padding: 22px 20px; margin-bottom: 32px;
}
header.site .inner {
  max-width: 1080px; margin: 0 auto;
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
header.site h1 { font-size: 1.35rem; letter-spacing: -0.01em; }
header.site nav { display: flex; gap: 18px; }
header.site nav a { color: var(--muted); text-decoration: none; font-size: 0.92rem; }
header.site nav a:hover { color: var(--accent); text-decoration: underline; }

h2 { font-size: 1.15rem; margin-bottom: 14px; letter-spacing: -0.01em; }
.muted { color: var(--muted); font-size: 0.9rem; }
.center { text-align: center; }
.stack > * + * { margin-top: 14px; }

.toolbar { display: flex; gap: 10px; margin-bottom: 26px; flex-wrap: wrap; }
input, select, textarea {
  font: inherit; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--surface); color: var(--ink); width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.toolbar input { flex: 1; min-width: 200px; }
.toolbar select { width: auto; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column;
}
.card img, .card .placeholder {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  background: var(--accent-soft); display: grid; place-items: center;
  color: var(--muted); font-size: 1.6rem;
}
.card .body { padding: 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .name { font-weight: 600; }
.card .desc { color: var(--muted); font-size: 0.87rem; flex: 1; }
.card .price { font-size: 1.1rem; font-weight: 600; }

.btn {
  font: inherit; font-weight: 500; padding: 9px 16px; border: 1px solid transparent;
  border-radius: 8px; cursor: pointer; background: var(--accent); color: #fff;
}
.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--line); }
.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: #efd8d8; }
.btn.small { padding: 5px 11px; font-size: 0.85rem; }
.btn.block { width: 100%; }

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em;
}
.pill.low { background: var(--warn-soft); color: var(--warn); }
.pill.out { background: var(--danger-soft); color: var(--danger); }
.state-pending   { background: var(--warn-soft);   color: var(--warn); }
.state-confirmed { background: var(--good-soft);   color: var(--good); }
.state-shipped   { background: #e8eef6; color: #2a4a73; }
.state-delivered { background: var(--good-soft);   color: var(--good); }
.state-cancelled { background: var(--danger-soft); color: var(--danger); }
.state-refunded  { background: #eeecea; color: var(--muted); }

dialog {
  border: 1px solid var(--line); border-radius: 14px; padding: 0;
  max-width: 480px; width: calc(100% - 32px); background: var(--surface); color: var(--ink);
}
dialog::backdrop { background: rgba(28, 27, 26, 0.45); }
dialog .head { padding: 20px 22px 0; }
dialog form { padding: 16px 22px 22px; display: grid; gap: 12px; }
dialog label { font-size: 0.85rem; font-weight: 500; display: block; margin-bottom: 4px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.summary { background: var(--accent-soft); border-radius: 8px; padding: 12px; font-size: 0.9rem; }

.order {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
}
.order .top {
  display: flex; justify-content: space-between; align-items: start;
  gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 10px;
}
.order .line { display: flex; justify-content: space-between; font-size: 0.9rem; padding: 3px 0; }
.order .total { text-align: right; font-weight: 600; margin-top: 8px; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; background: var(--surface); }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
th { font-weight: 600; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 28px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat .n { font-size: 1.5rem; font-weight: 600; }
.stat .l { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

.banner { padding: 12px 14px; border-radius: 8px; font-size: 0.9rem; margin-bottom: 16px; }
.banner.err  { background: var(--danger-soft); color: var(--danger); }
.banner.good { background: var(--good-soft);   color: var(--good); }

#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 99; }
.toast {
  padding: 12px 16px; border-radius: 8px; color: #fff; background: var(--accent);
  max-width: 340px; font-size: 0.9rem; box-shadow: 0 6px 24px rgba(0,0,0,.14);
}
.toast.err { background: var(--danger); }

.tabs { display: flex; gap: 6px; margin-bottom: 20px; }
.tabs button { background: none; border: 1px solid transparent; color: var(--muted); padding: 7px 14px; border-radius: 8px; cursor: pointer; font: inherit; }
.tabs button[aria-selected="true"] { background: var(--surface); border-color: var(--line); color: var(--ink); font-weight: 600; }

@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }
