/* Aroma brendbuki: ranglar #B79F7C, #89775C, #F4D2AE, #FEFEFE; shrift Manrope.
   Qizil faqat xato va xavfli amallar uchun. */
@font-face { font-family: Manrope; font-weight: 400; src: url(/admin/fonts/manrope-400.ttf); }
@font-face { font-family: Manrope; font-weight: 500; src: url(/admin/fonts/manrope-500.ttf); }
@font-face { font-family: Manrope; font-weight: 600; src: url(/admin/fonts/manrope-600.ttf); }
@font-face { font-family: Manrope; font-weight: 700; src: url(/admin/fonts/manrope-700.ttf); }

:root {
  --caramel: #B79F7C;
  --brown: #89775C;
  --peach: #F4D2AE;
  --white: #FEFEFE;
  --peach-soft: #FBEEDF;
  --line: #E6DACB;
  --red: #B3261E;
  --red-soft: #FDECEA;
  --radius: 12px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: Manrope, -apple-system, system-ui, sans-serif;
  font-size: 15px;
  color: var(--brown);
  background: var(--white);
}

h1, h2 { margin: 0 0 6px; font-weight: 700; }
h2 { font-size: 20px; }
.brand { font-weight: 700; font-size: 22px; }
.muted { margin: 0 0 16px; font-weight: 500; }
.small-text { font-size: 13px; }

input, select {
  font: inherit;
  color: var(--brown);
  background: var(--white);
  border: 1.5px solid var(--caramel);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 0;
}
input:focus, select:focus { outline: none; border-color: var(--brown); box-shadow: 0 0 0 3px var(--peach); }
input::placeholder { color: var(--caramel); }

label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 14px; }
label input, label select { display: block; width: 100%; margin-top: 6px; font-weight: 500; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 13px; font-weight: 500; margin: -6px 0 14px; }

