/* RESERVE — soft neutral theme (direction 1b) */
/* Fonts are loaded via <link> in the HTML head (faster than @import). */

:root {
  --bg:          #F1EFE9;
  --surface:     #FFFFFF;
  --surface-2:   #FAF9F5;
  --ink:         #23251F;
  --dim:         #686B60;
  --faint:       #9B9E92;
  --line:        rgba(35,37,31,.08);
  --line-2:      rgba(35,37,31,.15);
  --accent:      #3E6B54;
  --accent-deep: #2E5240;
  --accent-tint: rgba(62,107,84,.10);
  --warn:        #A8742C;
  --warn-tint:   rgba(168,116,44,.11);
  --bad:         #A5493C;
  --bad-tint:    rgba(165,73,60,.10);
  --info:        #5E7188;
  --info-tint:   rgba(94,113,136,.11);
  --shadow:      0 1px 2px rgba(20,22,18,.05);
  --font:        'Hanken Grotesk', system-ui, -apple-system, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  min-height: 100vh;
}
img { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-deep); text-decoration: underline; }
button { font-family: inherit; }
::selection { background: rgba(62,107,84,.18); }
:focus-visible { outline: 2px solid rgba(62,107,84,.4); outline-offset: 2px; }

/* ---------- header ---------- */
header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.wordmark { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); white-space: nowrap; }
.wordmark .dot { color: var(--accent); }
.wordmark .sub {
  font-size: 11px; font-weight: 600; color: var(--faint);
  letter-spacing: .05em; text-transform: uppercase; margin-left: 8px;
}
.header-right { display: flex; align-items: center; gap: 10px; }
.user-email { font-size: 12.5px; color: var(--dim); }
button.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent-tint); color: var(--accent);
  font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; cursor: pointer;
}
button.avatar:hover { background: rgba(62,107,84,.18); }

