/* =========================================================
   HAZINIY — Dizayn tizimi (Light + Dark rejim)
   ========================================================= */
:root {
  --hz-primary: #14504A;
  --hz-primary-dark: #0d3934;
  --hz-primary-light: #1c6961;
  --hz-accent: #F5DFA8;
  --hz-accent-dark: #e0c583;

  --hz-bg: #F2F1EC;
  --hz-surface: #ffffff;
  --hz-surface-2: #F7F6F2;
  --hz-border: #e4e2da;
  --hz-text: #1f2937;
  --hz-text-soft: #4b5563;
  --hz-muted: #6b7280;

  --hz-shadow: 0 2px 10px rgba(20, 80, 74, 0.07);
  --hz-shadow-lg: 0 8px 28px rgba(20, 80, 74, 0.12);
  --hz-radius: 14px;
  --hz-radius-sm: 9px;

  --hz-green: #16a34a;
  --hz-red: #dc2626;
  --hz-amber: #d97706;
  --hz-orange: #ea580c;

  --hz-sidebar-w: 236px;
}

[data-theme="dark"] {
  --hz-bg: #0f1715;
  --hz-surface: #16211e;
  --hz-surface-2: #1b2825;
  --hz-border: #263733;
  --hz-text: #eef1ef;
  --hz-text-soft: #c3cdc9;
  --hz-muted: #8b9c97;
  --hz-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
  --hz-shadow-lg: 0 10px 32px rgba(0, 0, 0, 0.45);
  --hz-primary-light: #2c8478;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--hz-bg);
  color: var(--hz-text);
  transition: background 0.2s ease, color 0.2s ease;
}

a { color: inherit; }

/* =========================================================
   Shell layout: sidebar + topbar + content
   ========================================================= */
.hz-shell { display: flex; min-height: 100vh; }

.hz-sidebar {
  width: var(--hz-sidebar-w);
  flex-shrink: 0;
  background: var(--hz-primary);
  color: var(--hz-accent);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: transform 0.25s ease;
  z-index: 40;
}

.hz-sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 22px;
  border-bottom: 1px solid rgba(245, 223, 168, 0.15);
  margin-bottom: 16px;
}
.hz-sidebar-brand img { height: 34px; width: auto; }
.hz-sidebar-brand .name { font-weight: 800; font-size: 17px; letter-spacing: 0.4px; }
.hz-sidebar-brand .slogan { font-size: 11px; opacity: 0.75; }

.hz-nav-group { margin-bottom: 18px; }
.hz-nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  opacity: 0.55; padding: 0 10px; margin-bottom: 6px; font-weight: 700;
}
.hz-nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px;
  color: var(--hz-accent); text-decoration: none;
  font-size: 13.5px; font-weight: 600; opacity: 0.82;
  margin-bottom: 2px;
}
.hz-nav-link .ic { width: 18px; text-align: center; font-size: 15px; }
.hz-nav-link:hover { background: rgba(245, 223, 168, 0.1); opacity: 1; }
.hz-nav-link.active { background: var(--hz-accent); color: var(--hz-primary-dark); opacity: 1; }

.hz-sidebar-footer {
  margin-top: auto; padding-top: 14px;
  border-top: 1px solid rgba(245, 223, 168, 0.15);
  font-size: 12px; opacity: 0.7;
}

.hz-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.hz-topbar {
  background: var(--hz-surface);
  border-bottom: 1px solid var(--hz-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px;
  position: sticky; top: 0; z-index: 30;
}
.hz-topbar-left { display: flex; align-items: center; gap: 14px; }
.hz-page-title { font-size: 16px; font-weight: 700; color: var(--hz-text); }
.hz-menu-btn {
  display: none; background: none; border: none; font-size: 20px;
  cursor: pointer; color: var(--hz-text);
}
.hz-topbar-right { display: flex; align-items: center; gap: 10px; }

.hz-theme-toggle {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--hz-border);
  background: var(--hz-surface-2); cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center; color: var(--hz-text);
}
.hz-theme-toggle:hover { background: var(--hz-border); }

.hz-user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px 6px 6px; border-radius: 10px; text-decoration: none;
  color: var(--hz-text); font-size: 13px; font-weight: 600;
  background: var(--hz-surface-2); border: 1px solid var(--hz-border);
}
.hz-user-chip .avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--hz-primary);
  color: var(--hz-accent); display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; flex-shrink: 0;
}

.hz-content { padding: 26px 28px; max-width: 1280px; width: 100%; margin: 0 auto; }

.hz-sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 35;
}

@media (max-width: 900px) {
  .hz-sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); }
  .hz-sidebar.open { transform: translateX(0); }
  .hz-sidebar-overlay.open { display: block; }
  .hz-menu-btn { display: block; }
  .hz-content { padding: 18px 16px; }
  .hz-topbar { padding: 10px 16px; }
}

/* =========================================================
   Generic components
   ========================================================= */
.hz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.hz-card {
  background: var(--hz-surface);
  border-radius: var(--hz-radius);
  box-shadow: var(--hz-shadow);
  border: 1px solid var(--hz-border);
  padding: 18px 20px;
}
.hz-card.accent-top { border-top: 3px solid var(--hz-primary); }

