/* โทนสีอ้างอิงจากโลโก้ My Living Style: กรมท่า #2a3d54 บนพื้นครีม #faf4ee */
:root {
  --ink: #1f2b3a;
  --muted: #6f7684;
  --line: #e2dacd;
  --paper: #faf4ee;
  --soft: #f1ebe1;
  --brand: #2a3d54;
  --brand-soft: #eceff4;
  --accent: #a8834a;
  --accent-soft: #f8f0e3;
  --ok: #2f6b4f;
  --bad: #b33b3b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--paper); }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  min-height: 72px; padding: 12px clamp(16px, 4vw, 56px);
  background: rgba(250, 244, 238, .94); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand b { color: var(--brand); }
.brand small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.mark { display: block; width: auto; height: 52px; }
.login-card { text-align: center; }
.login-card h1 { color: var(--brand); }
.login-card label { text-align: left; }
.login-logo { width: min(230px, 70%); height: auto; margin: 0 auto; }
nav { display: flex; align-items: center; gap: 14px; color: var(--muted); }
.icon-btn, .plain, .tab {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  min-height: 40px; padding: 0 14px;
}
.icon-btn { display: inline-flex; align-items: center; gap: 8px; }
.icon-btn b { min-width: 22px; height: 22px; border-radius: 999px; display: grid; place-items: center; background: var(--ink); color: #fff; font-size: 12px; }
.hero {
  min-height: min(460px, calc(100svh - 120px));
  display: flex; align-items: center; justify-content: space-between; gap: clamp(24px, 5vw, 64px);
  padding: clamp(28px, 6vw, 78px);
  background: linear-gradient(115deg, #1b2634 0%, var(--brand) 62%, #3b5170 100%);
  color: #fff;
}
.hero-copy { max-width: 640px; }
.hero-badge {
  flex: 0 0 auto; width: min(320px, 34vw); padding: clamp(14px, 2vw, 26px);
  background: var(--paper); border-radius: 14px; box-shadow: 0 18px 40px rgba(15, 22, 32, .28);
}
.hero-badge img { width: 100%; height: auto; display: block; }
.hero p { margin: 0 0 10px; color: #d9bd8d; text-transform: uppercase; letter-spacing: 0; }
.hero h1 { margin: 0; font-size: clamp(42px, 8vw, 94px); line-height: .96; letter-spacing: 0; }
.hero span { display: block; margin-top: 18px; max-width: 620px; font-size: 18px; line-height: 1.7; }
.section { padding: 44px clamp(16px, 4vw, 56px); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
h1, h2, h3 { letter-spacing: 0; }
.section h2, .panel h1 { margin: 0; font-size: 28px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters button, .secondary {
  border: 1px solid var(--line); background: #fff; color: var(--ink); min-height: 38px; padding: 0 12px;
}
.filters button.active { border-color: var(--ink); background: var(--ink); color: #fff; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.product {
  border: 1px solid var(--line); background: #fff; border-radius: 8px; overflow: hidden;
  display: flex; flex-direction: column; min-height: 100%;
}
.photo { aspect-ratio: 4 / 3; background: var(--soft); display: grid; place-items: center; overflow: hidden; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.placeholder { color: var(--muted); font-weight: 700; }
.product-body { padding: 14px; display: grid; gap: 10px; }
.product h3 { margin: 0; font-size: 18px; }
.price { color: var(--accent); font-weight: 800; font-size: 20px; }
.muted, .empty, .hint { color: var(--muted); }
.choices { display: grid; gap: 8px; }
.choices select, label input, label textarea, label select {
  width: 100%; border: 1px solid var(--line); background: #fff; min-height: 42px; padding: 9px 10px;
}
label { display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
.primary {
  border: 1px solid var(--brand); background: var(--brand); color: #fff;
  min-height: 44px; padding: 0 16px; font-weight: 700;
}
.drawer {
  position: fixed; inset: 0; z-index: 40; background: rgba(31,43,58,.45);
  display: none; justify-content: end;
}
.drawer.open { display: flex; }
.drawer-panel {
  width: min(520px, 100%); height: 100%; background: var(--paper);
  overflow: auto; padding: 20px;
}
.drawer-head, .cart-line, .total-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.cart-items { display: grid; gap: 10px; margin: 14px 0 22px; }
.cart-line { border: 1px solid var(--line); background: #fff; padding: 10px; border-radius: 8px; }
.qty { display: flex; align-items: center; gap: 8px; }
.qty button { width: 32px; height: 32px; border: 1px solid var(--line); background: #fff; }
.checkout, .stack { display: grid; gap: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; grid-template-columns: auto 1fr; align-items: center; color: var(--ink); }
.check input { width: auto; }
.total-row { border-top: 1px solid var(--line); padding-top: 16px; font-size: 18px; }
dialog { border: 0; padding: 0; background: transparent; width: min(420px, calc(100vw - 28px)); }
dialog::backdrop { background: rgba(31,43,58,.6); }
.dialog-card, .panel {
  background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 20px;
}
.dialog-card { display: grid; gap: 14px; }
.qr { width: min(100%, 300px); margin: auto; border: 1px solid var(--line); }
.reviews { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.review { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 14px; }
.review img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; margin-top: 8px; }
.narrow { max-width: 760px; margin: 28px auto; padding: 0 16px; display: grid; gap: 16px; }
.status-list { display: grid; gap: 10px; margin: 18px 0; }
.status-item { display: flex; gap: 10px; align-items: center; color: var(--muted); }
.dot { width: 12px; height: 12px; border-radius: 999px; border: 2px solid var(--line); }
.status-item.done { color: var(--ink); font-weight: 700; }
.status-item.done .dot { border-color: var(--ok); background: var(--ok); }
.login { min-height: 100svh; display: grid; place-items: center; padding: 16px; }
.login .panel { width: min(380px, 100%); }
.form-error { margin: 0; color: var(--bad); font-size: 14px; }
.admin-body { background: var(--soft); }
.admin-top { position: sticky; background: var(--paper); }
.admin-top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-shell { padding: 20px clamp(12px, 3vw, 36px) 60px; }
.tab { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; }
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab .count {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  display: grid; place-items: center; background: var(--soft); color: var(--muted); font-size: 12px;
}
.tab .count.alert { background: var(--accent); color: #fff; }
.tab.active .count { background: rgba(255, 255, 255, .18); color: #fff; }
.tab.active .count.alert { background: var(--accent); }
.plain { border-radius: 999px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: grid; gap: 4px; }
.stat small { color: var(--muted); }
.stat b { font-size: 22px; }
.stat.warn { border-color: var(--accent); background: var(--accent-soft); }
.stat.warn b { color: var(--accent); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.toolbar input[type="search"] {
  flex: 1 1 260px; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff;
}
.filters button { border-radius: 999px; }
.filters button span { color: var(--muted); font-size: 12px; }
.filters button.active span { color: #d9d2c8; }

.split { display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 18px; align-items: start; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.panel-head input[type="search"] { min-height: 38px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; }
.panel .hint { font-size: 12px; }
.admin-list { display: grid; gap: 10px; }
.admin-card { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 14px; display: grid; gap: 10px; }
.admin-card.editing { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(42, 61, 84, .14); }
.admin-card header { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.admin-card .right { text-align: right; display: grid; gap: 6px; justify-items: end; }
.items { display: grid; gap: 4px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px 0; }
.line-item { display: flex; justify-content: space-between; gap: 12px; }
.line-item em { color: var(--muted); font-style: normal; }
.ship { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.ship a { text-decoration: underline; }
.note { margin: 6px 0 0; padding: 8px 10px; background: var(--accent-soft); border-left: 3px solid var(--accent); }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--soft); font-size: 12px; font-weight: 700; white-space: nowrap;
}
.badge.s-checking_slip, .badge.p-slip_uploaded, .badge.rv-pending { background: var(--accent-soft); border-color: #e0c69c; color: #8a6733; }
.badge.s-paid, .badge.s-packing { background: var(--brand-soft); border-color: #c3cede; color: var(--brand); }
.badge.s-shipped, .badge.s-completed, .badge.p-paid, .badge.rv-approved { background: #e7f1ea; border-color: #a9cdb8; color: var(--ok); }
.badge.s-cancelled, .badge.p-refunded { background: #fbeced; border-color: #e2b3b3; color: var(--bad); }
.stars { color: var(--accent); letter-spacing: 2px; }

.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.admin-actions .field { flex: 1 1 150px; font-size: 12px; gap: 4px; }
.admin-actions select, .admin-actions input { min-height: 38px; border: 1px solid var(--line); padding: 6px 8px; background: #fff; }
.admin-actions button { border: 1px solid var(--line); background: #fff; min-height: 38px; padding: 0 14px; border-radius: 999px; }
.admin-actions button.primary { border-color: var(--brand); background: var(--brand); color: #fff; }
.admin-actions button[disabled] { opacity: .45; cursor: not-allowed; }
.upload { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); cursor: pointer; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { position: relative; display: inline-block; line-height: 0; }
.thumbs img { width: 76px; height: 60px; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; }
.thumb-x {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--bad); font-size: 14px; line-height: 1; padding: 0;
}
.slip { max-width: 220px; border: 1px solid var(--line); border-radius: 6px; }
.danger { border-color: var(--bad); color: var(--bad); }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 60;
  max-width: min(420px, calc(100vw - 24px)); padding: 12px 18px; border-radius: 999px;
  background: var(--ink); color: #fff; box-shadow: 0 8px 24px rgba(31, 43, 58, .3);
}
.toast.bad { background: var(--bad); }

@media (max-width: 760px) {
  .topbar { align-items: start; flex-direction: column; min-height: auto; }
  nav { width: 100%; justify-content: space-between; gap: 10px; }
  .hero { min-height: auto; flex-direction: column-reverse; align-items: stretch; text-align: left; }
  .hero-badge { width: min(230px, 60%); margin: 0 0 6px; }
  .section-head, .two, .split { grid-template-columns: 1fr; display: grid; }
  .grid { grid-template-columns: 1fr; }
  .admin-top { position: static; }
  .admin-top-actions { width: 100%; }
  .admin-card header, .ship { flex-direction: column; }
  .admin-card .right { text-align: left; justify-items: start; }
  .admin-actions .field { flex-basis: 100%; }
  .admin-actions button, .upload { flex: 1 1 auto; justify-content: center; }
}
