:root {
  --bg: #f5f3ef; --card: #ffffff; --ink: #1d1b18; --muted: #6b665e; --line: #e4dfd6;
  --brand: #1f5f4a; --brand-ink: #ffffff; --brand-soft: #e3efe9;
  --warn: #9a5b00; --warn-soft: #fff3dc; --bad: #b3261e; --bad-soft: #fde8e6; --ok: #1d7a46; --ok-soft: #e2f4e8;
  --info: #24548f; --info-soft: #e5eefa; --grey-soft: #efede8;
  --r: 12px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 10px rgba(0,0,0,.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161513; --card: #211f1c; --ink: #f0ede7; --muted: #a8a196; --line: #36332e;
    --brand: #4fb08c; --brand-ink: #0d1f18; --brand-soft: #1c3229;
    --warn: #f0b45a; --warn-soft: #3a2c14; --bad: #f2867d; --bad-soft: #3d1d1a; --ok: #6fd39a; --ok-soft: #173023;
    --info: #8bb6ef; --info-soft: #1a2a40; --grey-soft: #2a2824; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161513; --card: #211f1c; --ink: #f0ede7; --muted: #a8a196; --line: #36332e;
  --brand: #4fb08c; --brand-ink: #0d1f18; --brand-soft: #1c3229;
  --warn: #f0b45a; --warn-soft: #3a2c14; --bad: #f2867d; --bad-soft: #3d1d1a; --ok: #6fd39a; --ok-soft: #173023;
  --info: #8bb6ef; --info-soft: #1a2a40; --grey-soft: #2a2824; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { min-height: 100vh; padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
a { color: var(--brand); }
h1 { font-size: 1.35rem; margin: 0 0 12px; }
h2 { font-size: 1.1rem; margin: 18px 0 8px; }
h3 { font-size: 1rem; margin: 12px 0 6px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .9em; }

/* Khung */
.top { position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--line); padding: calc(8px + env(safe-area-inset-top)) 16px 8px; display: flex; align-items: center; gap: 10px; }
.top .brand { font-weight: 700; color: var(--brand); white-space: nowrap; }
.top .env { font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.top .me { margin-left: auto; font-size: .85rem; color: var(--muted); text-align: right; }
.wrap { display: flex; }
nav.side { display: none; }
main { flex: 1; min-width: 0; padding: 16px; max-width: 1200px; margin: 0 auto; }
nav.bottom { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line); display: flex; padding-bottom: env(safe-area-inset-bottom); }
nav.bottom a { flex: 1; text-align: center; padding: 8px 2px 6px; text-decoration: none; color: var(--muted); font-size: .72rem; }
nav.bottom a .i { display: block; font-size: 1.3rem; line-height: 1.2; }
nav.bottom a.on { color: var(--brand); font-weight: 600; }
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  nav.bottom { display: none; }
  nav.side { display: block; width: 220px; flex: none; position: sticky; top: 52px; height: calc(100vh - 52px); overflow: auto; padding: 12px 8px; border-right: 1px solid var(--line); background: var(--card); }
  nav.side a { display: block; padding: 9px 12px; border-radius: 8px; text-decoration: none; color: var(--ink); margin-bottom: 2px; }
  nav.side a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
  main { padding: 20px 24px; }
}
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.menu-grid a { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 12px; text-decoration: none; color: var(--ink); font-weight: 600; }
.menu-grid a span { display: block; font-size: 1.5rem; }

