/* MIA — Luxury Feminine. Màu theo Blueprint: Porcelain, Blush, Rose, Champagne, Espresso.
   Font: Playfair Display (tiêu đề) + Plus Jakarta Sans (nội dung; DM Sans của Blueprint thiếu glyph tiếng Việt). */

@font-face { font-family: 'Playfair Display'; font-weight: 400 900; font-display: swap; src: url(../vendor/fonts/playfair-display-latin-wght-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Playfair Display'; font-weight: 400 900; font-display: swap; src: url(../vendor/fonts/playfair-display-latin-ext-wght-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Playfair Display'; font-weight: 400 900; font-display: swap; src: url(../vendor/fonts/playfair-display-vietnamese-wght-normal.woff2) format('woff2'); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: 'Plus Jakarta Sans'; font-weight: 200 800; font-display: swap; src: url(../vendor/fonts/plus-jakarta-sans-latin-wght-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Plus Jakarta Sans'; font-weight: 200 800; font-display: swap; src: url(../vendor/fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Plus Jakarta Sans'; font-weight: 200 800; font-display: swap; src: url(../vendor/fonts/plus-jakarta-sans-vietnamese-wght-normal.woff2) format('woff2'); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }

:root {
  --porcelain: #f9f5f1;
  --blush: #ebd8d4;
  --rose: #c89c91;
  --champagne: #b59c80;
  --espresso: #342b29;

  --bg: var(--porcelain);
  --surface: #ffffff;
  --surface-2: #f4ebe6;
  --text: var(--espresso);
  --muted: #6f625e;
  --line: #e6d9d3;
  --accent: #8a5c52;          /* Rose đậm: đủ tương phản cho chữ nhỏ (>= 4.5:1 trên nền Porcelain) */
  --accent-soft: var(--blush);
  --primary: var(--espresso);
  --on-primary: #fffaf6;
  --danger: #a32d2d;
  --ok: #2f6b4f;
  --warn: #8a5a12;
  --focus: #1f5fbf;
  --shadow: 0 1px 2px rgba(52, 43, 41, .06), 0 8px 24px rgba(52, 43, 41, .08);
  --shadow-lg: 0 20px 60px rgba(52, 43, 41, .22);
  --r: 16px;
  --r-sm: 12px;
  --gutter: 20px;
  --tab-h: 64px;
  --top-h: 60px;
  --serif: 'Playfair Display', 'Times New Roman', serif;
  --sans: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1716; --surface: #272020; --surface-2: #302827; --text: #f3e9e4; --muted: #b8a9a3; --line: #3c3231;
    --accent: #e0b4a9; --accent-soft: #3a2d2b; --primary: #f3e9e4; --on-primary: #1c1716; --danger: #f08a8a; --ok: #7ccaa0; --warn: #e3b366; --focus: #8ab6ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1, h2 { font-family: var(--serif); font-weight: 600; letter-spacing: .005em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.3rem); }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .6em; }
a { color: var(--accent); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.icon { display: block; }
.ico { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.muted { color: var(--muted); }
.center { text-align: center; }
.pad { padding: 14px 16px; }
.pre { white-space: pre-wrap; }
.warn-text { color: var(--warn); display: flex; align-items: center; gap: 4px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }

/* ---------- Khung ---------- */
.shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 var(--gutter); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); min-width: 0; }
.brand-logo { color: var(--accent); display: inline-flex; }
.brand-name { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: .8rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip.static { cursor: default; background: var(--accent-soft); border-color: transparent; font-weight: 500; }
.sync-chip.ok { color: var(--ok); }
.sync-chip.err { color: var(--danger); }
.sync-chip.pend, .sync-chip.off { color: var(--warn); }
.sync-chip.busy .icon { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px var(--gutter); background: #fff3d6; color: #5c4510; font-size: .9rem; }
@media (prefers-color-scheme: dark) { .banner { background: #4a3a14; color: #f6e2b0; } }
#view { flex: 1; outline: none; padding-bottom: calc(var(--tab-h) + 24px + env(safe-area-inset-bottom)); }
.tabs { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: flex; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(52, 43, 41, .06); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: .7rem; font-weight: 600; min-width: 0; }
.tab span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tab.on { color: var(--accent); }
.tab.on .ico { background: var(--accent-soft); }
.tab .ico { padding: 4px 16px; border-radius: 999px; }
.shell[data-mode='customer'] .tabs, .tabs:empty { display: none; }
.shell[data-mode='customer'] #view { padding-bottom: 32px; }
.shell[data-mode='customer'] .sync-chip { display: none; }
@media (max-width: 560px) { .chip-text { display: none; } .sync-chip, .mode-chip { padding: 0 10px; } .shell[data-mode='customer'] .mode-chip .chip-text { display: inline; } }

@media (min-width: 880px) {
  .shell { display: grid; grid-template-columns: 96px minmax(0, 1fr); grid-template-rows: auto auto 1fr; }
  .topbar { grid-column: 1 / -1; }
  .banner { grid-column: 1 / -1; }
  .tabs { position: sticky; top: var(--top-h); grid-row: 3; align-self: start; height: calc(100vh - var(--top-h)); flex-direction: column; justify-content: flex-start; gap: 6px; padding: 16px 6px; border-top: 0; border-right: 1px solid var(--line); box-shadow: none; }
  .tab { flex: none; min-height: 68px; border-radius: 14px; }
  #view { grid-column: 2; grid-row: 3; padding-bottom: 40px; }
  .shell[data-mode='customer'] { grid-template-columns: 1fr; }
  .shell[data-mode='customer'] #view { grid-column: 1; }
}

.page { max-width: 1100px; margin: 0 auto; padding: 20px var(--gutter) 24px; }
.page.narrow { max-width: 680px; }
.view-wrap { position: relative; }

/* ---------- Nút ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 14px; border: 1.5px solid transparent; font-weight: 700; font-size: .95rem; cursor: pointer; text-decoration: none; transition: transform .08s, background .15s, box-shadow .15s; -webkit-tap-highlight-color: transparent; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 6px 16px rgba(52, 43, 41, .22); }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-secondary:hover:not(:disabled) { border-color: var(--rose); }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover:not(:disabled) { background: var(--accent-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--danger); }
.btn-danger-ghost:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn-lg { min-height: 54px; padding: 0 28px; font-size: 1rem; border-radius: 16px; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: .85rem; border-radius: 12px; }
.btn-icon { width: 44px; min-height: 44px; padding: 0; border-radius: 50%; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.btn-row.end { justify-content: flex-end; margin-bottom: 14px; }
.sticky-actions { position: sticky; bottom: calc(var(--tab-h) + 12px + env(safe-area-inset-bottom)); margin-top: 20px; padding: 12px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-radius: var(--r); }
@media (min-width: 880px) { .sticky-actions { bottom: 12px; } }
.shell[data-mode='customer'] .sticky-actions { bottom: 12px; }

/* ---------- Thẻ, tiêu đề trang ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.card h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.page-title { flex: 1; min-width: 0; }
.page-title .sub, .sub { color: var(--muted); margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; }
.back { flex: none; background: var(--surface); border: 1px solid var(--line); }
.section-title { margin: 22px 0 10px; }
.hint { color: var(--muted); font-size: .82rem; margin: 6px 0 0; }
.form-err { color: var(--danger); font-size: .9rem; min-height: 1.2em; margin: 6px 0; font-weight: 600; }
.notice { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--r-sm); background: var(--accent-soft); margin-bottom: 12px; font-size: .9rem; }
.notice.warn { background: #fff1d6; color: #5c4510; }
@media (prefers-color-scheme: dark) { .notice.warn { background: #4a3a14; color: #f6e2b0; } }
.alert { display: flex; gap: 12px; align-items: flex-start; border-color: #e7c27d; background: #fff8e8; }
.alert p { margin: 4px 0 0; }
@media (prefers-color-scheme: dark) { .alert { background: #3b3017; border-color: #7a5f1f; } }
.danger-zone { margin-top: 24px; padding-top: 14px; border-top: 1px dashed var(--line); }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty h3 { color: var(--text); font-family: var(--serif); font-size: 1.25rem; margin: 10px 0 6px; font-weight: 600; }
.empty-ico { width: 72px; height: 72px; margin: 0 auto; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.empty .btn { margin-top: 14px; }

/* ---------- Form ---------- */
.field { margin-bottom: 14px; }
.field > label, .i18n-head label { display: block; font-weight: 700; font-size: .85rem; margin-bottom: 6px; }
.input { width: 100%; min-height: 50px; padding: 10px 14px; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-sm); }
textarea.input { resize: vertical; min-height: 80px; line-height: 1.45; }
.input:focus { border-color: var(--rose); outline: 3px solid color-mix(in srgb, var(--focus) 35%, transparent); outline-offset: 0; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
.form { max-width: 680px; }
.grid-2 { display: grid; gap: 0 14px; grid-template-columns: 1fr; }
.grid-3 { display: grid; gap: 0 14px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: 1fr 1fr 1fr; } }
.i18n-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.i18n-head label { margin: 0; }
.consent { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 14px 4px; margin: 0 0 14px; }
.consent legend { font-weight: 700; font-size: .85rem; padding: 0 6px; }
.switch { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
.switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 48px; height: 28px; border-radius: 999px; background: var(--line); position: relative; flex: none; transition: background .15s; }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s; }
.switch-input:checked + .switch-track { background: var(--accent); }
.switch-input:checked + .switch-track .switch-thumb { transform: translateX(20px); }
.switch-input:focus-visible + .switch-track { outline: 3px solid var(--focus); outline-offset: 2px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.seg { display: inline-flex; padding: 4px; gap: 4px; background: var(--surface-2); border-radius: 14px; max-width: 100%; overflow-x: auto; margin-bottom: 14px; }
.seg button { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px; border: 0; background: transparent; border-radius: 11px; font-weight: 700; font-size: .85rem; color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.i18n-head .seg { margin: 0; padding: 2px; }
.i18n-head .seg button { min-height: 32px; padding: 0 10px; }
.icon-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.icon-picker button { width: 48px; height: 48px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; }
.icon-picker button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.price-field { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }
.price-input { width: 92px; min-height: 44px; text-align: right; }
.total-row { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
progress { width: 100%; height: 8px; accent-color: var(--accent); margin: 8px 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

/* ---------- Danh sách ---------- */
.list { display: flex; flex-direction: column; }
.list-item, .list-row { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 14px; border: 0; background: transparent; width: 100%; text-align: left; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--line); cursor: pointer; }
.list-row { cursor: default; }
.list-item:last-child, .list-row:last-child { border-bottom: 0; }
.list-item:hover { background: var(--surface-2); }
.list-item.on { background: var(--accent-soft); }
.list-sub { padding: 12px 14px 4px; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.li-main { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 600; }
.li-main small { color: var(--muted); font-weight: 400; font-size: .8rem; }
.card.list { padding: 4px 0; }
.list.card .list-item:first-child { border-radius: var(--r) var(--r) 0 0; }
.modal-body .list { margin: 8px -4px 0; max-height: 52vh; overflow: auto; }
.group-block .list-row { flex-wrap: wrap; row-gap: 6px; }
.group-block .li-main { flex: 1 1 150px; }
.group-block .list-row .btn-sm { margin-left: auto; }
.row-thumb { width: 52px; height: 52px; border-radius: 12px; overflow: hidden; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.avatar { display: inline-grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; flex: none; letter-spacing: .02em; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: .72rem; font-weight: 700; background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: #fff1d6; color: #7a5410; }
.badge.info { background: #e4eefb; color: #1f4f8f; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px; background: var(--accent-soft); font-size: .8rem; font-weight: 600; }
.pill.ok { background: #e2f1e8; color: var(--ok); }
.pill.warn { background: #fff1d6; color: var(--warn); }
.meta, .chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.price { font-weight: 700; white-space: nowrap; }
.searchbar { display: flex; align-items: center; gap: 10px; padding: 0 14px; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-sm); margin-bottom: 14px; color: var(--muted); }
.searchbar .input { border: 0; outline: 0; background: transparent; padding-left: 0; }

/* ---------- Hộp thoại ---------- */
.modal-layer { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; background: rgba(35, 27, 25, .5); animation: fade .18s; }
.modal-layer.out { opacity: 0; transition: opacity .18s; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
@keyframes drop { from { transform: translateY(-14px); opacity: 0; } }
.modal { width: 100%; max-width: 520px; max-height: 92vh; display: flex; flex-direction: column; background: var(--surface); border-radius: 24px 24px 0 0; box-shadow: var(--shadow-lg); animation: rise .2s; }
.modal-wide { max-width: 680px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px 4px; }
.modal-head h2 { margin: 0; }
.modal-body { padding: 12px 20px; overflow: auto; }
.modal-text { margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding: 12px 20px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 640px) { .modal-layer { align-items: center; } .modal { border-radius: 24px; } }
.toast-host { position: fixed; z-index: 200; left: 0; right: 0; top: calc(var(--top-h) + 10px + env(safe-area-inset-top)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { pointer-events: none; max-width: min(92vw, 420px); padding: 12px 18px; border-radius: 14px; background: var(--espresso); color: #fffaf6; font-weight: 600; font-size: .9rem; box-shadow: var(--shadow-lg); animation: drop .2s; }
.toast.out { opacity: 0; transition: opacity .25s; }
.toast-ok { background: #2f5e49; } .toast-err { background: #8e2626; } .toast-warn { background: #7a5410; }

/* ---------- Trình xem ảnh ---------- */
.viewer { position: fixed; inset: 0; z-index: 150; background: #161110; display: flex; flex-direction: column; color: #fff; }
.viewer-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 56px 12px 8px; touch-action: pan-y; }
.viewer-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px; }
.viewer-img.missing { min-width: 200px; min-height: 200px; background: #3a2f2d; }
.viewer-foot { padding: 8px var(--gutter) calc(20px + env(safe-area-inset-bottom)); text-align: center; }
.viewer-cap { min-height: 1.4em; margin-bottom: 10px; opacity: .9; }
.viewer-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.viewer .btn-secondary { background: rgba(255, 255, 255, .12); color: #fff; border-color: transparent; }
.viewer .btn-primary { background: #fff; color: var(--espresso); }
.viewer .btn-danger-ghost { color: #ffb4b4; }
.viewer-close { position: absolute; top: 10px; right: 10px; color: #fff; background: rgba(255, 255, 255, .14); }
.viewer-count { position: absolute; top: 20px; left: 20px; font-size: .85rem; opacity: .8; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); color: #fff; background: rgba(255, 255, 255, .14); }
.viewer-prev { left: 8px; } .viewer-next { right: 8px; }

/* ---------- Tư vấn ---------- */
.hero { display: grid; gap: 14px; padding: 28px 24px; margin-bottom: 18px; border-radius: 24px; background: linear-gradient(135deg, var(--blush), #f6e8e2 55%, #efe1d3); position: relative; overflow: hidden; }
@media (prefers-color-scheme: dark) { .hero { background: linear-gradient(135deg, #3a2d2b, #2c2423); } }
.hero::after { content: ''; position: absolute; right: -40px; top: -40px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, rgba(181, 156, 128, .35), transparent 70%); }
.hero-text { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.hero .eyebrow { margin: 0; font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.hero .sub { max-width: 46ch; color: var(--text); opacity: .8; margin-bottom: 10px; }
.cust-card { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cust-card .cs-main { flex: 1; min-width: 150px; }
.customer-strip { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; margin-bottom: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.cs-main { flex: 1; min-width: 160px; display: flex; flex-direction: column; }
.cs-main small { color: var(--muted); }
.group-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .group-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .group-grid { grid-template-columns: repeat(3, 1fr); } }
.group-card { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; align-items: center; gap: 0 10px; padding: 0 0 14px 0; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.group-card:hover { transform: translateY(-2px); }
.group-card > .ico:last-child { margin-right: 16px; color: var(--muted); }
.gc-media { grid-column: 1 / -1; aspect-ratio: 16 / 10; background: var(--accent-soft); overflow: hidden; margin-bottom: 12px; }
.gc-media img { width: 100%; height: 100%; object-fit: cover; }
.gc-ph { width: 100%; height: 100%; display: grid; place-items: center; color: var(--accent); background: linear-gradient(135deg, var(--blush), #f4e6dd); }
.gc-body { display: flex; align-items: center; gap: 12px; padding-left: 16px; color: var(--accent); }
.gc-body h2 { margin: 0; color: var(--text); font-size: 1.15rem; }
.gc-body p { margin: 0; color: var(--muted); font-size: .85rem; }
.service-list { display: grid; gap: 14px; }
.service-card { display: grid; grid-template-columns: 110px 1fr; gap: 6px 16px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); align-items: start; }
.sc-media { width: 110px; height: 110px; border-radius: 16px; overflow: hidden; background: var(--accent-soft); display: block; }
.sc-media img { width: 100%; height: 100%; object-fit: cover; }
.sc-body h2 { margin: 2px 0 4px; }
.sc-desc { color: var(--muted); font-size: .9rem; margin: 0 0 8px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sc-actions { grid-column: 1 / -1; }
.sc-actions .btn { width: 100%; }
@media (min-width: 720px) { .service-card { grid-template-columns: 160px 1fr auto; align-items: center; } .sc-media { width: 160px; height: 120px; } .sc-actions { grid-column: auto; } .sc-actions .btn { width: auto; } }
.service-head { margin-bottom: 18px; }
.lead { font-size: 1.05rem; color: var(--muted); max-width: 62ch; }
.masonry { column-width: 150px; column-gap: 12px; }
.tile { position: relative; margin: 0 0 12px; break-inside: avoid; border-radius: 18px; overflow: hidden; background: var(--accent-soft); box-shadow: var(--shadow); cursor: zoom-in; }
.tile img { width: 100%; height: auto; min-height: 120px; object-fit: cover; }
.tile img.missing { min-height: 180px; }
.tile figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 12px 10px; color: #fff; font-size: .8rem; font-weight: 600; background: linear-gradient(transparent, rgba(30, 20, 18, .62)); }
.heart { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .88); color: var(--espresso); cursor: pointer; backdrop-filter: blur(6px); }
.heart.on { background: var(--espresso); color: #ffd7d0; }
.heart.on .icon { fill: currentColor; }
.plan-bar { position: fixed; z-index: 25; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + 14px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 18px; border-radius: 999px; background: var(--espresso); color: #fffaf6; text-decoration: none; font-weight: 700; box-shadow: var(--shadow-lg); width: max-content; max-width: calc(100vw - 32px); }
.plan-bar .icon { fill: #ffb8ad; color: #ffb8ad; }
.plan-bar-go { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, .3); }
@media (min-width: 880px) { .plan-bar { bottom: 24px; left: calc(50% + 48px); } .shell[data-mode='customer'] .plan-bar { left: 50%; } }
.shell[data-mode='customer'] .plan-bar { bottom: 24px; }
.strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.strip-item { position: relative; flex: none; width: 110px; height: 140px; margin: 0; border-radius: 16px; overflow: hidden; background: var(--accent-soft); }
.strip-item img { width: 100%; height: 100%; object-fit: cover; }
.strip-x { position: absolute; top: 4px; right: 4px; width: 34px; min-height: 34px; background: rgba(255, 255, 255, .9); color: var(--espresso); }
.totals > div { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 0; }
.totals strong { font-family: var(--serif); font-size: 1.4rem; }
.talk summary { display: flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; min-height: 40px; }
.talk ul { margin: 8px 0 0; padding-left: 22px; } .talk li { margin: 6px 0; }
.handback { display: flex; align-items: center; gap: 12px; background: var(--accent-soft); }
.handback p { margin: 0; }

/* ---------- Hồ sơ khách ---------- */
.profile { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.profile-main { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 6px; }
.contact { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 600; }
.timeline { display: flex; flex-direction: column; }
.visit-card { padding: 16px; }
.vc-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.vc-head > div { flex: 1; }
.vc-head small { color: var(--muted); }
.vc-notes { color: var(--muted); font-size: .9rem; margin: 8px 0; }
.photo-row { display: flex; gap: 10px; overflow-x: auto; padding: 8px 0; }
.photo-row.wrap { flex-wrap: wrap; overflow: visible; }
.photo-btn { position: relative; flex: none; width: 112px; height: 112px; padding: 0; border: 0; border-radius: 16px; overflow: hidden; background: var(--accent-soft); cursor: zoom-in; }
.photo-btn img { width: 100%; height: 100%; object-fit: cover; }
.photo-tag { position: absolute; left: 6px; bottom: 6px; padding: 2px 8px; border-radius: 999px; background: rgba(30, 20, 18, .7); color: #fff; font-size: .68rem; font-weight: 700; }
.photo-section { margin-top: 12px; }
.tab-body { margin-top: 4px; }
.group-block .card-head h2 { color: var(--text); }
.sample-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.sample-card { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 12px; }
.sample-img { position: relative; aspect-ratio: 4 / 5; border-radius: 14px; overflow: hidden; background: var(--accent-soft); }
.sample-img img { width: 100%; height: 100%; object-fit: cover; }
.sample-img .badge { position: absolute; top: 8px; left: 8px; }
.sample-card .field { margin: 0; }

/* ---------- Đăng nhập ---------- */
.login-wrap { min-height: calc(100vh - var(--top-h)); display: grid; place-items: center; padding: 20px var(--gutter); }
.login-card { width: 100%; max-width: 420px; padding: 28px 24px; text-align: center; }
.login-card .field { text-align: left; }
.login-ico { width: 60px; height: 60px; margin: 0 auto 12px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.boot-error { padding: 40px; text-align: center; }

/* ---------- Ghép thử ---------- */
.tryon-stage-wrap { margin-bottom: 14px; }
.tryon-stage { position: relative; width: 100%; max-width: 760px; margin: 0 auto; aspect-ratio: 4 / 3; border-radius: 22px; overflow: hidden; background: #2a2120; box-shadow: var(--shadow); display: grid; place-items: center; }
.ar-canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.ar-canvas.mirror { transform: scaleX(-1); }
.comp-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage-msg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; text-align: center; color: #fff; background: rgba(30, 22, 21, .72); }
.stage-msg.hint { inset: auto 12px 12px; padding: 10px 14px; flex-direction: row; background: rgba(30, 22, 21, .7); border-radius: 14px; }
.stage-msg p { margin: 0; max-width: 40ch; }
.stage-msg .btn-primary { background: #fff; color: var(--espresso); }
.stage-controls { display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; margin-top: 14px; }
.stage-controls.wrap { gap: 10px; }
.shutter { width: 68px; height: 68px; border-radius: 50%; border: 5px solid var(--espresso); background: var(--surface); box-shadow: inset 0 0 0 4px var(--surface), inset 0 0 0 40px var(--rose); cursor: pointer; }
.shutter:disabled { opacity: .4; }
.item-toolbar { display: flex; justify-content: center; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.item-toolbar .btn-icon { width: 40px; min-height: 40px; }
.style-panel { display: flex; gap: 16px; align-items: flex-start; }
.style-groups { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.style-groups h3 { margin-bottom: 8px; }
.style-row { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 8px; scroll-snap-type: x proximity; }
.style-tile { flex: none; width: 96px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px; border-radius: 16px; border: 2px solid transparent; background: transparent; cursor: pointer; font-size: .72rem; font-weight: 600; text-align: center; scroll-snap-align: start; }
.style-tile canvas, .tile-photo { width: 84px; height: 84px; border-radius: 12px; overflow: hidden; background: var(--accent-soft); }
.tile-photo img { width: 100%; height: 100%; object-fit: cover; }
.style-tile.on { border-color: var(--accent); background: var(--accent-soft); }
.ref { flex: none; width: 110px; margin: 0; }
.ref img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 14px; }
.ref figcaption { font-size: .72rem; color: var(--muted); text-align: center; margin-top: 4px; }
.results { margin-top: 18px; }
.result-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 8px; }
.result { margin: 0; }
.result img { width: 100%; border-radius: 16px; margin-bottom: 8px; }
@media (max-width: 560px) { .style-panel { flex-direction: column; } .ref { width: 90px; } }

/* ---------- Tra khách cũ ---------- */
.lookup { padding: 18px; margin-bottom: 18px; }
.lookup h2 { margin-bottom: 2px; }
.lookup .sub { margin: 0 0 12px; font-size: .9rem; }
.lookup .searchbar { margin-bottom: 8px; }
.lookup-item { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); }
.lookup-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 6px 4px; background: none; border: 0; text-align: left; cursor: pointer; }
.lookup-main:hover { background: var(--surface-2); }
.lookup-main .li-main small { line-height: 1.35; }
.lookup-none { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 6px; }
.lookup-none p { margin: 0; font-weight: 600; }

/* ---------- Sẵn sàng offline ---------- */
.ready-verdict { display: flex; align-items: center; gap: 8px; font-weight: 700; margin: 8px 0 4px; }
.ready-verdict.ok { color: var(--ok); }
.ready-verdict.warn { color: var(--warn); }
.ready-list { list-style: none; margin: 8px 0 0; padding: 0; }
.ready-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 52px; padding: 6px 0; border-top: 1px solid var(--line); }
.ready-list .ready-label { flex: 1; min-width: 160px; display: flex; flex-direction: column; }
.ready-list .ready-label small { color: var(--muted); font-weight: 400; }
.ready-list li.ok .ico { color: var(--ok); }
.ready-list li.bad .ico { color: var(--warn); }