.hz-card .label { color: var(--hz-muted); font-size: 12.5px; margin-bottom: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.hz-card .value { font-size: 28px; font-weight: 800; color: var(--hz-primary-light); }
.hz-card .sub { font-size: 12px; color: var(--hz-muted); margin-top: 4px; }

/* -------------------------------------------------------------------
   BOSILADIGAN KO'RSATKICH KARTOCHKASI

   Bosh sahifadagi raqamlar endi havola: bosilganda aynan o'sha
   ma'lumot turgan ro'yxat ochiladi. Bosilishi mumkinligi ko'rinib
   turishi kerak — aks holda foydalanuvchi umuman urinib ko'rmaydi.
   ------------------------------------------------------------------- */
a.hz-kpi-link {
  display: block;
  position: relative;
  text-decoration: none;
  color: inherit;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
a.hz-kpi-link:hover,
a.hz-kpi-link:focus-visible {
  transform: translateY(-2px);
  border-color: var(--hz-primary);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
a.hz-kpi-link:focus-visible { outline: 2px solid var(--hz-primary); outline-offset: 2px; }

.hz-kpi-arrow {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 20px;
  line-height: 1;
  color: var(--hz-muted);
  opacity: .55;
  transition: opacity .12s ease, transform .12s ease;
}
a.hz-kpi-link:hover .hz-kpi-arrow { opacity: 1; transform: translateX(2px); }

.hz-kpi-hint { font-size: 11.5px; color: var(--hz-muted); margin-top: 4px; }

/* Sichqonchasiz qurilmalarda "hover" bo'lmaydi — u yerda strelka
   doim to'liq ko'rinsin, aks holda kartochka bosilmaydigandek
   tuyuladi. */
@media (hover: none) {
  .hz-kpi-arrow { opacity: .9; }
}

.hz-section-title {
  font-size: 16px; font-weight: 800; color: var(--hz-text);
  margin: 26px 0 14px; display: flex; align-items: center; gap: 8px;
}

.hz-panel {
  background: var(--hz-surface); border: 1px solid var(--hz-border);
  border-radius: var(--hz-radius); box-shadow: var(--hz-shadow);
  padding: 18px 20px;
}

.hz-table { width: 100%; border-collapse: collapse; background: var(--hz-surface); border-radius: var(--hz-radius); overflow: hidden; box-shadow: var(--hz-shadow); border: 1px solid var(--hz-border); }
.hz-table th, .hz-table td { text-align: left; padding: 11px 15px; border-bottom: 1px solid var(--hz-border); font-size: 13.5px; }
.hz-table th { background: var(--hz-surface-2); color: var(--hz-text-soft); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
.hz-table tr:last-child td { border-bottom: none; }
.hz-table tr:hover td { background: var(--hz-surface-2); }

.hz-empty { color: var(--hz-muted); font-size: 14px; padding: 28px; text-align: center; background: var(--hz-surface); border-radius: var(--hz-radius); border: 1px dashed var(--hz-border); }

.hz-tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 20px; padding-bottom: 4px; }
.hz-tab {
  white-space: nowrap; padding: 8px 16px; border-radius: 999px;
  background: var(--hz-surface); color: var(--hz-primary-light);
  text-decoration: none; font-size: 13px; font-weight: 700;
  border: 1px solid var(--hz-border);
}
.hz-tab.active { background: var(--hz-primary); color: var(--hz-accent); border-color: var(--hz-primary); }

.hz-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; color: #fff; }
.hz-badge.present { background: var(--hz-green); }
.hz-badge.absent { background: var(--hz-red); }
.hz-badge.excused { background: var(--hz-amber); }
.hz-badge.late { background: var(--hz-orange); }
.hz-badge.debt { background: var(--hz-red); }
.hz-badge.ok { background: var(--hz-green); }
.hz-badge.neutral { background: var(--hz-muted); }

.hz-grade-pill { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; font-weight: 800; font-size: 13px; color: #fff; background: var(--hz-primary); }

.hz-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--hz-primary); color: var(--hz-accent); border: none;
  padding: 10px 18px; border-radius: 10px; font-weight: 700; font-size: 13.5px;
  cursor: pointer; text-decoration: none;
}
.hz-btn:hover { background: var(--hz-primary-dark); }
.hz-btn.secondary { background: var(--hz-surface-2); color: var(--hz-text); border: 1px solid var(--hz-border); }
.hz-btn.secondary:hover { background: var(--hz-border); }
.hz-btn.danger { background: var(--hz-red); color: #fff; }

.hz-form-row { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.hz-form-row label { min-width: 110px; color: var(--hz-muted); font-size: 13px; font-weight: 600; }
.hz-form-row select, .hz-form-row input[type="date"], .hz-form-row input[type="text"],
.hz-form-row input[type="number"], .hz-form-row input[type="password"], .hz-form-row textarea {
  padding: 9px 11px; border: 1px solid var(--hz-border); border-radius: 8px; font-size: 13.5px;
  background: var(--hz-surface); color: var(--hz-text);
}
.hz-form-row textarea { width: 100%; min-height: 70px; font-family: inherit; }
.hz-field-full { flex: 1; min-width: 220px; }

.hz-journal-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--hz-surface); border: 1px solid var(--hz-border); border-radius: 10px;
  padding: 10px 14px; margin-bottom: 8px; box-shadow: var(--hz-shadow); gap: 12px; flex-wrap: wrap;
}
.hz-journal-row .student-name { font-weight: 700; flex: 1; min-width: 140px; }
.hz-journal-row select, .hz-journal-row input[type="number"] {
  padding: 7px 9px; border: 1px solid var(--hz-border); border-radius: 8px; font-size: 14px; width: 90px;
  background: var(--hz-surface); color: var(--hz-text);
}

.hz-save-btn {
  background: var(--hz-primary); color: var(--hz-accent); border: none;
  padding: 12px 22px; border-radius: 10px; font-weight: 700; font-size: 14px;
  cursor: pointer; margin-top: 14px;
}
.hz-save-btn:hover { background: var(--hz-primary-dark); }

.hz-success { background: #d1fae5; color: #065f46; padding: 10px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
[data-theme="dark"] .hz-success { background: #0d3b2a; color: #6ee7b7; }
.hz-error-box { background: #fee2e2; color: #991b1b; padding: 10px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
[data-theme="dark"] .hz-error-box { background: #3f1414; color: #fca5a5; }
.hz-warning-box { background: #fef3c7; color: #92400e; padding: 10px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
[data-theme="dark"] .hz-warning-box { background: #451a03; color: #fcd34d; }

.hz-child-card {
  background: var(--hz-surface); border: 1px solid var(--hz-border);
  border-radius: var(--hz-radius); box-shadow: var(--hz-shadow);
  padding: 18px 20px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 14px;
  text-decoration: none; color: var(--hz-text);
}
.hz-child-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--hz-accent); color: var(--hz-primary-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; flex-shrink: 0;
}
.hz-child-info .name { font-weight: 700; font-size: 16px; }
.hz-child-info .meta { color: var(--hz-muted); font-size: 13px; margin-top: 2px; }

/* Kanban */
.hz-kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; }
.hz-kanban-col { background: var(--hz-surface-2); border: 1px solid var(--hz-border); border-radius: 12px; min-width: 230px; max-width: 230px; padding: 10px; flex-shrink: 0; }
.hz-kanban-col-title { font-weight: 700; font-size: 13px; color: var(--hz-text); margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.hz-kanban-col-title .count { background: var(--hz-primary); color: var(--hz-accent); border-radius: 999px; padding: 1px 8px; font-size: 11px; }
.hz-kanban-cards { min-height: 60px; display: flex; flex-direction: column; gap: 8px; }
.hz-kanban-card { background: var(--hz-surface); border: 1px solid var(--hz-border); border-radius: 10px; padding: 10px 12px; box-shadow: var(--hz-shadow); text-decoration: none; color: var(--hz-text); cursor: grab; display: block; }
.hz-kanban-card:active { cursor: grabbing; opacity: 0.7; }
.hz-kanban-card .name { font-weight: 700; font-size: 13px; }
.hz-kanban-card .meta { font-size: 12px; color: var(--hz-muted); margin-top: 2px; }
.hz-kanban-card .tag { display: inline-block; margin-top: 6px; background: var(--hz-accent); color: var(--hz-primary-dark); font-size: 11px; padding: 2px 8px; border-radius: 999px; }

/* Login page */
.hz-login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--hz-primary); }
.hz-login-box { background: var(--hz-surface); border-radius: var(--hz-radius); padding: 40px 36px; width: 360px; box-shadow: 0 10px 30px rgba(0,0,0,0.25); text-align: center; }
.hz-login-box img { height: 70px; margin-bottom: 12px; }
.hz-login-box h1 { font-size: 18px; color: var(--hz-primary-light); margin: 0 0 4px; }
.hz-login-box p.slogan { color: var(--hz-muted); font-size: 13px; margin: 0 0 24px; }
.hz-login-box input { width: 100%; padding: 11px 14px; margin-bottom: 12px; border: 1px solid var(--hz-border); border-radius: 10px; font-size: 14px; background: var(--hz-surface-2); color: var(--hz-text); }
.hz-login-box button { width: 100%; padding: 12px; background: var(--hz-primary); color: var(--hz-accent); border: none; border-radius: 10px; font-weight: 700; font-size: 14px; cursor: pointer; margin-top: 6px; }
.hz-login-box button:hover { background: var(--hz-primary-dark); }
.hz-error { color: var(--hz-red); font-size: 13px; margin-bottom: 10px; }

.hz-search-bar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.hz-search-bar input, .hz-search-bar select {
  padding: 10px 12px; border: 1px solid var(--hz-border); border-radius: 9px;
  font-size: 13.5px; background: var(--hz-surface); color: var(--hz-text);
}
.hz-pagination { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.hz-pagination a, .hz-pagination span {
  padding: 7px 12px; border-radius: 8px; text-decoration: none; font-size: 13px;
  border: 1px solid var(--hz-border); color: var(--hz-text); background: var(--hz-surface);
}
.hz-pagination .current { background: var(--hz-primary); color: var(--hz-accent); border-color: var(--hz-primary); }

/* Mobile tweaks */
@media (max-width: 640px) {
  .hz-card .value { font-size: 22px; }
  .hz-table th, .hz-table td { padding: 9px 10px; font-size: 13px; }
}

/* Eski shablonlar bilan moslik uchun (endi .hz-content shu vazifani bajaradi) */
.hz-container { width: 100%; }

/* ---- Dashboard: filial tanlash qatori (kompakt pill) ---- */
.hz-branch-row {
  display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px;
}
.hz-branch-pill {
  display: flex; align-items: center; gap: 10px;
  background: var(--hz-surface); border: 1.5px solid var(--hz-border);
  border-radius: 12px; padding: 10px 16px; text-decoration: none; color: var(--hz-text);
  flex-shrink: 0; min-width: 190px; transition: border-color 0.15s ease;
}
.hz-branch-pill:hover { border-color: var(--hz-primary-light); }
.hz-branch-pill.active { border-color: var(--hz-primary); background: var(--hz-surface-2); }
.hz-branch-pill .ic { font-size: 20px; }
.hz-branch-pill .txt { display: flex; flex-direction: column; }
.hz-branch-pill .name { font-weight: 700; font-size: 13.5px; }
.hz-branch-pill .meta { font-size: 11.5px; color: var(--hz-muted); display: flex; align-items: center; gap: 4px; }
.hz-branch-pill .debt-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--hz-red);
  display: inline-block; margin-left: 6px;
}

/* ---- Chat ---- */
.hz-chat-list { display: flex; flex-direction: column; gap: 8px; }
.hz-chat-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--hz-surface); border: 1px solid var(--hz-border);
  border-radius: 12px; padding: 12px 16px; text-decoration: none; color: var(--hz-text);
}
.hz-chat-row:hover { border-color: var(--hz-primary-light); }
.hz-chat-row-info { flex: 1; min-width: 0; }
.hz-chat-row-info .name { font-weight: 700; font-size: 14px; }
.hz-chat-row-info .preview { font-size: 12.5px; color: var(--hz-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hz-chat-row-meta { text-align: right; flex-shrink: 0; }
.hz-chat-row-meta .time { font-size: 11px; color: var(--hz-muted); margin-bottom: 4px; }
.hz-chat-row-meta .unread-badge {
  background: var(--hz-primary); color: var(--hz-accent); border-radius: 999px;
  font-size: 11px; font-weight: 700; padding: 2px 7px; display: inline-block;
}

.hz-contact-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 24px; }
.hz-contact-card {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--hz-surface); border: 1px solid var(--hz-border); border-radius: 10px;
  padding: 10px 14px; cursor: pointer; font-size: 14px; color: var(--hz-text);
}
.hz-contact-card:hover { border-color: var(--hz-primary-light); background: var(--hz-surface-2); }

.hz-chat-window {
  background: var(--hz-surface); border: 1px solid var(--hz-border);
  border-radius: var(--hz-radius); display: flex; flex-direction: column;
  height: 65vh; max-height: 640px;
}
.hz-chat-messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.hz-msg { max-width: 72%; display: flex; flex-direction: column; }
.hz-msg.me { align-self: flex-end; align-items: flex-end; }
.hz-msg.them { align-self: flex-start; align-items: flex-start; }
.hz-msg-sender { font-size: 11px; color: var(--hz-muted); margin-bottom: 2px; padding: 0 4px; }
.hz-msg-bubble {
  padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.4;
  word-break: break-word; white-space: pre-wrap;
}
.hz-msg.me .hz-msg-bubble { background: var(--hz-primary); color: var(--hz-accent); border-bottom-right-radius: 4px; }
.hz-msg.them .hz-msg-bubble { background: var(--hz-surface-2); color: var(--hz-text); border-bottom-left-radius: 4px; }
.hz-msg-time { font-size: 10px; color: var(--hz-muted); margin-top: 2px; padding: 0 4px; }

.hz-chat-input-row {
  display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--hz-border);
}
.hz-chat-input-row input {
  flex: 1; padding: 10px 14px; border: 1px solid var(--hz-border); border-radius: 999px;
  background: var(--hz-surface-2); color: var(--hz-text); font-size: 14px;
}

/* Tizim (avtomatik) xabarlar — o'rtada, boshqacha rangda */
.hz-msg.system { align-self: center; align-items: center; max-width: 85%; }
.hz-msg.system .hz-msg-bubble {
  background: var(--hz-accent); color: var(--hz-primary-dark);
  border-radius: 12px; font-size: 13px; font-weight: 600; text-align: center;
}
.hz-msg.system .hz-msg-sender { color: var(--hz-primary-light); font-weight: 700; }

/* ---- Universal Drawer (slayd panel) — qo'shish/tahrirlash uchun ---- */
.hz-drawer-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 21, 0.45);
  z-index: 100; display: none; opacity: 0; transition: opacity 0.2s ease;
}
.hz-drawer-overlay.open { display: block; opacity: 1; }

