/* =========================================================
   Guruhlar
   Kartalar, guruh sahifasi, jurnal, davomat oynasi, haftalik jadval, o'quvchi qo'shish.
   ========================================================= */

.gcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 10px; }
.gcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; font-size: 13px;
  color: inherit; text-decoration: none; transition: border-color 0.15s;
}
.gcard:hover { border-color: var(--accent); }
.gcard.forming { border: 1px dashed var(--orange); }
.gcard.forming:hover { border-color: var(--accent); }
.gcard.closed { opacity: 0.65; }
.gname { font-size: 15px; font-weight: 600; }
.warn-text { color: var(--warning); }

/* Hafta kunlari: ixcham chiziq */
.wk.mini { gap: 2px; margin: 4px 0 2px; }
.wk.mini span { font-size: 9px; line-height: 14px; border-radius: 3px; }

/* To'lov va davomat: yozuvli ikkita chiziq */
.gstats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 6px; }
.gstat-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.gstat-head b { color: var(--text); font-weight: 600; }
.gbar { height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.gbar i { --w: 0%; display: block; width: var(--w); height: 100%; border-radius: 3px; }
.gbar .tone-none { background: transparent; }
.gmeta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; }

/* ---------- Guruh sahifasi ---------- */
.gd-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin: 6px 0 12px; }
.gd-title { display: flex; align-items: center; gap: 10px; }
.gd-admission {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 16px;
  font-size: 13px; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.gd-admission.open { background: var(--success-bg); color: var(--success); }
.gd-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.gd-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.gd-kpis .kpi strong { font-size: 20px; }

/* Yorliqlar */
.gd-tabs-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.gd-tabs { padding: 0 12px; }
.gd-panel { padding: 4px 0 12px; }

/* Jadval qatorlari: panelning chetigacha, ichida bo'shliq bilan */
.gd-row {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) 80px 110px 120px; gap: 10px;
  align-items: center; padding: 8px 14px; border-top: 1px solid var(--border);
  font-size: 13px; color: inherit; text-decoration: none;
}
.gd-row:hover:not(.head) { background: var(--surface-2); }
.gd-row.head { border-top: none; color: var(--muted); font-size: 12px; }
.gd-row .avatar { width: 30px; height: 30px; font-size: 11px; }
.gd-row .who-text { display: flex; flex-direction: column; }
.gd-row.pay { grid-template-columns: minmax(0, 1fr) 140px 120px; }
.gd-panel .empty { padding: 0 14px; }
.gd-total {
  display: flex; justify-content: space-between; padding: 10px 14px 0; margin-top: 4px;
  border-top: 1px solid var(--border); font-weight: 600;
}
.tag.danger-tag { background: var(--danger-bg); color: var(--danger); }
/* ---------- Qabul almashtirgichi ---------- */
button.gd-admission { border: none; font: inherit; font-size: 13px; cursor: pointer; }
.switch {
  width: 28px; height: 16px; border-radius: 8px; background: var(--border); position: relative; flex: none;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--knob); transition: left 0.15s;
}
.gd-admission.open .switch { background: var(--profit); }
.gd-admission.open .switch::after { left: 14px; }
.gd-actions .kebab summary.btn { padding: 7px 10px; }

/* ---------- Davomat jurnali ---------- */
.journal-scroll { overflow-x: auto; padding: 8px 14px 0; }
.journal { border-collapse: separate; border-spacing: 3px; font-size: 12px; }
.journal th { font-weight: 400; color: var(--muted); }
.journal .j-name {
  text-align: left; white-space: nowrap; padding-right: 10px; min-width: 150px;
  position: sticky; left: 0; background: var(--surface); z-index: 1;
}
.journal td.j-name { color: var(--text); font-size: 13px; }
.journal .j-total { text-align: right; padding-left: 8px; color: var(--muted); white-space: nowrap; }
.j-day {
  display: inline-block; min-width: 26px; padding: 2px 0; border: none; border-radius: 6px;
  background: none; color: var(--muted); font: inherit; font-size: 12px; text-align: center;
}
button.j-day { cursor: pointer; }
button.j-day:hover { background: var(--accent-bg); color: var(--accent); }
.j-day.today { background: var(--accent); color: var(--on-accent); }
.j-day.cancelled { text-decoration: line-through; opacity: 0.5; }
.j-cell {
  display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 22px;
  border-radius: 5px; font-size: 11px; font-style: normal; font-weight: 600;
}
.j-cell.present { background: var(--success-bg); color: var(--success); }
.j-cell.late { background: var(--warning-bg); color: var(--warning); }
.j-cell.absent { background: var(--danger-bg); color: var(--danger); }
.j-cell.excused { background: var(--surface-2); color: var(--muted); }
.j-cell.none { background: var(--warning-bg); box-shadow: inset 0 0 0 1px var(--orange); }
.j-cell.future { background: transparent; box-shadow: inset 0 0 0 1px var(--border); }
.j-cell.cancelled { background: var(--surface-2); opacity: 0.4; }
.j-cell.out { background: transparent; }
.journal-legend { display: flex; flex-wrap: wrap; gap: 12px; padding: 10px 14px 0; font-size: 12px; color: var(--muted); }
.journal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.journal-legend .j-cell { width: 18px; height: 16px; font-size: 10px; }

