/* =============================================================
   KASDAP ONE — CATALOG / SEARCH / ORDER
============================================================= */
.cat { display: grid; grid-template-columns: 252px 1fr 340px; height: calc(100vh - var(--topbar)); overflow: hidden; }

/* ---- left filter rail ---- */
.filters { background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; padding: 18px 14px; }
.filters .fh { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.filters .fh h3 { font-size: .92rem; }
.fgroup { margin-bottom: 22px; }
.fgroup .ft { font-family: var(--ff-mono); font-size: .6rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); margin-bottom: 10px; }
.frow { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: var(--r8, 8px); border-radius: 9px; cursor: pointer; transition: background .14s; font-size: .8rem; color: var(--text-2); }
.frow:hover { background: var(--surface-2); color: var(--text); }
.frow.on { background: var(--accent-soft); color: var(--accent); }
.frow .fi { width: 26px; height: 26px; border-radius: 7px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .15s; }
.frow.on .fi { background: rgba(var(--accent-rgb),.18); }
.frow .fn { flex: 1; font-weight: 500; }
.frow .fc { font-family: var(--ff-mono); font-size: .64rem; color: var(--text-3); }
.frow.on .fc { color: var(--accent); }
.switch { display: flex; align-items: center; justify-content: space-between; padding: 9px; }
.toggle { width: 38px; height: 22px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line-2); position: relative; transition: background .2s; cursor: pointer; flex-shrink: 0; }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-3); transition: all .2s; }
.toggle.on { background: var(--accent); border-color: var(--accent); }
.toggle.on::after { transform: translateX(16px); background: #fff; }

/* ---- center ---- */
.cat-center { display: flex; flex-direction: column; overflow: hidden; }
.cat-search { padding: 18px 22px 0; }
.searchbar { display: flex; align-items: center; gap: 11px; background: var(--surface); border: 1.5px solid var(--line-2); border-radius: var(--r14); padding: 0 16px; transition: all .2s; }
.searchbar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(var(--accent-rgb),.12); }
.searchbar svg { color: var(--text-3); flex-shrink: 0; }
.searchbar input { flex: 1; background: none; border: none; outline: none; padding: 15px 0; font-size: .95rem; color: var(--text); }
.searchbar input::placeholder { color: var(--text-3); }
.searchbar .kbd { font-family: var(--ff-mono); font-size: .6rem; color: var(--text-3); background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 3px 7px; }
.chips { display: flex; gap: 7px; overflow-x: auto; padding: 14px 0 16px; }
.chips::-webkit-scrollbar { display: none; }

.cat-body { flex: 1; overflow-y: auto; padding: 4px 22px 22px; }
.cat-tb { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 16px; }
.cat-tb .rc { font-size: .78rem; color: var(--text-2); }
.cat-tb .rc b { color: var(--accent); font-family: var(--ff-mono); }
.cat-tb .right { display: flex; align-items: center; gap: 9px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 13px; }