.hz-drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 420px; max-width: 92vw;
  background: var(--hz-surface); z-index: 101; box-shadow: -8px 0 30px rgba(0,0,0,0.25);
  transform: translateX(100%); transition: transform 0.25s ease;
  display: flex; flex-direction: column;
}
.hz-drawer.open { transform: translateX(0); }

.hz-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--hz-border);
}
.hz-drawer-header h3 { margin: 0; font-size: 16px; font-weight: 800; }
.hz-drawer-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--hz-muted); }
.hz-drawer-close:hover { color: var(--hz-text); }

.hz-drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.hz-drawer-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 20px; border-top: 1px solid var(--hz-border);
}

.hz-drawer-body .hz-form-row { flex-direction: column; align-items: stretch; gap: 6px; }
.hz-drawer-body .hz-form-row label { min-width: auto; font-weight: 700; color: var(--hz-text); }
.hz-drawer-body input, .hz-drawer-body select, .hz-drawer-body textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--hz-border); border-radius: 8px;
  background: var(--hz-surface); color: var(--hz-text); font-size: 14px;
}

/* Sozlamalar — ichki-menyu tuzilmasi */
.hz-settings-layout { display: flex; gap: 20px; align-items: flex-start; }
.hz-settings-nav { width: 220px; flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; }
.hz-settings-nav a {
  padding: 10px 14px; border-radius: 9px; text-decoration: none; font-size: 13.5px; font-weight: 600;
  background: var(--hz-surface); border: 1px solid var(--hz-border); color: var(--hz-text-soft);
}
.hz-settings-nav a.active { background: var(--hz-primary); color: var(--hz-accent); border-color: var(--hz-primary); }