/* ---------- Tarix ---------- */
.history { list-style: none; margin: 0; padding: 4px 14px 0; }
.history li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; }
.history li:first-child { border-top: none; }
.history .h-day { width: 84px; flex: none; color: var(--muted); font-size: 12px; }
.history i { color: var(--muted); font-size: 16px; }
.h-note { padding: 8px 14px 0; }

/* ---------- Davomat oynasi ---------- */
.att-lesson { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.att-counts { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); }
.att-counts b { color: var(--text); }
.att-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.att-list { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow-y: auto; }
.att-row {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px;
  border: none; border-radius: 8px; background: none; color: inherit; font: inherit; text-align: left;
  cursor: pointer; user-select: none;
}
.att-row:hover { background: var(--surface-2); }
.att-row .avatar { width: 28px; height: 28px; font-size: 10px; }
.att-name { flex: 1; font-size: 13px; }
.att-pill { min-width: 78px; padding: 3px 10px; border-radius: 12px; font-size: 12px; text-align: center; }
.att-pill.present { background: var(--success-bg); color: var(--success); }
.att-pill.late { background: var(--warning-bg); color: var(--warning); }
.att-pill.absent { background: var(--danger-bg); color: var(--danger); }
.att-pill.excused { background: var(--surface-2); color: var(--muted); }
.att-dot.present { background: var(--profit); }
.att-dot.late { background: var(--orange); }
.att-dot.absent { background: var(--danger); }
.att-dot.excused { background: var(--border); }
.att-foot .sub { margin-right: auto; }
.att-audit { display: flex; align-items: center; gap: 6px; margin: -4px 0 0; font-size: 12px; color: var(--muted); }
.att-row.locked { cursor: default; }
.att-row.locked:hover { background: none; }

/* ---------- Ko'rinish almashtirgichi ---------- */
.view-switch { display: flex; gap: 3px; padding: 3px; border-radius: 8px; background: var(--surface-2); }
.view-switch a {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 6px;
  font-size: 13px; color: var(--muted); text-decoration: none;
}
.view-switch a.on { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }

/* ---------- Haftalik jadval ---------- */
.week-card { display: flex; flex-direction: column; gap: 12px; }
.week-scroll { overflow-x: auto; }
.wk-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }

.wk-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); margin-left: auto; }
.wk-legend span { display: inline-flex; align-items: center; gap: 5px; }
.wk-head { text-align: center; font-size: 12px; color: var(--muted); padding-bottom: 4px; }
.wk-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--k); flex: none; }

/* Kurs turi ranglari: o'qituvchilar soniga bog'liq emas */
.k-standard { --k: var(--k-standard); }
.k-intensive { --k: var(--k-intensive); }
.k-individual { --k: var(--k-individual); }
.k-forming { --k: var(--k-forming); }
.wk-dot.k-forming { background: transparent; border: 1px dashed var(--k); }

/* 1-ko'rinish: qatorlar = o'qituvchilar */
.t-grid { display: grid; grid-template-columns: 170px repeat(6, minmax(110px, 1fr)); gap: 4px; min-width: 860px; }
.t-name {
  display: flex; flex-direction: column; justify-content: center; padding: 6px 10px; border-radius: 8px;
  background: var(--surface-2); color: var(--text); text-decoration: none; line-height: 1.3;
}
a.t-name:hover { background: var(--accent-bg); color: var(--accent); }
.t-name b { font-size: 13px; font-weight: 600; }
.t-name small { font-size: 11px; color: var(--muted); }
.t-name.none b { color: var(--warning); }
.t-cell { min-height: 48px; border-radius: 8px; background: var(--surface-2); padding: 3px; display: grid; gap: 3px; align-content: start; }
.t-free { font-size: 11px; color: var(--muted); text-align: center; padding-top: 12px; opacity: 0.6; }
.t-slot, .tw-block {
  display: block; padding: 3px 6px; border-radius: 6px; border-left: 3px solid var(--k);
  background: color-mix(in srgb, var(--k) 13%, var(--surface)); color: var(--text);
  font-size: 11px; line-height: 1.3; text-decoration: none;
}
.t-slot:hover, .tw-block:hover { background: color-mix(in srgb, var(--k) 24%, var(--surface)); }
.t-slot b, .tw-block b { font-weight: 600; }
.t-slot span, .tw-block span { display: flex; align-items: center; gap: 3px; color: var(--muted); font-size: 10px; }
.k-forming.t-slot, .k-forming.tw-block { background: transparent; border: 1px dashed var(--k); border-left-width: 3px; }
.conflict.t-slot, .conflict.tw-block { --k: var(--red); box-shadow: 0 0 0 1px var(--danger); }
.conflict.t-slot span, .conflict.tw-block span { color: var(--danger); }

