/* Căn yêu thích + so sánh (20/11/2026), đi kèm js/shortlist.js. Nạp sau css/finesse.css. Chỉ thêm, không đổi bố cục đã chốt.
   Mục: 1 nút lưu (dòng căn, trang căn) · 2 lối vào "Đã lưu · N" · 3 bảng so sánh · 4 điện thoại · 5 giảm chuyển động
   Gỡ thử: bỏ 2 dòng nạp trong index.html. */

/* ===== 1 · nút lưu: dấu cộng trong vòng mảnh → vòng đặc có dấu tích. Nằm dưới số căn, không làm đổi chiều cao dòng ===== */
.sl-save { position: relative; display: inline-flex; align-items: center; gap: 8px; margin-top: 7px; padding: 0; min-height: 22px; cursor: pointer;
  font-family: var(--sans); font-stretch: 112%; font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; color: var(--ink-2); transition: color .3s; }
.sl-save::before { content: ""; position: absolute; inset: -11px -10px -9px -8px; }          /* vùng chạm rộng hơn dấu nhìn thấy */
.sl-g { width: 16px; height: 16px; flex: none; overflow: visible; fill: none; stroke: currentColor; stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; }
.sl-ring { fill: transparent; transition: fill .35s var(--fx-out), stroke .3s; }
.sl-plus { transform-origin: 8px 8px; transition: transform .5s var(--fx-out), opacity .2s; }
.sl-tick { stroke: #fff; stroke-width: 1.3; stroke-dasharray: 12; stroke-dashoffset: 12; transition: stroke-dashoffset .45s var(--fx-out) .05s; }
.sl-save[aria-pressed="true"] { color: var(--taupe); }
.sl-save[aria-pressed="true"] .sl-ring { fill: var(--taupe); stroke: var(--taupe); }
.sl-save[aria-pressed="true"] .sl-plus { opacity: 0; transform: rotate(90deg); }
.sl-save[aria-pressed="true"] .sl-tick { stroke-dashoffset: 0; }
@media (hover: hover) { .sl-save:hover { color: var(--taupe); } }
.sl-save:focus-visible { outline: 1px solid currentColor; outline-offset: 6px; }
/* trang căn: nút to hơn, nằm bên phải dòng trạng thái */
.sl-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 20px; }
.sl-save.big { margin-top: 0; min-height: 44px; padding: 0 20px 0 16px; gap: 11px; border: 1px solid var(--line); font-size: 12.5px; transition: color .3s, border-color .3s; }
.sl-save.big::before { display: none; }
.sl-save.big[aria-pressed="true"], .sl-save.big:hover { border-color: var(--taupe); }

/* ===== 2 · lối vào "Đã lưu · N": đầu bảng căn và thanh trên (máy bàn; thanh trên lấy kiểu của .top-nav) ===== */
.sl-entry.in-head { position: relative; flex: none; padding: 10px 0; font-family: var(--sans); font-stretch: 112%; font-size: 12px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; white-space: nowrap; color: var(--taupe); }
.sl-entry.in-head::after { content: ""; position: absolute; left: 0; right: .16em; bottom: 6px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: 0 50%; transition: transform .45s var(--fx-out); }
.sl-entry.in-head:hover::after, .sl-entry.in-head:focus-visible::after { transform: scaleX(1); }
.sl-entry.in-head:hover { color: var(--ink); }
@keyframes sl-pop { from { opacity: 0; transform: translateY(5px); } }
.sl-entry:not([hidden]) { animation: sl-pop .6s var(--fx-out) both; }

