/* ═══════════════════════════════════════════════════════════
   NodiRetsept — dizayn tizimi
   ═══════════════════════════════════════════════════════════ */
:root {
  --brand: #0e7c86;
  --brand-dark: #0a5f67;
  --brand-light: #17a2ae;
  --brand-50: #e9f5f6;
  --brand-100: #cfe9eb;

  --ink: #0f2530;
  --ink-2: #33505c;
  --muted: #6f8792;
  --line: #e1eaee;
  --line-2: #eef4f6;
  --bg: #f3f7f8;
  --card: #ffffff;

  --ok: #0e8a5f;
  --ok-bg: #e6f6ef;
  --warn: #a8690b;
  --warn-bg: #fdf3e2;
  --danger: #c23b30;
  --danger-bg: #fdeceb;
  --info: #2563a8;
  --info-bg: #e8f0fa;

  --r-xs: 6px; --r-sm: 9px; --r: 13px; --r-lg: 18px; --r-xl: 24px;
  --sh-1: 0 1px 2px rgba(16,45,58,.06), 0 1px 3px rgba(16,45,58,.05);
  --sh-2: 0 2px 6px rgba(16,45,58,.06), 0 8px 24px rgba(16,45,58,.07);
  --sh-3: 0 12px 48px rgba(16,45,58,.16);
  --sidebar-w: 250px;
  --topbar-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
          "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; overflow-x: hidden; font-family: var(--font); background: var(--bg); color: var(--ink);
  font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
h1,h2,h3,h4 { margin: 0 0 .4em; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.24rem; } h3 { font-size: 1.05rem; } h4 { font-size: .95rem; }
p { margin: 0 0 1em; }
small { font-size: .8rem; }
hr { border: none; border-top: 1px solid var(--line); margin: 20px 0; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.tiny { font-size: .74rem; }
.strong { font-weight: 700; }
.mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hide { display: none !important; }
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}.mt-4{margin-top:32px}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}.mb-3{margin-bottom:24px}
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1 1 auto; min-width: 0; }
.gap-0{gap:0}.gap-1{gap:6px}.gap-2{gap:12px}.gap-3{gap:20px}

/* ── Tugmalar ─────────────────────────────────────────── */
.btn {
  --btn-bg: #fff; --btn-fg: var(--ink); --btn-bd: var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--r-sm); border: 1px solid var(--btn-bd);
  background: var(--btn-bg); color: var(--btn-fg); font: inherit; font-weight: 600; font-size: .9rem;
  cursor: pointer; transition: .15s ease; white-space: nowrap; text-decoration: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--sh-1); color: var(--btn-fg); }
