:root {
  --ink: #101a30;
  --ink-soft: #16223c;
  --paper: #f5efe4;
  --paper-2: #fbf7ef;
  --accent: #b56a4a;
  --line: rgba(16, 26, 48, 0.12);
  --muted: rgba(16, 26, 48, 0.55);
  --ok: #2f6b4f;
  --warn: #8a5a2b;
  --font: "Zen Kaku Gothic New", system-ui, sans-serif;
  --serif: "Cormorant Garamond", serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.topbar {
  background: var(--ink);
  color: var(--paper);
  border-bottom: 1px solid rgba(245, 239, 228, 0.12);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  flex-wrap: wrap;
  padding-top: 10px;
  padding-bottom: 10px;
}
.brand {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.02em;
}
.brand span { color: rgba(245, 239, 228, 0.55); font-size: 14px; margin-left: 8px; }
.nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.nav a { text-decoration: none; color: rgba(245, 239, 228, 0.78); }
.nav a:hover { color: #fff; }
.who { color: rgba(245, 239, 228, 0.45); font-size: 12px; }
.btn-ghost {
  border: 1px solid rgba(245, 239, 228, 0.28);
  padding: 6px 12px;
  border-radius: 2px;
  text-decoration: none !important;
}
.main { padding: 36px 20px 72px; }
h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(28px, 4vw, 36px);
  margin: 0 0 8px;
  color: var(--ink-soft);
}
.lede { color: var(--muted); margin: 0 0 28px; max-width: 48em; }
.card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 24px;
}
.flash {
  padding: 12px 14px;
  border-radius: 2px;
  margin-bottom: 20px;
  font-size: 14px;
}
.flash-ok { background: rgba(47, 107, 79, 0.12); color: var(--ok); }
.flash-err { background: rgba(160, 50, 40, 0.1); color: #8b2e26; }
label { display: block; font-size: 12px; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 6px; }
input[type="text"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
  font: inherit;
  color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
.field { margin-bottom: 16px; }
.row { display: grid; grid-template-columns: 1fr 120px; gap: 12px; }
@media (max-width: 640px) { .row { grid-template-columns: 1fr; } }
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 22px;
  border-radius: 2px;
  font: inherit;
  font-size: 14px;
  letter-spacing: 0.06em;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.05); }
.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.item-block {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 8px;
}
.item-block:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 500;
}
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 2px;
  font-size: 12px;
  background: rgba(181, 106, 74, 0.14);
  color: var(--accent);
}
.badge-shipped { background: rgba(47, 107, 79, 0.14); color: var(--ok); }
.badge-paid { background: rgba(138, 90, 43, 0.14); color: var(--warn); }
.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
}
.step {
  font-size: 11px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
}
.step.on {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(181, 106, 74, 0.08);
}
.muted { color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(181, 106, 74, 0.18), transparent 50%),
    var(--ink);
}
.login-card {
  width: min(420px, 100%);
  background: var(--paper);
  border-radius: 3px;
  padding: 36px 30px;
}
.login-card h1 { font-size: 28px; }
.foot {
  padding: 24px 20px 40px;
  color: var(--muted);
  font-size: 12px;
}
.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  align-items: center;
}
.admin-form .grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 720px) { .admin-form .grid2 { grid-template-columns: 1fr; } }
.add-line {
  background: none;
  border: 1px dashed var(--line);
  width: 100%;
  padding: 10px;
  cursor: pointer;
  color: var(--muted);
  font: inherit;
  margin-top: 8px;
}
.add-line:hover { border-color: var(--accent); color: var(--accent); }
.remove-line {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  padding: 0;
  margin-top: 6px;
}
.remove-line[hidden] { display: none; }

/* Language switcher */
.langs { display: inline-flex; gap: 2px; align-items: center; }
.langs a {
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  border-radius: 2px;
  text-decoration: none;
  color: rgba(245, 239, 228, 0.55);
}
.langs a.on { background: rgba(245, 239, 228, 0.14); color: #fff; }
.login-langs { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.login-langs .langs a { color: var(--muted); }
.login-langs .langs a.on { background: rgba(16, 26, 48, 0.1); color: var(--ink); }

/* Admin secondary navigation */
.subnav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin: 0 0 26px;
  border-bottom: 1px solid var(--line);
}
.subnav a {
  font-size: 13px;
  padding: 8px 14px;
  text-decoration: none;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.subnav a:hover { color: var(--ink); }
.subnav a.on { color: var(--accent); border-bottom-color: var(--accent); }

.card-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 18px;
  color: var(--ink-soft);
}

/* Order line: category + search above the product select */
.pick {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 12px;
  margin-bottom: 4px;
}
@media (max-width: 640px) { .pick { grid-template-columns: 1fr; } }
.order-line, .custom-line { padding-bottom: 4px; }

/* Product / spec / quantity line: the spec cell disappears when unused */
.line-row { display: flex; gap: 12px; flex-wrap: wrap; }
.line-row .field { margin-bottom: 12px; }
.f-prod { flex: 1 1 260px; min-width: 0; }
.f-spec { flex: 0 1 190px; }
.f-spec[hidden] { display: none; }
.f-qty { flex: 0 0 110px; }
@media (max-width: 560px) {
  .f-spec, .f-qty { flex: 1 1 100%; }
}

.item-list { margin: 0; padding-left: 18px; }
.item-list li { margin: 2px 0; }
.spec-tag {
  display: inline-block;
  font-size: 12px;
  padding: 1px 7px;
  border-radius: 2px;
  background: rgba(181, 106, 74, 0.12);
  color: var(--accent);
}

.subsection {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 18px 20px 20px;
  margin: 8px 0 4px;
  min-width: 0;
}
.subsection legend {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--accent);
  padding: 0 8px;
}