/* Sozlamalar yon menyusidagi guruh sarlavhasi — bo'limlar ko'payib
   ketgani uchun ularni mavzu bo'yicha ajratamiz. */
.hz-settings-group {
  font-size: 11px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--hz-text-muted);
  padding: 14px 4px 4px; margin-top: 4px;
  border-top: 1px solid var(--hz-border);
}
.hz-settings-group:first-child { margin-top: 0; padding-top: 2px; border-top: none; }
.hz-settings-nav a:hover:not(.active) { border-color: var(--hz-primary-light); }
.hz-settings-content { flex: 1; min-width: 0; }

@media (max-width: 760px) {
  .hz-settings-layout { flex-direction: column; }
  .hz-settings-nav { width: 100%; flex-direction: row; flex-wrap: wrap; }
}

/* ===================================================================
   CHAT — to'liq messenger uslublari
   Fayl/rasm yuborish, javob berish, reaksiya va xabar amallari uchun.
   =================================================================== */

.hz-chat-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px; padding-bottom: 12px;
  border-bottom: 1px solid var(--hz-border);
}
.hz-chat-toolbar-info { flex: 1; min-width: 120px; display: flex; flex-direction: column; }

/* Xabar ilovalari */
.hz-msg-image {
  max-width: 280px; max-height: 320px; border-radius: 10px;
  display: block; margin-bottom: 6px; cursor: zoom-in;
}
.hz-msg-file {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
  padding: 9px 12px; border-radius: 10px; margin-bottom: 6px;
  background: rgba(0,0,0,.06); color: inherit;
}
.hz-msg-file:hover { background: rgba(0,0,0,.12); }
.hz-msg-file .ic { font-size: 20px; }
.hz-msg-file small { opacity: .75; }

/* Javob (iqtibos) */
.hz-msg-reply {
  border-left: 3px solid currentColor; opacity: .75;
  padding: 4px 8px; margin-bottom: 6px; font-size: 12px;
  border-radius: 4px; background: rgba(0,0,0,.05);
}
.hz-reply-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; background: var(--hz-surface-2);
  border-top: 1px solid var(--hz-border); font-size: 13px;
}
.hz-reply-bar button {
  border: none; background: none; cursor: pointer;
  font-size: 18px; color: var(--hz-muted);
}

/* Xabar ustidagi amallar — sichqoncha olib borilganda ko'rinadi */
.hz-msg-actions {
  display: flex; gap: 8px; margin-top: 3px;
  opacity: 0; transition: opacity .15s;
}
.hz-msg:hover .hz-msg-actions { opacity: 1; }
.hz-msg-actions button {
  border: none; background: none; cursor: pointer; padding: 0;
  font-size: 11.5px; color: var(--hz-muted); text-decoration: underline;
}
.hz-msg-actions button:hover { color: var(--hz-primary); }
/* Telefonlarda "hover" yo'q — amallar doim ko'rinadi */
@media (hover: none) { .hz-msg-actions { opacity: 1; } }

/* Reaksiyalar */
.hz-msg-reactions { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.hz-reaction {
  border: 1px solid var(--hz-border); background: var(--hz-white);
  border-radius: 12px; padding: 1px 8px; font-size: 12px; cursor: pointer;
}
.hz-reaction.mine { border-color: var(--hz-primary); background: var(--hz-surface-2); }
.hz-emoji-box {
  position: absolute; z-index: 60; display: flex; gap: 4px;
  background: var(--hz-white); border: 1px solid var(--hz-border);
  border-radius: 20px; padding: 5px 8px; box-shadow: var(--hz-shadow);
}
.hz-emoji-box button {
  border: none; background: none; cursor: pointer; font-size: 18px;
  padding: 2px 4px; border-radius: 50%;
}
.hz-emoji-box button:hover { background: var(--hz-surface-2); }

/* Fayl biriktirish tugmasi */
.hz-attach-btn {
  cursor: pointer; font-size: 20px; padding: 6px 10px;
  border-radius: 10px; user-select: none; flex-shrink: 0;
}
.hz-attach-btn:hover { background: var(--hz-surface-2); }
.hz-file-chip {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px;
  padding: 7px 14px; background: var(--hz-surface-2);
  border-top: 1px solid var(--hz-border);
}
.hz-file-chip button {
  border: none; background: none; cursor: pointer;
  font-size: 16px; color: var(--hz-red);
}

.hz-msg-text { white-space: pre-wrap; word-break: break-word; }

/* Menyudagi o'qilmagan xabarlar nishoni */
.hz-nav-badge {
  display: inline-block; min-width: 18px; padding: 0 5px;
  margin-left: 6px; border-radius: 9px;
  background: var(--hz-red); color: #fff;
  font-size: 11px; font-weight: 800; line-height: 18px;
  text-align: center; vertical-align: middle;
}

/* Ovozli xabar */
.hz-msg-audio { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.hz-msg-audio audio { height: 36px; max-width: 220px; }
.hz-audio-time { font-size: 11.5px; opacity: .75; }

.hz-mic-btn {
  border: none; background: none; cursor: pointer; font-size: 20px;
  padding: 6px 10px; border-radius: 10px; flex-shrink: 0;
}
.hz-mic-btn:hover { background: var(--hz-surface-2); }

.hz-rec-bar {
  display: flex; align-items: center; gap: 10px; font-size: 13px;
  padding: 9px 14px; background: var(--hz-surface-2);
  border-top: 1px solid var(--hz-border);
}
.hz-rec-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--hz-red); animation: hz-blink 1s infinite;
}
@keyframes hz-blink { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

/* ===================================================================
   MOSLASHUVCHANLIK (RESPONSIVE) — to'liq qatlam
   Kompyuter / planshet / telefon

   MUAMMO: jadvallar telefonda siqilib, ustunlar bir-birining ustiga
   chiqib ketardi. Formalar ham tor ekranda buzilardi. Foydalanuvchi
   telefonda ba'zi bo'limlarni umuman ko'ra olmasdi.
   =================================================================== */

/* ---------- Jadvallar: gorizontal aylantirish ----------
   Keng jadvalni siqib buzish o'rniga, uni yon tomonga suriladigan
   qilamiz. Ustunlar o'z kengligini saqlaydi, matn chalkashmaydi. */
.hz-table-wrap {
  width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
  border-radius: var(--hz-radius);
}
.hz-table-wrap .hz-table { margin-bottom: 0; }

/* Telefonda jadval ichidagi matn kichrayadi, lekin o'qilarli qoladi */
@media (max-width: 760px) {
  .hz-table { min-width: 640px; }
  .hz-table th, .hz-table td { padding: 10px 12px; font-size: 13px; }
}

/* ---------- Kartochka ko'rinishidagi jadval (telefon uchun) ----------
   Eng muhim ro'yxatlarda (o'quvchilar, xodimlar) jadval o'rniga
   kartochkalar ko'rsatiladi — telefonda o'qish ancha qulay. */
.hz-cards-mobile { display: none; }
@media (max-width: 760px) {
  .hz-hide-mobile { display: none !important; }
  .hz-cards-mobile { display: grid; gap: 12px; }
}
@media (min-width: 761px) {
  .hz-show-mobile-only { display: none !important; }
}

.hz-row-card {
  background: var(--hz-surface); border: 1px solid var(--hz-border);
  border-radius: 12px; padding: 14px;
}
.hz-row-card-head {
  display: flex; justify-content: space-between; gap: 10px;
  align-items: flex-start; margin-bottom: 10px;
}
.hz-row-card-title { font-weight: 700; font-size: 15px; line-height: 1.35; }
.hz-row-card-sub { font-size: 12.5px; color: var(--hz-text-muted); margin-top: 2px; }
.hz-row-card-body {
  display: grid; grid-template-columns: auto 1fr; gap: 6px 12px;
  font-size: 13.5px; margin-bottom: 12px;
}
.hz-row-card-body dt { color: var(--hz-text-muted); }
.hz-row-card-body dd { margin: 0; font-weight: 500; }
.hz-row-card-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding-top: 10px; border-top: 1px solid var(--hz-border);
}
.hz-row-card-actions a, .hz-row-card-actions button {
  flex: 1; min-width: 78px; text-align: center; font-size: 13px;
  padding: 8px 10px;
}

