/* MaalTrack v43 — search upgrade + dark-mode polish. Loaded after every other stylesheet. */

/* ================= DARK: top bar (shop name was invisible) =================
   The topbar uses `bg-white/90`, which the old dark overrides (.bg-white) never matched,
   so it stayed light while its text turned light. */
html.dark #topbar-root header {
  background: rgba(11, 18, 32, .82) !important;
  border-bottom-color: rgba(148, 163, 184, .14) !important;
  box-shadow: 0 8px 24px -16px rgba(0, 0, 0, .7);
}
html.dark #topbar-root header p.text-slate-900 { color: #F1F5F9 !important; }
html.dark #topbar-root header button:hover { background: rgba(148, 163, 184, .12) !important; }
#topbar-root header p.truncate.font-semibold { font-size: 15px; letter-spacing: -.005em; max-width: min(46vw, 200px); }
html.dark #topbar-root header img { box-shadow: 0 0 0 1px rgba(148, 163, 184, .2); }
html.dark #menu-drawer .bg-white\/5, html.dark #menu-drawer .bg-white\/10 { background-color: rgba(255, 255, 255, .06) !important; }

/* ================= DARK: general finish ================= */
html.dark { color-scheme: dark; }
html.dark ::selection { background: rgba(45, 212, 191, .3); color: #fff; }
html.dark * { scrollbar-color: #2a3750 transparent; }
html.dark #bottom-nav-root nav {
  background: rgba(11, 18, 32, .9) !important;
  border-top: 1px solid rgba(148, 163, 184, .14) !important;
  backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
}
html.dark .mz-card, html.dark .mz-inv, html.dark .mz-prod {
  border-color: rgba(148, 163, 184, .13);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .025), rgba(255, 255, 255, 0));
}
html.dark .mz-sheet { background-color: #111a2c; border-top: 1px solid rgba(148, 163, 184, .16); }
html.dark input, html.dark select, html.dark textarea { border-color: #2a3750; }
html.dark input:focus, html.dark select:focus, html.dark textarea:focus { border-color: #2DD4BF !important; }
html.dark ::placeholder { color: #6b7c97; opacity: 1; }

/* ================= SEARCH (v48) =================
   Neutral, premium search: no teal border / ring on focus (teal only stays on the icon).
   premium.css puts a teal border + ring on EVERY focused input with !important; inside the
   pill that drew a teal box around the typing area. The repeated class below out-ranks it. */
:root { --sx-line: rgba(15, 23, 42, .10); --sx-line-f: rgba(15, 23, 42, .28); --sx-ring: rgba(15, 23, 42, .055); --sx-pop: 0 18px 40px -18px rgba(11, 27, 58, .38); }
html.dark { --sx-line: rgba(148, 163, 184, .18); --sx-line-f: rgba(203, 213, 225, .40); --sx-ring: rgba(226, 232, 240, .07); --sx-pop: 0 20px 44px -18px rgba(0, 0, 0, .8); }

.ux-search-target::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }

/* --- mobile pill search (.mz-search) --- */
.mz-search {
  position: relative; height: 54px; border-radius: 18px; gap: 12px; padding: 0 8px 0 18px;
  background: var(--mz-card); border: 1px solid var(--sx-line);
  box-shadow: 0 1px 2px rgba(11, 27, 58, .04), 0 10px 24px -16px rgba(11, 27, 58, .24);
  transition: border-color .18s ease, box-shadow .2s ease, background-color .18s ease;
}
.mz-search > .mz-i { width: 20px; height: 20px; flex: none; color: var(--mz-mute); transition: color .18s ease; }
.mz-search:focus-within { transform: none; border-color: var(--sx-line-f); box-shadow: 0 0 0 4px var(--sx-ring), 0 16px 32px -18px rgba(11, 27, 58, .38); }
.mz-search:focus-within > .mz-i { color: var(--mz-ink); transform: none; }
.mz-search.flat { height: 50px; box-shadow: none; }
.mz-search.flat:focus-within { box-shadow: 0 0 0 4px var(--sx-ring); }

/* the typing area itself: no border, ring or outline of its own */
.mz-search.mz-search.mz-search.mz-search.mz-search input,
.mz-search.mz-search.mz-search.mz-search.mz-search input:hover,
.mz-search.mz-search.mz-search.mz-search.mz-search input:focus,
.mz-search.mz-search.mz-search.mz-search.mz-search input:focus-visible {
  outline: 0 !important; box-shadow: none !important; border: 0 !important; border-radius: 0 !important; background: transparent !important;
  font-size: 16px; /* 16px stops iOS zoom-on-focus */ font-weight: 500; letter-spacing: -.005em; caret-color: var(--mz-ink);
}
.mz-search input { text-overflow: ellipsis; }
.mz-search input::placeholder { color: var(--mz-mute); font-weight: 400; opacity: .8; text-overflow: ellipsis; }
.mz-search input::-webkit-search-cancel-button, .mz-search input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
html.dark .mz-search { background: linear-gradient(180deg, #16223a, #121b2d); }
html.dark .mz-search.flat { background: #17233A; }
html.dark .mz-search:focus-within { background: #15213a; box-shadow: 0 0 0 4px var(--sx-ring), 0 14px 30px -14px rgba(0, 0, 0, .75); }

/* scan button + clear button inside the pill */
.mz-search .mz-scanbtn { width: 38px; height: 38px; border-radius: 13px; background: var(--mz-soft); color: var(--mz-ink); transition: background-color .15s ease, transform .12s ease; }
.mz-search .mz-scanbtn:active { transform: scale(.94); }
html.dark .mz-search .mz-scanbtn { color: var(--mz-ink); }
.ux-clear {
  flex: none; width: 26px; height: 26px; border-radius: 50%; border: 0; padding: 0; margin-right: 2px;
  display: grid; place-items: center; background: var(--mz-line); color: var(--mz-mute);
  opacity: 0; transform: scale(.7); pointer-events: none;
  transition: opacity .15s ease, transform .15s ease, background-color .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.ux-clear svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2.8; stroke-linecap: round; }
.mz-search.has-text .ux-clear { opacity: 1; transform: none; pointer-events: auto; }
.ux-clear:active { transform: scale(.9); }
@media (hover: hover) { .ux-clear:hover { background: var(--sx-line-f); color: var(--mz-ink); } }

/* recent searches (injected by search-ux.js) */
.ux-recent {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 40; padding: 10px 12px 12px;
  background: var(--mz-card); border: 1px solid var(--sx-line); border-radius: 18px; box-shadow: var(--sx-pop);
  opacity: 0; transform: translateY(-4px); pointer-events: none; transition: opacity .16s ease, transform .16s ease;
}
.mz-search.show-recent .ux-recent { opacity: 1; transform: none; pointer-events: auto; }
.ux-recent-h { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 8px; font-size: 13px; font-weight: 600; color: var(--mz-mute); }
.ux-recent-h button { border: 0; background: transparent; padding: 4px 8px; margin: -4px -6px -4px 0; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--mz-mute); }
.ux-recent-h button:active { background: var(--mz-soft); }
.ux-recent-list { display: flex; flex-wrap: wrap; gap: 8px; }
.ux-rchip {
  display: inline-flex; align-items: center; gap: 7px; max-width: 100%; height: 36px; padding: 0 13px 0 11px;
  border-radius: 12px; border: 1px solid var(--sx-line); background: var(--mz-soft); color: var(--mz-ink);
  font-size: 14px; font-weight: 500; text-align: left; -webkit-tap-highlight-color: transparent;
}
.ux-rchip svg { width: 14px; height: 14px; flex: none; stroke: var(--mz-mute); fill: none; stroke-width: 2.2; stroke-linecap: round; }
.ux-rchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ux-rchip:active { background: var(--mz-line); }

/* --- desktop / legacy tailwind search boxes --- */
input.ux-legacy-search {
  border-radius: 14px; min-height: 44px; font-size: 14.5px;
  padding-left: 42px !important; padding-right: 36px;
  background-repeat: no-repeat; background-position: 14px 50%; background-size: 18px 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
  transition: border-color .18s ease, box-shadow .2s ease, background-color .18s ease;
}
input.ux-legacy-search.ux-legacy-search.ux-legacy-search.ux-legacy-search.ux-legacy-search:focus,
.gh-in.gh-in.gh-in.gh-in.gh-in:focus,
.su-search .su-input.su-input.su-input.su-input.su-input:focus {
  border-color: var(--sx-line-f) !important; outline: none !important; box-shadow: 0 0 0 4px var(--sx-ring) !important;
}
input.ux-legacy-search:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
}
html.dark input.ux-legacy-search:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23E2E8F0' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
}
input.ux-legacy-search::-webkit-search-cancel-button {
  -webkit-appearance: none; appearance: none; height: 18px; width: 18px; margin-right: 2px; cursor: pointer; border-radius: 50%;
  background: no-repeat center / 10px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") , rgba(100, 116, 139, .16);
}
html.dark input.ux-legacy-search { background-color: #0f1729; }
html.dark input.ux-legacy-search::-webkit-search-cancel-button {
  background: no-repeat center / 10px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23CBD5E1' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E"), rgba(148, 163, 184, .2);
}

/* --- Business-tools / labels search + POS results --- */
.gh-in { border-radius: 16px; min-height: 48px; font-size: 16px; transition: border-color .18s ease, box-shadow .2s ease; }
.mz-results { border-radius: 18px; }
.mz-res { transition: background-color .12s ease; }
html.dark .mz-res:hover, html.dark .mz-res:active { background: #1a2742; }
.ux-mark { background: rgba(20, 184, 166, .22); color: inherit; border-radius: 4px; padding: 0 1px; }

/* --- themed dropdown search (select-ui) --- */
.su-search { border-radius: 14px; }

@media (prefers-reduced-motion: reduce) {
  .mz-search, .mz-search > .mz-i, .ux-clear, .ux-recent, .mz-search .mz-scanbtn { transition: none; }
}

/* Hamburger menu: "Online Shop — coming soon" entry */
.drawer-soon{display:flex;align-items:center;gap:12px;margin-top:10px;padding:10px 12px;border-radius:12px;text-decoration:none;
  background:linear-gradient(135deg,#0B1B3A,#0F766E);color:#fff;border:1px solid rgba(183,121,31,.7)}
.drawer-soon-ico{font-size:22px;line-height:1}
.drawer-soon-txt{display:flex;flex-direction:column;min-width:0;flex:1}
.drawer-soon-txt b{font-size:14px;font-weight:600}
.drawer-soon-txt small{font-size:11.5px;opacity:.8;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.drawer-soon-tag{background:#E0B052;color:#1a1200;font-size:11px;font-weight:700;padding:3px 9px;border-radius:99px}
.drawer-soon:active{transform:scale(.98)}

/* Dashboard: today summary */
.dp-today{padding:14px 14px 12px}
.dp-today-head{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:10px}
.dp-today-head b{font-size:15px;font-weight:700;color:#0b1b3a}.dp-today-head span{font-size:12px;color:#64748b}
.dp-today-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.dp-today-grid>div{background:#f6faf9;border:1px solid #e3ece9;border-radius:12px;padding:10px 12px;min-width:0}
.dp-today-l{font-size:11.5px;font-weight:600;color:#64748b;margin:0}
.dp-today-v{font-size:17px;font-weight:700;color:#0b1b3a;margin:2px 0 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dp-today-v.profit{color:#0F766E}.dp-today-v.rose{color:#e11d48}
.dp-today-grid small{font-size:11px;color:#94a3b8}
@media(min-width:768px){.dp-today-grid{grid-template-columns:repeat(4,1fr)}}
html.dark .dp-today-head b,html.dark .dp-today-v{color:#f1f5f9}
html.dark .dp-today-grid>div{background:#14202e;border-color:#243247}
html.dark .dp-today-v.profit{color:#2dd4bf}html.dark .dp-today-v.rose{color:#fb7185}

/* Khata: overdue badge */
.kh-od{display:inline-block;margin-top:2px;font-size:10px;font-weight:700;padding:1px 7px;border-radius:99px;background:#fef3c7;color:#92400e}
.kh-od.mid{background:#ffedd5;color:#9a3412}.kh-od.hi{background:#ffe4e6;color:#be123c}
html.dark .kh-od{background:#3b2e0f;color:#fcd34d}html.dark .kh-od.mid{background:#3d2410;color:#fdba74}html.dark .kh-od.hi{background:#431320;color:#fda4af}

/* About: developer */
.st-dev{display:flex;align-items:center;gap:12px;margin-top:14px;padding-top:14px;border-top:1px dashed #dbe3e1}
.st-dev i{display:grid;place-items:center;width:42px;height:42px;border-radius:50%;background:#0F766E;color:#fff;font:700 16px Inter,sans-serif;font-style:normal;flex:none}
.st-dev small{display:block;font-size:11.5px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:#64748b}
.st-dev b{display:block;font-size:16px;color:#0b1b3a}
html.dark .st-dev{border-color:#25324a}html.dark .st-dev b{color:#eef2f7}