/* 2-ko'rinish: bitta o'qituvchi, haqiqiy vaqt o'qi. O'lchamlar HTML'dan: style="--top: ..; --h: .." */
.tload { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.tload .sub { margin-left: auto; }
.tw-grid { display: grid; grid-template-columns: 48px repeat(6, minmax(110px, 1fr)); gap: 4px; min-width: 760px; }
.tw-axis { --h: 0px; position: relative; height: var(--h); padding-bottom: 8px; }
.tw-axis span { --top: 0px; position: absolute; top: var(--top); right: 6px; transform: translateY(-50%); font-size: 11px; color: var(--muted); }
.tw-col { --h: 0px; position: relative; height: var(--h); border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.tw-line { --top: 0px; position: absolute; top: var(--top); left: 0; right: 0; border-top: 1px solid var(--border); opacity: 0.6; }
.tw-block { --top: 0px; --h: 0px; position: absolute; top: var(--top); height: var(--h); left: 3px; right: 3px; overflow: hidden; }

/* Ikki tugmali almashtirgich: "Barcha o'qituvchilar" | "O'qituvchi tanlash ▾" */
.seg-switch { display: flex; gap: 3px; padding: 3px; border-radius: 10px; background: var(--surface-2); }
.seg-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px;
  font-size: 13px; color: var(--muted); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.on { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.seg-drop summary { list-style: none; }
.seg-drop summary::-webkit-details-marker { display: none; }
.seg-caret { font-size: 14px; transition: transform 0.15s; }
.seg-drop[open] .seg-caret { transform: rotate(180deg); }
.seg-menu { left: 0; right: auto; min-width: 270px; max-height: 340px; overflow-y: auto; }
.seg-menu .menu-item small { margin-left: auto; color: var(--muted); font-size: 11px; }
.seg-menu .mi-name { white-space: nowrap; }

/* Yig'ilgan bo'sh oraliq */
.tw-gap {
  --top: 0px; position: absolute; top: var(--top); left: 0; right: 0; height: 28px; z-index: 1;
  display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted);
  background: repeating-linear-gradient(-45deg, transparent 0 6px, var(--border) 6px 7px);
  border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border);
}

/* ---------- Guruhdan chiqarish ---------- */
.gd-row.member { grid-template-columns: 30px minmax(0, 1fr) 80px 110px 120px 32px; }
.gd-row.member .who-text { color: inherit; text-decoration: none; min-width: 0; }
.gd-row.member .who-text:hover .nm { color: var(--accent); }
.row-end { display: flex; align-items: center; gap: 6px; }
.drawer-box .kebab summary.icon-btn { width: 28px; height: 28px; }
/* Menyu ochiq bo'lsa, panel uni kesmasin */
.gd-tabs-wrap:has(.kebab[open]) { overflow: visible; }
.gd-row .kebab-menu { min-width: 200px; }

/* ---------- Guruhga o'quvchi qo'shish ---------- */
.add-search, .add-search input { width: 100%; }
.add-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.add-list { display: flex; flex-direction: column; gap: 2px; max-height: 42vh; overflow-y: auto; }
.add-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; font-size: 13px; }
.add-row:hover { background: var(--surface-2); }
.add-row .avatar { width: 30px; height: 30px; font-size: 11px; }
.add-row .who-text { flex: 1; }
.add-pick {
  display: grid; gap: 6px; padding: 10px 12px; border-radius: 10px; font-size: 13px;
  border: 1px solid var(--accent); background: var(--accent-bg);
}
.add-pick .kv { border-top: none; padding: 2px 0; align-items: center; }
.add-pick .pct { width: 70px; padding: 3px 6px; border: 1px solid var(--border); border-radius: 6px; font: inherit; }
.add-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border); padding-top: 10px; }
.add-hint { display: flex; align-items: center; gap: 8px; margin: 4px 0; }

/* ---------- Kichik ekranlar ---------- */
@media (max-width: 1100px) {
  .gd-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.gd-hint { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }