/* NPK Cò Bay — giao diện kính mờ (Liquid Glass) */
:root {
  --green: #10A04B;
  --green-2: #2CC266;
  --green-ink: #0B7A39;
  --leaf: #76C044;
  --ink: #0F1A12;
  --ink-2: #3B4A3F;
  --muted: #6B7A6F;
  --line: rgba(15, 60, 30, .08);
  --bg-1: #F4FBF6;
  --bg-2: #E3F4E8;
  --glass: rgba(255, 255, 255, .58);
  --glass-strong: rgba(255, 255, 255, .78);
  --glass-edge: rgba(255, 255, 255, .85);
  --glass-shadow: 0 10px 40px rgba(24, 90, 48, .10), 0 2px 8px rgba(24, 90, 48, .06);
  --hi: inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 -1px 0 rgba(255, 255, 255, .35);
  --ok: #16A34A; --ok-bg: rgba(22, 163, 74, .12);
  --low: #EA8A0C; --low-bg: rgba(234, 138, 12, .14);
  --out: #E5372F; --out-bg: rgba(229, 55, 47, .12);
  --n: #10A04B; --p: #E08A00; --k: #2F6FD6;
  --r-xl: 28px; --r-l: 22px; --r-m: 16px; --r-s: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #EEF6F0; --ink-2: #C9D8CD; --muted: #93A698; --line: rgba(255, 255, 255, .08);
    --bg-1: #08140C; --bg-2: #0E2215;
    --glass: rgba(28, 48, 34, .52); --glass-strong: rgba(30, 52, 37, .78); --glass-edge: rgba(255, 255, 255, .14);
    --glass-shadow: 0 10px 40px rgba(0, 0, 0, .35); --hi: inset 0 1px 0 rgba(255, 255, 255, .10);
    --green-ink: #5FD394; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #EEF6F0; --ink-2: #C9D8CD; --muted: #93A698; --line: rgba(255, 255, 255, .08);
  --bg-1: #08140C; --bg-2: #0E2215;
  --glass: rgba(28, 48, 34, .52); --glass-strong: rgba(30, 52, 37, .78); --glass-edge: rgba(255, 255, 255, .14);
  --glass-shadow: 0 10px 40px rgba(0, 0, 0, .35); --hi: inset 0 1px 0 rgba(255, 255, 255, .10);
  --green-ink: #5FD394; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); color: var(--ink); font-size: 16px; line-height: 1.45;
  background: linear-gradient(170deg, var(--bg-1) 0%, var(--bg-2) 100%) fixed;
  min-height: 100vh; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  letter-spacing: -.005em;
}
img { display: block; max-width: 100%; }
a { color: var(--green-ink); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid rgba(16, 160, 75, .45); outline-offset: 2px; border-radius: 10px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Nền lá cây mờ ---------- */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .75; }
.o1 { width: 60vw; height: 60vw; left: -18vw; top: -22vw; background: radial-gradient(circle, #BDEBC9, transparent 70%); }
.o2 { width: 55vw; height: 55vw; right: -20vw; bottom: -18vw; background: radial-gradient(circle, #CFF0D3, transparent 70%); }
.leaf {
  position: absolute; width: 420px; height: 420px; opacity: .55; filter: blur(1.5px);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='1' x2='1' y2='0'%3E%3Cstop offset='0' stop-color='%2346B85E'/%3E%3Cstop offset='1' stop-color='%23B9EBA4'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M20 185C25 95 85 30 185 15C175 110 115 175 20 185Z' fill='url(%23g)'/%3E%3Cpath d='M22 183C70 130 110 85 175 25' stroke='%23E8FFE6' stroke-width='3' fill='none' opacity='.7'/%3E%3C/svg%3E") center/contain no-repeat;
}
.l1 { left: -150px; bottom: -60px; transform: rotate(-8deg); }
.l2 { right: -170px; top: 60px; width: 360px; height: 360px; transform: rotate(160deg); opacity: .35; filter: blur(4px); }
.l3 { left: 30%; bottom: -260px; width: 380px; height: 380px; transform: rotate(40deg); opacity: .25; filter: blur(6px); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .leaf { opacity: .12; } :root:not([data-theme="light"]) .orb { opacity: .25; } }

/* ---------- Vật liệu kính ---------- */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(170%); backdrop-filter: blur(24px) saturate(170%);
  border: 1px solid var(--glass-edge); box-shadow: var(--glass-shadow), var(--hi);
}

/* ---------- Khung trang ---------- */
.shell { max-width: 1440px; margin: 0 auto; }
#app { padding: 0 16px calc(96px + var(--safe-b)); min-height: 100vh; }
.sidebar { display: none; }
@media (min-width: 1024px) {
  .shell { display: grid; grid-template-columns: 248px 1fr; gap: 20px; padding: 20px; }
  .sidebar {
    display: flex; flex-direction: column; position: sticky; top: 20px; height: calc(100vh - 40px);
    border-radius: var(--r-xl); padding: 22px 14px;
  }
  #app { padding: 6px 4px 40px; min-width: 0; }
  .tabbar { display: none !important; }
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); padding: 0 8px 18px; }
.brand img { width: 58px; height: auto; }
.brand b { display: block; font-size: 20px; letter-spacing: -.02em; color: #0B6B33; }
.brand small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand b { color: #8FE0A8; } }
.sidenav { display: grid; gap: 6px; margin-top: 10px; }
.sidenav a {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; color: var(--ink-2);
  text-decoration: none; font-weight: 600; font-size: 15px;
}
.sidenav a:hover { background: rgba(255, 255, 255, .45); }
.sidenav svg, .tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sidenav a[aria-current="page"] { color: #fff; background: linear-gradient(180deg, var(--green-2), var(--green)); box-shadow: 0 8px 20px rgba(16, 160, 75, .35), inset 0 1px 0 rgba(255, 255, 255, .45); }
.side-foot { margin-top: auto; padding: 14px 10px 0; font-size: 12.5px; color: var(--muted); }
.side-foot b { display: block; color: var(--ink); font-size: 18px; letter-spacing: -.02em; }

/* ---------- Thanh tab nổi (điện thoại) ---------- */
.tabbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(10px + var(--safe-b)); z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 6px; border-radius: 26px;
  background: var(--glass-strong);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 6px; border-radius: 20px; color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 600; }
.tabbar a[aria-current="page"] { color: var(--green-ink); background: rgba(16, 160, 75, .12); box-shadow: inset 0 0 0 1px rgba(16, 160, 75, .18); }

/* ---------- Đầu trang ---------- */
.topbar { display: flex; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top, 0px) + 14px) 0 6px; }
.topbar .brand { padding: 0; }
.topbar .brand img { width: 46px; }
.topbar .brand b { font-size: 19px; }
.topbar .spacer { flex: 1; }
@media (min-width: 1024px) { .topbar .brand { display: none; } }
.chip-asof { font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 7px 12px; border-radius: 99px; white-space: nowrap; }
.chip-asof.stale { color: var(--out); }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex: none; border: 1px solid var(--glass-edge); background: var(--glass); box-shadow: var(--hi), 0 4px 14px rgba(24, 90, 48, .08); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.page-title { margin: 10px 0 2px; font-size: clamp(30px, 7.5vw, 44px); line-height: 1.08; font-weight: 800; letter-spacing: -.035em; }
.page-sub { margin: 0 0 16px; color: var(--muted); font-size: 15px; }

/* ---------- Ô tìm kiếm ---------- */
.searchrow { display: flex; gap: 12px; align-items: stretch; margin-bottom: 18px; }
.search { flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 8px 0 16px; border-radius: 20px; min-height: 56px; background: var(--glass-strong); }
.search > svg { width: 22px; height: 22px; fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-linecap: round; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 17px; padding: 14px 0; }
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { display: none; }
.scan { width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); text-decoration: none; }
.scan svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.searchrow .btn-search { display: none; }
@media (min-width: 760px) { .searchrow .btn-search { display: inline-flex; } }

.btn {
  border: 0; border-radius: 18px; padding: 0 22px; min-height: 52px; font-weight: 700; font-size: 16px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap;
}
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn-green {
  color: #fff; background: linear-gradient(180deg, #34C96B 0%, #0E9A43 100%);
  box-shadow: 0 10px 24px rgba(16, 160, 75, .35), inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -2px 0 rgba(0, 80, 30, .25);
}
.btn-glass { background: var(--glass-strong); border: 1px solid var(--glass-edge); box-shadow: var(--hi), 0 4px 14px rgba(24, 90, 48, .08); color: var(--ink); }
.btn-zalo { color: #fff; background: linear-gradient(180deg, #2E86FF, #0062E6); box-shadow: 0 10px 24px rgba(0, 98, 230, .3), inset 0 1px 0 rgba(255, 255, 255, .45); }

/* ---------- Lưới cây trồng ---------- */
.crops { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 760px) { .crops { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
.crop {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 12px; border-radius: var(--r-l);
  cursor: pointer; text-align: left; min-height: 104px; border: 1px solid var(--glass-edge); color: var(--ink);
  transition: transform .15s ease, box-shadow .15s ease;
}
.crop:active { transform: scale(.98); }
.crop img { width: 64px; height: 64px; object-fit: contain; flex: none; filter: drop-shadow(0 6px 8px rgba(30, 60, 20, .18)); }
.crop .tx b { display: block; font-size: 16px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; color: var(--ink); }
.crop .tx > span { font-size: 13px; color: var(--muted); }
.crop .chev { margin-left: auto; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--glass-strong); flex: none; box-shadow: var(--hi); }
.crop .chev svg { width: 14px; height: 14px; fill: none; stroke: var(--ink-2); stroke-width: 2.4; stroke-linecap: round; }
.crop[aria-pressed="true"] { background: linear-gradient(160deg, rgba(220, 248, 228, .85), rgba(196, 238, 206, .6)); border-color: rgba(16, 160, 75, .45); box-shadow: 0 0 0 1px rgba(16, 160, 75, .25), var(--glass-shadow); }
@media (min-width: 760px) {
  .crop { min-height: 136px; padding: 18px 20px; gap: 18px; }
  .crop img { width: 96px; height: 96px; }
  .crop .tx b { font-size: 20px; } .crop .tx > span { font-size: 15px; }
}
@media (max-width: 759px) {
  .crop { flex-direction: column; align-items: flex-start; gap: 6px; min-height: 0; padding: 12px; }
  .crop img { width: 58px; height: 58px; }
  .crop .chev { position: absolute; top: 12px; right: 12px; }
}

/* ---------- Khối sản phẩm theo cây trồng ---------- */
.panel { border-radius: var(--r-xl); padding: 18px; margin-top: 18px; }
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-head img { width: 52px; height: 52px; object-fit: contain; flex: none; }
.panel-head h2 { margin: 0; font-size: 19px; letter-spacing: -.02em; }
.panel-head h2 small { font-size: 14px; color: var(--muted); font-weight: 500; }
.panel-head p { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); }
.panel-head .more { margin-left: auto; font-size: 14px; font-weight: 600; padding: 10px 14px; border-radius: 14px; text-decoration: none; color: var(--green-ink); white-space: nowrap; }
@media (max-width: 759px) { .panel { padding: 14px; } .panel-head p, .panel-head img { display: none; } .panel-head h2 { font-size: 17px; } .panel-head h2 small { display: block; font-size: 13px; } .panel-head .more { padding: 8px 12px; } }

.pcards { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .pcards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1280px) { .pcards { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1700px) { .pcards { grid-template-columns: repeat(4, 1fr); } }
.pcard {
  display: grid; grid-template-columns: 84px 1fr auto; gap: 12px; align-items: center; padding: 12px; border-radius: 20px;
  text-decoration: none; color: inherit; background: var(--glass-strong); border: 1px solid var(--glass-edge); box-shadow: var(--hi), 0 4px 16px rgba(24, 90, 48, .06);
}
.pcard .thumb { width: 84px; height: 104px; }
.pcard .nm { font-weight: 700; font-size: 15.5px; line-height: 1.25; letter-spacing: -.01em; }
.pcard .meta { font-size: 13px; color: var(--muted); margin-top: 3px; }
.pcard .qty { white-space: nowrap; font-size: 19px; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.pcard .qty small { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.pcard .pill { margin-top: 6px; }
.pcard .go svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; }

.thumb { display: grid; place-items: center; position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(20, 60, 30, .18)); }
.thumb .ph { width: 100%; height: 100%; border-radius: 14px; display: grid; place-items: center; background: rgba(255, 255, 255, .5); box-shadow: inset 0 0 0 1px var(--line); }
.thumb .ph svg { width: 46%; height: 46%; fill: none; stroke: rgba(16, 120, 60, .35); stroke-width: 1.5; stroke-linejoin: round; }
.thumb .sw { width: 70%; aspect-ratio: 1; border-radius: 50%; box-shadow: inset 0 -6px 12px rgba(0, 0, 0, .18), inset 0 6px 10px rgba(255, 255, 255, .45), 0 6px 14px rgba(0, 0, 0, .12); }

/* Nhãn tình trạng */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 99px; white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: var(--ok-bg); }
.pill.low { color: var(--low); background: var(--low-bg); }
.pill.out { color: var(--out); background: var(--out-bg); }
.pill.off { color: var(--muted); background: rgba(120, 130, 120, .14); }

/* ---------- Trang tra cứu tồn kho ---------- */
.filters { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 900px) { .filters { grid-template-columns: repeat(3, 1fr) auto; gap: 12px; } }
.fsel { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 14px; border-radius: 16px; min-height: 52px; }
.fsel label { font-size: 14px; font-weight: 600; white-space: nowrap; }
.fsel select { flex: 1; min-width: 0; appearance: none; -webkit-appearance: none; border: 0; border-radius: 12px; padding: 9px 30px 9px 12px; font-size: 14px; background: var(--glass-strong) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%233B4A3F' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") right 8px center/16px no-repeat; box-shadow: inset 0 0 0 1px var(--line); }
@media (max-width: 899px) { .fsel label { display: none; } .fsel { padding: 4px; min-height: 48px; } .fsel select { background-color: transparent; box-shadow: none; } .fsel.wide { grid-column: span 2; } }
.btn-more { min-height: 52px; border-radius: 16px; padding: 0 18px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { border-radius: var(--r-l); padding: 14px; display: flex; align-items: center; gap: 12px; cursor: pointer; border: 1px solid var(--glass-edge); text-align: left; color: var(--ink); }
.stat svg { width: 46px; height: 46px; flex: none; }
.stat b { display: block; font-size: 30px; line-height: 1; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .t { display: block; font-weight: 700; font-size: 15px; margin-top: 2px; }
.stat .s { display: block; font-size: 12px; color: var(--muted); }
.stat.warn b, .stat.warn .t { color: var(--out); }
.stat.warn { background: linear-gradient(160deg, rgba(255, 235, 233, .75), rgba(255, 255, 255, .5)); }
@media (max-width: 759px) { .stat { flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px; } .stat svg { width: 34px; height: 34px; } .stat b { font-size: 24px; } .stat .s { display: none; } .stat .t { font-size: 13px; } }

.seg { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 12px; padding: 2px 16px; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: none; border: 0; border-radius: 99px; padding: 9px 14px; font-size: 14px; font-weight: 600; cursor: pointer; background: var(--glass); box-shadow: inset 0 0 0 1px var(--glass-edge); color: var(--ink-2); }
.seg button[aria-pressed="true"] { color: #fff; background: linear-gradient(180deg, #34C96B, #0E9A43); box-shadow: 0 6px 16px rgba(16, 160, 75, .3), inset 0 1px 0 rgba(255, 255, 255, .5); }

.listwrap { display: grid; gap: 16px; }
@media (min-width: 1280px) { .listwrap.has-detail { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; } }
@media (max-width: 1699px) { .listwrap.has-detail .ptable .col-size { display: none; } }
.tablecard { border-radius: var(--r-xl); padding: 16px; min-width: 0; overflow-x: auto; }
.tablecard h2 { margin: 2px 4px 12px; font-size: 18px; letter-spacing: -.02em; }
.tablecard h2 small { color: var(--muted); font-weight: 500; font-size: 14px; }
.ptable { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
.ptable th { text-align: left; font-size: 13px; color: var(--ink-2); font-weight: 600; padding: 4px 12px; }
.ptable td { padding: 8px 12px; background: var(--glass-strong); font-size: 14.5px; vertical-align: middle; }
.ptable tr.row { cursor: pointer; }
.ptable td:first-child { border-radius: 16px 0 0 16px; }
.ptable td:last-child { border-radius: 0 16px 16px 0; }
.ptable tr.sel td { background: linear-gradient(180deg, rgba(222, 248, 230, .95), rgba(205, 241, 214, .85)); box-shadow: inset 0 1px 0 rgba(16, 160, 75, .25), inset 0 -1px 0 rgba(16, 160, 75, .25); }
.ptable .pn { display: flex; align-items: center; gap: 12px; }
.ptable .pn .thumb { width: 44px; height: 52px; }
.ptable .pn b { display: block; font-size: 14.5px; color: var(--ink); }
.ptable .pn > span > span { font-size: 12.5px; color: var(--muted); }
.ptable td.nw { white-space: nowrap; }
.ptable .num { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ptable .num small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.ptable .chev svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; }
.only-wide { display: none; }
@media (min-width: 900px) { .only-wide { display: block; } .only-narrow { display: none !important; } }

/* ---------- Chi tiết sản phẩm ---------- */
.detail { border-radius: var(--r-xl); padding: 18px; }
@media (min-width: 1280px) { .listwrap .detail { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow: auto; } }
.d-head { display: flex; gap: 10px; align-items: flex-start; }
.d-head h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; line-height: 1.2; flex: 1; }
.d-code { color: var(--muted); font-size: 13.5px; margin: 4px 0 14px; }
.d-imgs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.d-img { border: 0; padding: 0; cursor: zoom-in; background: var(--glass-strong); border-radius: 18px; box-shadow: inset 0 0 0 1px var(--glass-edge), var(--hi); text-align: center; }
.d-img .box { aspect-ratio: 4 / 5; display: grid; place-items: center; padding: 10px; }
.d-img img { max-height: 100%; object-fit: contain; filter: drop-shadow(0 8px 14px rgba(20, 60, 30, .2)); }
.d-img .sw { width: 72%; aspect-ratio: 1; border-radius: 50%; box-shadow: inset 0 -8px 16px rgba(0, 0, 0, .2), inset 0 8px 14px rgba(255, 255, 255, .5); }
.d-img .ph { font-size: 13px; color: var(--muted); padding: 10px; }
.d-img span { display: block; font-size: 13px; font-weight: 600; padding: 0 0 10px; color: var(--ink-2); }
.d-more { display: flex; gap: 8px; overflow-x: auto; margin-top: 10px; scrollbar-width: none; }
.d-more button { flex: 0 0 64px; height: 76px; border: 0; padding: 4px; border-radius: 12px; background: var(--glass-strong); box-shadow: inset 0 0 0 1px var(--glass-edge); cursor: zoom-in; }
.d-more img { width: 100%; height: 100%; object-fit: contain; }

.formula { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 6px; margin: 16px 0 4px; }
.formula .f { font-size: 44px; font-weight: 800; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.formula .x { font-size: 18px; font-weight: 700; color: var(--green-ink); }
.npk { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 2px; }
.npk div { font-size: 12px; color: var(--muted); font-weight: 600; }
.npk .bar { height: 7px; border-radius: 7px; background: rgba(15, 60, 30, .08); margin-top: 4px; overflow: hidden; }
.npk .bar i { display: block; height: 100%; border-radius: 7px; }

.kv { list-style: none; margin: 14px 0 0; padding: 0; }
.kv li { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 9px 2px; border-top: 1px solid var(--line); font-size: 14px; }
.kv li span { color: var(--muted); }
.kv li b { font-weight: 600; }
.dots { display: inline-flex; gap: 4px; vertical-align: middle; margin-right: 6px; }
.dot { width: 13px; height: 13px; border-radius: 50%; display: inline-block; box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .2), inset 0 2px 3px rgba(255, 255, 255, .4); }

details.acc { margin-top: 12px; border-radius: 18px; background: var(--glass-strong); box-shadow: inset 0 0 0 1px var(--glass-edge); }
details.acc summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 14px 16px; font-weight: 700; font-size: 15px; }
details.acc summary::-webkit-details-marker { display: none; }
details.acc summary .ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(180deg, #34C96B, #0E9A43); color: #fff; flex: none; }
details.acc summary .ic svg { width: 15px; height: 15px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
details.acc summary .car { margin-left: auto; transition: transform .2s; }
details.acc summary .car svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2.4; stroke-linecap: round; }
details.acc[open] summary .car { transform: rotate(180deg); }
details.acc .in { padding: 0 16px 14px; font-size: 14px; }
.specs { display: grid; grid-template-columns: 1fr auto; margin: 0; }
.specs dt, .specs dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line); }
.specs dt { color: var(--muted); }
.specs dd { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.lines { list-style: none; margin: 0; padding: 0; }
.lines li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.lines .c { font-weight: 700; }
.lines .q { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.lines .m { font-size: 12px; color: var(--muted); }
.lines .z { opacity: .5; }
.legal ul { margin: 0 0 10px; padding-left: 18px; }
.legal li { margin-bottom: 4px; }
.doc-links { display: grid; gap: 8px; }
.doc-links a { display: flex; justify-content: space-between; align-items: center; padding: 11px 14px; border-radius: 12px; background: rgba(255, 255, 255, .55); text-decoration: none; color: var(--ink); font-weight: 600; box-shadow: inset 0 0 0 1px var(--line); }
.doc-links a span { color: var(--green-ink); font-size: 13px; }

.d-actions { display: flex; gap: 10px; margin-top: 16px; }
.d-actions .btn { flex: 1; }
.page-detail .d-actions { position: sticky; bottom: calc(86px + var(--safe-b)); z-index: 5; margin: 16px -10px 0; padding: 10px; border-radius: 24px; background: var(--glass); -webkit-backdrop-filter: blur(20px) saturate(170%); backdrop-filter: blur(20px) saturate(170%); box-shadow: 0 0 0 1px var(--glass-edge), var(--glass-shadow); }
@media (min-width: 1024px) { .page-detail .d-actions { bottom: 16px; } }
.page-detail { max-width: 720px; margin: 0 auto; }
.page-detail .d-imgs .box { aspect-ratio: 4 / 5; }

/* ---------- Bảng trượt bộ lọc ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgba(10, 30, 15, .25); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.sheet[hidden] { display: none; }
.sheet-panel { width: 100%; max-width: 720px; max-height: 86vh; overflow: auto; border-radius: 28px 28px 0 0; padding: 8px 18px calc(18px + var(--safe-b)); background: var(--glass-strong); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%); box-shadow: 0 -10px 40px rgba(0, 0, 0, .15); animation: up .25s ease-out; }
@keyframes up { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet-panel { animation: none; } .crop { transition: none; } }
.grab { width: 40px; height: 5px; border-radius: 5px; background: rgba(0, 0, 0, .15); margin: 4px auto 10px; }
.sheet h3 { font-size: 14px; margin: 16px 0 8px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { border: 0; border-radius: 99px; padding: 9px 14px; font-size: 14px; font-weight: 600; background: rgba(255, 255, 255, .7); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.opt[aria-pressed="true"] { background: linear-gradient(180deg, #34C96B, #0E9A43); color: #fff; box-shadow: none; }
.sheet-foot { position: sticky; bottom: calc(-18px - var(--safe-b)); padding: 14px 0 4px; display: flex; gap: 10px; background: linear-gradient(180deg, transparent, var(--glass-strong) 30%); }
.sheet-foot .btn-green { flex: 1; }

/* ---------- Trình chiếu ---------- */
.present { position: fixed; inset: 0; z-index: 60; color: #fff; display: flex; flex-direction: column; background: radial-gradient(120% 80% at 50% 0%, #1E5A33 0%, #0A1F12 60%, #050D08 100%); }
.present[hidden] { display: none; }
.present-top { display: flex; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 6px; }
.present-top img { width: 44px; }
.present-top .ttl { flex: 1; font-weight: 700; font-size: 15px; opacity: .9; }
.present-top button { border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .12); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); color: #fff; border-radius: 99px; padding: 10px 18px; font-weight: 700; cursor: pointer; }
.pslides { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.pslides::-webkit-scrollbar { display: none; }
.pslide { flex: 0 0 100%; scroll-snap-align: center; display: flex; flex-direction: column; justify-content: center; padding: 16px 22px 24px; overflow: auto; }
.pslide img { max-height: 64vh; margin: 0 auto; object-fit: contain; filter: drop-shadow(0 20px 30px rgba(0, 0, 0, .45)); }
.pslide .label { text-align: center; font-weight: 700; color: #9BE7B0; margin-top: 16px; font-size: 16px; }
.pslide .pf { font-size: clamp(64px, 20vw, 140px); font-weight: 800; line-height: .95; letter-spacing: -.045em; text-align: center; }
.pslide .pe { text-align: center; font-size: 24px; font-weight: 700; color: #9BE7B0; margin-top: 8px; }
.pslide .pn { text-align: center; opacity: .8; margin-top: 6px; }
.pslide dl { max-width: 540px; width: 100%; margin: 24px auto 0; display: grid; grid-template-columns: 1fr auto; padding: 8px 20px; border-radius: 22px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); }
.pslide dt, .pslide dd { margin: 0; padding: 11px 0; border-bottom: 1px solid rgba(255, 255, 255, .1); font-size: 17px; }
.pslide dd { font-weight: 800; text-align: right; }
.pslide p.big { font-size: 21px; line-height: 1.5; max-width: 580px; margin: 0 auto; }
.pslide h2 { text-align: center; font-size: 16px; color: #9BE7B0; margin: 0 0 16px; }
.pslide ul { max-width: 580px; margin: 0 auto; font-size: 16px; line-height: 1.6; }
.pslide .grain-sw { width: 55vw; max-width: 300px; aspect-ratio: 1; border-radius: 50%; margin: 0 auto; box-shadow: inset 0 -20px 40px rgba(0, 0, 0, .3), inset 0 16px 30px rgba(255, 255, 255, .35); }
.pnav { display: flex; justify-content: center; gap: 8px; padding: 10px 0 calc(16px + var(--safe-b)); }
.pnav i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, .3); }
.pnav i.on { width: 22px; border-radius: 8px; background: #9BE7B0; }
.slogan { text-align: center; font-size: 12px; opacity: .6; }

.zoom { position: fixed; inset: 0; z-index: 70; background: rgba(5, 15, 8, .92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); display: flex; align-items: center; justify-content: center; padding: 20px; }
.zoom img { max-width: 100%; max-height: 100%; }
.zoom button { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 14px); right: 14px; }

/* ---------- Mã bao ---------- */
.code-input input { width: 100%; font-size: 26px; font-weight: 800; letter-spacing: .01em; padding: 18px 20px; border-radius: 20px; border: 1px solid var(--glass-edge); background: var(--glass-strong); box-shadow: var(--hi), var(--glass-shadow); outline: none; }
.code-input input:focus { box-shadow: 0 0 0 3px rgba(16, 160, 75, .35), var(--glass-shadow); }
.recent-codes { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.hits { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
@media (min-width: 900px) { .hits { grid-template-columns: 1fr 1fr; } }
.hit { display: block; border-radius: 20px; padding: 14px 16px; text-decoration: none; color: inherit; }
.hit .row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.hit .code { font-size: 21px; font-weight: 800; letter-spacing: -.01em; }
.hit .meta { color: var(--muted); font-size: 14px; }

/* ---------- Dữ liệu ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { border-radius: var(--r-l); padding: 16px; }
.kpi b { font-size: 28px; font-weight: 800; letter-spacing: -.03em; display: block; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 13px; color: var(--muted); }
.meter { height: 7px; border-radius: 7px; background: rgba(15, 60, 30, .08); margin-top: 10px; overflow: hidden; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, #34C96B, #0E9A43); border-radius: 7px; }
.card { border-radius: var(--r-xl); padding: 18px; margin-top: 14px; }
.card h2 { margin: 0 0 8px; font-size: 18px; letter-spacing: -.02em; }
.issue { padding: 12px 0; border-top: 1px solid var(--line); }
.issue:first-of-type { border-top: 0; }
.issue b { display: block; }
.issue p { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.idlist { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.idlist a, .idlist span { font-size: 12.5px; font-weight: 600; padding: 4px 9px; border-radius: 8px; background: rgba(255, 255, 255, .6); box-shadow: inset 0 0 0 1px var(--line); text-decoration: none; color: var(--ink); }
.note { color: var(--muted); font-size: 13.5px; }
.stale-txt { color: var(--out); font-weight: 600; }

.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty-state b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 6px; }
.banner { margin: 0 0 12px; padding: 10px 14px; border-radius: 14px; background: rgba(255, 236, 200, .75); color: #6B4A00; font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: calc(100px + var(--safe-b)); transform: translateX(-50%); z-index: 80; color: #fff; background: rgba(15, 30, 20, .85); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); padding: 12px 18px; border-radius: 16px; font-weight: 600; font-size: 14px; max-width: calc(100% - 32px); }
.toast[hidden] { display: none; }
.loading { padding: 80px 0; text-align: center; color: var(--muted); }