/* ---------- Formalar ---------- */
@media (max-width: 760px) {
  .hz-form-row {
    flex-direction: column; align-items: stretch !important; gap: 6px;
  }
  .hz-form-row label { margin-bottom: 0; }
  .hz-form-row input, .hz-form-row select, .hz-form-row textarea {
    width: 100% !important; flex: none !important;
  }
  .hz-field-full { width: 100%; }
}

/* ---------- Qidiruv va filtr qatori ---------- */
@media (max-width: 760px) {
  .hz-search-bar {
    flex-direction: column; align-items: stretch; gap: 8px;
  }
  .hz-search-bar input, .hz-search-bar select, .hz-search-bar button {
    width: 100%; min-width: 0 !important;
  }
}

/* ---------- Tugmalar telefonda ---------- */
@media (max-width: 560px) {
  .hz-btn { padding: 10px 16px; font-size: 13.5px; }
  .hz-actions-stack { display: flex; flex-direction: column; gap: 8px; }
  .hz-actions-stack > * { width: 100%; text-align: center; }
}

/* ---------- Planshet ---------- */
@media (min-width: 761px) and (max-width: 1024px) {
  .hz-content { padding: 20px 18px; }
  .hz-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .hz-cards-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ---------- Yon menyu: planshetda ham yashiriladi ---------- */
@media (max-width: 1024px) {
  .hz-sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%);
                z-index: 40; }
  .hz-sidebar.open { transform: translateX(0); }
  .hz-sidebar-overlay.open { display: block; }
  .hz-menu-btn { display: block; }
  .hz-main { margin-left: 0 !important; }
}

/* ---------- Yuqori panel telefonda ---------- */
@media (max-width: 640px) {
  .hz-topbar { padding: 9px 12px; gap: 8px; flex-wrap: nowrap; }
  .hz-topbar-right { gap: 4px; }
  .hz-user-chip { padding: 5px 9px; font-size: 12.5px; max-width: 130px;
                  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hz-user-chip .avatar { width: 26px; height: 26px; font-size: 12px; }
  .hz-branch-select { max-width: 120px; font-size: 12.5px; }
  .hz-content { padding: 14px 12px; }
  .hz-page-title { font-size: 18px; }
}

/* Juda tor ekranda ortiqcha elementlarni yashiramiz */
@media (max-width: 420px) {
  .hz-topbar .hz-user-chip .name-text { display: none; }
  .hz-theme-toggle { padding: 4px 7px; font-size: 15px; }
}

/* ---------- Drawer (yon oyna) telefonda to'liq ekran ---------- */
@media (max-width: 640px) {
  .hz-drawer { width: 100% !important; max-width: 100%; }
}

/* ---------- Rasmlar hech qachon tashqariga chiqmasin ---------- */
img { max-width: 100%; height: auto; }

/* ---------- Uzun matn qatorni buzmasin ---------- */
.hz-table td, .hz-row-card-body dd { overflow-wrap: anywhere; }

/* ---------- Parol ko'rsatish tugmasi ----------

   TUZATILDI: ilgari bu qoidalar `.hz-password-toggle` deb yozilgan edi,
   lekin kirish sahifasida `.hz-login-box button { width: 100% }` qoidasi
   kuchliroq (specificity) bo'lgani uchun ustun kelardi. Natijada ko'z
   tugmasi butun maydonni qoplab, yashil to'rtburchakka aylanib qolardi
   va parol maydonlari ko'rinmasdi.

   Endi qoidalar `.hz-password-wrap` konteksti bilan yoziladi — bu
   `.hz-login-box button` dan kuchliroq va muammo takrorlanmaydi. */

/* ---------- Parol ko'rsatish tugmasi ----------

   TUZATILDI: ilgari tugma oddiy `.hz-password-toggle` bilan uslublangan
   edi, lekin kirish sahifasida `.hz-login-box button { width: 100%; }`
   qoidasi bor. U aniqroq (specificity yuqoriroq) bo'lgani uchun
   yutib ketardi va tugma BUTUN MAYDONNI qoplab olardi — foydalanuvchi
   parolni umuman kirita olmasdi.

   Endi qoidalar aniqroq yozilgan va `!important` bilan mustahkamlangan,
   shuning uchun boshqa sahifadagi umumiy `button` qoidalari buzmaydi. */

.hz-password-wrap {
  position: relative !important;
  display: block !important;
  width: 100%;
}
.hz-password-wrap > input,
.hz-login-box .hz-password-wrap > input {
  width: 100% !important;
  padding-right: 46px !important;
  margin-bottom: 0 !important;
}
/* Maydonlar orasidagi bo'shliq wrapper'da bo'ladi */
.hz-password-wrap { margin-bottom: 12px; }

.hz-password-wrap > button.hz-password-toggle,
.hz-login-box .hz-password-wrap > button.hz-password-toggle,
.hz-login-box button.hz-password-toggle {
  position: absolute !important;
  right: 4px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 38px !important;
  height: 34px !important;
  min-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  cursor: pointer;
  font-size: 16px !important;
  line-height: 1 !important;
  color: var(--hz-text-muted) !important;
  border-radius: 7px !important;
  display: grid !important;
  place-items: center !important;
}
.hz-password-wrap > button.hz-password-toggle:hover,
.hz-login-box button.hz-password-toggle:hover {
  background: var(--hz-surface-2) !important;
  color: var(--hz-primary) !important;
}
.hz-login-box .hz-password-wrap .hz-password-toggle:hover {
  background: var(--hz-surface-2); color: var(--hz-primary);
}

/* ---------- Ro'yxat sahifalari uchun umumiy uslublar ---------- */
.hz-toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 16px;
}
.hz-toolbar-count {
  margin-left: auto; color: var(--hz-text-muted); font-size: 13.5px;
}
@media (max-width: 560px) {
  .hz-toolbar { gap: 8px; }
  .hz-toolbar .hz-btn { flex: 1 1 calc(50% - 4px); text-align: center; }
  .hz-toolbar-count { flex-basis: 100%; margin-left: 0; text-align: center; }
}