/* ===== 3 · bảng so sánh toàn màn ===== */
html.sl-lock, html.sl-lock body { overflow: hidden; }
@keyframes sl-fade { from { opacity: 0; } }
@keyframes sl-rise { from { opacity: 0; transform: translateY(18px); } }
.sl-ov { display: none; position: fixed; inset: 0; z-index: 44; background: var(--paper); color: var(--ink); font-family: var(--sans); }
.sl-ov.on { display: block; animation: sl-fade .45s var(--fx-out) both; }
.sl-ov.on.leave { opacity: 0; transition: opacity .25s; animation: none; }
.sl-sheet { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); outline: none; }
.sl-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 76px; padding: env(safe-area-inset-top, 0px) max(40px, env(safe-area-inset-right, 0px)) 0 max(40px, env(safe-area-inset-left, 0px)); border-bottom: 1px solid var(--line); }
.sl-eyebrow { margin: 0 0 2px; font-family: var(--sans); font-stretch: 112%; font-size: 11.5px; font-weight: 500; letter-spacing: .22em; text-transform: uppercase; color: var(--taupe); }
.sl-ttl h2 { margin: 0; font-family: var(--serif); font-weight: 300; font-size: 34px; line-height: 1.1; color: var(--ink); }
.sl-count { margin-left: .35em; color: var(--taupe); }
.sl-tools { display: flex; align-items: center; gap: 14px; }
.sl-copy { padding: 12px 20px; border: 1px solid var(--ink); font-family: var(--sans); font-stretch: 112%; font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; color: var(--ink); transition: background .4s var(--fx-out), color .4s; }
.sl-x { width: 44px; height: 44px; display: grid; place-items: center; font-size: 32px; font-weight: 200; line-height: 1; color: var(--ink); transition: color .3s, transform .5s var(--fx-out); }
@media (hover: hover) { .sl-copy:hover { background: var(--ink); color: #fff; } .sl-x:hover { color: var(--taupe); transform: rotate(90deg); } }
.sl-ov button:focus-visible, .sl-ov a:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }

.sl-body { overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(124, 114, 98, .35) transparent; }
/* các cột dùng chung hàng lưới (subgrid): ảnh, số căn, từng thông số, nút nằm đúng một đường ngang qua mọi cột */
.sl-grid { display: grid; grid-template-columns: repeat(var(--n, 1), minmax(0, 1fr)); grid-template-rows: auto auto auto auto auto auto auto auto;
  width: min(100%, calc(var(--n, 1) * 380px + 80px)); margin: 0 auto; padding: 26px 40px 56px; }
.sl-col { display: grid; grid-template-rows: subgrid; grid-row: 1 / span 8; min-width: 0; padding: 0 26px; border-left: 1px solid var(--line); }
.sl-col:first-child { border-left: 0; }
.sl-ov:not(.settled) .sl-col { animation: sl-rise .9s var(--fx-out) both; animation-delay: calc(var(--i, 0) * 80ms + 120ms); }
.sl-pic { aspect-ratio: 16 / 10; background: var(--bone); overflow: hidden; }
.sl-pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sl-id { padding: 18px 0 13px; }
.sl-num { font-family: var(--serif); font-weight: 300; font-size: 68px; line-height: .95; color: var(--taupe); font-variant-numeric: lining-nums; letter-spacing: -.01em; }
.sl-num small { font-size: .5em; letter-spacing: 0; }
.sl-type { margin: 10px 0 0; font-family: var(--sans); font-stretch: 112%; font-size: 12px; font-weight: 500; letter-spacing: .18em; text-transform: uppercase; color: var(--taupe); }
.sl-spec { padding: 11px 0 12px; border-top: 1px solid var(--line); }
.sl-k { display: block; font-family: var(--sans); font-stretch: 112%; font-size: 11.5px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); }
.sl-v { display: block; margin-top: 5px; font-size: 17px; line-height: 1.4; color: var(--ink); }
.sl-spec.num .sl-v { font-family: var(--serif); font-weight: 300; font-size: 28px; line-height: 1.15; color: var(--ink); font-variant-numeric: lining-nums; }
.sl-st .status { margin-top: 7px; }
.sl-act { display: flex; align-items: stretch; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.sl-go { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 16px; min-height: 46px; border: 1px solid var(--ink); text-decoration: none;
  font-family: var(--sans); font-stretch: 112%; font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; color: var(--ink); transition: background .4s var(--fx-out), color .4s; }
.sl-go i { font-style: normal; transition: transform .5s var(--fx-out); }
.sl-del, .sl-keep { min-width: 62px; padding: 0 16px; border: 1px solid var(--line); font-family: var(--sans); font-stretch: 112%; font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; color: var(--ink-2); transition: border-color .3s, color .3s; }
.sl-keep[aria-pressed="true"] { border-color: var(--taupe); color: var(--taupe); }
@media (hover: hover) { .sl-go:hover { background: var(--ink); color: #fff; } .sl-go:hover i { transform: translateX(5px); } .sl-del:hover, .sl-keep:hover { border-color: var(--taupe); color: var(--ink); } }
@supports not (grid-template-rows: subgrid) { .sl-col { display: block; } .sl-spec { min-height: 88px; } .sl-act { margin-top: 8px; } }

/* ===== 4 · điện thoại: hai căn đứng cạnh nhau; từ ba căn trở lên các cột trượt ngang, dừng đúng từng cột ===== */
@media (max-width: 860px) {
  .sl-entry.in-head { margin-left: auto; font-size: 11.5px; letter-spacing: .12em; }
  .app.unit-open .panel-head:has(.sl-entry:not([hidden])) .panel-title { display: none; }   /* trang căn đã có số căn rất lớn; nhường chỗ cho lối vào "Đã lưu" */
  .sl-top { min-height: 64px; gap: 10px; padding: env(safe-area-inset-top, 0px) max(8px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); }
  .sl-eyebrow { font-size: 10.5px; letter-spacing: .18em; }
  .sl-ttl h2 { font-size: 24px; }
  .sl-tools { gap: 4px; }
  .sl-copy { padding: 11px 13px; font-size: 11px; letter-spacing: .1em; }
  .sl-grid { width: 100%; padding: 22px 12px calc(40px + env(safe-area-inset-bottom, 0px)); }
  .sl-col { padding: 0 12px; }
  .sl-num { font-size: 50px; }
  .sl-id { padding: 18px 0 14px; }
  .sl-type { font-size: 11px; letter-spacing: .14em; }
  .sl-v { font-size: 16px; }
  .sl-spec.num .sl-v { font-size: 26px; }
  .sl-act { flex-direction: column; }
  .sl-go { min-height: 46px; }
  .sl-del, .sl-keep { min-height: 42px; }
  .sl-st .status { font-size: 12px; letter-spacing: .08em; }
  .sl-body:has(.sl-grid[data-n="3"], .sl-grid[data-n="4"]) { scroll-snap-type: x mandatory; }
  .sl-grid[data-n="3"], .sl-grid[data-n="4"] { width: max-content; grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: min(68vw, 290px); padding-left: 4px; padding-right: 4px; }
  .sl-grid[data-n="3"] .sl-col, .sl-grid[data-n="4"] .sl-col { scroll-snap-align: start; scroll-margin-left: 4px; padding: 0 12px; }
  .sl-grid[data-n="1"] { width: min(100%, 420px); }
  .sl-grid[data-n="1"] .sl-col { padding: 0 8px; }
}

/* ===== 5 · người dùng tắt chuyển động ===== */
@media (prefers-reduced-motion: reduce) {
  .sl-ov.on, .sl-ov:not(.settled) .sl-col, .sl-entry:not([hidden]) { animation: none; }
  .sl-ring, .sl-plus, .sl-tick, .sl-go i, .sl-x, .sl-save, .sl-ov.on.leave { transition: none; }
}
