/* ===========================================================
   Marketing Mini App — Light minimal (corporate)
   =========================================================== */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e5e9f0;
  --border-strong: #d5dbe3;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #94a3b8;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #059669;
  --success-soft: #ecfdf5;
  --radius: 12px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 2px 8px rgba(15, 23, 42, .06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding: 14px;
  padding-bottom: 40px;
  max-width: 640px;
  margin: 0 auto;
}

/* Topbar (☰ + sahifa nomi) */
.topbar { display: flex; align-items: center; gap: 12px; padding: 4px 2px 16px; }
.menu-btn {
  flex: 0 0 auto; width: 40px; height: 40px; border: 1px solid var(--border);
  background: var(--surface); border-radius: 10px; font-size: 18px; line-height: 1;
  cursor: pointer; color: var(--text); box-shadow: var(--shadow-sm); font-family: inherit;
}
.menu-btn:active { background: var(--surface-2); }
.topbar-title { flex: 1; font-size: 18px; font-weight: 700; letter-spacing: -.015em; }
.topbar-logo { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); }

/* Chap sidebar (drawer) — admin panel kabi bo'limlar ro'yxati */
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: 268px; max-width: 82vw; z-index: 60;
  background: var(--surface); border-right: 1px solid var(--border);
  box-shadow: 2px 0 18px rgba(15, 23, 42, .12); padding: 16px; overflow-y: auto;
  transform: translateX(-100%); transition: transform .22s ease;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 6px 4px 14px;
  border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.drawer-head img { width: 38px; height: 38px; border-radius: 9px; object-fit: cover; border: 1px solid var(--border); }
.drawer-brand { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.drawer-user { font-size: 12px; color: var(--muted); margin-top: 2px; }
.drawer-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  padding: 12px 14px; border-radius: 10px; font-size: 15px; font-weight: 600;
  color: var(--text-2); cursor: pointer; transition: .14s; user-select: none;
}
.nav-item:active { background: var(--surface-2); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-hover); }

.overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 50;
  opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s;
}
.overlay.show { opacity: 1; visibility: visible; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Card wrapper for forms */
form {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm);
}