/* Thẻ & lưới */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); margin-bottom: 12px; }
.grid { display: grid; gap: 12px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; text-decoration: none; color: var(--ink); display: block; }
.kpi b { display: block; font-size: 1.6rem; line-height: 1.1; }
.kpi span { color: var(--muted); font-size: .85rem; }
.kpi.warn { background: var(--warn-soft); border-color: transparent; }
.kpi.bad { background: var(--bad-soft); border-color: transparent; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 8px; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; }
.cat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; }
.cat .ph { aspect-ratio: 1; background: var(--grey-soft); }
.cat .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cat .bd { padding: 8px 10px 10px; font-size: .88rem; }
.cat .bd b { font-size: .95rem; }
.colors { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

/* Nhãn trạng thái */
.tag { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: var(--grey-soft); color: var(--muted); white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.info { background: var(--info-soft); color: var(--info); }
.tag.brand { background: var(--brand-soft); color: var(--brand); }
.note { padding: 10px 12px; border-radius: 10px; background: var(--info-soft); color: var(--ink); font-size: .9rem; margin: 8px 0; }
.note.warn { background: var(--warn-soft); }
.note.bad { background: var(--bad-soft); }
.note.ok { background: var(--ok-soft); }

/* Nút & ô nhập */
button, .btn { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 10px; padding: 10px 14px; min-height: 44px; cursor: pointer; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
button.pri, .btn.pri { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
button.danger { color: var(--bad); border-color: var(--bad); }
button.sm, .btn.sm { min-height: 34px; padding: 5px 10px; font-size: .85rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; min-height: 44px; width: 100%; }
textarea { min-height: 80px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; min-height: 0; accent-color: var(--brand); }
input.num { width: 80px; text-align: center; }
label.f { display: block; font-size: .85rem; color: var(--muted); margin: 10px 0 4px; font-weight: 600; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; cursor: pointer; display: flex; gap: 6px; align-items: center; background: var(--card); }
.seg label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.seg input { display: none; }

/* Bảng */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { padding: 8px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 600; font-size: .8rem; white-space: nowrap; }
.tbl td.n, .tbl th.n { text-align: right; font-variant-numeric: tabular-nums; }

/* Dòng đơn có ảnh lớn */
.line { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line .imgs { display: flex; flex-direction: column; gap: 6px; }
.thumb { width: 96px; height: 96px; border-radius: 10px; object-fit: cover; background: var(--grey-soft); display: block; cursor: zoom-in; }
.thumb.sm { width: 56px; height: 56px; }
.crop { width: 96px; height: 96px; border-radius: 10px; background-repeat: no-repeat; background-color: var(--grey-soft); cursor: zoom-in; }
@media (min-width: 700px) { .line { grid-template-columns: 220px 1fr; } .line .imgs { flex-direction: row; } }
.big-pick { font-size: 1.25rem; font-weight: 700; }
.loc { font-weight: 700; color: var(--brand); }

/* Tiếp nhận */
.drop { border: 2px dashed var(--line); border-radius: var(--r); padding: 24px; text-align: center; background: var(--card); cursor: pointer; }
.drop.on { border-color: var(--brand); background: var(--brand-soft); }
.shot { position: relative; display: inline-block; max-width: 100%; touch-action: none; user-select: none; }
.shot img { max-width: 100%; max-height: 70vh; display: block; border-radius: 8px; }
.shot .box { position: absolute; border: 3px solid var(--brand); border-radius: 4px; background: rgba(31,95,74,.08); }
.shot .box b { position: absolute; top: -2px; left: -2px; background: var(--brand); color: var(--brand-ink); font-size: .8rem; padding: 0 6px; border-radius: 4px 0 4px 0; }
.shot .box.off { border-style: dashed; border-color: var(--muted); background: transparent; }
.shot .box .x { position: absolute; top: -12px; right: -12px; width: 26px; height: 26px; min-height: 0; padding: 0; border-radius: 50%; font-size: .8rem; }
.shot .draft { position: absolute; border: 2px dashed var(--warn); }
.cand { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0; }
.cand button { flex: none; flex-direction: column; padding: 4px; min-height: 0; border-radius: 10px; font-weight: 500; font-size: .78rem; width: 92px; }
.cand button img { width: 82px; height: 82px; object-fit: cover; border-radius: 8px; }
.cand button.on { border: 2px solid var(--brand); background: var(--brand-soft); }

/* Hộp thoại & ảnh phóng to */
dialog { border: 0; border-radius: 14px; padding: 0; max-width: min(640px, calc(100vw - 24px)); width: 100%; background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,.5); }
dialog .dh { padding: 14px 16px; border-bottom: 1px solid var(--line); font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
dialog .db { padding: 14px 16px; max-height: 70vh; overflow: auto; }
dialog .df { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.zoom { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.zoom img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 200; max-width: calc(100vw - 32px); box-shadow: var(--shadow); }
.toast.bad { background: var(--bad); color: #fff; }
.login { max-width: 380px; margin: 10vh auto; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }

/* In nhãn */
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(62mm, 1fr)); gap: 4mm; }
.lbl { border: 1px solid #000; border-radius: 2mm; padding: 3mm; display: flex; gap: 3mm; align-items: center; background: #fff; color: #000; break-inside: avoid; }
.lbl .t b { font-size: 15pt; display: block; }
.lbl .t { font-size: 10pt; line-height: 1.3; }
.lbl .qr canvas, .lbl .qr img { width: 22mm !important; height: 22mm !important; }
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(70mm, 1fr)); gap: 4mm; }
.board .it { border: 1px solid #000; border-radius: 2mm; padding: 3mm; break-inside: avoid; background: #fff; color: #000; }
.board .it img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 1mm; }
.board .it .addr { font-weight: 700; font-size: 12pt; }
@media print {
  .top, nav, .no-print { display: none !important; }
  body, main { background: #fff; padding: 0; margin: 0; }
  .card { border: 0; box-shadow: none; padding: 0; }
}

/* ===== Giao diện theo mẫu "Kho ảnh & Soạn toa Hoàng Hưng" (14/10/2026) ===== */
:root { --navy: #14294a; --navy-2: #1d3a63; --brand: #0f7a85; --brand-ink: #fff; --brand-soft: #e3f3f4; --orange: #d9732a; --orange-soft: #fdeee2; --sky-soft: #e6f1fb; --bg: #f4f6f9; --line: #e3e8ef; --ink: #142033; --muted: #64707f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --navy: #0d1a2e; --navy-2: #1a2d4a; --brand: #3fb3bd; --brand-ink: #062226; --brand-soft: #123236; --orange: #f0a062; --orange-soft: #3a2616; --sky-soft: #15283c; --bg: #0f141b; --card: #18202a; --line: #2a3442; --ink: #e8edf3; --muted: #93a0b0; } }
:root[data-theme="dark"] { --navy: #0d1a2e; --navy-2: #1a2d4a; --brand: #3fb3bd; --brand-ink: #062226; --brand-soft: #123236; --orange: #f0a062; --orange-soft: #3a2616; --sky-soft: #15283c; --bg: #0f141b; --card: #18202a; --line: #2a3442; --ink: #e8edf3; --muted: #93a0b0; }
.top .brand { color: var(--navy); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .top .brand { color: var(--ink); } }
@media (min-width: 900px) {
  .top { display: none; }
  nav.side { background: var(--navy); border-right: 0; top: 0; height: 100vh; width: 230px; padding: 18px 12px; color: #fff; }
  nav.side .logo { text-align: center; margin: 6px 0 22px; color: #fff; }
  nav.side .logo b { display: inline-flex; width: 52px; height: 52px; border: 2px solid #fff; border-radius: 10px; align-items: center; justify-content: center; font-size: 1.35rem; letter-spacing: -1px; }
  nav.side .logo div { font-weight: 700; font-size: 1.15rem; margin-top: 6px; }
  nav.side a { color: #dfe7f2; padding: 11px 14px; font-size: .98rem; }
  nav.side a:hover { background: rgba(255,255,255,.06); }
  nav.side a.on { background: var(--navy-2); color: #fff; }
  nav.side .me { margin-top: 18px; padding: 10px 14px; font-size: .82rem; color: #9fb0c8; border-top: 1px solid rgba(255,255,255,.1); }
  main { max-width: 1500px; }
}
nav.side .logo, nav.side .me { display: none; }
@media (min-width: 900px) { nav.side .logo, nav.side .me { display: block; } }
.pagehead { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.pagehead h1 { margin: 0 8px 0 0; font-size: 1.7rem; color: var(--navy); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pagehead h1 { color: var(--ink); } }
.search { flex: 1; min-width: 220px; position: relative; display: flex; gap: 6px; }
.search input { padding-left: 38px; }
.search::before { content: "🔍"; position: absolute; left: 12px; top: 11px; font-size: .9rem; opacity: .6; }
button.out, .btn.out { border-color: var(--brand); color: var(--brand); background: var(--card); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { display: flex; gap: 14px; align-items: center; padding: 16px 18px; border-radius: 12px; text-decoration: none; color: var(--ink); background: var(--sky-soft); }
.tile.o { background: var(--orange-soft); } .tile.t { background: var(--brand-soft); }
.tile .ic { font-size: 1.8rem; }
.tile span { display: block; font-size: .92rem; } .tile b { font-size: 1.45rem; }
.kho { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 1250px) { .kho { grid-template-columns: 1fr 330px; } .kho .panel { position: sticky; top: 16px; align-self: start; } }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.pcard { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.pcard .ph { position: relative; aspect-ratio: 5/4; background: var(--grey-soft); display: block; }
.pcard .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcard .dots { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 4px; background: rgba(255,255,255,.85); padding: 3px 5px; border-radius: 99px; }
.pcard .dots i { width: 12px; height: 12px; border-radius: 50%; border: 1px solid #bbb; display: block; }
.pcard .badge { position: absolute; right: 8px; top: 8px; background: var(--orange-soft); color: var(--orange); font-size: .78rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; }
.pcard .bd { padding: 10px 12px 8px; font-size: .86rem; flex: 1; }
.pcard .bd .tt { font-weight: 700; font-size: .95rem; margin-bottom: 4px; color: var(--ink); text-decoration: none; display: block; }
.pcard .cr { display: grid; grid-template-columns: 62px 1fr; gap: 4px; color: var(--muted); line-height: 1.5; }
.pcard .cr b { color: var(--ink); font-weight: 600; }
.pcard .cr .cb { color: var(--ok); font-weight: 700; } .pcard .cr .cb.z { color: var(--bad); }
.pcard .ft { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px 10px; font-size: .85rem; color: var(--muted); gap: 6px; }
.pcard .ft a { text-decoration: none; }
.pin { color: var(--brand); }
.locpill { display: inline-flex; align-items: center; gap: 5px; background: var(--brand-soft); color: var(--brand); font-weight: 600; border-radius: 8px; padding: 4px 10px; font-size: .88rem; margin: 3px 4px 0 0; }
.panel .card { padding: 0; overflow: hidden; }
.panel .ph { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 700; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: .8rem; font-weight: 700; background: var(--orange-soft); color: var(--orange); white-space: nowrap; }
.pill.info { background: var(--sky-soft); color: var(--info); } .pill.ok { background: var(--ok-soft); color: var(--ok); }
.oline { display: grid; grid-template-columns: 84px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; margin: 8px 12px; background: var(--card); }
.oline img, .oline .crop { width: 84px; height: 84px; border-radius: 8px; object-fit: cover; }
.oline .t1 { font-weight: 700; }
.cus { display: flex; gap: 10px; align-items: center; padding: 12px 14px; text-decoration: none; color: var(--ink); }
.cus .av { font-size: 1.4rem; color: var(--brand); }
.actbar { display: flex; gap: 10px; padding: 12px; }
.actbar > * { flex: 1; }
@media (max-width: 899px) {
  .actbar.stick { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); background: var(--bg); z-index: 5; margin: 0 -16px; padding: 10px 16px; border-top: 1px solid var(--line); }
}
.res { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 760px) { .res { grid-template-columns: 220px 1fr; } }
.res .std img { width: 100%; border-radius: 10px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 4px 10px; font-size: .95rem; }
.kv b { font-size: 1.05rem; }
.big3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.big3 div { background: var(--grey-soft); border-radius: 10px; padding: 8px; text-align: center; }
.big3 b { display: block; font-size: 1.5rem; }
.big3 .cb { background: var(--ok-soft); color: var(--ok); }
.lbl.ao { padding: 2mm; gap: 2mm; } .lbl.ao .t b { font-size: 12pt; } .lbl.ao .t { font-size: 8.5pt; }
.labels.ao { grid-template-columns: repeat(auto-fill, minmax(45mm, 1fr)); gap: 2mm; }
.pcard .mh { font-size: 1.15rem; letter-spacing: .2px; color: var(--navy); font-family: ui-monospace, Consolas, monospace; font-weight: 800; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pcard .mh { color: var(--ink); } }
.sz { display: inline-block; background: var(--navy); color: #fff; font-weight: 700; font-size: .8rem; padding: 2px 9px; border-radius: 6px; margin: 2px 0 6px; }
.demo-tag { position: fixed; right: 12px; bottom: 12px; z-index: 50; background: var(--orange); color: #fff; font-weight: 700; font-size: .8rem; padding: 4px 10px; border-radius: 99px; }
.pcard .vt { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 6px 0; }
.pcard .vt span { background: var(--brand-soft); color: var(--brand); border-radius: 6px; padding: 1px 7px; font-size: .8rem; font-family: ui-monospace, Consolas, monospace; }
.pcard .vt b { font-family: system-ui, sans-serif; }

.pcard .riov { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(transparent, rgba(10,22,40,.88) 30%); color: #fff; padding: 22px 10px 8px; font-size: .86rem; }
.pcard .riov .rc { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.pcard .riov .rc span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.pcard .riov i { width: 11px; height: 11px; border-radius: 50%; border: 1px solid rgba(255,255,255,.8); display: inline-block; }
.pcard .riov b { font-size: 1rem; }
.pcard .riov .tg { margin-top: 3px; font-weight: 700; color: #ffd27a; }
@media (max-width: 899px) {
  .tiles { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .tile { flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px; }
  .tile .ic { font-size: 1.2rem; } .tile span { font-size: .78rem; } .tile b { font-size: 1.05rem; }
  .pagehead h1 { font-size: 1.4rem; }
  .pcard .ph { aspect-ratio: 1; }
}

/* Lưới ảnh từng màu */
.pcard .phm { display: block; text-decoration: none; }
.lm { display: grid; gap: 2px; background: var(--line); }
.lm.c2 { grid-template-columns: repeat(2, 1fr); } .lm.c3 { grid-template-columns: repeat(3, 1fr); } .lm.c4 { grid-template-columns: repeat(2, 1fr); }
.lm.c5, .lm.c6 { grid-template-columns: repeat(3, 1fr); }
.lm .t { position: relative; aspect-ratio: 3/4; overflow: hidden; background: var(--grey-soft); }
.lm .t img, .lm .t .sw { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.lm .t .lb { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 4px; padding: 14px 7px 5px; background: linear-gradient(transparent, rgba(10,22,40,.9) 45%); color: #fff; font-size: .82rem; }
.lm .t .lb b { font-size: 1.1rem; }
.lm .t.het img, .lm .t.het .sw { filter: grayscale(1) brightness(.75); opacity: .55; }
.lm .t.het .lb b { color: #ff8a80; }
.lm .t .x { position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%) rotate(-14deg); border: 3px solid #e53935; color: #e53935; background: rgba(255,255,255,.88); font-weight: 900; font-size: 1.15rem; padding: 2px 10px; border-radius: 6px; letter-spacing: 1px; text-align: center; line-height: 1.1; }
.lm .t .x small { display: block; font-size: .62rem; letter-spacing: 0; font-weight: 700; }
.lmsum { background: var(--navy); color: #ffd27a; font-weight: 700; padding: 7px 12px; font-size: .9rem; }
.lmsum b { color: #fff; } .lmsum.het { background: #b3261e; color: #fff; }
.pcard .riov .rc span.z { opacity: .7; text-decoration: line-through; }
.pcard .riov .rc span.z b { color: #ff8a80; text-decoration: none; }
.pcard .riov.het .tg { color: #ff8a80; }

.mrows { display: grid; gap: 8px; margin-bottom: 12px; }
.mrow { display: flex; gap: 10px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.mrow img, .mrow .sw { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; flex: none; }
.mrow.het img, .mrow.het .sw { filter: grayscale(1); opacity: .5; }
.mrow .cbn { font-weight: 800; color: var(--ok); font-size: 1.05rem; }
@media (min-width: 900px) { .mrows { display: none; } }
@media (max-width: 899px) { .chi-may-tinh { display: none; } }