/* product card */
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r18); padding: 14px; cursor: pointer; transition: transform .2s, border-color .2s, box-shadow .2s; position: relative; display: flex; flex-direction: column; }
.pcard:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: var(--shadow-2); }
.pcard.incart { border-color: rgba(var(--accent-rgb),.45); box-shadow: 0 0 0 1px rgba(var(--accent-rgb),.25), var(--shadow-2); }
.pcard .pimg { height: 120px; margin-bottom: 12px; border-radius: var(--r12, 12px); border-radius: 12px; }
.pcard .pimg-tags { position: absolute; top: 10px; left: 10px; display: flex; gap: 5px; }
.rxtag { font-family: var(--ff-mono); font-size: .54rem; font-weight: 600; padding: 2px 6px; border-radius: 5px; letter-spacing: .04em; }
.rxtag.rx { background: var(--rose-soft); color: var(--rose); border: 1px solid rgba(251,92,126,.3); }
.rxtag.otc { background: var(--emerald-soft); color: var(--emerald); border: 1px solid rgba(0,184,107,.3); }
.rxtag.new { background: var(--sky-soft); color: var(--sky); border: 1px solid rgba(79,155,247,.3); }
.pcat { font-family: var(--ff-mono); font-size: .58rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 4px; }
.pname { font-size: .86rem; font-weight: 700; line-height: 1.25; letter-spacing: -.01em; }
.psalt { font-size: .68rem; color: var(--text-2); font-style: italic; margin-top: 3px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pmeta { display: flex; align-items: center; gap: 8px; margin-top: 7px; font-size: .64rem; color: var(--text-3); }
.pmeta .dotsep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); }
.pfoot { display: flex; align-items: flex-end; justify-content: space-between; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); gap: 8px; }
.price-col { min-width: 0; }
.p-mrp { font-family: var(--ff-mono); font-size: .62rem; color: var(--text-3); text-decoration: line-through; }
.p-now { font-family: var(--ff-mono); font-size: 1.06rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.p-unit { font-size: .58rem; color: var(--text-3); font-weight: 600; }
.p-save { font-size: .58rem; font-weight: 700; color: var(--emerald); margin-top: 2px; }
[data-mode="b2b"] .p-save { color: var(--indigo); }
.p-sub { font-family: var(--ff-mono); font-size: .58rem; color: var(--text-2); margin-top: 1px; }
.addbtn { width: 38px; height: 38px; border-radius: var(--r10); background: var(--accent-soft); border: 1px solid rgba(var(--accent-rgb),.25); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .18s; }
.addbtn:hover { background: var(--accent); color: var(--on-accent); box-shadow: 0 4px 14px rgba(var(--accent-rgb),.4); }

/* ---- right: unified basket ---- */
.basket { background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; }
.basket-h { padding: 16px 16px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.basket-h h3 { font-size: .96rem; display: flex; align-items: center; gap: 8px; }
.basket-body { flex: 1; overflow-y: auto; padding: 12px; }
.basket-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; color: var(--text-3); padding: 30px; }
.basket-empty .be-ic { width: 56px; height: 56px; border-radius: 16px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; }
.basket-group { margin-bottom: 14px; }
.bg-h { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; font-size: .68rem; font-weight: 700; }
.bg-h .bg-tag { font-family: var(--ff-mono); font-size: .56rem; padding: 2px 7px; border-radius: 5px; letter-spacing: .04em; }
.bg-h.em .bg-tag { background: var(--emerald-soft); color: var(--emerald); }
.bg-h.in .bg-tag { background: var(--indigo-soft); color: var(--indigo); }
.bg-h .bg-sub { margin-left: auto; font-family: var(--ff-mono); font-size: .68rem; color: var(--text-2); }
.bline { display: flex; gap: 10px; padding: 10px; border-radius: var(--r12, 12px); border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 7px; animation: ksSlideIn .2s ease; }
.bline .pimg { width: 44px; height: 44px; flex-shrink: 0; border-radius: 9px; }
.bline .bl-mid { flex: 1; min-width: 0; }
.bl-name { font-size: .76rem; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bl-meta { font-size: .62rem; color: var(--text-3); margin-top: 2px; }
.bl-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 7px; gap: 6px; }
.bl-price { font-family: var(--ff-mono); font-size: .78rem; font-weight: 700; }
.bl-del { color: var(--text-3); transition: color .15s; } .bl-del:hover { color: var(--rose); }
.qty.mini button { width: 24px; height: 24px; } .qty.mini input { width: 32px; font-size: .74rem; }

.basket-foot { border-top: 1px solid var(--line); padding: 14px; }
.sumrow { display: flex; align-items: center; justify-content: space-between; font-size: .8rem; color: var(--text-2); margin-bottom: 7px; }
.sumrow .v { font-family: var(--ff-mono); color: var(--text); }
.sumrow.tot { font-weight: 800; font-size: .98rem; color: var(--text); padding-top: 10px; border-top: 1px solid var(--line); margin-top: 4px; }
.sumrow.tot .v { color: var(--accent); }
.sumrow.save .v { color: var(--emerald); }
.secure { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: .64rem; color: var(--text-3); margin-top: 10px; }

/* mobile drawer triggers */
.cat-fab, .filter-fab { display: none; }

@media (max-width: 1180px) { .cat { grid-template-columns: 220px 1fr 300px; } }
@media (max-width: 1024px) {
  .cat { grid-template-columns: 1fr; }
  .filters { display: none; }
  .basket { display: none; }
  .cat-fab { display: flex; position: fixed; right: 16px; bottom: calc(var(--bottomnav) + 16px); width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent); align-items: center; justify-content: center; box-shadow: 0 8px 26px rgba(var(--accent-rgb),.5); z-index: 200; }
  .cat-fab .cart-badge { border-color: var(--bg); }
  .filter-fab { display: inline-flex; }
}
@media (max-width: 720px) {
  .cat { height: auto; min-height: calc(100vh - var(--topbar) - var(--bottomnav)); }
  .cat-search { padding: 12px 14px 0; }
  .cat-body { padding: 4px 14px 22px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .pcard .pimg { height: 96px; }
  .cat-fab { bottom: calc(var(--bottomnav) + 14px); }
}

/* slide-up drawer (mobile basket / filters) */
.sheet-overlay { position: fixed; inset: 0; background: rgba(4,7,14,.6); z-index: 400; backdrop-filter: blur(3px); animation: ksPop .2s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 401; background: var(--surface); border-radius: var(--r24) var(--r24) 0 0; max-height: 88vh; display: flex; flex-direction: column; animation: sheetUp .32s cubic-bezier(.32,.72,0,1); padding-bottom: env(safe-area-inset-bottom); }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--line-3); margin: 12px auto 4px; }