.form-group { margin-bottom: 15px; position: relative; }
label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13px; color: var(--text-2); }
.required { color: var(--danger); }
.field-hint { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.field-hint a { color: var(--primary); font-weight: 600; text-decoration: none; }

input, select, textarea {
  width: 100%; padding: 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font-size: 15px; font-family: inherit;
  background: #fff; color: var(--text); transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
textarea { resize: vertical; min-height: 74px; }

.btn {
  width: 100%; padding: 13px; border: none; border-radius: var(--radius-sm);
  background: var(--primary); color: #fff; font-size: 15px; font-weight: 700;
  font-family: inherit; cursor: pointer; margin-top: 4px; transition: background .12s, transform .05s;
}
.btn:hover { background: var(--primary-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; }

/* Autocomplete */
.suggestions {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 20; margin-top: 4px;
  background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  max-height: 210px; overflow-y: auto; box-shadow: var(--shadow); display: none;
}
.suggestions.show { display: block; }
.suggestion { padding: 11px 12px; cursor: pointer; font-size: 14px; border-bottom: 1px solid var(--border); }
.suggestion:last-child { border-bottom: none; }
.suggestion:hover, .suggestion.active { background: var(--primary-soft); color: var(--primary-hover); }

/* Messages */
.message {
  padding: 12px 14px; border-radius: var(--radius-sm); margin: 14px 0; font-weight: 500;
  display: none; font-size: 14px; border: 1px solid transparent;
}
.message.show { display: block; }
.message.error { background: var(--danger-soft); color: #991b1b; border-color: #fecaca; }
.message.success { background: var(--success-soft); color: #065f46; border-color: #a7f3d0; }

/* Recent list */
.recent { margin-top: 22px; }
.recent h3 { font-size: 13px; font-weight: 600; margin-bottom: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.recent-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; margin-bottom: 8px; box-shadow: var(--shadow-sm);
}
.recent-item .amt { font-weight: 700; color: var(--primary-hover); }
.recent-item .meta { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

.center-msg { text-align: center; padding: 48px 24px; color: var(--text-2); font-size: 15px; }
.center-msg b { color: var(--text); }

/* Ko'p tanlovli apteka (chips) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chips:empty { margin-bottom: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px;
  background: var(--primary-soft); color: var(--primary-hover); border-radius: 999px;
  font-size: 13px; font-weight: 600;
}
.chip-x { cursor: pointer; font-weight: 700; font-size: 15px; line-height: 1; opacity: .7; }
.chip-x:hover { opacity: 1; }

/* ===== Shaxsiy kabinet: KPI / So'rovlar / Baza ===== */
.sec-title { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase;
  letter-spacing: .04em; margin: 20px 2px 10px; }

/* KPI kartalar */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px; box-shadow: var(--shadow-sm); }
.kpi-l { font-size: 12.5px; color: var(--text-2); font-weight: 600; margin-bottom: 6px; }
.kpi-n { font-size: 22px; font-weight: 800; color: var(--primary-hover); letter-spacing: -.02em; }
.kpi.accent { background: var(--primary-soft); border-color: var(--primary); }
.kpi.accent .kpi-n { color: var(--primary-hover); }
.kpi.accent.danger { background: var(--danger-soft); border-color: var(--danger); }
.kpi.accent.danger .kpi-n { color: var(--danger); }

/* Panel (ro'yxatlar konteyneri) */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow-sm); }

/* Ustunli grafik (CSS) */
.bar-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.bar-lbl { flex: 0 0 68px; font-size: 12.5px; color: var(--text-2); }
.bar-track { flex: 1; height: 9px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.bar-val { flex: 0 0 auto; font-size: 12.5px; font-weight: 700; color: var(--text); min-width: 52px; text-align: right; }

.line-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--border); font-size: 14px; }
.line-row:last-child { border-bottom: none; }
.line-row b { color: var(--primary-hover); }

/* Effektivlik jadvali — barcha kataklar bir xil shrift/o'lcham, ustunlar chiziqli */
.eff-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow-x: auto; }
.eff-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.eff-table th, .eff-table td { padding: 9px 10px; text-align: right; white-space: nowrap;
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.eff-table th:last-child, .eff-table td:last-child { border-right: none; }
.eff-table tr:last-child td { border-bottom: none; }
.eff-table th { font-weight: 700; color: var(--text-2); background: var(--surface-2); }
.eff-table th:first-child, .eff-table td:first-child { text-align: left; }
.eff-table td.eff-pct { color: var(--primary-hover); font-weight: 700; }

/* Sўровларим */
.req { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
.req-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.req-doc { font-weight: 700; font-size: 15px; }
.req-amt { font-weight: 800; color: var(--primary-hover); white-space: nowrap; }
.req-meta { color: var(--text-2); font-size: 13px; margin-top: 4px; }
.req-preps { color: var(--success); font-size: 13px; margin-top: 4px; font-weight: 500; }
.req-date { color: var(--muted); font-size: 11.5px; margin-top: 6px; }
.req-status { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px;
  border-radius: 999px; vertical-align: middle; }
.req-status.pending { background: #fef3c7; color: #b45309; }
.req-status.approved { background: var(--success-soft); color: #065f46; }
.req-status.rejected { background: var(--danger-soft); color: #991b1b; }

/* Базам */
.search-box { margin-bottom: 14px; }
.base-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 14px; margin-bottom: 8px; box-shadow: var(--shadow-sm); }
.base-name { font-weight: 700; font-size: 14.5px; }
.base-meta { color: var(--text-2); font-size: 13px; margin-top: 3px; }

/* Preparatlar ro'yxati */
.preparat-list { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; max-height: 320px; overflow-y: auto; }
.prep-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.prep-row:last-child { border-bottom: none; }
.prep-name { flex: 1; font-size: 14px; }
.prep-qty { width: 84px; padding: 8px 10px; text-align: center; }
.prep-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }
