/* TutorFlow — əsas üslub. Rəng dəyişənləri includes/head.php-də :root-da təyin olunur. */
:root {
  --rp-primary: #534AB7; --rp-primary-lt: #ECEBF8; --rp-accent: #EF9F27;
  --rp-success: #3B6D11; --rp-success-lt: #E8F3E0; --rp-danger: #C0392B; --rp-danger-lt: #FBEAE8;
  --rp-warning: #854F0B; --rp-text: #1A1A2E; --rp-text-muted: #6B7280; --rp-border: #E5E7EB;
  --rp-role: var(--rp-primary); --rp-role-lt: var(--rp-primary-lt);
  --rp-bg: #F6F6FB; --rp-card: #FFFFFF; --rp-warning-lt: #FDF3E1; --rp-accent-lt: #FEF1DD;
  --rp-radius: 12px; --rp-shadow: 0 1px 2px rgba(26, 26, 46, .05), 0 1px 8px rgba(26, 26, 46, .04);
  --sidebar-w: 248px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px; line-height: 1.5; color: var(--rp-text); background: var(--rp-bg); }
a { color: var(--rp-role); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
h1 { font-size: 22px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
h2 { font-size: 16px; }
h3 { font-size: 15px; }
h4 { font-size: 13px; margin: 12px 0 6px; color: var(--rp-text-muted); text-transform: uppercase; letter-spacing: .03em; }
code, .code-like { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; background: var(--rp-bg);
  padding: 2px 6px; border-radius: 6px; word-break: break-all; }
.code-like { display: block; padding: 10px 12px; line-height: 1.8; }
.muted, .sub { color: var(--rp-text-muted); }
.sub { font-size: 12px; }
.text-danger { color: var(--rp-danger); }
.text-warning { color: var(--rp-warning); }
.mt { margin-top: 16px; }
.push-right { margin-left: auto; }
.hidden-form { display: none; }

/* ---------- Karkas ---------- */
.layout { min-height: 100vh; }
.sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w); background: var(--rp-card);
  border-right: 1px solid var(--rp-border); display: flex; flex-direction: column; z-index: 40; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 14px; font-weight: 700; font-size: 18px; color: var(--rp-role); }
.brand .ti { font-size: 26px; }
.user-box { display: flex; align-items: center; gap: 10px; margin: 0 14px 10px; padding: 10px; border-radius: 10px; background: var(--rp-role-lt); }
.avatar { width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--rp-role); color: #fff; display: grid; place-items: center; font-weight: 700; }
.avatar.lg { width: 54px; height: 54px; font-size: 22px; }
.user-name { font-weight: 600; font-size: 13px; }
.user-role { font-size: 12px; color: var(--rp-text-muted); }
.side-nav { display: flex; flex-direction: column; padding: 6px 10px 20px; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--rp-text); font-weight: 500; }
.side-nav a .ti { font-size: 19px; color: var(--rp-text-muted); }
.side-nav a:hover { background: var(--rp-bg); text-decoration: none; }
.side-nav a.active { background: var(--rp-role-lt); color: var(--rp-role); }
.side-nav a.active .ti { color: var(--rp-role); }
.main { margin-left: var(--sidebar-w); padding: 24px 28px 40px; max-width: 1400px; }
.topbar, .nav-overlay, .mobile-nav { display: none; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 4px 0 0; width: 100%; }