.hz-label {
  display: block; font-size: 12.5px; color: var(--hz-text-muted);
  margin-bottom: 4px; font-weight: 500;
}
.hz-input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--hz-border);
  border-radius: 9px; background: var(--hz-white); color: var(--hz-text);
  font-size: 14px; font-family: inherit;
}
.hz-form-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.hz-bulk-bar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: var(--hz-surface-2); border: 1px solid var(--hz-border);
  border-radius: 11px; padding: 12px 14px; margin-bottom: 14px;
}
@media (max-width: 640px) {
  .hz-bulk-bar { flex-direction: column; align-items: stretch; }
  .hz-bulk-bar .hz-input, .hz-bulk-bar .hz-btn, .hz-bulk-bar .hz-tab { width: 100%; }
}

.hz-link-strong {
  font-weight: 600; color: var(--hz-primary); text-decoration: none;
}
.hz-link-strong:hover { text-decoration: underline; }
.hz-cell-sub { font-size: 11.5px; color: var(--hz-text-muted); margin-top: 2px; }
.hz-cell-actions { white-space: nowrap; }
.hz-cell-actions .hz-tab { margin-right: 2px; }
.hz-tab-green { color: var(--hz-green) !important; font-weight: 600; }
.hz-badge.neutral { background: var(--hz-muted); }

/* ===================================================================
   CHAT — ko'rinishni yaxshilash
   =================================================================== */

/* Suhbat oynasi telefonda to'liq balandlikni egallasin */
.hz-chat-window {
  display: flex; flex-direction: column;
  height: calc(100vh - 210px); min-height: 400px;
  background: var(--hz-surface); border: 1px solid var(--hz-border);
  border-radius: var(--hz-radius); overflow: hidden;
}
@media (max-width: 760px) {
  .hz-chat-window { height: calc(100vh - 170px); border-radius: 12px; }
}

.hz-chat-messages {
  flex: 1; overflow-y: auto; padding: 18px;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--hz-surface-2);
  scroll-behavior: smooth;
}

/* Xabar pufakchalari — Telegram uslubida */
.hz-msg { display: flex; flex-direction: column; max-width: 74%; margin-bottom: 8px; }
.hz-msg.me { align-self: flex-end; align-items: flex-end; }
.hz-msg.them { align-self: flex-start; align-items: flex-start; }
.hz-msg.system { align-self: center; align-items: center; max-width: 88%; }