.chip {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
  margin-right: 4px;
}
.chip-custom { border-color: rgba(181, 106, 74, 0.5); color: var(--accent); }
.chip-admin { border-color: rgba(47, 107, 79, 0.5); color: var(--ok); }
.chip-off { border-color: rgba(139, 46, 38, 0.35); color: #8b2e26; }
.row-off { opacity: 0.55; }

.quote {
  margin-top: 8px;
  padding: 8px 12px;
  border-left: 2px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }
.inline-form input[type="text"] { min-width: 150px; padding: 7px 9px; font-size: 13px; }
.link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}
.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  letter-spacing: 0;
  color: var(--ink);
  margin-bottom: 0;
}
.check input { width: auto; margin-top: 4px; }

.csv-modes { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.csv-modes label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  letter-spacing: 0;
  font-size: 14px;
  color: var(--ink);
}
.csv-modes input { width: auto; margin-top: 4px; }
.csv-warn[hidden] { display: none; }
.csv-warn {
  margin: 4px 0 8px;
  padding: 14px 16px;
  border: 1px solid rgba(139, 46, 38, 0.4);
  background: rgba(160, 50, 40, 0.08);
  border-radius: 2px;
}
.csv-warn p { margin: 0 0 12px; color: #8b2e26; font-size: 14px; }
.csv-warn input { max-width: 220px; background: #fff; }
.csv-errors { margin: 0; padding-left: 1.2em; }
.csv-errors li { margin: 2px 0; }
input[type="file"] { font: inherit; font-size: 14px; }

.pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 14px;
}
.pick-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 0 0 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: inherit;
  text-decoration: none;
  text-align: left;
  font: inherit;
  cursor: pointer;
  overflow: hidden;
}
a.pick-card { padding: 22px 16px; }
.pick-card:hover { border-color: rgba(181, 106, 74, 0.55); }
.pick-card[hidden] { display: none; }
.pick-photo, .dlg-photo, .cart-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #efe8dc;
  overflow: hidden;
}
.pick-photo { aspect-ratio: 1; margin-bottom: 8px; }
.pick-photo img, .dlg-photo img, .cart-photo img { width: 100%; height: 100%; object-fit: contain; }
.pick-letter {
  font-family: var(--serif);
  font-size: 42px;
  color: rgba(16, 26, 48, 0.28);
}
.pick-name { font-size: 15px; line-height: 1.45; color: var(--ink-soft); padding: 0 12px; }
a.pick-card .pick-name { padding: 0; font-size: 18px; }
.pick-meta, .pick-count { font-size: 12px; color: var(--muted); padding: 0 12px; }
a.pick-card .pick-count { padding: 0; }
.back-link { color: var(--accent); text-decoration: none; font-size: 13px; }
.back-link:hover { text-decoration: underline; }

.product-dialog {
  border: none;
  border-radius: 3px;
  padding: 0;
  width: min(440px, calc(100% - 32px));
  background: var(--paper-2);
  color: var(--ink);
}
.product-dialog::backdrop { background: rgba(16, 26, 48, 0.45); }
.product-dialog form { padding: 20px; }
.dlg-photo { aspect-ratio: 1; margin: -20px -20px 16px; }
.product-dialog .card-title { margin-bottom: 4px; }

.cart-list { display: flex; flex-direction: column; gap: 16px; }
.cart-line {
  display: grid;
  grid-template-columns: 88px 1fr 120px;
  gap: 14px;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.cart-photo { width: 88px; height: 88px; border-radius: 2px; }
.cart-qty label { margin-bottom: 4px; }
.cart-qty input { margin-bottom: 6px; }
.admin-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 2px;
  background: #efe8dc;
  vertical-align: middle;
  margin-right: 8px;
}
@media (max-width: 640px) {
  .cart-line { grid-template-columns: 72px 1fr; }
  .cart-qty { grid-column: 1 / -1; }
}

.filter-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-form select, .filter-form input[type="search"] { width: auto; min-width: 170px; }
input[type="search"] {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
  font: inherit;
  color: var(--ink);
}
