/* FOR KIDS — interfeys uslublari. Bootstrap 5 ustiga. */
:root {
  --fk-green: #2f855a;
  --fk-green-soft: #e6f4ec;
  --fk-sidebar-w: 248px;
  --fk-topbar-h: 56px;
  --fk-radius: 12px;
  --fk-surface: #ffffff;
  --fk-bg: #f4f6f8;
  --fk-border: #e6e9ee;
  --fk-text-muted: #6b7280;
  --bs-primary: var(--fk-green);
  --bs-primary-rgb: 47, 133, 90;
  --bs-link-color: var(--fk-green);
  --bs-link-hover-color: #276749;
}
[data-bs-theme="dark"] {
  --fk-surface: #1c2128;
  --fk-bg: #12161b;
  --fk-border: #2c333c;
  --fk-green-soft: #1e3a2c;
  --fk-text-muted: #9aa4b2;
}

html, body { height: 100%; }
.app-body { background: var(--fk-bg); font-size: 14.5px; }
.app-shell { display: flex; min-height: 100vh; }

/* --- sidebar --- */
.app-sidebar {
  width: var(--fk-sidebar-w); flex: 0 0 var(--fk-sidebar-w);
  background: var(--fk-surface); border-right: 1px solid var(--fk-border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
@media (max-width: 991.98px) { .app-sidebar { display: none; } }
.app-brand { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 18px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--fk-border); }
.brand-custom { height: 36px; }
.brand-logo { width: 100%; max-width: 176px; height: auto; }
.brand-logo-sm { max-width: 120px; }
[data-bs-theme="dark"] .brand-logo, [data-bs-theme="dark"] .login-logo img { filter: brightness(1.18); }
.brand-mark { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--fk-green); color: #fff; font-weight: 700; }
.brand-text { font-weight: 700; letter-spacing: .3px; }
.app-menu { list-style: none; margin: 0; padding: 8px 10px; flex: 1 1 0; min-height: 0; overflow-y: auto; }
.app-menu li a { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 10px; color: inherit; text-decoration: none; }
.app-menu li a:hover { background: var(--fk-bg); }
.app-menu li a.active { background: var(--fk-green-soft); color: var(--fk-green); font-weight: 600; }
.app-menu li a.disabled { opacity: .5; pointer-events: none; }
.app-menu li a i { font-size: 1.1rem; width: 22px; text-align: center; }
.menu-group { margin-top: 8px; }
.menu-group-title { display: block; padding: 4px 12px; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--fk-text-muted); }
.badge-soon { margin-left: auto; font-size: .65rem; background: var(--fk-bg); color: var(--fk-text-muted); border-radius: 999px; padding: 1px 7px; }
.app-sidebar-footer { padding: 10px 18px; border-top: 1px solid var(--fk-border); }
.app-offcanvas { width: var(--fk-sidebar-w) !important; }

