:root {
  --bg: #f4efe7;
  --card: #fffdf9;
  --ink: #2b2118;
  --muted: #8a7d6c;
  --line: #e6ddcf;
  --accent: #6b4f2a;
  --accent-soft: #b08a4f;
  --ok: #2e7d32;
  --err: #c0392b;
  --radius: 14px;
  --shadow: 0 2px 14px rgba(80, 60, 30, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-weight: 400;
  line-height: 1.45;
}

.bg-grain {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(circle at 20% 10%, rgba(176,138,79,0.08), transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(107,79,42,0.06), transparent 45%);
}

/* ── header ── */
.header { background: var(--accent); color: #fff; }
.header-inner { max-width: 760px; margin: 0 auto; padding: 18px 20px; }
.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon { font-size: 30px; }
.logo-title { font-family: 'Playfair Display', serif; font-size: 22px; font-weight: 700; }
.logo-sub { font-size: 13px; opacity: 0.85; }

/* ── layout ── */
.main { max-width: 760px; margin: 0 auto; padding: 22px 20px 60px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}
.card-label {
  font-family: 'Playfair Display', serif;
  font-size: 17px; font-weight: 600;
  margin-bottom: 14px; color: var(--accent);
}

.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }
.field { margin-bottom: 14px; position: relative; }
.field:last-child { margin-bottom: 0; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.req { color: var(--err); }

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-family: inherit; font-size: 15px;
  background: #fff; color: var(--ink);
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent-soft);
}
textarea { resize: vertical; }

.error-msg { display: none; color: var(--err); font-size: 12px; margin-top: 4px; }
.field.has-error .error-msg { display: block; }
.invalid { border-color: var(--err) !important; }

/* ── products ── */
.no-products { color: var(--muted); font-size: 14px; padding: 8px 0; }
.product-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.prod-search-wrap { flex: 1; position: relative; }
.prod-qty { width: 80px; text-align: center; }
.btn-remove {
  width: 40px; flex: none; border: 1px solid var(--line); background: #fff;
  border-radius: 9px; cursor: pointer; color: var(--muted); font-size: 15px; padding: 10px 0;
}
.btn-remove:hover { color: var(--err); border-color: var(--err); }