.btn:active { transform: translateY(0); }
.btn[disabled], .btn.loading { opacity: .6; pointer-events: none; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn-primary { --btn-bg: var(--brand); --btn-fg: #fff; --btn-bd: var(--brand); }
.btn-primary:hover { --btn-bg: var(--brand-dark); --btn-bd: var(--brand-dark); }
.btn-dark { --btn-bg: var(--ink); --btn-fg: #fff; --btn-bd: var(--ink); }
.btn-soft { --btn-bg: var(--brand-50); --btn-fg: var(--brand-dark); --btn-bd: transparent; }
.btn-danger { --btn-bg: #fff; --btn-fg: var(--danger); --btn-bd: #f0c8c4; }
.btn-danger:hover { --btn-bg: var(--danger); --btn-fg: #fff; }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--ink-2); }
.btn-ghost:hover { --btn-bg: var(--line-2); box-shadow: none; }
.btn-sm { padding: 6px 11px; font-size: .82rem; border-radius: var(--r-xs); }
.btn-sm svg { width: 15px; height: 15px; }
.btn-lg { padding: 14px 24px; font-size: 1rem; border-radius: var(--r); }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; border-radius: var(--r-xs); }

/* ── Formalar ─────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.label .req { color: var(--danger); }
.input,
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="hidden"]),
select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: #fff; font: inherit; font-size: .92rem; color: var(--ink); transition: .15s;
  -webkit-appearance: none; appearance: none;
}
select, select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236f8792' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50);
}
input::placeholder, textarea::placeholder { color: #a8bac2; }
textarea { min-height: 80px; resize: vertical; line-height: 1.5; }
.hint { font-size: .76rem; color: var(--muted); }
.error-text { font-size: .8rem; color: var(--danger); }
input[type="color"] { padding: 3px; height: 40px; cursor: pointer; }
input[type="file"] { padding: 7px; font-size: .85rem; background: var(--line-2); border-style: dashed; cursor: pointer; }
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 600; font-size: .8rem; padding: 6px 12px; margin-right: 10px;
  border: 1px solid var(--line); border-radius: var(--r-xs); background: #fff; color: var(--ink-2); cursor: pointer;
}
input[type="file"]::file-selector-button:hover { border-color: var(--brand); color: var(--brand-dark); }
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: .88rem; padding: 6px 0; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); margin: 0; flex: none; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); gap: 0 16px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.dx { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); }
fieldset { border: none; padding: 0; margin: 0 0 18px; }
legend { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--brand); padding: 0 0 8px; }

/* ── Kartalar ─────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--sh-1); padding: 20px;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line-2);
}
.card-head h3, .card-head h2 { margin: 0; }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line-2); background: #fbfdfd; }
.grid { display: grid; gap: 16px; }
.grid > *, .col > * { min-width: 0; }   /* grid/flex bolalari qisqara olsin */
.col { min-width: 0; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.grid.sidebar-right { grid-template-columns: minmax(0,2fr) minmax(280px,1fr); align-items: start; }
.grid.sidebar-right > * { min-width: 0; }

/* ── Statistika kartasi ───────────────────────────────── */
.stat { position: relative; overflow: hidden; }
.stat .stat-label { font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat .stat-value { font-size: 2.1rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; margin: 6px 0 2px; }
.stat .stat-foot { font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .stat-icon {
  position: absolute; top: 16px; right: 16px; width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center; background: var(--brand-50); color: var(--brand);
}
.stat .stat-icon svg { width: 19px; height: 19px; }
.stat.accent { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%); border-color: transparent; color: #fff; }
.stat.accent .stat-label, .stat.accent .stat-foot { color: rgba(255,255,255,.82); }
.stat.accent .stat-icon { background: rgba(255,255,255,.18); color: #fff; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-size: .78rem; }
.delta.up { color: var(--ok); } .delta.down { color: var(--danger); } .delta.flat { color: var(--muted); }
.stat.accent .delta { color: #fff; }

/* ── Nishonlar ────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 100px;
  font-size: .74rem; font-weight: 700; background: var(--line-2); color: var(--ink-2); white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.brand { background: var(--brand-50); color: var(--brand-dark); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 100px;
  background: #fff; border: 1px solid var(--line); font-size: .82rem; cursor: pointer; transition: .15s;
}
.chip:hover { border-color: var(--brand); color: var(--brand-dark); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ── Avatar ───────────────────────────────────────────── */
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--brand-50); color: var(--brand-dark); font-weight: 700; font-size: .85rem;
  border: 1px solid var(--brand-100);
}
.avatar.lg { width: 56px; height: 56px; font-size: 1.1rem; }
.avatar.sm { width: 30px; height: 30px; font-size: .72rem; }

/* ── Jadval ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: .89rem; }
.table th {
  text-align: left; font-size: .73rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); background: #fbfdfd;
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #fafcfc; }
.table tbody tr:last-child td { border-bottom: none; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table a.rowlink { color: var(--ink); font-weight: 600; }
.table a.rowlink:hover { color: var(--brand); }

/* ── Bo'sh holat ──────────────────────────────────────── */
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty svg { width: 46px; height: 46px; color: var(--line); margin-bottom: 10px; }
.empty h3 { color: var(--ink-2); }

/* ── Ilova qobig'i ────────────────────────────────────── */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: #0d2b33; color: #cfe2e5; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px; padding: 20px 20px 18px; color: #fff;
  font-weight: 800; font-size: 1.06rem; letter-spacing: -.02em;
}
.sidebar .brand .logo { width: 34px; height: 34px; border-radius: 9px; display: block; flex: none; }
.sidebar .brand small { display: block; font-size: .68rem; font-weight: 500; color: #7fa8ad; letter-spacing: .02em; }
.nav { padding: 6px 12px; flex: 1; }
.nav-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #6b939a;
  padding: 14px 10px 6px; font-weight: 700; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--r-sm);
  color: #b9d4d8; font-size: .9rem; font-weight: 500; margin-bottom: 2px; transition: .14s;
}
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: var(--brand); color: #fff; font-weight: 600; box-shadow: 0 3px 10px rgba(14,124,134,.4); }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav a .count { margin-left: auto; font-size: .72rem; background: rgba(255,255,255,.12); padding: 1px 7px; border-radius: 20px; }
.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-sm); }
.sidebar-user:hover { background: rgba(255,255,255,.06); }
.sidebar-user .avatar { background: rgba(255,255,255,.14); color: #fff; border-color: transparent; }
.sidebar-user .nm { font-size: .84rem; font-weight: 600; color: #fff; }
.sidebar-user .rl { font-size: .72rem; color: #7fa8ad; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); background: rgba(255,255,255,.86); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px;
  padding: 0 24px; position: sticky; top: 0; z-index: 40;
}
.topbar h1 { font-size: 1.16rem; margin: 0; }
.topbar .sub { font-size: .78rem; color: var(--muted); }
.content { padding: 24px; flex: 1; max-width: 1420px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; margin-bottom: 20px; }
.burger { display: none; }

/* ── Mobil pastki navigatsiya ─────────────────────────── */
.mobile-nav { display: none; }

/* ── Flash / toast ────────────────────────────────────── */
.flash {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--r-sm);
  margin-bottom: 18px; font-size: .9rem; font-weight: 500; border: 1px solid transparent;
}
.flash.success { background: var(--ok-bg); color: var(--ok); border-color: #bfe6d5; }
.flash.error { background: var(--danger-bg); color: var(--danger); border-color: #f3ccc8; }
.flash.info { background: var(--info-bg); color: var(--info); border-color: #cadcf1; }
.flash svg { width: 18px; height: 18px; flex: none; }
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--r-sm);
  box-shadow: var(--sh-3); font-size: .88rem; display: flex; align-items: center; gap: 10px;
  animation: toastIn .25s ease; max-width: 380px;
}
.toast.ok { background: #0e6b4c; } .toast.err { background: #a8322a; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }

/* ── Modal ────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(11,34,42,.55); backdrop-filter: blur(3px);
  z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px;
  overflow-y: auto;
}
.modal-backdrop.open { display: flex; animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  background: var(--card); border-radius: var(--r-lg); box-shadow: var(--sh-3);
  width: 100%; max-width: 880px; max-height: calc(100vh - 40px); display: flex; flex-direction: column;
  animation: modalIn .22s cubic-bezier(.2,.9,.3,1); margin: auto;
}
.modal.sm { max-width: 460px; }
.modal.lg { max-width: 1040px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(.98); } }
.modal-head {
  display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 1.12rem; }
.modal-head .sub { font-size: .78rem; color: var(--muted); }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 15px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px;
  justify-content: flex-end; align-items: center; background: #fbfdfd;
  border-radius: 0 0 var(--r-lg) var(--r-lg); flex-wrap: wrap;
}
.modal-close { margin-left: auto; }

/* ── Grafik ───────────────────────────────────────────── */
.chart { display: flex; align-items: flex-end; gap: 5px; height: 132px; padding-top: 8px; }
.chart .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end;
  align-items: center; gap: 5px; height: 100%; min-width: 0; }
.chart .bar .fill {
  width: 100%; max-width: 34px; background: linear-gradient(180deg, var(--brand-light), var(--brand));
  border-radius: 5px 5px 3px 3px; min-height: 3px; transition: .3s; position: relative;
}
.chart .bar:hover .fill { background: var(--ink); }
.chart .bar .v { font-size: .68rem; font-weight: 700; color: var(--ink-2); }
.chart .bar .l { font-size: .64rem; color: var(--muted); white-space: nowrap; overflow: hidden; }
.chart .bar.today .fill { background: linear-gradient(180deg, #f0a132, #dd7f13); }

.rank-list { display: flex; flex-direction: column; gap: 10px; }
.rank-item { display: flex; align-items: center; gap: 10px; font-size: .87rem; }
.rank-item .rk { width: 20px; height: 20px; border-radius: 6px; background: var(--brand-50);
  color: var(--brand-dark); font-size: .7rem; font-weight: 700; display: grid; place-items: center; flex: none; }
.rank-item .bar-bg { flex: 1; height: 6px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.rank-item .bar-bg i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }

/* ── Ro'yxat elementi ─────────────────────────────────── */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 20px;
  border-bottom: 1px solid var(--line-2); transition: background .12s; color: inherit;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: #fafcfc; color: inherit; }
.list-item .ttl { font-weight: 600; font-size: .92rem; }
.list-item .sub { font-size: .78rem; color: var(--muted); }

/* ── Sahifalash ───────────────────────────────────────── */
.pager { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 16px; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 34px; height: 34px; padding: 0 10px; border-radius: var(--r-xs); display: grid; place-items: center;
  border: 1px solid var(--line); background: #fff; font-size: .85rem; font-weight: 600; color: var(--ink-2);
}
.pager a:hover { border-color: var(--brand); color: var(--brand); }
.pager .cur { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager .dots { border: none; background: none; }

/* ═══ Ommaviy sahifalar ═══════════════════════════════ */
.public-page { background: linear-gradient(180deg, #eaf3f4 0%, var(--bg) 340px); }
.pub-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 24px; max-width: 1100px; margin: 0 auto;
}
.pub-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; color: var(--ink); }
.pub-brand .logo { width: 36px; height: 36px; border-radius: 10px; display: block; flex: none; }
.pub-brand small { display: block; font-size: .68rem; font-weight: 500; color: var(--muted); }
.pub-main { max-width: 1100px; margin: 0 auto; padding: 20px 24px 60px; }
.hero { text-align: center; padding: 30px 0 34px; }
.hero h1 { font-size: clamp(1.7rem, 4.4vw, 2.5rem); letter-spacing: -.03em; }
.hero p.lead { font-size: 1.03rem; color: var(--ink-2); max-width: 560px; margin: 0 auto 26px; }
.search-card {
  background: #fff; border-radius: var(--r-lg); box-shadow: var(--sh-2); padding: 24px;
  max-width: 620px; margin: 0 auto; border: 1px solid var(--line);
}
.search-form { display: flex; gap: 10px; }
.search-form input {
  flex: 1; font-size: 1.05rem; padding: 14px 16px; letter-spacing: .06em; font-weight: 600;
  text-transform: uppercase; text-align: center; border-radius: var(--r);
}
.search-form input::placeholder { letter-spacing: normal; font-weight: 400; text-transform: none; }
.or-line { display: flex; align-items: center; gap: 12px; margin: 20px 0 16px; color: var(--muted); font-size: .8rem; }
.or-line::before, .or-line::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-top: 46px; }
.step { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.step .n {
  width: 30px; height: 30px; border-radius: 9px; background: var(--brand-50); color: var(--brand-dark);
  font-weight: 800; display: grid; place-items: center; margin-bottom: 10px; font-size: .9rem;
}
.step h3 { font-size: .98rem; }
.step p { font-size: .86rem; color: var(--muted); margin: 0; }

/* ── Retsept blankasi (veb) ───────────────────────────── */
.rx-sheet {
  background: #fff; border-radius: var(--r-lg); box-shadow: var(--sh-2); border: 1px solid var(--line);
  max-width: 820px; margin: 0 auto; overflow: hidden;
}
.rx-top { height: 6px; background: var(--rx-accent, var(--brand)); }
.rx-header { display: flex; gap: 20px; padding: 24px 28px 18px; border-bottom: 2px solid var(--rx-accent, var(--brand)); }
.rx-header .clinic { flex: 1; min-width: 0; }
.rx-header .clinic-head { display: flex; align-items: center; gap: 13px; }
.rx-header .clinic h2 { font-size: 1.24rem; margin-bottom: 2px; }
.rx-header .clinic .sub { color: var(--muted); font-size: .84rem; }
.rx-header .clinic .contacts { color: var(--muted); font-size: .76rem; margin-top: 5px; }
.rx-header .qr { text-align: center; flex: none; }
.rx-header .qr img { width: 92px; height: 92px; display: block; border-radius: 6px; }
.rx-header .qr .idtxt { font-size: .74rem; font-weight: 700; margin-top: 5px; letter-spacing: .04em; }
.rx-header .logo-img { width: 52px; height: 52px; max-width: 92px; object-fit: contain; flex: none; }
.rx-titlebar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--brand-50); padding: 12px 28px; flex-wrap: wrap;
}
.rx-titlebar .t { font-size: 1.16rem; font-weight: 800; color: var(--rx-accent, var(--brand)); letter-spacing: .04em; }
.rx-titlebar .t small { font-weight: 500; color: var(--muted); font-size: .72rem; letter-spacing: 0; margin-left: 8px; }
.rx-body { padding: 22px 28px 26px; }
.rx-section { margin-bottom: 20px; }
.rx-section > .lbl {
  font-size: .71rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
  color: var(--rx-accent, var(--brand)); margin-bottom: 7px;
}
.rx-patient { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px 16px; }
.rx-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px 22px; }
.rx-kv > div { display: flex; gap: 8px; font-size: .88rem; align-items: baseline; }
.rx-kv .k { color: var(--muted); font-size: .78rem; min-width: 92px; flex: none; }
.rx-kv .v { font-weight: 600; }
.rx-dx { font-size: 1.06rem; font-weight: 700; }
.rp-head { display: flex; align-items: baseline; gap: 12px; border-bottom: 1px solid var(--line);
  padding-bottom: 7px; margin-bottom: 14px; }
.rp-head .rp { font-family: Georgia, "Times New Roman", serif; font-size: 1.75rem; font-weight: 700;
  color: var(--rx-accent, var(--brand)); line-height: 1; }
.rx-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.rx-item:last-child { border-bottom: none; }
.rx-item .n { font-weight: 800; color: var(--rx-accent, var(--brand)); font-size: .92rem; min-width: 18px; }
.rx-item .drug { font-weight: 700; font-size: 1rem; }
.rx-item .dtd { font-size: .9rem; }
.rx-item .sig { font-size: .9rem; margin-top: 3px; }
.rx-item .sig b { color: var(--rx-accent, var(--brand)); margin-right: 5px; }
.rx-doctor { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end;
  border-top: 1px solid var(--line); padding-top: 16px; margin-top: 26px; flex-wrap: wrap; }
.rx-doctor .sign-area { display: flex; gap: 20px; align-items: flex-end; }
.rx-doctor .sign { text-align: center; min-width: 130px; }
.rx-doctor .sign img { max-height: 46px; max-width: 130px; object-fit: contain; display: block; margin: 0 auto 4px; }
.rx-doctor .sign .line { border-bottom: 1px solid var(--line); height: 1px; margin-bottom: 4px; }
.rx-doctor .stamp img { max-height: 92px; max-width: 110px; object-fit: contain; }
.rx-doctor .stamp .placeholder {
  width: 82px; height: 82px; border: 2px dashed var(--line); border-radius: 50%;
  display: grid; place-items: center; color: #cbd9de; font-size: .78rem; font-weight: 700;
}
.rx-footer { padding: 14px 28px; border-top: 1px solid var(--line); background: #fbfdfd;
  display: flex; justify-content: space-between; gap: 12px; font-size: .74rem; color: var(--muted); flex-wrap: wrap; }
.rx-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 22px 0 8px; }
.verify-banner {
  display: flex; align-items: center; gap: 10px; max-width: 820px; margin: 0 auto 16px;
  background: var(--ok-bg); color: var(--ok); border: 1px solid #bfe6d5; border-radius: var(--r-sm);
  padding: 11px 16px; font-size: .87rem; font-weight: 600;
}
.verify-banner.cancelled { background: var(--danger-bg); color: var(--danger); border-color: #f3ccc8; }
.verify-banner svg { width: 19px; height: 19px; flex: none; }

/* ── Retsept muharriri (modal) ────────────────────────── */
.picker { position: relative; }
.picker-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; z-index: 30;
  border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--sh-2);
  max-height: 288px; overflow-y: auto; display: none;
}
.picker-results.open { display: block; }
.picker-item { padding: 10px 14px; cursor: pointer; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--line-2); }
.picker-item:last-child { border-bottom: none; }
.picker-item:hover, .picker-item.hl { background: var(--brand-50); }
.picker-item .nm { font-weight: 600; font-size: .9rem; }
.picker-item .meta { font-size: .76rem; color: var(--muted); }
.picker-item.add { color: var(--brand-dark); font-weight: 700; background: #f7fbfb; position: sticky; bottom: 0; }
.selected-patient {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--brand-50); border: 1px solid var(--brand-100);
}
.drug-row {
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 13px 14px 6px;
  margin-bottom: 12px; background: #fdfefe; position: relative;
}
.drug-row .drug-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.drug-row .drug-num {
  width: 24px; height: 24px; border-radius: 7px; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: .76rem; font-weight: 700; flex: none;
}
.drug-row .grid-3 { display: grid; grid-template-columns: 2fr minmax(0,1fr) minmax(0,1fr); gap: 0 12px; }
.drug-row .grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 0 12px; }
.drug-row .field { margin-bottom: 10px; }
.rx-preview-line { font-size: .82rem; color: var(--muted); padding: 6px 0 10px; border-top: 1px dashed var(--line); }
.rx-preview-line b { color: var(--brand-dark); }
.suggest-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: -4px; margin-bottom: 10px; }
.suggest-row button {
  font: inherit; font-size: .74rem; padding: 3px 9px; border-radius: 20px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); cursor: pointer;
}
.suggest-row button:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-50); }
.success-panel { text-align: center; padding: 14px 0; }
.success-panel .qr-box { background: #fff; border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px; display: inline-block; box-shadow: var(--sh-1); }
.success-panel .qr-box img { width: 190px; height: 190px; display: block; }
.success-panel .idbig {
  font-size: 1.5rem; font-weight: 800; letter-spacing: .1em; color: var(--brand-dark);
  margin: 14px 0 4px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.copy-field {
  display: flex; gap: 8px; align-items: center; background: var(--line-2); border-radius: var(--r-sm);
  padding: 8px 8px 8px 14px; font-size: .82rem; max-width: 460px; margin: 12px auto 0;
}
.copy-field input { border: none; background: none; padding: 0; font-size: .82rem; }
.copy-field input:focus { box-shadow: none; }

/* ── Skaner ───────────────────────────────────────────── */
.scanner-wrap { max-width: 520px; margin: 0 auto; }
.scanner-view {
  position: relative; background: #08181d; border-radius: var(--r-lg); overflow: hidden;
  aspect-ratio: 1; display: grid; place-items: center;
}
.scanner-view video { width: 100%; height: 100%; object-fit: cover; }
.scanner-frame {
  position: absolute; inset: 16%; border-radius: 20px; box-shadow: 0 0 0 100vmax rgba(6,20,25,.42);
  border: 2px solid rgba(255,255,255,.85);
}
.scanner-frame::before, .scanner-frame::after {
  content: ''; position: absolute; width: 26px; height: 26px; border: 4px solid var(--brand-light);
}
.scanner-frame::before { top: -3px; left: -3px; border-right: none; border-bottom: none; border-radius: 12px 0 0 0; }
.scanner-frame::after { bottom: -3px; right: -3px; border-left: none; border-top: none; border-radius: 0 0 12px 0; }
.scanner-hint { text-align: center; color: #fff; position: absolute; bottom: 14px; left: 0; right: 0;
  font-size: .84rem; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.scanner-placeholder { text-align: center; color: #7fa8ad; padding: 30px; }
.scanner-placeholder svg { width: 52px; height: 52px; margin-bottom: 12px; }

/* ── Kirish sahifasi ──────────────────────────────────── */
.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 20px;
  background: linear-gradient(140deg, #0d2b33 0%, #114c55 55%, #0e7c86 100%); }
.auth-card { background: #fff; border-radius: var(--r-xl); box-shadow: 0 24px 70px rgba(4,26,32,.35);
  width: 100%; max-width: 420px; padding: 34px 32px; }
.auth-card .brandline { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.auth-card .brandline .logo { width: 42px; height: 42px; border-radius: 12px; display: block; flex: none; }
.auth-card .brandline .nm { font-size: 1.16rem; font-weight: 800; letter-spacing: -.02em; }
.auth-card .brandline small { display: block; color: var(--muted); font-size: .72rem; font-weight: 500; }
.auth-hint { text-align: center; margin-top: 18px; font-size: .82rem; color: var(--muted); }

/* ── Bo'limlar (tab) ──────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a, .tabs button {
  padding: 10px 15px; font-size: .88rem; font-weight: 600; color: var(--muted); border: none;
  background: none; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; font-family: inherit;
}
.tabs a:hover, .tabs button:hover { color: var(--ink); }
.tabs a.active, .tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ── Suzuvchi tugma ───────────────────────────────────── */
.fab { display: none; }

/* ═══ Moslashuvchanlik ════════════════════════════════ */
@media (max-width: 1080px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.sidebar-right { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 268px; z-index: 120;
    transform: translateX(-100%); transition: transform .25s ease; height: 100dvh;
  }
  .sidebar.open { transform: none; box-shadow: var(--sh-3); }
  .sidebar-scrim { position: fixed; inset: 0; background: rgba(9,28,35,.5); z-index: 110; display: none; }
  .sidebar-scrim.open { display: block; }
  .burger { display: inline-flex; }
  .content { padding: 16px 14px 92px; }
  .topbar { padding: 0 14px; }
  .topbar h1 { font-size: 1.02rem; }
  .grid.c3, .grid.c2 { grid-template-columns: minmax(0, 1fr); }
  .form-grid.two, .form-grid.dx { grid-template-columns: minmax(0, 1fr); }
  .mobile-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 90;
    background: rgba(255,255,255,.96); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .mobile-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 2px;
    font-size: .66rem; color: var(--muted); font-weight: 600;
  }
  .mobile-nav a svg { width: 21px; height: 21px; }
  .mobile-nav a.active { color: var(--brand); }
  .mobile-nav .fab-slot { position: relative; }
  .fab {
    display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-light), var(--brand)); color: #fff;
    box-shadow: 0 6px 18px rgba(14,124,134,.45); border: 3px solid #fff;
    position: absolute; left: 50%; transform: translateX(-50%); top: -24px; cursor: pointer;
  }
  .fab svg { width: 24px; height: 24px; }
  .modal { max-height: calc(100dvh - 16px); border-radius: var(--r); }
  .modal-backdrop { padding: 8px; align-items: flex-start; }
  .modal-foot { border-radius: 0 0 var(--r) var(--r); }
  .modal-foot .btn { flex: 1; }
  .drug-row .grid-3, .drug-row .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .rx-header { flex-direction: column-reverse; align-items: center; text-align: center; gap: 14px; }
  .rx-header .qr img { width: 128px; height: 128px; }
  .rx-body, .rx-titlebar, .rx-footer { padding-left: 18px; padding-right: 18px; }
  .rx-doctor { flex-direction: column; align-items: stretch; gap: 18px; }
  .rx-doctor .sign-area { justify-content: space-between; }
  .page-head { align-items: stretch; }
  .page-head .btn { width: 100%; }
  .search-form { flex-direction: column; }
  .table th, .table td { padding: 10px 11px; }
}
@media (max-width: 560px) {
  /* Jadvallar siqilmasin — kartaning ichida gorizontal aylantiriladi */
  .table-wrap table.table { min-width: 520px; }
  /* Kichik ekranda grafik sanalarini siyraklashtiramiz */
  .chart .bar .l { display: none; }
  .chart .bar:nth-child(4n+1) .l { display: block; font-size: .58rem; }
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat .stat-value { font-size: 1.6rem; }
  .stat .stat-icon { width: 30px; height: 30px; top: 12px; right: 12px; }
  .card { padding: 16px; }
  .hide-sm { display: none !important; }
  .drug-row .grid-3, .drug-row .grid-4 { grid-template-columns: minmax(0,1fr); }
}

/* ═══ Chop etish ══════════════════════════════════════ */
@media print {
  body { background: #fff; }
  .no-print, .topbar, .sidebar, .mobile-nav, .rx-actions, .pub-header, .verify-banner,
  .fab, #toasts, .modal-backdrop { display: none !important; }
  .pub-main, .content { padding: 0; max-width: none; }
  .rx-sheet { box-shadow: none; border: none; border-radius: 0; max-width: none; }
  .rx-body { padding: 16px 0; }
  .rx-header, .rx-titlebar, .rx-footer { padding-left: 0; padding-right: 0; }
  .rx-titlebar { background: none; border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; }
  a[href]::after { content: none !important; }
  @page { margin: 14mm; size: A4; }
}