/* --- main --- */
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
  height: var(--fk-topbar-h); display: flex; align-items: center; padding: 0 20px;
  background: var(--fk-surface); border-bottom: 1px solid var(--fk-border); position: sticky; top: 0; z-index: 20;
}
.branch-select { min-width: 160px; }
.lang-select { width: 72px; }
@media (max-width: 575.98px) {
  .table-xs-compact { font-size: .7rem; }
  .table-xs-compact > :not(caption) > * > * { padding: .45rem .2rem; }
  .table.table-xs-compact thead th, .table.table-xs-compact thead th.text-end { white-space: normal; font-size: .64rem; letter-spacing: 0; vertical-align: bottom; }
  .app-topbar { padding: 0 12px; }
  .branch-select { min-width: 0; max-width: 136px; }
  .lang-select { width: 62px; }
}
.avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--fk-green); color: #fff; font-size: .8rem; font-weight: 600; }
.app-content { padding: 22px 24px 40px; max-width: 1400px; width: 100%; }
@media (max-width: 575.98px) { .app-content { padding: 14px 14px 32px; } }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title { font-size: 1.45rem; font-weight: 700; margin: 0; }
.page-subtitle { color: var(--fk-text-muted); margin: 2px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- kartalar --- */
.card { border: 1px solid var(--fk-border); border-radius: var(--fk-radius); background: var(--fk-surface); }
.stat-card { padding: 16px 18px; }
.stat-label { color: var(--fk-text-muted); font-size: .82rem; }
.stat-value { font-size: 1.55rem; font-weight: 700; line-height: 1.2; margin-top: 4px; }
/* telefonda katta sonlar (208 630 474) bir qatorda sig'sin */
@media (max-width: 575.98px) { .stat-card { padding: 14px; } .stat-value, .stat-value.fs-4, .stat-value.fs-5 { font-size: 1.1rem !important; white-space: nowrap; } }
.stat-value.text-success { color: var(--fk-green) !important; }
.stat-hint { color: var(--fk-text-muted); font-size: .78rem; margin-top: 2px; }

/* --- jadval --- */
.table-card .table { margin: 0; }
.table thead th { font-weight: 600; font-size: .8rem; color: var(--fk-text-muted); text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--fk-border); background: var(--fk-surface); }
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { background: var(--fk-bg); }
.row-inactive td { opacity: .55; }
.badge-status { border-radius: 999px; padding: 3px 9px; font-size: .75rem; font-weight: 600; }
.badge-status.on { background: var(--fk-green-soft); color: var(--fk-green); }
.badge-status.off { background: var(--fk-bg); color: var(--fk-text-muted); }
.badge-status.free { background: #e0f2fe; color: #075985; }
[data-bs-theme="dark"] .badge-status.free { background: rgba(56,189,248,.16); color: #7dd3fc; }

/* --- sozlamalar --- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.settings-tile { display: block; padding: 16px; border: 1px solid var(--fk-border); border-radius: var(--fk-radius); background: var(--fk-surface); color: inherit; text-decoration: none; transition: box-shadow .15s; }
.settings-tile:hover { box-shadow: 0 6px 18px rgba(0,0,0,.06); color: inherit; }
.settings-tile i { font-size: 1.4rem; color: var(--fk-green); }
.settings-tile .title { font-weight: 600; margin-top: 8px; }
.settings-tile .count { color: var(--fk-text-muted); font-size: .8rem; }
.settings-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.settings-tabs a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--fk-border); background: var(--fk-surface); color: inherit; text-decoration: none; font-size: .85rem; }
.settings-tabs a.active { background: var(--fk-green); border-color: var(--fk-green); color: #fff; }

/* --- forma --- */
.form-label { font-weight: 500; }
.form-text { color: var(--fk-text-muted); }
.btn-primary { --bs-btn-bg: var(--fk-green); --bs-btn-border-color: var(--fk-green); --bs-btn-hover-bg: #276749; --bs-btn-hover-border-color: #276749; --bs-btn-active-bg: #22543d; --bs-btn-active-border-color: #22543d; }
.btn-outline-primary { --bs-btn-color: var(--fk-green); --bs-btn-border-color: var(--fk-green); --bs-btn-hover-bg: var(--fk-green); --bs-btn-hover-border-color: var(--fk-green); }

/* --- login --- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #e9f5ee 0%, #f4f6f8 60%); }
[data-bs-theme="dark"] .login-page { background: linear-gradient(160deg, #15221b 0%, #12161b 60%); }
.login-card { width: 100%; max-width: 400px; padding: 32px 30px; }
.login-logo { display: flex; flex-direction: column; align-items: center; margin-bottom: 22px; text-align: center; }
.login-logo img { max-width: 240px; max-height: 130px; width: auto; height: auto; }

/* --- kalendar --- */
.cal-month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-day { text-align: center; padding: 6px 2px; border-radius: 8px; font-size: .82rem; border: 1px solid transparent; cursor: pointer; }
.cal-day.off { background: var(--fk-bg); color: var(--fk-text-muted); }
.cal-day.holiday { background: #fdecea; color: #c0392b; }
.cal-day.working { background: var(--fk-green-soft); color: var(--fk-green); font-weight: 600; }
.cal-day.wd { font-size: .7rem; color: var(--fk-text-muted); cursor: default; }
.cal-day:hover:not(.wd) { border-color: var(--fk-green); }
.cal-day.empty { cursor: default; }
.htmx-request .htmx-indicator { display: inline-block; }
.htmx-indicator { display: none; }

/* --- davomat --- */
.att-day { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; font-size: .78rem; background: var(--fk-bg); color: var(--fk-text-muted); }
.att-day.off { opacity: .35; }
.att-day.present { background: var(--fk-green-soft); color: var(--fk-green); font-weight: 600; }
.att-day.excused { background: #e3f2fd; color: #1565c0; font-weight: 600; }
.att-day.unexcused { background: #fdecea; color: #c0392b; font-weight: 600; }
[data-bs-theme="dark"] .att-day.excused { background: #16324a; color: #8ec5ff; }
[data-bs-theme="dark"] .att-day.unexcused { background: #4a1f1c; color: #ff9b91; }
.attendance-table tr.att-present td:first-child { border-left: 3px solid var(--fk-green); }
.attendance-table tr.att-excused td:first-child { border-left: 3px solid #1565c0; }
.attendance-table tr.att-unexcused td:first-child { border-left: 3px solid #c0392b; }
.att-grid th, .att-grid td { padding: .3rem .35rem; font-size: .8rem; }
.att-grid .sticky-col { position: sticky; left: 0; background: var(--fk-surface); z-index: 1; }
.att-cell.present { color: var(--fk-green); font-weight: 700; }
.att-cell.excused { color: #1565c0; font-weight: 700; }
.att-cell.unexcused { color: #c0392b; font-weight: 700; }
.group-card:hover { box-shadow: 0 6px 18px rgba(0,0,0,.06); }
.receipt { max-width: 420px; margin: 0 auto; font-family: "Courier New", monospace; font-size: 13px; }
.receipt-logo { max-width: 150px; max-height: 80px; margin-bottom: 6px; }
.receipt-roll { max-width: 80mm; }
.receipt-roll .receipt-logo { max-width: 42mm; }
@media print { .app-sidebar, .app-topbar, .page-actions, .app-messages { display: none !important; } .app-content { padding: 0; } .card { border: none; } }
.attendance-table tbody { counter-reset: row; }
.attendance-table td.row-num::before { counter-increment: row; content: counter(row); }
.table td.text-end, .table th.text-end { white-space: nowrap; }
/* --- panel diagrammasi --- */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 8px; }
.bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.bar-pair { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.bar { width: 40%; max-width: 34px; border-radius: 6px 6px 0 0; min-height: 2px; }
.bar.plan { background: #b8c4d6; }
.bar.paid { background: var(--fk-green); }
.bar-label { font-size: .75rem; color: var(--fk-text-muted); margin-top: 6px; }
.legend { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; }
.legend.plan { background: #b8c4d6; } .legend.paid { background: var(--fk-green); }

/* --- bola hujjatlari --- */
.doc-thumb { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 8px; background: var(--fk-bg); overflow: hidden; font-size: 1.4rem; color: var(--fk-text-muted); }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.min-w-0 { min-width: 0; }

/* Nachisleniye: hali hisoblanmagan (taxminiy) qator — raqamlar xira va qiyshiq */
.table > tbody > tr.row-preview > td:not(:first-child) { color: var(--fk-text-muted); font-style: italic; }

/* --- bo'lim yorliqlari: Nachisleniye → «Oy bo'yicha» | «Oylar tarixi» (v0.2.9) --- */
.fk-tabs { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 16px; max-width: 100%; overflow-x: auto;
  background: var(--fk-surface); border: 1px solid var(--fk-border); border-radius: 999px; }
.fk-tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px;
  color: inherit; text-decoration: none; white-space: nowrap; font-weight: 500; }
.fk-tabs a:hover { background: var(--fk-bg); }
.fk-tabs a.active { background: var(--fk-green-soft); color: var(--fk-green); font-weight: 600; }
.month-select { width: auto; min-width: 9.5rem; }
.page-header .fk-tabs { margin: 10px 0 0; }
.fk-inline-btn { font-size: inherit; line-height: inherit; vertical-align: baseline; }
/* Oylar tarixi — telefonda har oy alohida karta */
.hist-card .card-body { padding: 10px 14px; }
.hist-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; margin-top: 8px; }
.hist-grid .lbl { font-size: .72rem; color: var(--fk-text-muted); }
.hist-grid .val { font-weight: 600; white-space: nowrap; }
.page-header > div:first-child { min-width: 0; max-width: 100%; }
@media (max-width: 575.98px) { .fk-tabs a { padding: 6px 11px; } }

/* --- «Sayt» bo'limi (v0.3.0) --- */
.cms-lang { display: inline-block; min-width: 2rem; padding: 1px 6px; border-radius: 6px; font-size: .7rem; font-weight: 700; text-align: center; background: var(--fk-bg); color: var(--fk-text-muted); }
.form-control.cms-missing, .form-select.cms-missing { border-color: #e0a800; background-color: #fffbeb; }
.cms-thumb { display: inline-grid; place-items: center; width: 56px; height: 42px; object-fit: cover; border-radius: 6px; background: var(--fk-bg); vertical-align: middle; }
.cms-image-preview { width: 220px; max-width: 100%; border-radius: 10px; border: 1px solid var(--fk-border); }
.cms-inline .form-control, .cms-inline .form-select { min-width: 8rem; }
.cms-actions { position: sticky; bottom: 0; z-index: 5; padding: 12px 0; background: var(--fk-bg); border-top: 1px solid var(--fk-border); }