.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 8px 0 14px; }
.section-head h2 { margin: 6px 0 4px; }
.section-head .muted { margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 36px; }
.card { border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.inactive { opacity: .55; }
.card-title { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.card-meta { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.dept { margin-bottom: 24px; }
.dept h3 { font-size: 16px; margin: 0 0 8px; }
tr.inactive td { opacity: .55; }
tr.inactive td.actions { opacity: 1; }

.btn {
  font: inherit;
  font-weight: 700;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  border: 1.5px solid var(--brown);
  background: var(--white);
  color: var(--brown);
  white-space: nowrap;
}
.btn:hover { background: var(--peach-soft); }
.btn.primary { background: var(--brown); color: var(--white); }
.btn.primary:hover { opacity: .9; }
.btn.danger { background: var(--red); border-color: var(--red); color: var(--white); }
.btn.ghost { border-color: var(--caramel); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.link { border: none; background: none; padding: 4px 6px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.btn.link.danger-text { color: var(--red); }
.btn.wide { width: 100%; margin-top: 6px; }
.btn:disabled { opacity: .5; cursor: default; }

.error {
  background: var(--red-soft);
  color: var(--red);
  border-left: 4px solid var(--red);
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 600;
  margin: 0 0 14px;
}

/* Kirish */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--peach); padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--white); border-radius: 20px; padding: 32px 28px; }

/* Chap menyu va asosiy maydon */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  width: 240px; flex-shrink: 0;
  display: flex; flex-direction: column;
  background: var(--peach); padding: 24px 16px;
  /* Menyu ekrandan uzun bo'lsa, fon tugab qolmasin: menyuning o'zi aylantiriladi */
  overflow-y: auto; overscroll-behavior: contain;
}
.sidebar-brand { display: flex; flex-direction: column; gap: 2px; padding: 0 12px 24px; }
.sidebar-sub { font-weight: 600; font-size: 13px; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1 0 auto; }
.tab {
  font: inherit; font-weight: 700; color: var(--brown); text-align: left;
  background: none; border: none; border-radius: 10px;
  padding: 11px 12px; cursor: pointer;
}
.nav-group {
  font: inherit; font-weight: 700; color: var(--brown); text-align: left;
  background: none; border: none; border-radius: 10px; padding: 11px 12px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
}
.nav-group:hover { background: var(--peach-soft); }
.nav-group.open .caret { transform: rotate(90deg); }
.caret { display: inline-block; transition: transform .15s; font-size: 12px; }
.nav-sub { display: flex; flex-direction: column; gap: 2px; margin: 0 0 4px 12px; padding-left: 8px; border-left: 2px solid var(--caramel); }
.tab.sub { font-size: 14px; padding: 9px 12px; }
.tab:hover { background: var(--peach-soft); }
.tab.active { background: var(--white); }
.sidebar-user {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 16px 12px 0; border-top: 1.5px solid var(--caramel); font-weight: 700;
}
.main { flex: 1; min-width: 0; }
.page-title { font-size: 26px; margin-bottom: 20px; }

.page { padding: 32px 36px 48px; }

.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.stat { border: 1.5px solid var(--line); border-radius: var(--radius); padding: 12px 16px; min-width: 140px; }
.stat b { display: block; font-size: 24px; }
.stat span { font-size: 13px; font-weight: 600; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input[type=search] { width: 280px; }
.spacer { flex: 1; }

.table-wrap { overflow-x: auto; border: 1.5px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { font-size: 13px; font-weight: 700; background: var(--peach-soft); white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
td.name { font-weight: 700; }
td.nowrap { white-space: nowrap; }
td.wrap { white-space: normal; min-width: 220px; }
td.actions { white-space: nowrap; text-align: right; }
tr.blocked td { opacity: .55; }
tr.blocked td.actions { opacity: 1; }
.empty { padding: 32px; text-align: center; font-weight: 600; margin: 0; }

.chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; border: 1.5px solid var(--caramel); white-space: nowrap; }
.chip.ok { background: var(--peach); border-color: var(--peach); }
.chip.warn { background: var(--red-soft); border-color: var(--red-soft); color: var(--red); }

.audit { list-style: none; margin: 0; padding: 0; border: 1.5px solid var(--line); border-radius: var(--radius); }
.audit li { display: grid; grid-template-columns: 150px 160px 1fr; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.audit li:last-child { border-bottom: none; }
.audit .when { font-weight: 600; font-size: 13px; }
.audit .who { font-weight: 700; }

dialog { border: none; border-radius: 18px; padding: 28px; width: min(440px, calc(100vw - 32px)); color: var(--brown); }
dialog::backdrop { background: rgba(70, 58, 42, .35); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

.phone-input { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.phone-input .prefix { font-weight: 700; }
.phone-input input { margin-top: 0; }

.code-box { text-align: center; }
.code { font-size: 48px; font-weight: 700; letter-spacing: 14px; padding: 12px 0 4px 14px; }
.note { background: var(--peach); border-radius: 10px; padding: 12px; font-weight: 600; font-size: 14px; text-align: left; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--brown); color: var(--white); font-weight: 600;
  padding: 12px 18px; border-radius: 12px;
}

/* Smena grafigi jadvali */
.week-label { font-weight: 700; font-size: 18px; margin: 4px 0 6px; }
table.schedule th, table.schedule td { white-space: normal; vertical-align: top; min-width: 120px; }
table.schedule th.emp, table.schedule td.emp { min-width: 180px; position: sticky; left: 0; background: var(--white); z-index: 1; }
table.schedule thead th.emp { background: var(--peach-soft); }
table.schedule th.today { background: var(--peach); }
table.schedule td.today { background: var(--peach-soft); }
table.schedule td.past { background: #F7F3EE; }
.emp-name { font-weight: 700; }
.emp-pos { font-size: 12px; font-weight: 600; }
.shift-chip {
  display: block; width: 100%; text-align: left; font: inherit; cursor: pointer;
  background: var(--brown); color: var(--white); border: none; border-radius: 8px;
  padding: 6px 8px; margin-bottom: 4px; font-size: 13px; font-weight: 700; line-height: 1.3;
}
.shift-chip small { display: block; font-weight: 500; font-size: 12px; }
.shift-chip.past { background: var(--caramel); cursor: default; }
.shift-chip:hover:not(.past) { opacity: .9; }
.add-cell {
  display: block; width: 100%; font: inherit; font-weight: 700; color: var(--caramel); cursor: pointer;
  background: none; border: 1.5px dashed var(--line); border-radius: 8px; padding: 4px 0;
}
.add-cell:hover { color: var(--brown); border-color: var(--caramel); }
tfoot td { font-size: 12px; font-weight: 600; background: var(--peach-soft); vertical-align: top; }
.option-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.option-list .btn { text-align: left; display: flex; justify-content: space-between; gap: 12px; }
.dialog-actions.spread { justify-content: space-between; align-items: center; }
.dialog-actions.spread span { display: flex; gap: 10px; }

/* Xodim rasmlari */
.avatar {
  width: 36px; height: 36px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--peach); color: var(--brown); font-weight: 700; font-size: 13px;
  border: 2px solid var(--brown);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.large { width: 72px; height: 72px; font-size: 22px; border-width: 3px; }
td.avatar-cell { width: 52px; padding-right: 0; }
.photo-block { display: flex; align-items: center; gap: 16px; margin: 4px 0 16px; }
.photo-title { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.file-btn { display: inline-block; margin: 0; cursor: pointer; }
label.inline { display: flex; align-items: center; gap: 10px; margin: 0; }
label.inline input { width: auto; margin: 0; }

/* Oy yulduzlari */
.awards-cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.award-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.award-row .medal { font-size: 22px; width: 28px; text-align: center; }
.award-row select { flex: 1; min-width: 0; }

/* Darslar va testlar */
textarea {
  display: block; width: 100%; margin-top: 6px;
  font: inherit; font-weight: 500; font-size: 14px; line-height: 1.55; color: var(--brown);
  background: var(--white); border: 1.5px solid var(--caramel); border-radius: 10px; padding: 10px 12px; resize: vertical;
}
textarea:focus { outline: none; border-color: var(--brown); box-shadow: 0 0 0 3px var(--peach); }
textarea#lesson-body { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
label.minutes input { width: 120px; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 380px); gap: 24px; margin-bottom: 28px; }
.format-help { font-size: 13px; font-weight: 500; line-height: 1.8; margin-top: -6px; }
.format-help code { background: var(--peach-soft); border-radius: 6px; padding: 1px 6px; font-size: 12px; }
.preview-title { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.preview {
  border: 1.5px solid var(--line); border-radius: 24px; padding: 20px 18px;
  max-height: 760px; overflow-y: auto; position: sticky; top: 16px;
}
.preview h3 { font-size: 22px; margin: 0 0 4px; }
.preview .pv-summary { border-left: 4px solid var(--brown); padding-left: 12px; font-weight: 500; margin: 12px 0; }
.preview h4 { font-size: 17px; margin: 18px 0 6px; }
.preview p { margin: 0 0 10px; line-height: 1.55; }
.preview .pv-row { display: flex; gap: 6px; margin-bottom: 6px; line-height: 1.55; }
.preview .pv-row > span:first-child { flex-shrink: 0; min-width: 18px; font-weight: 700; }
.preview .pv-note { border: 1.5px solid var(--caramel); border-left: 4px solid var(--brown); border-radius: 10px; padding: 10px 12px; font-weight: 600; margin: 8px 0 12px; white-space: pre-line; }
.question { border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.question-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.question-head b { flex: 1; }
.question textarea { margin: 0 0 10px; }
.option-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.option-row input[type=radio] { width: 18px; height: 18px; accent-color: var(--brown); flex-shrink: 0; margin: 0; }
.option-row input[type=text] { flex: 1; }
.option-row.correct input[type=text] { border-color: var(--brown); background: var(--peach-soft); font-weight: 700; }
.question-foot { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 600; }
.chip.dark { background: var(--brown); border-color: var(--brown); color: var(--white); }
.chip.faded { opacity: .6; }
.move-btns { display: inline-flex; gap: 4px; margin-right: 6px; }
table.results th, table.results td { text-align: center; }
table.results th:first-child, table.results td:first-child, table.results th:nth-child(2), table.results td:nth-child(2) { text-align: left; }
.also-block { margin-bottom: 14px; }
.also-list { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.also-list label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; font-size: 13px; }
.also-list input { width: 16px; height: 16px; margin: 0; accent-color: var(--brown); }
.code-tag { display: inline-block; font-size: 11px; font-weight: 700; background: var(--brown); color: var(--white); border-radius: 6px; padding: 1px 6px; margin-right: 6px; vertical-align: 1px; }
.lesson-sub { font-size: 13px; font-weight: 500; white-space: normal; max-width: 520px; }
.page-title.no-margin { margin: 0; }
table.growth td { white-space: normal; vertical-align: top; }
table.growth td.name { min-width: 170px; }
table.growth select { max-width: 190px; }
.cell-sub { display: block; font-size: 12px; font-weight: 500; margin-top: 3px; }
.cell-sub.bad { color: var(--red); font-weight: 600; }
.promo-actions { display: flex; gap: 8px; margin-top: 12px; }
.bonus-head { margin-top: 36px; }
.dept-block { margin-bottom: 26px; }
.dept-block h2 { font-size: 17px; margin-bottom: 10px; }
.guide-card { cursor: pointer; text-align: left; font: inherit; color: inherit; background: var(--white); }
.guide-card:hover { background: var(--peach-soft); }
.guide-card .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
details.gsec { border: 1.5px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; background: var(--white); }
details.gsec > summary { list-style: none; cursor: pointer; padding: 14px 16px; display: flex; align-items: center; gap: 10px; font-weight: 700; }
details.gsec > summary::-webkit-details-marker { display: none; }
details.gsec > summary .num { min-width: 30px; height: 30px; border-radius: 8px; background: var(--peach); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; padding: 0 6px; }
details.gsec > summary .num.sop { background: var(--brown); color: var(--white); }
details.gsec > summary .grow { flex: 1; }
details.gsec[open] > summary { border-bottom: 1px solid var(--line); }
.gsec-body { padding: 16px; }
.gsec-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.gsec-actions .spacer { flex: 1; }
.unsaved { color: var(--red); font-size: 12px; font-weight: 700; }
.sop-head { margin-top: 36px; }
.readonly-note { font-size: 13px; font-weight: 600; padding: 12px 16px; }
textarea.gbody { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.wide-dialog { width: min(560px, calc(100vw - 32px)); }
.radio-col { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 10px; }
.inline-radio { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; font-size: 14px; }
.inline-radio input { width: 16px; height: 16px; margin: 0; accent-color: var(--brown); }
.schedule-list { margin: 0 0 14px 24px; }
.schedule-list.disabled { opacity: .4; pointer-events: none; }
.story-preview {
  background: var(--brown); color: var(--white); border-radius: 28px; padding: 18px 18px 22px;
  min-height: 600px; display: flex; flex-direction: column; position: sticky; top: 16px;
}
.story-bars { display: flex; gap: 4px; margin-bottom: 10px; }
.story-bars span { flex: 1; height: 3px; border-radius: 2px; background: var(--white); }
.story-label { font-size: 12px; font-weight: 600; opacity: .9; margin-bottom: 14px; }
.story-preview img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 16px; margin-bottom: 16px; }
.story-title { font-size: 24px; font-weight: 700; line-height: 1.25; }
.story-summary { margin-top: 10px; font-size: 16px; font-weight: 500; line-height: 1.5; white-space: pre-line; }
.story-spacer { flex: 1; min-height: 20px; }
.story-btn { background: var(--white); color: var(--brown); border-radius: 12px; padding: 13px; text-align: center; font-weight: 700; margin-top: 8px; }
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 5px; min-width: 120px; }
.progress > span { display: block; height: 100%; background: var(--brown); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--peach-soft); }
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

@media (max-width: 960px) {
  .editor-grid { grid-template-columns: 1fr; }
  .preview { position: static; }
}

@media (max-width: 720px) {
  /* Telefonda menyu yuqoriga chiqadi */
  .layout { flex-direction: column; }
  .sidebar { position: static; height: auto; width: auto; padding: 16px; }
  .sidebar-brand { padding: 0 0 12px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-user { flex-direction: row; align-items: center; justify-content: space-between; padding: 12px 0 0; margin-top: 12px; }
  .page { padding-left: 16px; padding-right: 16px; }
  .toolbar input[type=search] { width: 100%; }
  .audit li { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------- Ish haqlari ---------- */
.pay-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
/* Nomi ikki qatorga tushsa ham katakchalar bir chiziqda turadi */
.pay-grid > label { display: flex; flex-direction: column; justify-content: flex-end; }
.levels { display: grid; gap: 8px; margin: 8px 0; }
.level-row { display: grid; grid-template-columns: 1.4fr 1.2fr 32px; gap: 8px; align-items: center; }
.level-row.service { grid-template-columns: 1.2fr 0.7fr 1.1fr 32px; }
.level-row.late { grid-template-columns: 1fr 1fr 1.2fr 32px; }
.level-row.head { font-size: 13px; font-weight: 600; }
input.money { text-align: right; }
tr.group-row td { background: var(--peach-soft); font-weight: 700; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters select { width: auto; }
.kpi-card { margin-bottom: 12px; }
.kpi-card .section-head { margin: 0 0 8px; }
table.kpi-table { width: 100%; }
h2.dept-title { margin-top: 24px; }
#pay-emp-body select { min-width: 150px; }
#pay-emp-body td.pay-rules, #pay-tpl-body td.pay-rules { white-space: normal; min-width: 200px; max-width: 340px; }
#pay-emp-body td.pay-rules .chip, #pay-tpl-body td.pay-rules .chip { margin: 2px 4px 2px 0; font-weight: 600; border-color: var(--line); }
@media (max-width: 800px) { .pay-grid { grid-template-columns: 1fr 1fr; } }

.tpl-rules { display: grid; gap: 6px; margin: 6px 0 4px; }
.tpl-rule { display: flex; align-items: center; gap: 8px; }
.tpl-rule .btn.link { margin-left: auto; }
#pay-emp-term .note { margin-top: 0; }
#pay-form .pay-grid { grid-template-columns: 1fr 1fr; }
#pay-dialog.wide-dialog { width: min(760px, 94vw); }
.plans-table input.money { min-width: 140px; }
#pay-form .kpi-table td { white-space: normal; overflow-wrap: anywhere; }
#pay-form { max-width: 100%; overflow-x: hidden; }

/* ---------- Mehmon fikri ---------- */
.inline-check { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; margin: 0; white-space: nowrap; }
.inline-check input { width: auto; margin: 0; flex: none; }
.fb-settings .inline-check { white-space: normal; }
.stat.warn { border-color: var(--red); color: var(--red); }
.fb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fb-resp { margin-bottom: 10px; display: grid; gap: 8px; }
.fb-resp.low { border-color: var(--red-soft); border-left: 4px solid var(--red); }
.fb-resp p { margin: 0; }
.fb-resp-head { display: flex; align-items: center; gap: 12px; }
.fb-resp-where { display: grid; gap: 2px; }
.fb-nps { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 17px; background: var(--peach-soft); flex: none; }
.fb-nps.bad { background: var(--red); color: var(--white); }
.fb-nps.good { background: var(--brown); color: var(--white); }
.fb-comment { font-weight: 600; white-space: pre-wrap; }
.fb-qr-mini svg { width: 56px; height: 56px; display: block; }
.fb-settings { display: grid; gap: 8px; max-width: 560px; margin-bottom: 20px; }
.fb-settings .hint { margin: 0 0 8px; }
#fb-form textarea { width: 100%; }
#fb-form .also-list { max-height: 50vh; overflow: auto; display: grid; gap: 6px; }

/* Chop etish: faqat QR kartochkalar (A4 sahifaga 2x3) */
#fb-print { display: none; }
@media print {
  body.fb-printing > *:not(#fb-print) { display: none !important; }
  body.fb-printing #fb-print { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8mm; padding: 0; }
  @page { size: A4; margin: 10mm; }
  .fbp-card { break-inside: avoid; border: 1px solid #E6DACB; border-radius: 6mm; padding: 6mm; text-align: center; color: #89775C; height: 88mm; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.5mm; }
  .fbp-head { display: grid; gap: 0.5mm; }
  .fbp-head b { font-size: 16pt; font-weight: 800; letter-spacing: .02em; }
  .fbp-head span { font-size: 8pt; font-weight: 600; }
  .fbp-qr svg { width: 42mm; height: 42mm; display: block; }
  .fbp-title { font-size: 13pt; font-weight: 800; }
  .fbp-ru { font-size: 9pt; font-weight: 600; }
  .fbp-sub { font-size: 10pt; font-weight: 700; background: #F4D2AE; border-radius: 99px; padding: 1mm 4mm; }
  .fbp-gift { font-size: 9pt; font-weight: 700; }
}

/* ---------- Tekshiruvlar ---------- */
.ins-qr svg { width: 220px; height: 220px; display: block; margin: 8px auto; }
.ins-list { display: grid; gap: 8px; max-height: 60vh; overflow: auto; }
.ins-row { border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 4px; }
.ins-row.bad { border-color: var(--red); background: var(--red-soft); }
.ins-ans { font-weight: 700; }
.ins-photos { display: flex; flex-wrap: wrap; gap: 6px; }
.ins-photos img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; }
.ins-edit { display: grid; gap: 10px; max-height: 60vh; overflow: auto; }
.ins-items { display: grid; gap: 6px; margin: 8px 0; }
.ins-erow { display: grid; grid-template-columns: minmax(200px, 1fr) 130px 64px 140px auto auto auto; gap: 6px; align-items: center; }
.ins-erow input[type=number] { width: 64px; }
#ins-dialog.wide-dialog { width: min(980px, 96vw); }
#ins-dialog { width: min(560px, calc(100vw - 32px)); }
.sch-pool { width: auto; min-width: 320px; font-size: 13px; }
.month-from { font-size: 13px; font-weight: 600; margin-right: 8px; } .month-from input { width: auto; display: inline-block; margin-left: 4px; }
/* Oy yulduzlari: avtomatik reyting */
.aw-list { display: grid; gap: 16px; }
.aw-head { display: flex; align-items: center; gap: 10px; }
.aw-table td.num, .aw-table th.num { text-align: right; white-space: nowrap; }
.aw-table tr.aw-out { opacity: .55; }
.aw-manual { width: 110px; padding: 4px 6px; text-align: right; }
.aw-places { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 12px; }
.aw-places .award-row { margin: 0; }
.awards-settings summary { cursor: pointer; font-weight: 700; }
.aw-weights { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0; }
.aw-w { width: 64px; padding: 4px; }
/* Qo'shimcha soatlar */
.ot-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ot-note { width: 170px; padding: 5px 8px; }
.ot-table td.num { text-align: right; }
/* Dars ko'rinishidagi rasm va chizmalar */
.pv-figure { margin: 10px 0; }
.pv-figure img { width: 100%; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.pv-figure figcaption { font-size: 12px; text-align: center; margin-top: 4px; }

/* Xodimlar jadvali: o'ngga surilganda rasm va ism chapda qotib turadi */
table.emp-table td.name, table.emp-table thead th:first-child { position: sticky; left: 0; z-index: 2; background: var(--white); box-shadow: 6px 0 6px -6px rgba(0, 0, 0, .18); }
table.emp-table thead th:first-child { background: var(--peach-soft); z-index: 3; }
table.emp-table td.name { white-space: normal; min-width: 200px; max-width: 280px; }
table.emp-table .name-with-photo { display: flex; align-items: center; gap: 12px; }
/* Bloklangan qator: qotgan ustun shaffof bo'lmasin (orqasidagi matn ko'rinmasin) */
table.emp-table tr.blocked td.name { opacity: 1; color: #9C8F7E; }
table.emp-table tr.blocked td.name .avatar { opacity: .55; }
/* Qator amallari menyusi */
.row-menu { position: fixed; z-index: 1000; min-width: 200px; background: var(--white); border: 1.5px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .14); padding: 6px; display: flex; flex-direction: column; }
.row-menu button { background: none; border: 0; text-align: left; padding: 10px 12px; border-radius: 8px; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; color: inherit; }
.row-menu button:hover, .row-menu button:focus-visible { background: var(--peach-soft); outline: none; }
.row-menu button.danger-text { color: var(--red); }
.btn.row-menu-btn { padding: 6px 12px; font-size: 13px; }
table.emp-table td { white-space: normal; }
table.emp-table td.nowrap, table.emp-table td.actions { white-space: nowrap; }
table.emp-table .chips { display: flex; flex-wrap: wrap; gap: 6px; }
/* Xodimlar: Ishlayotganlar / Arxiv */
.seg-switch { display: inline-flex; gap: 4px; padding: 4px; border: 1.5px solid var(--line); border-radius: 999px; margin-bottom: 16px; }
.seg-switch .seg { font: inherit; font-weight: 700; font-size: 14px; padding: 7px 16px; border: 0; border-radius: 999px; background: none; color: var(--brown); cursor: pointer; }
.seg-switch .seg.active { background: var(--brown); color: var(--white); }
table.emp-table td.reason { white-space: normal; min-width: 200px; max-width: 360px; }
/* Shaxsiy anketa */
.anketa h3 { font-size: 15px; margin: 18px 0 8px; }
.anketa .row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.anketa .multi-row { display: grid; grid-template-columns: 1.4fr 1.2fr .8fr auto; gap: 8px; align-items: end; margin-bottom: 8px; }
.anketa .multi-row.rel { grid-template-columns: 1fr 1.6fr 1.2fr auto; }
.anketa .multi-row label { margin: 0; font-size: 12px; }
.anketa .row-del { border: 0; background: none; color: var(--red); font-size: 18px; cursor: pointer; padding: 6px 8px; }
.anketa .hint { font-size: 12px; margin: -2px 0 8px; }
@media (max-width: 720px) { .anketa .row-3, .anketa .multi-row, .anketa .multi-row.rel { grid-template-columns: 1fr; } }
#anketa-dialog.wide-dialog, #employee-dialog.with-anketa { width: min(760px, 94vw); }
.stat.attention { border-color: var(--caramel); background: var(--peach-soft); }
.struct-dialog .struct-dep { margin-bottom: 12px; }
.struct-checks { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 6px 0 10px; }
.struct-dialog.wide-dialog { width: min(720px, 94vw); }

/* Maosh bo'limi jadvallari ekranga sig'sin: uzun matnli ustunlar katak ichida keyingi qatorga o'tadi */
#payroll-body td:first-child { white-space: normal; min-width: 240px; max-width: 380px; }
#payroll-body td:first-child .chip.warn { display: block; width: fit-content; max-width: 100%; white-space: normal; margin: 4px 0 0; line-height: 1.35; }
#pay-fine-entries td:nth-child(3) { white-space: normal; min-width: 180px; max-width: 280px; }
#pay-kpi-rules td:nth-child(3) { white-space: normal; min-width: 260px; }

/* Tashkiliy tuzilma: tepadan pastga daraxt (Umid chizgan sxema ranglari bo'yicha darajalar) */
.org-scroll { overflow-x: auto; padding: 8px 0 24px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--white); }
.org-tree { display: inline-block; min-width: 100%; }
.org-tree ul { display: flex; justify-content: center; padding: 22px 0 0; margin: 0; position: relative; }
.org-tree li { list-style: none; position: relative; padding: 22px 6px 0; display: flex; flex-direction: column; align-items: center; }
.org-tree > ul { padding-top: 6px; }
.org-tree > ul > li { padding-top: 0; }
/* tutashtiruvchi chiziqlar */
.org-tree li::before, .org-tree li::after { content: ''; position: absolute; top: 0; width: 50%; height: 22px; border-top: 2px solid var(--brown); }
.org-tree li::before { right: 50%; }
.org-tree li::after { left: 50%; border-left: 2px solid var(--brown); }
.org-tree li:only-child::before, .org-tree li:only-child::after { border-top: none; }
.org-tree li:first-child::before, .org-tree li:last-child::after { border-top: none; }
.org-tree li:last-child::before { border-right: 2px solid var(--brown); border-radius: 0 6px 0 0; }
.org-tree li:first-child::after { border-radius: 6px 0 0 0; }
.org-tree > ul > li::before, .org-tree > ul > li::after { display: none; }
.org-tree ul ul::before { content: ''; position: absolute; top: 0; left: 50%; height: 22px; border-left: 2px solid var(--brown); }
.org-node { min-width: 150px; max-width: 220px; border: 2px solid; border-radius: 10px; padding: 8px 10px; text-align: left; font-size: 13px; }
.org-node > b { display: block; text-align: center; font-size: 13px; }
/* Bo'limlar ranglari (ilovadagi bilan bir xil) */
.org-node.dept-boshqaruv { background: #dbe8fb; border-color: #44607f; }
.org-node.dept-zal { background: #dcebd5; border-color: #4f7a3a; }
.org-node.dept-kassa { background: #d6eef0; border-color: #2f7d86; }
.org-node.dept-bar { background: #e8dcf5; border-color: #6b4a9a; }
.org-node.dept-oshxona { background: #fde4cc; border-color: #b0661c; }
.org-node.dept-tozalik { background: #ececec; border-color: #7a7a7a; }
.org-node.dept-konditer { background: #fadbe7; border-color: #a8436d; }
.org-node.dept-taminot { background: #efe3d3; border-color: #7a5a33; }
.org-node.dept-yetkazish { background: #fff2cc; border-color: #a5882a; }
.org-node.vacant { border-style: dashed; }
.org-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 12px; font-weight: 600; }
.org-legend span { display: inline-flex; align-items: center; gap: 6px; }
.org-legend i.org-node { display: inline-block; min-width: 0; width: 14px; height: 14px; padding: 0; border-radius: 4px; border-width: 1.5px; }
.org-count { display: block; text-align: center; font-size: 11px; font-weight: 600; margin-top: 1px; }
.org-people { margin-top: 6px; display: grid; gap: 4px; }
.org-person { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; line-height: 1.2; }
.org-person small { display: block; font-weight: 500; font-size: 10px; opacity: .8; }
.org-person .avatar.small { width: 24px; height: 24px; font-size: 10px; border-width: 1.5px; }
.org-more summary { cursor: pointer; font-size: 11px; font-weight: 700; margin-top: 4px; }
.org-more .org-person { margin-top: 4px; }
.org-rules { margin-top: 18px; }
.org-rules summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
@media print { .org-scroll { overflow: visible; border: none; } }
