/* Shared styles for order / login / dashboard / admin — white, minimal */
:root {
  --bg: #ffffff;
  --soft: #f6f6f4;
  --line: #e5e5e2;
  --line-strong: #cfcfcb;
  --text: #111111;
  --muted: #6b6b68;
  --accent: #b8891a;
  --ok: #13795b;
  --warn: #8a6508;
  --err: #b42318;
  --border: var(--line);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 10px;

  /* legacy names still referenced by inline styles in the app pages */
  --gold: var(--text);
  --gold-hi: var(--text);
  --gold-lo: var(--text);
  --navy: var(--bg);
  --navy-2: var(--bg);
  --navy-3: var(--soft);
  --cream: var(--soft);
  --ink: var(--text);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: #000; }
h1, h2, h3, h4 { letter-spacing: -0.01em; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
  font-size: 1.05rem;
}
.brand img.brand-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}
.brand small {
  font-size: inherit;
  font-weight: 400;
  color: var(--muted);
  margin-left: 0.3rem;
}
.topbar-nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.topbar-nav a, .topbar-nav button.linkish {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}
.topbar-nav a:hover, .topbar-nav button.linkish:hover { color: var(--text); }
.topbar-nav a.active { color: var(--text); font-weight: 600; }

.wrap { width: min(100% - 2rem, 1100px); margin: 0 auto; padding: 2rem 0 4rem; }
.wrap-sm { width: min(100% - 2rem, 420px); margin: 0 auto; padding: 3.5rem 0; }

.card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.5rem;
}
.card h1, .card h2 { margin: 0 0 0.4rem; }
.card h1 { font-size: 1.5rem; }
.card .sub, .sub { color: var(--muted); margin: 0 0 1.25rem; font-size: 0.93rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font: 600 0.9rem/1 var(--font);
  padding: 0.8rem 1.2rem;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
/* primary action (class name kept from the old theme) */
.btn-gold { color: #fff; background: var(--text); border-color: var(--text); }
.btn-gold:hover { background: #333; border-color: #333; color: #fff; }
.btn-outline { color: var(--text); background: var(--bg); border-color: var(--line-strong); }
.btn-outline:hover { border-color: var(--text); }
.btn-sm { padding: 0.5rem 0.8rem; font-size: 0.8rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.field { display: grid; gap: 0.35rem; margin-bottom: 0.9rem; }
.field label, .field > span {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
}
.field input, .field select, .field textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
  outline: none;
}
.field input::placeholder, .field textarea::placeholder { color: #a3a3a0; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}
.field textarea { min-height: 90px; resize: vertical; }
.check-row {
  display: flex !important;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.92rem !important;
  font-weight: 400 !important;
  margin: 0.4rem 0;
  cursor: pointer;
}
.check-row input { width: auto; accent-color: var(--text); }

.alert {
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--text);
}
.alert-error { background: #fef3f2; border-color: #fecdca; color: var(--err); }
.alert-ok { background: #ecfdf3; border-color: #abefc6; color: var(--ok); }
.alert-info { background: var(--soft); border-color: var(--line); color: var(--text); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 800px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.85rem; margin-bottom: 1.5rem; }
@media (max-width: 900px) { .stats { grid-template-columns: 1fr 1fr; } }
.stat {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.1rem;
}
.stat strong { display: block; font-size: 1.6rem; font-weight: 600; }
.stat span { font-size: 0.82rem; color: var(--muted); }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th, table.data td {
  text-align: left;
  padding: 0.75rem 0.65rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.data th { font-size: 0.78rem; color: var(--muted); font-weight: 500; }
table.data tr:last-child td { border-bottom: 0; }

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--text);
  white-space: nowrap;
}
.badge-pending_quote, .badge-artwork_review, .badge-new, .badge-pending {
  background: #fffaeb; color: var(--warn); border-color: #fedf89;
}
.badge-delivered, .badge-paid, .badge-registered, .badge-approved {
  background: #ecfdf3; color: var(--ok); border-color: #abefc6;
}
.badge-cancelled, .badge-void, .badge-rejected {
  background: #fef3f2; color: var(--err); border-color: #fecdca;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 2rem 0 0.85rem;
  flex-wrap: wrap;
}
.section-title h2 { margin: 0; font-size: 1.1rem; font-weight: 600; }

.timeline { display: grid; gap: 0.65rem; margin-top: 0.75rem; }
.timeline-item { display: grid; grid-template-columns: 12px 1fr; gap: 0.75rem; font-size: 0.88rem; }
.timeline-item .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text);
  margin-top: 0.4rem;
}
.timeline-item .meta { color: var(--muted); font-size: 0.78rem; }

.tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tab {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  font: 500 0.84rem/1 var(--font);
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--text); color: #fff; border-color: var(--text); }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(17, 17, 17, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: min(100%, 520px);
  max-height: 90vh;
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.35rem 1.5rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
}
.modal h3 { margin: 0 0 0.75rem; }
.modal-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }

.invoice-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  background: var(--soft);
  margin-top: 0.75rem;
}
.invoice-box table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.invoice-box td, .invoice-box th { padding: 0.4rem 0; border-bottom: 1px solid var(--line); text-align: left; }
.invoice-box th { color: var(--muted); font-weight: 500; font-size: 0.8rem; }
.invoice-box .total { font-weight: 700; font-size: 1.05rem; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
}
.hidden { display: none !important; }

/* ---------- Order page ---------- */
.order-wrap { width: min(100% - 2rem, 1080px); margin: 0 auto; padding: 2.5rem 0 4rem; }
.order-head h1 { font-size: 1.9rem; margin: 0 0 0.35rem; }
.order-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 2.5rem;
  align-items: start;
  margin-top: 1.75rem;
}
.step { padding: 1.5rem 0; border-top: 1px solid var(--line); }
.step:first-child { border-top: 0; padding-top: 0; }
.step-title { display: flex; align-items: baseline; gap: 0.65rem; margin: 0 0 1rem; font-size: 1.05rem; font-weight: 600; }
.step-num { color: var(--muted); font-weight: 500; font-size: 0.9rem; font-variant-numeric: tabular-nums; }

.machine-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.machine-option { position: relative; cursor: pointer; }
.machine-option input { position: absolute; opacity: 0; pointer-events: none; }
.machine-option .mo-body {
  display: grid;
  gap: 0.3rem;
  height: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0.85rem;
  transition: border-color .15s, box-shadow .15s;
}
.machine-option:hover .mo-body { border-color: var(--text); }
.machine-option input:checked + .mo-body { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.machine-option input:focus-visible + .mo-body { outline: 2px solid var(--text); outline-offset: 2px; }
.mo-img { height: 120px; background: var(--soft); border-radius: 8px; display: grid; place-items: center; overflow: hidden; }
.mo-img img { max-height: 108px; max-width: 90%; object-fit: contain; display: block; border-radius: 4px; }
.mo-name { font-weight: 600; font-size: 0.9rem; line-height: 1.3; margin-top: 0.35rem; }
.mo-price { color: var(--muted); font-size: 0.88rem; }

.field input.qty { width: 110px; }
.chosen-machine { display: flex; align-items: center; gap: 1rem; border: 1px solid var(--line); border-radius: 12px; padding: 0.85rem; }
.cm-img { width: 72px; height: 72px; flex-shrink: 0; background: var(--soft); border-radius: 8px; display: grid; place-items: center; overflow: hidden; }
.cm-img img { max-width: 62px; max-height: 62px; object-fit: contain; border-radius: 4px; }
.cm-text { flex: 1; display: grid; gap: 0.15rem; }
.cm-text strong { font-weight: 600; font-size: 0.98rem; line-height: 1.3; }
.cm-text span { color: var(--muted); font-size: 0.9rem; }
.option-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  margin-bottom: 0.6rem;
  cursor: pointer;
}
.option-row input { margin-top: 0.2rem; accent-color: var(--text); }
.option-row .or-text { flex: 1; }
.option-row strong { display: block; font-weight: 600; font-size: 0.93rem; }
.option-row span { color: var(--muted); font-size: 0.86rem; }
.option-row em { font-style: normal; font-weight: 600; font-size: 0.93rem; white-space: nowrap; }
.artwork-panel { margin: 0.25rem 0 0.75rem; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
.artwork-panel > p { margin: 0 0 0.85rem; font-size: 0.88rem; color: var(--muted); }
.signed-in { padding: 0.9rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); font-size: 0.93rem; }

.summary { position: sticky; top: 88px; border: 1px solid var(--line); border-radius: 14px; padding: 1.25rem; }
.summary h2 { font-size: 1rem; margin: 0 0 0.9rem; font-weight: 600; }
.summary-img { height: 170px; background: var(--soft); border-radius: 10px; display: grid; place-items: center; margin-bottom: 1rem; overflow: hidden; }
.summary-img img { max-height: 150px; max-width: 85%; object-fit: contain; }
.sum-line { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.9rem; padding: 0.3rem 0; }
.sum-line span:first-child { color: var(--muted); }
.sum-total { border-top: 1px solid var(--line); margin-top: 0.6rem; padding-top: 0.8rem; font-size: 1.05rem; font-weight: 700; }
.sum-total span:first-child { color: var(--text); }
.summary .btn { margin-top: 1rem; }
.summary-note { margin: 0.8rem 0 0; font-size: 0.82rem; color: var(--muted); line-height: 1.45; }

.done { max-width: 560px; margin: 3rem auto; text-align: center; }
.done h1 { font-size: 1.7rem; margin: 0 0 0.6rem; }
.done .order-no { font-size: 1.15rem; font-weight: 700; margin: 1rem 0; }
.done-actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }

@media (max-width: 900px) {
  .order-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .summary { position: static; }
  .machine-options { grid-template-columns: 1fr; }
  .machine-option .mo-body { grid-template-columns: 96px 1fr; align-items: center; column-gap: 0.85rem; }
  .mo-img { grid-row: span 2; height: 96px; }
  .mo-img img { max-height: 84px; }
  .mo-name { margin-top: 0; align-self: end; }
  .mo-price { align-self: start; }
}
@media (max-width: 560px) {
  .topbar { padding: 0.75rem 1rem; }
  .brand small { display: none; }
}
