* { box-sizing: border-box; margin: 0; }
:root { --navy:#16283a; --blue:#1668b0; --paper:#f5f8fa; --line:#dde5ec; }
body { font-family: -apple-system, "Segoe UI", Arial, sans-serif; background: var(--paper); color: var(--navy); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.logo { height: 40px; }
#search { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; }
button { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--line); padding: 9px 14px; background: #fff; }
button.primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
button.ghost { background: #fff; }
button.wide { width: 100%; margin-top: 8px; }
.pill { background: #fff; color: var(--blue); border-radius: 10px; padding: 0 7px; font-weight: 700; margin-left: 4px; }
.banner { background: #fff7e0; border: 1px solid #ecd9a0; border-radius: 8px; padding: 10px 14px; margin: 14px 0 0; }
.cats { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 4px; }
.cats button { white-space: nowrap; }
.cats button.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; padding: 14px 0 40px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.card img { width: 100%; height: 130px; object-fit: contain; background: #fff; }
.card .noimg { width: 100%; height: 130px; display: flex; align-items: center; justify-content: center; color: #b8c4cf; font-size: 40px; background: var(--paper); border-radius: 8px; }
.card .name { font-weight: 600; font-size: 14px; min-height: 34px; }
.card .item { color: #7b8894; font-size: 12px; }
.card .price { font-size: 18px; font-weight: 700; }
.card .unit { color: #7b8894; font-size: 12px; font-weight: 400; }
.stock { font-size: 12px; font-weight: 600; }
.stock.in { color: #1e7d3c; } .stock.low { color: #b07716; } .stock.out { color: #b02525; }
.qtyrow { display: flex; gap: 6px; margin-top: auto; }
.qtyrow input { width: 54px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; text-align: center; }
.qtyrow button { flex: 1; }
.drawer { position: fixed; top: 0; right: 0; width: min(380px, 95vw); height: 100vh; background: #fff; box-shadow: -6px 0 24px rgba(0,0,0,.15); z-index: 20; display: flex; flex-direction: column; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.drawer-body { flex: 1; overflow-y: auto; padding: 10px 16px; }
.drawer-foot { border-top: 1px solid var(--line); padding: 14px 16px; }
.cline { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.cline .n { flex: 1; font-size: 14px; }
.cline input { width: 48px; padding: 6px; border: 1px solid var(--line); border-radius: 6px; text-align: center; }
.cline .x { color: #b02525; background: none; border: none; font-size: 16px; }
.modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); background: #fff; border-radius: 14px; padding: 22px; width: min(430px, 94vw); max-height: 90vh; overflow-y: auto; z-index: 30; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal h2 { margin-bottom: 10px; }
.modal label { display: block; margin: 10px 0; font-size: 14px; font-weight: 600; }
.modal input, .modal textarea { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; margin-top: 4px; }
.shade { position: fixed; inset: 0; background: rgba(10,20,30,.45); z-index: 10; }
.hidden { display: none !important; }
.row { display: flex; justify-content: space-between; align-items: center; }
.row.gap { gap: 10px; margin-top: 12px; }
.row.big { font-size: 18px; }
.muted { color: #7b8894; }
.small { font-size: 12px; margin: 6px 0; }
.err { background: #fdecec; border: 1px solid #f2b8b8; color: #8e1f1f; border-radius: 8px; padding: 8px 12px; margin: 8px 0; font-size: 14px; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tab { flex: 1; } .tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.otable { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.otable th, .otable td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
footer { padding: 18px 0 30px; font-size: 13px; }