.hz-msg-bubble {
  padding: 9px 14px; border-radius: 16px; font-size: 14.5px;
  line-height: 1.5; word-break: break-word; box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.hz-msg.me .hz-msg-bubble {
  background: var(--hz-primary); color: #fff; border-bottom-right-radius: 5px;
}
.hz-msg.them .hz-msg-bubble {
  background: var(--hz-white); color: var(--hz-text);
  border-bottom-left-radius: 5px; border: 1px solid var(--hz-border);
}
.hz-msg.system .hz-msg-bubble {
  background: var(--hz-accent-light, #F5DFA8); color: var(--hz-primary-dark, #0D3833);
  font-size: 13.5px; text-align: center; border-radius: 12px;
}

.hz-msg-sender {
  font-size: 12px; font-weight: 700; color: var(--hz-primary);
  margin-bottom: 3px; padding: 0 6px;
}
.hz-msg-time {
  font-size: 11px; color: var(--hz-text-muted); margin-top: 3px; padding: 0 6px;
  display: flex; gap: 5px; align-items: center;
}

/* Sana ajratgichi */
.hz-msg-date-sep {
  align-self: center; margin: 14px 0 10px;
  background: rgba(0,0,0,.07); color: var(--hz-text-muted);
  padding: 4px 14px; border-radius: 20px; font-size: 12px; font-weight: 600;
}

/* Yozish qatori */
.hz-chat-input-row {
  display: flex; gap: 8px; align-items: center; padding: 12px 14px;
  background: var(--hz-surface); border-top: 1px solid var(--hz-border);
}
.hz-chat-input-row input[type="text"] {
  flex: 1; padding: 11px 15px; border: 1px solid var(--hz-border);
  border-radius: 22px; background: var(--hz-white); color: var(--hz-text);
  font-size: 14.5px; font-family: inherit; min-width: 0;
}
.hz-chat-input-row input[type="text"]:focus {
  outline: none; border-color: var(--hz-primary);
}
@media (max-width: 560px) {
  .hz-chat-input-row { padding: 9px 10px; gap: 5px; }
  .hz-chat-input-row .hz-btn { padding: 10px 14px; font-size: 13px; }
  .hz-msg { max-width: 86%; }
}

/* Suhbatlar ro'yxati */
.hz-chat-row {
  display: flex; gap: 13px; align-items: center; padding: 13px 15px;
  border-bottom: 1px solid var(--hz-border); text-decoration: none;
  color: var(--hz-text); transition: background .12s;
}
.hz-chat-row:hover { background: var(--hz-surface-2); }
.hz-chat-row:last-child { border-bottom: none; }
.hz-chat-list {
  background: var(--hz-surface); border: 1px solid var(--hz-border);
  border-radius: var(--hz-radius); overflow: hidden;
}
.hz-chat-row-info { flex: 1; min-width: 0; }
.hz-chat-row-info .name {
  font-weight: 700; font-size: 14.5px; margin-bottom: 2px;
  display: flex; align-items: center; gap: 6px;
}
.hz-chat-row-info .preview {
  font-size: 13px; color: var(--hz-text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hz-chat-row-meta {
  text-align: right; flex-shrink: 0; display: flex;
  flex-direction: column; align-items: flex-end; gap: 5px;
}
.hz-chat-row-meta .time { font-size: 11.5px; color: var(--hz-text-muted); }
.unread-badge {
  background: var(--hz-red); color: #fff; border-radius: 11px;
  min-width: 21px; padding: 1px 7px; font-size: 11.5px;
  font-weight: 800; text-align: center;
}

/* O'qilmagan suhbat ajralib tursin */
.hz-chat-row.unread { background: rgba(20,80,74,.04); }
.hz-chat-row.unread .name { color: var(--hz-primary); }
.hz-chat-row.unread .preview { color: var(--hz-text); font-weight: 500; }

/* Yangi xabar keldi — qisqa yorqinlik */
@keyframes hz-flash {
  0% { background: rgba(201,162,39,.28); }
  100% { background: transparent; }
}
.hz-msg-new { animation: hz-flash 1.2s ease-out; }

/* Forma maydoni ostidagi maslahat matni */
.hz-field-hint {
  font-size: 12.5px; color: var(--hz-text-muted);
  margin: -8px 0 16px; line-height: 1.55; padding-left: 2px;
}

/* ---------- Shaxsiy kabinet ---------- */
.hz-profile-grid {
  display: grid; grid-template-columns: 300px 1fr; gap: 18px;
  align-items: start;
}
@media (max-width: 860px) {
  .hz-profile-grid { grid-template-columns: 1fr; }
}
.hz-profile-avatar {
  width: 110px; height: 110px; border-radius: 50%; margin: 0 auto 14px;
  background: var(--hz-primary); color: var(--hz-accent-light, #F5DFA8);
  display: grid; place-items: center; font-size: 42px; font-weight: 800;
  overflow: hidden;
}
.hz-profile-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ===================================================================
   CHAT XABARLARI — o'lcham xatosini tuzatish

   MUAMMO: eski `.hz-msg` qoidasi (72% kenglik, `flex-direction: column`)
   yangi qoidalar bilan to'qnashardi. Natijada qisqa xabar ham butun
   balandlikni egallab, "salom" so'zi ustun bo'lib cho'zilib ketardi.

   Bu qoidalar fayl oxirida turgani uchun ustunlik qiladi.
   =================================================================== */

.hz-chat-messages .hz-msg {
  max-width: 74% !important;
  width: auto !important;
  height: auto !important;
  align-self: flex-start;
  flex: 0 0 auto !important;
}
.hz-chat-messages .hz-msg.me { align-self: flex-end !important; }
.hz-chat-messages .hz-msg.system { align-self: center !important; }

.hz-chat-messages .hz-msg-bubble {
  display: inline-block !important;
  width: auto !important;
  height: auto !important;
  max-width: 100%;
  min-height: 0 !important;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

/* Rasm va video pufakchani cho'zmasin */
.hz-chat-messages .hz-msg img,
.hz-chat-messages .hz-msg video {
  max-width: 100%; height: auto; border-radius: 12px; display: block;
}

@media (max-width: 560px) {
  .hz-chat-messages .hz-msg { max-width: 88% !important; }
}

/* ---------- O'quvchi do'koni ---------- */
.hz-shop-header {
  display: flex; gap: 24px; align-items: center; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--hz-primary), #0D3833);
  color: #fff; border-radius: var(--hz-radius); padding: 22px 26px;
  margin-bottom: 20px;
}
.hz-shop-header > div:first-child { flex-shrink: 0; }
.hz-shop-header div { color: rgba(255,255,255,.85) !important; }
.hz-coin-balance {
  font-size: 34px; font-weight: 800; color: var(--hz-accent, #F5DFA8) !important;
  line-height: 1.1;
}
.hz-coin-balance span { font-size: 16px; font-weight: 600; opacity: .8; }

.hz-shop-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}
.hz-shop-card {
  background: var(--hz-surface); border: 1px solid var(--hz-border);
  border-radius: 13px; overflow: hidden; display: flex; flex-direction: column;
  transition: transform .18s, box-shadow .18s;
}
.hz-shop-card:hover { transform: translateY(-3px); box-shadow: var(--hz-shadow); }
.hz-shop-card.unavailable { opacity: .68; }
.hz-shop-img {
  position: relative; aspect-ratio: 4/3; background: var(--hz-surface-2);
  display: grid; place-items: center; overflow: hidden;
}
.hz-shop-img img { width: 100%; height: 100%; object-fit: cover; }
.hz-shop-badge {
  position: absolute; top: 8px; right: 8px; padding: 3px 10px;
  border-radius: 20px; font-size: 11.5px; font-weight: 700; color: #fff;
}
.hz-shop-badge.out { background: var(--hz-red); }
.hz-shop-badge.low { background: #D97706; }
.hz-shop-body { padding: 13px 14px; flex: 1; display: flex; flex-direction: column; }
.hz-shop-name { font-weight: 700; font-size: 14.5px; margin-bottom: 4px; }
.hz-shop-desc {
  font-size: 12.5px; color: var(--hz-text-muted); flex: 1; margin-bottom: 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.hz-shop-foot {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; flex-wrap: wrap;
}
.hz-shop-price {
  font-weight: 800; color: var(--hz-primary); font-size: 15px;
}
.hz-shop-foot .hz-btn { padding: 7px 14px; font-size: 13px; }
@media (max-width: 560px) {
  .hz-shop-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .hz-coin-balance { font-size: 28px; }
}

/* ---------- Reyting ---------- */
.hz-rank {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--hz-surface-2); color: var(--hz-text-muted);
  font-weight: 800; font-size: 13px;
}
.hz-rank.gold   { background: #F2C14E; color: #6B4E00; }
.hz-rank.silver { background: #D8DDE1; color: #4A5157; }
.hz-rank.bronze { background: #E2A76F; color: #5C3410; }

.hz-progress {
  height: 7px; border-radius: 4px; background: var(--hz-surface-2);
  overflow: hidden; margin-bottom: 3px;
}
.hz-progress-bar {
  height: 100%; background: linear-gradient(90deg, var(--hz-primary), #2E7D6F);
  border-radius: 4px; transition: width .5s;
}

/* O'quvchi holati sahifasidagi reyting kartochkalari */
.hz-rank-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.hz-rank-card {
  background: var(--hz-surface); border: 1px solid var(--hz-border);
  border-radius: 13px; padding: 18px; text-align: center;
}
.hz-rank-card .value {
  font-size: 30px; font-weight: 800; color: var(--hz-primary); line-height: 1;
}
.hz-rank-card .label {
  font-size: 12.5px; color: var(--hz-text-muted); margin-top: 6px;
}
.hz-rank-card .sub { font-size: 11.5px; color: var(--hz-text-muted); margin-top: 3px; }

/* ---------- Yig'iladigan bo'lim (<details>) ----------
   JavaScript'siz ishlaydi — hech qachon buzilmaydi. */
.hz-details {
  background: var(--hz-surface); border: 1px solid var(--hz-border);
  border-radius: var(--hz-radius); margin-bottom: 18px; overflow: hidden;
}
.hz-details > summary {
  padding: 14px 18px; cursor: pointer; font-weight: 700; font-size: 14.5px;
  color: var(--hz-primary); list-style: none; user-select: none;
  display: flex; align-items: center; gap: 8px;
}
.hz-details > summary::-webkit-details-marker { display: none; }
.hz-details > summary::after {
  content: "▾"; margin-left: auto; transition: transform .2s;
  font-size: 12px; opacity: .6;
}
.hz-details[open] > summary::after { transform: rotate(180deg); }
.hz-details > summary:hover { background: var(--hz-surface-2); }
.hz-details > div { padding: 0 18px 18px; }

/* ===================================================================
   TELEFON REJIMI — ilova ko'rinishi

   MUAMMO: telefonda yon menyu chetdan chiqardi, sarlavha siqilardi,
   tugmalar mayda edi. Foydalanuvchi "sayt" bilan ishlayotgandek
   his qilardi, ilova bilan emas.

   YECHIM: pastda doimiy menyu (ilovalardagi kabi), kattaroq
   tegiladigan maydonlar, yumshoqroq o'tishlar.
   =================================================================== */

@media (max-width: 760px) {

  /* --- Pastki menyu: eng ko'p ishlatiladigan 4-5 bo'lim --- */
  .hz-bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0;
    z-index: 60; background: var(--hz-surface);
    border-top: 1px solid var(--hz-border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -2px 16px rgba(0,0,0,.07);
  }
  .hz-bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    gap: 3px; padding: 7px 2px; text-decoration: none;
    color: var(--hz-text-muted); font-size: 10.5px; font-weight: 600;
    border-radius: 11px; position: relative; min-width: 0;
  }
  .hz-bottom-nav a .ic { font-size: 20px; line-height: 1; }
  .hz-bottom-nav a.active { color: var(--hz-primary); }
  .hz-bottom-nav a.active .ic { transform: translateY(-1px); }
  .hz-bottom-nav a span:last-child {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    max-width: 100%;
  }
  .hz-bottom-nav .hz-nav-badge {
    position: absolute; top: 3px; right: calc(50% - 18px);
    min-width: 17px; height: 17px; padding: 0 4px; font-size: 10px;
    line-height: 17px; border-radius: 9px;
  }

  /* Pastki menyu kontentni yopib qolmasin */
  .hz-content { padding-bottom: 86px; }

  /* --- Sarlavha: ilovadagidek sodda --- */
  .hz-topbar {
    position: sticky; top: 0; z-index: 50;
    background: var(--hz-surface);
    border-bottom: 1px solid var(--hz-border);
    padding: 10px 12px;
  }
  .hz-page-title { font-size: 17px; font-weight: 800; }

  /* --- Tegiladigan maydonlar kattaroq (barmoq uchun) --- */
  .hz-btn, .hz-tab, .hz-nav-link, button, select {
    min-height: 42px;
  }
  .hz-table td a, .hz-row-card-actions a { min-height: 38px;
                                            display: inline-flex;
                                            align-items: center; }
  input, select, textarea { font-size: 16px !important; }
  /* 16px — iOS shundan kichik bo'lsa sahifani avtomatik kattalashtiradi */

  /* --- Kartochkalar yumshoqroq --- */
  .hz-panel, .hz-row-card, .hz-stat-card {
    border-radius: 14px;
  }

  /* --- Yon menyu: pastki menyu bor, shuning uchun soddaroq --- */
  .hz-sidebar { width: 82%; max-width: 320px; }
  .hz-sidebar .hz-nav-link { padding: 13px 16px; font-size: 15px; }

  /* --- Yuqoriga tortib yangilash uchun joy --- */
  body { overscroll-behavior-y: contain; }
}

/* Kompyuterda pastki menyu ko'rinmaydi */
.hz-bottom-nav { display: none; }

/* --- Ilova kabi: tanlash va ajratib ko'rsatishni o'chirish --- */
@media (max-width: 760px) {
  .hz-nav-link, .hz-bottom-nav a, .hz-btn, .hz-tab {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
  }
}

/* --- Telefon uchun modal/drawer pastdan chiqsin (ilovadagidek) --- */
@media (max-width: 640px) {
  .hz-drawer {
    inset: auto 0 0 0 !important; width: 100% !important;
    max-height: 88vh; border-radius: 20px 20px 0 0 !important;
    transform: translateY(100%);
    transition: transform .28s cubic-bezier(.22,.61,.36,1);
  }
  .hz-drawer.open { transform: translateY(0); }
  .hz-drawer::before {
    content: ""; display: block; width: 40px; height: 4px;
    background: var(--hz-border); border-radius: 2px;
    margin: 10px auto 4px;
  }
}

/* ===================================================================
   TEST NATIJASI — javob ranglari

   TUZATILDI: to'g'ri/noto'g'ri javoblarda faqat orqa fon berilardi.
   Tungi rejimda matn oq bo'lib qolib, och yashil fonda umuman
   ko'rinmasdi.
   =================================================================== */
.hz-answer-correct {
  background: #D1FAE5 !important; color: #065F46 !important;
  font-weight: 600; border-radius: 9px; padding: 10px 13px;
}
.hz-answer-wrong {
  background: #FEE2E2 !important; color: #991B1B !important;
  font-weight: 600; border-radius: 9px; padding: 10px 13px;
}

/* ===================================================================
   TELEFON: yuqori panel to'liq ko'rinsin

   MUAMMO: sarlavhadagi tugmalar (yil, filial, til, profil) bitta
   qatorga sig'masdi va o'ngdagilari ekran chetiga chiqib ketardi.
   Foydalanuvchi ularni faqat sahifani kichraytirib ko'ra olardi.
   =================================================================== */
@media (max-width: 900px) {
  .hz-topbar {
    flex-wrap: wrap;              /* ikkinchi qatorga tushsin */
    align-items: center;
    row-gap: 8px;
    padding: 9px 12px;
  }
  .hz-topbar-left {
    flex: 1 1 100%;               /* sarlavha alohida qatorda */
    min-width: 0;
  }
  .hz-topbar-right {
    flex: 1 1 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
    overflow-x: auto;             /* sig'masa suriladi */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .hz-topbar-right::-webkit-scrollbar { display: none; }
  .hz-topbar-right > * { flex-shrink: 0; }

  .hz-page-title {
    font-size: 17px; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
  }
  .hz-user-chip { padding: 6px 10px; font-size: 12.5px; }
  .hz-branch-select { font-size: 12.5px; padding: 5px 8px; }
}

/* Juda tor ekranda ortiqcha yozuvlarni yashiramiz — belgi qoladi */
@media (max-width: 480px) {
  .hz-topbar-right .name-text { display: none; }
  .hz-user-chip { padding: 6px 8px; }
}