/* ---------- Kartlar ---------- */
.card { background: var(--rp-card); border: 1px solid var(--rp-border); border-radius: var(--rp-radius); box-shadow: var(--rp-shadow);
  padding: 18px; margin-bottom: 18px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2, .card-title { display: flex; align-items: center; gap: 8px; }
.card-title { margin-bottom: 14px; }
.card-head .ti, .card-title .ti { color: var(--rp-role); }
.empty { color: var(--rp-text-muted); text-align: center; padding: 24px 8px; margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-2 > .card { margin-bottom: 18px; }
.grid-2-wide { grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); align-items: start; }
.form-narrow { max-width: 760px; }
.sticky { position: sticky; top: 18px; }

/* ---------- Statistika ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { display: flex; align-items: center; gap: 14px; background: var(--rp-card); border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius); padding: 16px; box-shadow: var(--rp-shadow); }
.stat > .ti { font-size: 24px; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; background: var(--rp-role-lt); color: var(--rp-role); flex: none; }
.stat-success > .ti { background: var(--rp-success-lt); color: var(--rp-success); }
.stat-danger > .ti { background: var(--rp-danger-lt); color: var(--rp-danger); }
.stat-val { font-size: 20px; font-weight: 700; }
.stat-lbl { font-size: 12px; color: var(--rp-text-muted); }
.mini-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

/* ---------- Düymələr ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--rp-border); background: var(--rp-card); color: var(--rp-text); font: inherit; font-weight: 500;
  cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--rp-bg); text-decoration: none; }
.btn .ti { font-size: 17px; }
.btn-primary { background: var(--rp-role); border-color: var(--rp-role); color: #fff; }
.btn-primary:hover { background: var(--rp-role); filter: brightness(1.08); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; margin-top: 12px; }
.btn-link { border: 0; background: none; color: var(--rp-role); padding: 0 4px; }
.btn-danger-outline { border-color: var(--rp-danger); color: var(--rp-danger); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent;
  background: none; color: var(--rp-text-muted); cursor: pointer; font-size: 18px; padding: 0; }
.icon-btn:hover { background: var(--rp-bg); color: var(--rp-role); text-decoration: none; }
.icon-btn.danger:hover { color: var(--rp-danger); background: var(--rp-danger-lt); }
form.inline { display: inline; margin: 0; }

/* ---------- Badge ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.badge-success { background: var(--rp-success-lt); color: var(--rp-success); }
.badge-danger { background: var(--rp-danger-lt); color: var(--rp-danger); }
.badge-warning { background: var(--rp-warning-lt); color: var(--rp-warning); }
.badge-accent { background: var(--rp-accent-lt); color: var(--rp-warning); }
.badge-primary { background: var(--rp-primary-lt); color: var(--rp-primary); }
.badge-muted { background: #F1F2F4; color: var(--rp-text-muted); }

/* ---------- Xəbərdarlıqlar ---------- */
.alert { display: flex; align-items: flex-start; gap: 8px; padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid transparent; }
.alert .ti { font-size: 18px; flex: none; margin-top: 1px; }
.alert-success { background: var(--rp-success-lt); color: var(--rp-success); border-color: #CFE5BF; }
.alert-error { background: var(--rp-danger-lt); color: var(--rp-danger); border-color: #F3C9C4; }
.alert-info { background: var(--rp-primary-lt); color: var(--rp-primary); border-color: #D6D3F0; }
.alert-warning { background: var(--rp-warning-lt); color: var(--rp-warning); border-color: #F2DDB4; }

/* ---------- Cədvəl ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 10px; text-align: left; border-bottom: 1px solid var(--rp-border); vertical-align: middle; }
.table th { font-size: 12px; font-weight: 600; color: var(--rp-text-muted); text-transform: uppercase; letter-spacing: .03em; background: #FAFAFC; }
.table tbody tr:hover { background: #FBFBFE; }
.table tfoot th { background: var(--rp-role-lt); color: var(--rp-text); }
.table .actions { text-align: right; white-space: nowrap; }
.row-inactive td { opacity: .55; }
.row-selected td { background: var(--rp-role-lt); }

/* ---------- Formalar ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--rp-text); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=month], input[type=time],
input[type=tel], input[type=url], input[type=search], input[type=email], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--rp-border); border-radius: 8px; background: #fff; color: var(--rp-text);
  font: inherit; min-height: 38px; }
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--rp-role-lt); border-color: var(--rp-role); }
input:disabled { background: #F3F4F6; color: var(--rp-text-muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.span-2 { grid-column: span 2; }
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.check-list { display: flex; flex-direction: column; gap: 6px; }
.check-list.scroll { max-height: 420px; overflow-y: auto; }
.check-item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 10px; border: 1px solid var(--rp-border); border-radius: 8px; cursor: pointer; }
.check-item:hover { background: var(--rp-bg); }
.check-item input { margin-top: 3px; }
.check-item span { display: flex; flex-direction: column; }
.check-item small { color: var(--rp-text-muted); }
.check-inline { display: flex; align-items: center; gap: 8px; margin: 6px 0; cursor: pointer; }
.radio-row { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; }
.radio-row label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.radio-card { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--rp-border); border-radius: 8px; cursor: pointer; font-weight: 400; }
.radio-card:has(input:checked) { border-color: var(--rp-role); background: var(--rp-role-lt); }
.radio-card small { color: var(--rp-text-muted); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters input, .filters select { width: auto; min-width: 160px; }
.filters input[type=search] { min-width: 240px; flex: 1; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { flex: 1; }
.inline-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--rp-text-muted); }

/* Toggle (switch) */
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; margin-bottom: 12px; user-select: none; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .slider { position: relative; width: 40px; height: 22px; background: #D1D5DB; border-radius: 999px; transition: background .2s; flex: none; }
.toggle .slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked + .slider { background: var(--rp-role); }
.toggle input:checked + .slider::after { transform: translateX(18px); }
.toggle input:focus-visible + .slider { outline: 2px solid var(--rp-role); outline-offset: 2px; }

/* Gün toggle-ları */
.day-toggles { display: flex; gap: 6px; flex-wrap: wrap; }
.day-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.day-toggle span { display: inline-grid; place-items: center; min-width: 46px; height: 38px; padding: 0 8px; border: 1px solid var(--rp-border);
  border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--rp-text-muted); background: #fff; }
.day-toggle input:checked + span { background: var(--rp-role); border-color: var(--rp-role); color: #fff; }
.day-toggle input:focus-visible + span { outline: 2px solid var(--rp-role); outline-offset: 2px; }

/* ---------- Siyahılar ---------- */
.simple-list { list-style: none; margin: 0; padding: 0; }
.simple-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 9px 0; border-bottom: 1px solid var(--rp-border); }
.simple-list li:last-child { border-bottom: 0; }
.note-list { list-style: none; margin: 0; padding: 0; }
.note-list li { padding: 12px 0; border-bottom: 1px solid var(--rp-border); }
.note-list li:last-child { border-bottom: 0; }
.note-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.note-text { white-space: normal; word-wrap: break-word; }
.dl { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 12px; margin: 0; }
.dl dt { color: var(--rp-text-muted); }
.dl dd { margin: 0; font-weight: 500; }
.lesson-list { list-style: none; margin: 0; padding: 0; }
.lesson-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rp-border); }
.lesson-list li:last-child { border-bottom: 0; }
.lesson-list li.today .ll-date { background: var(--rp-role); color: #fff; }
.ll-date { width: 52px; flex: none; text-align: center; border-radius: 8px; background: var(--rp-role-lt); color: var(--rp-role); padding: 4px 0; line-height: 1.2; }
.ll-date span { display: block; font-size: 11px; }
.ll-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ll-time { font-weight: 600; white-space: nowrap; }

/* ---------- Davamiyyət ---------- */
.att-list { display: flex; flex-direction: column; }
.att-row { display: grid; grid-template-columns: minmax(160px, 1fr) auto minmax(180px, 1fr); gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--rp-border); }
.seg { display: inline-flex; border: 1px solid var(--rp-border); border-radius: 9px; overflow: hidden; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg span { display: inline-flex; align-items: center; gap: 4px; padding: 7px 12px; font-weight: 600; font-size: 13px; color: var(--rp-text-muted); background: #fff; border-right: 1px solid var(--rp-border); }
.seg label:last-child span { border-right: 0; }
.seg-present input:checked + span { background: var(--rp-success); color: #fff; }
.seg-absent input:checked + span { background: var(--rp-danger); color: #fff; }
.seg-late input:checked + span { background: var(--rp-accent); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--rp-role); outline-offset: -2px; }

/* İmtahan */
.score-input { max-width: 130px; }
.score-row.is-absent td { background: #FAFAFA; color: var(--rp-text-muted); }

/* ---------- Sürüşən panel ---------- */
.panel-overlay { position: fixed; inset: 0; background: rgba(26, 26, 46, .35); opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; z-index: 90; }
.panel-overlay.open { opacity: 1; visibility: visible; }
.side-panel { position: fixed; top: 0; right: -420px; width: 400px; max-width: 100vw; height: 100%; background: var(--rp-card);
  box-shadow: -8px 0 30px rgba(26, 26, 46, .15); z-index: 100; transition: right .3s ease; display: flex; flex-direction: column; }
.side-panel.open { right: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--rp-border); }
.panel-head h3 { display: flex; align-items: center; gap: 6px; }
.panel-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.panel-body .radio-card { margin-bottom: 6px; }

/* ---------- Modal (gün popup) ---------- */
.modal { position: fixed; inset: 0; background: rgba(26, 26, 46, .4); display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal.open { display: flex; }
.modal-box { background: var(--rp-card); border-radius: var(--rp-radius); width: 100%; max-width: 440px; max-height: 85vh; display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.dm-item { padding: 8px 0; border-bottom: 1px solid var(--rp-border); }
.dm-item:last-child { border-bottom: 0; }

/* ---------- Kalendar ---------- */
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-head { text-align: center; font-size: 12px; font-weight: 600; color: var(--rp-text-muted); padding: 4px 0; }
.cal-cell { position: relative; min-height: 64px; border: 1px solid var(--rp-border); border-radius: 8px; padding: 6px; background: #fff; }
.cal-cell.empty { border: 0; background: none; }
.cal-cell.has-info { cursor: pointer; }
.cal-cell.has-info:hover { box-shadow: 0 0 0 2px var(--rp-role-lt); }
.cal-cell.present { background: var(--rp-success-lt); border-color: #CFE5BF; }
.cal-cell.absent { background: var(--rp-danger-lt); border-color: #F3C9C4; }
.cal-cell.late { background: #FEF6E4; border-color: #F6DFAE; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--rp-role); }
.cal-num { font-weight: 600; font-size: 13px; }
.cal-dots { position: absolute; bottom: 6px; right: 6px; display: flex; gap: 3px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot-note { background: #2563EB; }
.dot-pay { background: #16A34A; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; font-size: 12px; color: var(--rp-text-muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.sq { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.sq.present { background: var(--rp-success-lt); border: 1px solid #CFE5BF; }
.sq.late { background: #FEF6E4; border: 1px solid #F6DFAE; }
.sq.absent { background: var(--rp-danger-lt); border: 1px solid #F3C9C4; }

/* ---------- Valideyn ---------- */
.child-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--rp-border); background: #fff; color: var(--rp-text); font-weight: 500; }
.chip:hover { text-decoration: none; border-color: var(--rp-role); }
.chip.active { background: var(--rp-role); border-color: var(--rp-role); color: #fff; }
.child-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }

/* ---------- Hesabatlar / parametrlər ---------- */
.report-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 18px; align-items: start; }
.report-menu { display: flex; flex-direction: column; gap: 2px; padding: 8px; }
.report-menu a { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 8px; color: var(--rp-text); font-weight: 500; }
.report-menu a:hover { background: var(--rp-bg); text-decoration: none; }
.report-menu a.active { background: var(--rp-role-lt); color: var(--rp-role); }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.settings-grid .span-all { grid-column: 1 / -1; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 20% 10%, var(--rp-primary-lt), transparent 50%), var(--rp-bg); }
.login-card { width: 100%; max-width: 380px; background: var(--rp-card); border: 1px solid var(--rp-border); border-radius: 16px; padding: 28px; box-shadow: 0 10px 40px rgba(83, 74, 183, .12); }
.login-brand { text-align: center; margin-bottom: 20px; }
.login-brand .ti { font-size: 44px; color: var(--rp-primary); }
.login-brand h1 { justify-content: center; font-size: 24px; margin-top: 6px; }
.login-brand p { margin: 4px 0 0; color: var(--rp-text-muted); }
