/* Admin panel — builds on site.css tokens. */
.admin-body { background: var(--bg-soft); min-height: 100vh; }
.admin-bar { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; }
.admin-bar-inner { display: flex; align-items: center; gap: 20px; min-height: 66px; flex-wrap: wrap; padding: 8px 0; }
.admin-bar .brand img { width: 40px; height: 40px; }
.admin-bar .brand-text strong { color: #fff; font-size: 1.1rem; }
.admin-bar .brand-text small { color: #9fb3c2; }
.admin-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.admin-nav a { display: inline-flex; align-items: center; gap: 6px; color: #c9d8e3; padding: 8px 12px; border-radius: 10px; font-weight: 600; font-size: .95rem; }
.admin-nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.admin-nav a.active { background: rgba(0, 173, 239, .2); color: #fff; }
.admin-tools { display: flex; gap: 8px; margin-inline-start: auto; align-items: center; flex-wrap: wrap; }
.admin-tools form { margin: 0; }
.admin-bar .lang-switch { color: #e3edf4; border-color: rgba(255, 255, 255, .2); background: none; font: inherit; font-weight: 700; font-size: .88rem; cursor: pointer; }
.admin-bar .lang-switch:hover { color: #fff; border-color: #fff; }
.admin-main { padding: 32px 0 64px; }
.admin-title { font-size: 1.7rem; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head { margin-bottom: 12px; }
.page-head .admin-title { margin: 0; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; display: flex; flex-direction: column; gap: 6px; color: var(--ink); }
.kpi span { color: var(--muted); font-weight: 600; }
.kpi strong { font-size: 2.1rem; font-weight: 800; color: var(--navy); line-height: 1.1; }
.kpi strong.kpi-small { font-size: 1.1rem; }
.kpi-accent { background: linear-gradient(135deg, var(--orange), var(--orange-deep)); border: 0; }
.kpi-accent span, .kpi-accent strong { color: #fff; }
a.kpi:hover { box-shadow: var(--shadow); color: var(--ink); }
.admin-cols { display: grid; grid-template-columns: 1.7fr 1fr; gap: 20px; align-items: start; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.panel h2 { font-size: 1.2rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { padding: 12px 10px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 700; font-size: .85rem; white-space: nowrap; }
.table tbody tr:hover { background: var(--bg-soft); }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.row-actions form { margin: 0; }
.badge { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: .82rem; font-weight: 700; white-space: nowrap; }
.st-new { background: #fff3e0; color: #b86200; }
.st-contacted { background: #e3f2fd; color: #0b6aa5; }
.st-accepted { background: #e6f6ee; color: #12805c; }
.st-rejected { background: #fdecea; color: #b03a2e; }
.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-tabs a { padding: 7px 16px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-weight: 700; color: var(--ink); font-size: .92rem; }
.filter-tabs a.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 12px 24px; margin: 0; }
.details dt { color: var(--muted); font-weight: 700; }
.details dd { margin: 0; font-weight: 600; word-break: break-word; }
.stack { display: grid; gap: 16px; }
.danger-zone { margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--line); }
.back-link.dark { color: var(--blue); }
.bi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 20px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; margin-top: 8px; cursor: pointer; }
.thumb { max-width: 220px; border-radius: 12px; margin-top: 10px; border: 1px solid var(--line); }
.stat-list { list-style: none; padding: 0; margin: 0 0 12px; }
.stat-list li { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stat-list strong { color: var(--navy); }
.small { font-size: .88rem; }
.login-wrap { min-height: calc(100vh - 96px); display: grid; place-items: center; }
.login-card { width: min(420px, 100%); display: grid; gap: 16px; text-align: center; }
.login-card .field { text-align: start; }
.login-logo { margin: 0 auto; border-radius: 50%; }
.login-card h1 { font-size: 1.5rem; margin: 0; }
.login-foot { margin: 0; font-size: .9rem; color: var(--muted); }
@media (max-width: 860px) {
  .admin-cols, .bi-grid { grid-template-columns: 1fr; }
  .admin-tools { margin-inline-start: 0; }
  .details { grid-template-columns: 1fr; gap: 2px; }
  .details dd { margin-bottom: 10px; }
}

/* Finance */
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.num, .table th.num { text-align: end; }
.pos { color: #12805c; }
.neg { color: #b03a2e; }
.kpi small { font-size: .82rem; }
.kpi-positive { border-inline-start: 5px solid #12805c; }
.kpi-negative { border-inline-start: 5px solid #b03a2e; }
.kpi-grid.compact .kpi strong { font-size: 1.5rem; }
.admin-cols.even { grid-template-columns: 1fr 1fr; }
.fin-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 20px; }
.fin-filters .field { min-width: 150px; }
.fin-filters input, .fin-filters select { padding: 8px 12px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-inline-start: auto; }
.presets a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: .85rem; font-weight: 700; color: var(--ink); }
.presets a.active, .presets a:hover { background: var(--navy); border-color: var(--navy); color: #fff; }
.fin-search { margin: -8px 0 18px; }
.fin-search input { max-width: 420px; }
.legend { list-style: none; display: flex; gap: 14px; margin: 0; padding: 0; font-size: .88rem; color: var(--muted); font-weight: 600; }
.legend li { display: flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw-in, .bar-in { background: #0b8fd0; }
.sw-out, .bar-out { background: #f7941d; }
.bar-chart { display: flex; align-items: stretch; gap: 4px; height: 240px; padding: 8px 0 0; border-bottom: 1px solid var(--line); background-image: linear-gradient(to top, var(--line) 1px, transparent 1px); background-size: 100% 25%; }
.bar-group { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; outline: none; }
.bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.bar { width: 42%; max-width: 18px; min-height: 2px; border-radius: 4px 4px 0 0; }
.bar-label { font-size: .72rem; color: var(--muted); padding: 4px 0; direction: ltr; }
.bar-tip { position: absolute; bottom: 70%; inset-inline-start: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 8px 12px; border-radius: 10px; font-size: .8rem; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .15s; z-index: 5; font-variant-numeric: tabular-nums; }
[dir="rtl"] .bar-tip { transform: translateX(50%); }
.bar-group:hover .bar-tip, .bar-group:focus .bar-tip { opacity: 1; }
.bar-group:hover .bars, .bar-group:focus .bars { background: rgba(11, 143, 208, .06); border-radius: 6px; }
.table-toggle { margin-top: 12px; }
.table-toggle summary { cursor: pointer; color: var(--blue); font-weight: 700; font-size: .9rem; }
.breakdown th { font-weight: 600; color: var(--ink); font-size: .95rem; }
.breakdown tr.total th, .breakdown tr.total td { font-weight: 800; border-top: 2px solid var(--navy); border-bottom: 0; }
h3.sub { font-size: 1rem; margin: 20px 0 10px; }
.meter { position: relative; display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px 12px; font-size: .92rem; font-weight: 600; }
.meter i { position: absolute; inset-inline-start: 10px; bottom: 4px; height: 5px; border-radius: 4px; background: #0b8fd0; max-width: calc(100% - 20px); }
.meter-out i { background: #f7941d; }
.badge.kind-payment { background: #e6f6ee; color: #12805c; }
.badge.kind-expense { background: #fdecea; color: #b03a2e; }
.badge.kind-salary { background: #e3f2fd; color: #0b6aa5; }
.badge.kind-advance { background: #fff3e0; color: #b86200; }
@media (max-width: 860px) {
  .admin-cols.even { grid-template-columns: 1fr; }
  .presets { margin-inline-start: 0; }
}
@media (max-width: 860px) {
  .admin-bar { position: static; }
  .admin-nav a { padding: 6px 10px; }
}
.bar-group:first-child .bar-tip { inset-inline-start: 0; transform: none; }
.bar-group:last-child .bar-tip { inset-inline-start: auto; inset-inline-end: 0; transform: none; }

/* Academic follow-up */
.acad-filters .field.grow, .fin-filters .field.grow { flex: 1 1 220px; }
.badge.res-pass, .badge.ex-published { background: #e6f6ee; color: #12805c; }
.badge.res-fail { background: #fdecea; color: #b03a2e; }
.badge.res-incomplete, .badge.ex-draft { background: #fff3e0; color: #b86200; }
.badge.ex-closed { background: #eceff3; color: #4a5866; }
.badge.att-present, .sw.att-present { background: #e6f6ee; color: #12805c; }
.badge.att-absent, .sw.att-absent { background: #fdecea; color: #b03a2e; }
.badge.att-late, .sw.att-late { background: #fff3e0; color: #b86200; }
.badge.att-excused, .sw.att-excused { background: #e3f2fd; color: #0b6aa5; }
.sw.att-present { background: #12805c; } .sw.att-absent { background: #b03a2e; } .sw.att-late { background: #f7941d; } .sw.att-excused { background: #0b8fd0; }
.att-legend { flex-wrap: wrap; margin-bottom: 12px; }
.att-kpi-absent { border-inline-start: 5px solid #b03a2e; }
.att-kpi-late { border-inline-start: 5px solid #f7941d; }
.exam-block + .exam-block { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 4px; }
.exam-block h3.sub { margin: 8px 0; }
.timetable th:first-child { width: 90px; }
.timetable thead th { text-align: center; }
.timetable tbody th { vertical-align: top; }
.timetable tbody th small { display: block; font-weight: 600; }
.timetable td { vertical-align: top; min-width: 120px; }
.tt-cell { display: grid; gap: 2px; background: var(--bg-soft); border: 1px solid var(--line); border-inline-start: 4px solid var(--blue); border-radius: 10px; padding: 8px 10px; }
.tt-cell + .tt-cell { margin-top: 6px; }
.tt-cell strong { color: var(--navy); font-size: .95rem; }

/* Documents */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.doc-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.doc-card.is-expired { border-color: #f5c6c0; box-shadow: inset 0 4px 0 #b03a2e; }
.doc-card.is-soon { border-color: #ffe0b2; box-shadow: inset 0 4px 0 #f7941d; }
.doc-preview { position: relative; display: block; width: 100%; height: 200px; padding: 0; border: 0; background: var(--bg-soft); cursor: zoom-in; overflow: hidden; color: var(--muted); }
a.doc-preview { cursor: pointer; }
.doc-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.doc-preview iframe { width: 100%; height: 100%; border: 0; pointer-events: none; background: #fff; }
.doc-preview:focus-visible { outline: 3px solid var(--blue); outline-offset: -3px; }
.doc-icon { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-weight: 800; font-size: 1.2rem; }
.doc-icon small { font-size: .8rem; font-weight: 600; }
.doc-ext { position: absolute; top: 10px; inset-inline-start: 10px; background: rgba(11, 34, 51, .75); color: #fff; font-size: .72rem; font-weight: 800; padding: 2px 8px; border-radius: 6px; text-transform: uppercase; }
.doc-body { padding: 14px 16px 6px; display: grid; gap: 4px; flex: 1; }
.doc-body strong { overflow-wrap: anywhere; }
.doc-expired { color: #b03a2e; font-weight: 700; }
.doc-soon { color: #b86200; font-weight: 700; }
.doc-actions { display: flex; gap: 8px; padding: 8px 16px 16px; flex-wrap: wrap; }
.doc-viewer { width: min(1100px, 96vw); height: min(88vh, 900px); padding: 0; border: 0; border-radius: var(--radius); box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.doc-viewer::backdrop { background: rgba(11, 34, 51, .6); }
.doc-viewer-inner { display: flex; flex-direction: column; height: 100%; }
.doc-viewer-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.doc-viewer-head strong { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-viewer-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; background: var(--bg-soft); }
.doc-viewer-body img { max-width: 100%; max-height: 100%; object-fit: contain; }
.doc-viewer-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.admin-cols > * { min-width: 0; }

/* Accounts, roles and "my page" */
.quick-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.quick-links a { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); color: var(--navy); font-weight: 700; text-align: center; }
.quick-links a:hover { border-color: var(--blue); box-shadow: var(--shadow); }
.quick-links .icon { color: var(--blue); }
.today-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.today-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 10px 12px; background: var(--bg-soft); border: 1px solid var(--line); border-inline-start: 4px solid var(--blue); border-radius: 10px; }
.today-list .period { width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 800; font-size: .85rem; }
.user-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; align-items: start; }
.user-form .field.full { grid-column: 1 / -1; }
.user-form [hidden] { display: none; }
.role-hint { margin: -6px 0 0; }
.row-actions.start { justify-content: flex-start; }
.btn.danger { border-color: #b03a2e; color: #b03a2e; }
.btn.danger:hover { background: #b03a2e; color: #fff; }
.badge.role-admin { background: var(--navy); color: #fff; }
.badge.role-manager { background: #e3f2fd; color: #0b6aa5; }
.badge.role-supervisor { background: #fff3e0; color: #b86200; }
.badge.role-teacher { background: #e6f6ee; color: #12805c; }
