/* Evermont design system — Soft UI (neumorphism) with accessible contrast.
   Shared by the Boshqaruv paneli (served at /shared/ui.css) and the Kassa planshet (bundled by Vite).
   Surfaces are raised/inset by paired light+shade shadows; text and primary actions keep >= 4.5:1 contrast. */

@font-face { font-family: 'Fira Sans'; font-weight: 400; font-display: swap; src: url('./fonts/fira-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Fira Sans'; font-weight: 500; font-display: swap; src: url('./fonts/fira-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Fira Sans'; font-weight: 600; font-display: swap; src: url('./fonts/fira-sans-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Fira Sans'; font-weight: 700; font-display: swap; src: url('./fonts/fira-sans-latin-700-normal.woff2') format('woff2'); }

:root {
  /* calm teal-sage palette */
  --bg: #e6edef;
  --surface: #edf2f3;
  --surface-hi: #f5f8f8;
  --line: rgba(120, 146, 152, .22);
  --text: #163a3f;
  --text-2: #3f5a60;
  --muted: #557075;
  --brand: #0e7c74;
  --brand-strong: #0a5f59;
  --brand-soft: #d3ebe7;
  --brand-tint: #e3f2ef;
  --info: #1d5fa8;   --info-soft: #dde8f6;
  --violet: #5b4bb0; --violet-soft: #e6e2f6;
  --ok: #15703f;     --ok-soft: #d9efe2;
  --warn: #975404;   --warn-soft: #f6ead6;
  --danger: #b42318; --danger-soft: #f8e1de;

  --shade: rgba(150, 168, 175, .55);
  --light: rgba(255, 255, 255, .92);
  --raise-lg: 10px 10px 24px var(--shade), -10px -10px 24px var(--light);
  --raise: 6px 6px 14px var(--shade), -6px -6px 14px var(--light);
  --raise-sm: 3px 3px 8px var(--shade), -3px -3px 8px var(--light);
  --inset: inset 3px 3px 7px var(--shade), inset -3px -3px 7px var(--light);
  --inset-sm: inset 2px 2px 4px var(--shade), inset -2px -2px 4px var(--light);
  --ring: 0 0 0 3px rgba(14, 124, 116, .35);

  --r-lg: 18px; --r: 14px; --r-sm: 10px;
  --z-sticky: 10; --z-dropdown: 20; --z-drawer: 40; --z-modal: 50; --z-toast: 60;

  font-family: 'Fira Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); }
body { background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 24px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
a { color: var(--brand-strong); }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }
.c { text-align: center; }
.b { font-weight: 600; }
.nowrap { white-space: nowrap; }
.icon { flex-shrink: 0; display: inline-block; vertical-align: middle; }

:focus { outline: none; }
:focus-visible { box-shadow: var(--ring) !important; outline: none; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); font-weight: 500; text-decoration: none;
  box-shadow: var(--raise-sm); cursor: pointer; transition: box-shadow .18s ease, background-color .18s ease, color .18s ease;
}
.btn:hover { background: var(--surface-hi); color: var(--brand-strong); }
.btn:active { box-shadow: var(--inset-sm); }
.btn.primary { background: linear-gradient(145deg, #12908a, var(--brand)); border-color: transparent; color: #fff;
  box-shadow: 5px 5px 12px rgba(14, 124, 116, .35), -4px -4px 10px var(--light); }
.btn.primary:hover { background: linear-gradient(145deg, var(--brand), var(--brand-strong)); color: #fff; }
.btn.primary:active { box-shadow: inset 2px 2px 6px rgba(0, 0, 0, .25); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn.solid-danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; }
.btn.ghost:hover { background: var(--brand-tint); }
.btn.sm { min-height: 34px; padding: 5px 12px; font-size: 13px; border-radius: 9px; }
.btn.lg { min-height: 52px; padding: 12px 20px; font-size: 16px; font-weight: 600; border-radius: var(--r); }
.btn.icon-only { width: 40px; padding: 0; }
.btn.lg.icon-only { width: 52px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; box-shadow: none; }

/* ---------- Inputs (inset) ---------- */
.input, select.input, textarea.input {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid transparent; border-radius: var(--r-sm);
  background: var(--surface); box-shadow: var(--inset); color: var(--text); font-size: 15px; transition: box-shadow .18s, border-color .18s;
}
.input::placeholder { color: #7b9095; }
.input:focus { border-color: rgba(14, 124, 116, .5); box-shadow: var(--inset), var(--ring); }
.input.invalid { border-color: var(--danger); box-shadow: var(--inset), 0 0 0 3px rgba(180, 35, 24, .2); }
select.input { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23557075' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; z-index: 1; }
.input-icon > .input { padding-left: 40px; }
/* parolni ko'rsatish tugmasi */
.pw-wrap { position: relative; display: block; }
.has-pw > .input { padding-right: 46px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); z-index: 1; width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.pw-toggle:hover, .pw-toggle[aria-pressed="true"] { color: var(--brand-strong); }
.pw-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); min-width: 0; }
label.field > span { font-weight: 500; }
.hint { font-size: 12px; color: var(--muted); }
label.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; min-height: 40px; }
label.check input { width: 18px; height: 18px; flex: none; accent-color: var(--brand); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- Chips / badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.4; background: var(--surface-hi); color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: var(--inset-sm); }
.badge.drug { background: var(--info-soft); color: var(--info); }
.badge.tool { background: var(--violet-soft); color: var(--violet); }
.badge.service { background: var(--brand-soft); color: var(--brand-strong); }
.badge.other { background: #e2e8ea; color: var(--text-2); }
.badge.type { background: var(--surface-hi); color: var(--text); }
.badge.type .icon { color: var(--brand); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- Segmented controls / tabs (inset track, raised pill) ---------- */
.tabs, .seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface); box-shadow: var(--inset); flex-wrap: wrap; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border-radius: var(--r); width: 100%; }
.tab, .seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 6px 16px;
  border: 0; border-radius: 999px; background: transparent; color: var(--text-2); font-weight: 500; cursor: pointer;
  transition: background-color .18s, color .18s, box-shadow .18s; white-space: nowrap; }
.seg button { border-radius: 11px; min-height: 42px; }
.tab:hover, .seg button:hover { color: var(--brand-strong); }
.tab.active, .seg button.active { background: var(--surface-hi); color: var(--brand-strong); font-weight: 600; box-shadow: var(--raise-sm); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid rgba(255, 255, 255, .55); border-radius: var(--r-lg); box-shadow: var(--raise); padding: 20px; min-width: 0; }
.card > h2, .card > h3 { margin-bottom: 14px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h3 { margin: 0; }
.icon-tile { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); box-shadow: var(--raise-sm); color: var(--brand); flex-shrink: 0; }
.icon-tile.warn { color: var(--warn); } .icon-tile.danger { color: var(--danger); } .icon-tile.info { color: var(--info); } .icon-tile.ok { color: var(--ok); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty .icon { color: #9ab0b4; }

/* ---------- Tables (sit on a raised card) ---------- */
.table-wrap { overflow: auto; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--raise); border: 1px solid rgba(255, 255, 255, .55); }
.card .table-wrap { box-shadow: none; border: 0; border-radius: var(--r); background: transparent; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
th { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
  background: var(--surface); position: sticky; top: 0; z-index: 1; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color .15s; }
tbody tr:hover { background: rgba(255, 255, 255, .45); }
tr[data-view], tr[data-sale] { cursor: pointer; }
tr.voided td { color: var(--muted); text-decoration: line-through; }

/* ---------- Modal, toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(22, 58, 63, .35); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; z-index: var(--z-modal); }
.modal { background: var(--surface); border-radius: 22px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(22, 58, 63, .28); border: 1px solid rgba(255, 255, 255, .7); }
.modal.wide { max-width: 800px; }
.modal-head { padding: 18px 22px 10px; display: flex; align-items: center; gap: 10px; }
.modal-body { padding: 10px 22px 18px; overflow: auto; }
.modal-foot { padding: 14px 22px 20px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: var(--z-toast); width: max-content; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 10px; background: #173c41; color: #fff; padding: 12px 18px; border-radius: 14px; box-shadow: 0 10px 30px rgba(22, 58, 63, .3); font-weight: 500; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }

/* ---------- Login / PIN ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 20% 0%, #f2f7f7 0, transparent 60%), var(--bg); }
.login { width: 100%; max-width: 420px; padding: 32px; display: flex; flex-direction: column; gap: 14px; border-radius: 26px; }
.login-logo { display: block; width: 100%; max-width: 300px; margin: 0 auto 4px; }
.login .lead { text-align: center; color: var(--text-2); margin: 0; }
.pin-display { display: flex; justify-content: center; gap: 14px; height: 44px; align-items: center; }
.pin-display .dot { width: 14px; height: 14px; border-radius: 50%; box-shadow: var(--inset-sm); background: var(--surface); }
.pin-display .dot.on { background: var(--brand); box-shadow: none; }
.pin-display.bad { color: var(--danger); font-weight: 600; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 4px 12px; }
.keypad button { aspect-ratio: 1.35; min-height: 56px; border: 0; border-radius: 18px; background: var(--surface); box-shadow: var(--raise-sm);
  font-size: 22px; font-weight: 500; color: var(--text); cursor: pointer; display: grid; place-items: center; transition: box-shadow .12s; }
.keypad button:active { box-shadow: var(--inset); }
.keypad button.ok { background: linear-gradient(145deg, #12908a, var(--brand)); color: #fff; }
.match { font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 700; letter-spacing: 3px; color: var(--brand-strong); }
.match.big { font-size: 44px; letter-spacing: 6px; text-indent: 6px; margin: 6px 0; padding: 14px 18px; border-radius: 18px; box-shadow: var(--inset); text-align: center; }

/* ---------- Receipt preview & print ---------- */
.receipt { font-family: 'Courier New', ui-monospace, Menlo, monospace; font-size: 12px; line-height: 1.35; color: #000; background: #fff; padding: 10px; margin: 0 auto; }
.receipt.w58 { width: 58mm; font-size: 10.5px; }
.receipt .c { text-align: center; }
.receipt .b { font-weight: 700; }
.receipt .big { font-size: 1.35em; }
.receipt .hr { border-top: 1px dashed #000; margin: 6px 0; }
.receipt .r-logo { display: block; width: 100%; max-width: 50mm; margin: 0 auto 4px; }
.receipt .slogan { font-style: italic; margin-top: 2px; }
.receipt .lr { display: flex; justify-content: space-between; gap: 8px; }
.receipt .item { margin: 3px 0; }
.receipt .item > span:first-child { flex: 1; }
.receipt-preview { padding: 18px; border-radius: 18px; box-shadow: var(--inset); background: var(--surface); }
.receipt-preview .receipt { box-shadow: 0 6px 18px rgba(22, 58, 63, .15); border-radius: 4px; }
#print-area { display: none; }

/* ---------- Autocomplete ---------- */
.ac-wrap { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); background: var(--surface-hi); border-radius: var(--r); box-shadow: 0 14px 34px rgba(22, 58, 63, .22);
  max-height: 320px; overflow: auto; z-index: var(--z-dropdown); border: 1px solid rgba(255, 255, 255, .8); }
.ac-head { padding: 10px 14px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); }
.ac-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--line); }
.ac-item:last-child { border-bottom: 0; }
.ac-item:hover, .ac-item.active { background: var(--brand-tint); }

/* ---------- Bar chart ---------- */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 200px; padding: 18px 4px 0; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; gap: 6px; }
.bar .fill { width: 100%; max-width: 30px; min-height: 3px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, #2bb3a8, var(--brand)); position: relative;
  box-shadow: 2px 2px 6px rgba(14, 124, 116, .25); transition: filter .15s; }
.bar .fill:hover { filter: brightness(.9); }
.bar .lbl { font-size: 11px; color: var(--muted); white-space: nowrap; }
.bar .fill[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: #173c41; color: #fff; padding: 6px 10px; border-radius: 8px; font-size: 12px; white-space: nowrap; z-index: 3; }