.prod-dropdown {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0;
  max-height: 240px; overflow-y: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 9px;
  box-shadow: 0 8px 24px rgba(80,60,30,0.14);
}
.prod-option {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 9px 12px; cursor: pointer; font-size: 14px;
}
.prod-option:hover { background: #f6f0e6; }
.prod-option-price { color: var(--muted); white-space: nowrap; }
.prod-no-result { padding: 9px 12px; color: var(--muted); font-size: 14px; }

.btn-add {
  border: 1px dashed var(--accent-soft); background: transparent; color: var(--accent);
  padding: 9px 14px; border-radius: 9px; cursor: pointer; font-family: inherit; font-size: 14px;
}
.btn-add:hover { background: #f6f0e6; }
.btn-add-icon { font-weight: 700; }

/* ── summary ── */
.summary-card { background: #fbf6ee; }
.summary-line { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; border-bottom: 1px dashed var(--line); }
.summary-total { margin-top: 12px; text-align: right; font-size: 17px; }

/* ── submit ── */
.form-error {
  background: #fdecea; color: var(--err); border: 1px solid #f5c6c0;
  padding: 10px 14px; border-radius: 9px; font-size: 14px; margin-bottom: 14px;
}
.submit-row { text-align: center; }
.btn-submit {
  background: var(--accent); color: #fff; border: none;
  padding: 13px 38px; border-radius: 10px; font-size: 16px; font-family: inherit;
  cursor: pointer; min-width: 200px;
}
.btn-submit:hover { background: #5a4222; }
.btn-submit:disabled { opacity: .7; cursor: default; }
.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%; display: inline-block;
  animation: spin .7s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── success ── */
.success-screen { text-align: center; padding: 60px 20px; }
.success-icon {
  width: 64px; height: 64px; line-height: 64px; margin: 0 auto 18px;
  background: var(--ok); color: #fff; border-radius: 50%; font-size: 32px;
}
.success-title { font-family: 'Playfair Display', serif; font-size: 24px; margin-bottom: 8px; }
.success-sub { color: var(--muted); margin-bottom: 22px; }
.btn-new {
  background: transparent; border: 1px solid var(--accent); color: var(--accent);
  padding: 10px 22px; border-radius: 9px; cursor: pointer; font-family: inherit; font-size: 15px;
}
.btn-new:hover { background: #f6f0e6; }

@media (max-width: 560px) {
  .field-row { flex-direction: column; gap: 0; }
}

/* ═══════════════ STAFF PAGES ═══════════════ */
.staff-nav {
  background: var(--accent); color: #fff;
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 0 16px;
}
.staff-nav .brand { font-family: 'Playfair Display', serif; font-weight: 700; padding: 14px 16px 14px 0; }
.staff-nav a {
  color: #fff; text-decoration: none; padding: 14px 14px; font-size: 14px; opacity: .82;
}
.staff-nav a:hover { opacity: 1; }
.staff-nav a.active { opacity: 1; box-shadow: inset 0 -3px 0 var(--accent-soft); }
.staff-nav .spacer { flex: 1; }
.staff-nav .logout { font-size: 13px; }

.staff-main { max-width: 1040px; margin: 0 auto; padding: 24px 20px 60px; }
.staff-title { font-family: 'Playfair Display', serif; font-size: 26px; margin: 0 0 4px; }
.staff-sub { color: var(--muted); margin: 0 0 20px; font-size: 14px; }

.export-bar { margin-bottom: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.btn-export {
  background: var(--accent); color: #fff; text-decoration: none;
  padding: 9px 16px; border-radius: 9px; font-size: 14px;
}
.btn-export.alt { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
.btn-export:hover { background: #5a4222; }
.btn-export.alt:hover { background: #f6f0e6; }

.date-block { margin-bottom: 26px; }
.date-head {
  font-family: 'Playfair Display', serif; font-size: 18px;
  background: #efe6d6; color: var(--accent); padding: 8px 14px; border-radius: 9px 9px 0 0;
}
table.grid { width: 100%; border-collapse: collapse; background: var(--card); }
table.grid th, table.grid td { padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 14px; text-align: left; }
table.grid th { background: #faf5ec; color: var(--muted); font-weight: 500; }
table.grid td.num, table.grid th.num { text-align: right; }
table.grid td.center, table.grid th.center { text-align: center; }
tr.total td { font-weight: 700; background: #f3ecde; }
tr.grand td { font-weight: 700; background: #e7dcc7; font-size: 15px; }

.empty-state { color: var(--muted); padding: 30px 0; text-align: center; }

/* login */
.login-wrap { max-width: 360px; margin: 80px auto; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.login-card h1 { font-family: 'Playfair Display', serif; font-size: 22px; margin: 0 0 18px; color: var(--accent); }
.login-card .err { color: var(--err); font-size: 13px; margin-bottom: 12px; }
.login-card button { width: 100%; margin-top: 12px; background: var(--accent); color: #fff; border: none; padding: 12px; border-radius: 9px; font-size: 15px; cursor: pointer; }

/* ═══════════════ customer accounts ═══════════════ */
/* header: logo left, account links right */
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.account-bar { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.account-bar a { color: #fff; opacity: 0.9; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,0.4); padding-bottom: 1px; }
.account-bar a:hover { opacity: 1; }
.account-bar .acc-hi { opacity: 0.95; }
.account-bar .acc-reg { border-bottom: none; background: rgba(255,255,255,0.15); padding: 5px 10px; border-radius: 7px; }

/* repeat-last-order button */
.btn-repeat { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px; background: var(--accent-soft); color: #fff; border: none; padding: 9px 14px; border-radius: 9px; font-size: 14px; cursor: pointer; }
.btn-repeat:hover { filter: brightness(1.05); }

/* login / register cards */
.login-card label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; }
.login-card input { width: 100%; box-sizing: border-box; padding: 11px; border: 1px solid var(--line); border-radius: 9px; font-size: 15px; font-family: inherit; background: #fff; color: var(--ink); }
.login-card input:focus { outline: none; border-color: var(--accent-soft); }
.login-intro { font-size: 13px; color: var(--muted); margin: 0 0 14px; line-height: 1.5; }
.login-alt { font-size: 13px; color: var(--muted); margin: 14px 0 0; text-align: center; }
.login-alt a { color: var(--accent); }
.login-alt.warn { color: var(--err); text-align: left; line-height: 1.45; }
.cred-box { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin: 6px 0 14px; }
.cred-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; }
.cred-row span { font-size: 12px; color: var(--muted); }
.cred-row code { font-size: 15px; color: var(--ink); font-weight: 600; word-break: break-all; }
.copy-btn { width: 100%; background: var(--accent); color: #fff; border: none; padding: 11px; border-radius: 9px; font-size: 14px; cursor: pointer; }
.cta-link { display: block; text-align: center; margin-top: 14px; color: var(--accent); font-weight: 500; text-decoration: none; }
.cta-link.ghost { color: var(--muted); }

/* account dashboard */
.acc-title { font-family: 'Playfair Display', serif; color: var(--accent); margin: 6px 0 18px; }
.acc-card { max-width: 760px; margin: 0 auto 18px; }
.acc-profile { display: flex; flex-wrap: wrap; gap: 22px; margin-bottom: 8px; }
.acc-profile div { display: flex; flex-direction: column; gap: 3px; }
.acc-profile span { font-size: 12px; color: var(--muted); }
.acc-profile strong { font-size: 15px; color: var(--ink); }
.acc-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.acc-table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.acc-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
.acc-table .num { text-align: right; }
.acc-empty { color: var(--muted); font-size: 14px; }
.login-card textarea { width: 100%; box-sizing: border-box; padding: 11px; border: 1px solid var(--line); border-radius: 9px; font-size: 15px; font-family: inherit; background: #fff; color: var(--ink); resize: vertical; }
.login-card textarea:focus { outline: none; border-color: var(--accent-soft); }