/* ---------- tabs ---------- */
nav.tabs { display: flex; gap: 4px; padding: 14px 18px 0; max-width: 1320px; margin: 0 auto; width: 100%; }
nav.tabs button {
  display: inline-flex; align-items: center; gap: 7px;
  border: none; background: none;
  color: var(--dim); font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
nav.tabs button:hover { color: var(--ink); }
nav.tabs button.active { background: var(--ink); color: #fff; }
.tab-count {
  font-size: 11px; font-weight: 700;
  background: rgba(35,37,31,.07); color: var(--dim);
  border-radius: 999px; padding: 1px 7px; min-width: 20px; text-align: center;
}
nav.tabs button.active .tab-count { background: rgba(255,255,255,.18); color: #fff; }

main { padding: 16px 18px 40px; max-width: 1320px; margin: 0 auto; width: 100%; }
body.customer main, body.customer nav.tabs { max-width: 680px; }

/* customer: bottom tab bar on phones */
@media (max-width: 719px) {
  body.customer nav.tabs {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    margin: 0; max-width: none;
  }
  body.customer nav.tabs button { flex: 1; justify-content: center; padding: 11px 8px; }
  body.customer nav.tabs button.active { background: var(--accent-tint); color: var(--accent); }
  body.customer nav.tabs button.active .tab-count { background: rgba(62,107,84,.18); color: var(--accent); }
  body.customer main { padding-bottom: 104px; }
  body.customer .toast { bottom: calc(88px + env(safe-area-inset-bottom)); }
}

/* ---------- hero (customer) ---------- */
.hero-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.hero-value { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.chip-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.chip { font-size: 12px; font-weight: 600; color: var(--dim); background: rgba(35,37,31,.06); border-radius: 999px; padding: 4px 12px; white-space: nowrap; }
.chip.accent { color: var(--accent); background: var(--accent-tint); }
.chip.warn { color: var(--warn); background: var(--warn-tint); }
.linkish { cursor: pointer; }
.linkish:hover { color: var(--accent); text-decoration: underline; }

/* ---------- panels & cards ---------- */
.panel { background: var(--surface); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.panel h2 { font-size: 15px; font-weight: 700; }
.panel .hint { font-size: 12.5px; color: var(--faint); margin: 2px 0 14px; }
.list-title { font-size: 13px; font-weight: 700; margin: 18px 2px 10px; }
.card-list { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--surface); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.card .title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card .title { font-size: 15px; font-weight: 700; }
.card .meta { font-size: 12.5px; color: var(--dim); margin-top: 2px; }
.progress { margin-top: 14px; height: 5px; background: rgba(35,37,31,.07); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.amounts { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: 12.5px; color: var(--dim); flex-wrap: wrap; }
.amounts .owe { font-weight: 700; color: var(--warn); }
.amounts .ok { font-weight: 700; color: var(--accent); }
.reply { margin-top: 10px; background: var(--accent-tint); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; color: var(--accent-deep); }
.reply b { display: block; font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 2px; color: var(--accent); }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.thumb {
  width: 56px; height: 56px; border-radius: 10px; object-fit: cover;
  background: rgba(35,37,31,.06); border: 1px solid var(--line); cursor: zoom-in;
}

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 700; letter-spacing: .01em;
  border-radius: 999px; padding: 4px 10px; white-space: nowrap;
  background: rgba(35,37,31,.06); color: var(--dim);
  text-transform: capitalize;
}
.badge.pending, .badge.reserved, .badge.waiting { color: var(--warn); background: var(--warn-tint); }
.badge.sourcing, .badge.ordered, .badge.in_production { color: var(--info); background: var(--info-tint); }
.badge.quoted, .badge.shipped, .badge.arrived, .badge.converted { color: var(--accent); background: var(--accent-tint); }
.badge.collected, .badge.vip { color: var(--accent); background: var(--accent-tint); }
.badge.declined, .badge.cancelled { color: var(--bad); background: var(--bad-tint); }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
label {
  display: block; font-size: 11px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--faint); margin-bottom: 6px;
}
label .req { color: var(--warn); }
label .opt { text-transform: none; letter-spacing: 0; font-weight: 400; }
input, textarea, select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  color: var(--ink);
  font-family: inherit; font-size: 14px;
  padding: 10px 12px;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(62,107,84,.15);
}
input:disabled { color: var(--faint); background: rgba(35,37,31,.04); }
textarea { resize: vertical; min-height: 64px; }
select.inline-select { width: auto; font-size: 12px; font-weight: 600; padding: 6px 26px 6px 10px; border-radius: 8px; background: var(--surface); }

/* photo attach */
.photo-attach { display: flex; align-items: center; gap: 10px; }

/* ---------- buttons ---------- */
button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; font-weight: 600;
  padding: 10px 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink);
  white-space: nowrap;
  transition: background .12s, border-color .12s, filter .12s;
}
button.btn:hover { background: var(--surface-2); border-color: rgba(35,37,31,.28); }
button.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.btn.primary:hover { filter: brightness(1.07); }
button.btn.danger { color: var(--bad); border-color: rgba(165,73,60,.3); }
button.btn.danger:hover { background: var(--bad-tint); border-color: rgba(165,73,60,.45); }
button.btn.small { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
button.btn.block { width: 100%; }
button.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- stats (admin) ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); }
.stat .label { font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); }
.stat .value { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .value.money { color: var(--ink); }
.stat .value.good { color: var(--accent); }
.stat .value.warn { color: var(--warn); }

/* ---------- tables (admin) ---------- */
.table-card { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; margin-bottom: 16px; }
.table-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px 10px; flex-wrap: wrap; }
.table-head h2 { font-size: 14px; font-weight: 700; }
.table-wrap { overflow-x: auto; }
.table-wrap table { min-width: 720px; }
table { width: 100%; border-collapse: collapse; }
th {
  font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase;
  color: var(--faint); font-weight: 600; text-align: left;
  padding: 8px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 12px 14px; border-bottom: 1px solid rgba(35,37,31,.06); font-size: 13px; vertical-align: top; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #FAFAF7; }
td:first-child, th:first-child { padding-left: 18px; }
td:last-child, th:last-child { padding-right: 18px; }
td .strong { font-weight: 600; }
td .sub { display: block; font-size: 11.5px; color: var(--faint); margin-top: 2px; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th.num { text-align: right; }
.owing { color: var(--warn); font-weight: 700; }
.paid-full { color: var(--accent); font-weight: 600; }
.row-thumb {
  width: 40px; height: 40px; border-radius: 8px; object-fit: cover;
  border: 1px solid var(--line); cursor: zoom-in; background: rgba(35,37,31,.06);
}
.prod-cell { display: flex; gap: 10px; align-items: flex-start; }

/* ---------- gates ---------- */
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.gate-box {
  width: 100%; max-width: 400px;
  background: var(--surface); border-radius: 20px; padding: 30px 28px;
  box-shadow: 0 2px 12px rgba(20,22,18,.06);
}
.gate-box .wordmark { display: block; text-align: center; font-size: 22px; }
.gate-box .tagline { text-align: center; font-size: 12.5px; color: var(--faint); margin: 4px 0 22px; }
.gate-box .msg { margin-top: 12px; font-size: 13px; }
.msg.ok { color: var(--accent); }
.msg.err { color: var(--bad); }
.gate-note { font-size: 13px; color: var(--dim); line-height: 1.6; }
.gate-box.center { text-align: center; }
.spinner {
  width: 26px; height: 26px;
  border: 3px solid var(--accent-tint); border-top-color: var(--accent);
  border-radius: 50%; margin: 0 auto;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { margin-top: 12px; font-size: 12.5px; color: var(--faint); }

/* ---------- modals ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(28,29,25,.45);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
}
.modal {
  width: 100%; max-width: 540px;
  background: var(--surface); border-radius: 18px; padding: 22px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 8px 30px rgba(20,22,18,.18);
}
.modal h3 { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.modal .modal-sub { font-size: 12.5px; color: var(--faint); margin-bottom: 16px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
#modal-photo { cursor: zoom-out; }
#modal-photo img {
  max-width: min(92vw, 900px); max-height: 86vh;
  border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.3);
}

/* ---------- misc ---------- */
.empty { padding: 28px; text-align: center; color: var(--faint); font-size: 13px; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200;
  background: var(--ink); color: #fff;
  border-radius: 12px; padding: 11px 18px;
  font-size: 13px; font-weight: 600;
  max-width: min(90vw, 420px);
  box-shadow: 0 6px 20px rgba(20,22,18,.25);
}
.toast.err { background: #7E3A30; }
.hidden { display: none !important; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 10px; gap: 10px; flex-wrap: wrap; }
.section-head h2 { font-size: 14px; font-weight: 700; }
.filter-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

@media (max-width: 640px) {
  main { padding: 12px 12px 40px; }
  .panel { padding: 16px; }
  .hero-value { font-size: 30px; }
}
