/* ═══════════════════════════════════════════════════════════════
   IMUO Examiner panel — app style for phone and desktop
   ═══════════════════════════════════════════════════════════════ */
:root {
	--ink: #0f172a;
	--ink-2: #334155;
	--muted: #64748b;
	--line: #e2e8f0;
	--bg: #f1f5f9;
	--card: #ffffff;
	--brand: #4f46e5;
	--brand-soft: #eef2ff;
	--accent: #f59e0b;
	--ok: #16a34a;
	--ok-soft: #dcfce7;
	--warn: #b45309;
	--warn-soft: #fef3c7;
	--danger: #dc2626;
	--radius: 16px;
	--bottom-nav: 64px;
}
* { -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); }
body {
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
	color: var(--ink);
	font-size: 15px;
	padding-bottom: calc(var(--bottom-nav) + env(safe-area-inset-bottom));
}
@media (min-width: 768px) { body { padding-bottom: 24px; } }
a { color: var(--brand); }

/* ── App bar ─────────────────────────────────────────────────── */
.app-bar {
	position: sticky; top: 0; z-index: 1020;
	background: var(--ink); color: #fff;
	padding-top: env(safe-area-inset-top);
	box-shadow: 0 2px 12px rgba(15, 23, 42, .18);
}
.app-bar-inner {
	max-width: 1100px; margin: 0 auto; height: 58px;
	display: flex; align-items: center; gap: .75rem; padding: 0 1rem;
}
.app-brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-weight: 700; white-space: nowrap; }
.app-logo { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--ink); display: grid; place-items: center; font-size: 1.1rem; }
.app-title { flex: 1; font-weight: 600; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-icon-btn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 1.3rem; text-decoration: none; }
.app-icon-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.app-top-nav { gap: .25rem; }
.app-top-nav a { color: #cbd5e1; text-decoration: none; font-size: .88rem; font-weight: 600; padding: .45rem .8rem; border-radius: 999px; }
.app-top-nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.app-top-nav a.active { color: var(--ink); background: #fff; }
.app-avatar {
	width: 38px; height: 38px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35);
	background: var(--brand); color: #fff; font-weight: 700; font-size: .85rem;
}

/* ── Page ────────────────────────────────────────────────────── */
.app-page { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.app-card { background: var(--card); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04); }
.app-card-body { padding: 1rem 1.1rem; }
.section-title { font-size: .78rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 1.25rem 0 .6rem; }

/* Hello + session */
.hello { display: flex; justify-content: space-between; align-items: flex-end; gap: .75rem; flex-wrap: wrap; margin: .25rem 0 1rem; }
.hello h1 { font-size: 1.35rem; font-weight: 800; margin: 0; }
.hello p { margin: .15rem 0 0; color: var(--muted); font-size: .88rem; }
.session-chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.session-chip { border: 1px solid var(--line); background: #fff; color: var(--ink-2); border-radius: 999px; padding: .3rem .85rem; font-size: .82rem; font-weight: 700; }
.session-chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
@media (max-width: 767px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { background: #fff; border-radius: var(--radius); padding: .9rem 1rem; box-shadow: 0 1px 3px rgba(15,23,42,.06); display: flex; gap: .75rem; align-items: center; }
.stat .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; flex: 0 0 42px; }
.stat .n { font-size: 1.4rem; font-weight: 800; line-height: 1.1; }
.stat .l { font-size: .74rem; color: var(--muted); font-weight: 600; }
.ic-brand { background: var(--brand-soft); color: var(--brand); }
.ic-warn  { background: var(--warn-soft); color: var(--warn); }
.ic-ok    { background: var(--ok-soft); color: var(--ok); }
.ic-ink   { background: #e2e8f0; color: var(--ink); }

/* Tabs (segmented) */
.seg { display: inline-flex; background: #e2e8f0; border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; border-radius: 9px; padding: .45rem 1rem; font-weight: 700; font-size: .86rem; color: var(--ink-2); }
.seg button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15,23,42,.12); }
.seg .cnt { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: .3rem; border-radius: 999px; background: var(--ink); color: #fff; font-size: .7rem; line-height: 18px; }
.seg button:not(.active) .cnt { background: #94a3b8; }

/* Filters */
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .9rem 0; }
.search-box { position: relative; flex: 1 1 240px; }
.search-box i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box input { padding-left: 2.3rem; border-radius: 12px; height: 42px; border-color: var(--line); }
.toolbar .form-select { width: auto; border-radius: 12px; height: 42px; border-color: var(--line); font-size: .88rem; }
@media (max-width: 767px) {
	.toolbar .seg { width: 100%; }
	.toolbar .seg button { flex: 1; }
	.toolbar .search-box { flex-basis: 100%; }
	.toolbar .form-select { flex: 1 1 0; min-width: 0; }
}

/* Student list */
.stu-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
@media (max-width: 767px) { .stu-list { grid-template-columns: minmax(0, 1fr); } }
.stu {
	display: flex; gap: .85rem; align-items: center; background: #fff; border-radius: var(--radius);
	padding: .85rem 1rem; text-decoration: none; color: inherit; border: 1px solid transparent;
	box-shadow: 0 1px 3px rgba(15,23,42,.06); transition: border-color .15s, transform .1s;
}
.stu:hover { border-color: #c7d2fe; color: inherit; }
.stu:active { transform: scale(.99); }
.stu .av { width: 46px; height: 46px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 1.3rem; flex: 0 0 46px; }
.stu .av.done { background: var(--ok-soft); color: var(--ok); }
.stu .info { flex: 1; min-width: 0; }
.stu .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stu .meta { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stu .tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }
.tag { font-size: .68rem; font-weight: 700; padding: .12rem .5rem; border-radius: 999px; background: #f1f5f9; color: var(--ink-2); }
.tag-brand { background: var(--brand-soft); color: var(--brand); }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.stu .right { text-align: right; flex: 0 0 auto; }
.stu .score { font-size: 1.15rem; font-weight: 800; color: var(--ok); }
.stu .chev { color: #94a3b8; font-size: 1.2rem; }

.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty i { font-size: 2.6rem; display: block; margin-bottom: .5rem; color: #cbd5e1; }
.skel { height: 78px; border-radius: var(--radius); background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* ── Evaluate page ───────────────────────────────────────────── */
.eval-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 991px) { .eval-grid { grid-template-columns: 1fr; } }
.video-wrap { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; }
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-wrap .no-video { position: absolute; inset: 0; display: grid; place-items: center; color: #94a3b8; text-align: center; padding: 1rem; }
.video-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin: .6rem 0 0; }
.video-tabs button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .3rem .8rem; font-size: .8rem; font-weight: 700; }
.video-tabs button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.video-note { font-size: .76rem; color: var(--muted); margin-top: .5rem; }

.kv { display: grid; grid-template-columns: 110px 1fr; gap: .35rem .75rem; font-size: .88rem; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; word-break: break-word; }

.mark-box { display: flex; gap: .75rem; align-items: center; }
.mark-box .mark-input { flex: 1; }
.mark-total { font-size: 1.6rem; font-weight: 800; color: #94a3b8; white-space: nowrap; }
.mark-input { font-size: 1.6rem !important; font-weight: 800; text-align: center; height: 58px; border-radius: 14px !important; }
.mark-pct { font-size: .82rem; color: var(--muted); margin-top: .35rem; text-align: center; }
.quick-marks { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .6rem; }
.quick-marks button { border: 1px solid var(--line); background: #fff; border-radius: 10px; min-width: 42px; padding: .3rem .5rem; font-weight: 700; font-size: .85rem; }
.quick-marks button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.remark-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .5rem; }
.remark-chips button { border: 1px dashed #cbd5e1; background: #f8fafc; border-radius: 999px; padding: .25rem .7rem; font-size: .76rem; color: var(--ink-2); }
.remark-chips button:hover { border-style: solid; border-color: var(--brand); color: var(--brand); }

.sticky-actions { position: sticky; bottom: calc(var(--bottom-nav) + 8px); z-index: 10; }
@media (min-width: 992px) { .eval-side { position: sticky; top: 74px; } .sticky-actions { position: static; } }
.btn-app { border-radius: 14px; font-weight: 700; padding: .75rem 1rem; }
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover, .btn-brand:focus { background: #4338ca; border-color: #4338ca; color: #fff; }
.done-banner { background: var(--ok-soft); color: #166534; border-radius: 12px; padding: .6rem .8rem; font-size: .85rem; font-weight: 600; }

/* ── Bottom nav ──────────────────────────────────────────────── */
.bottom-nav {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
	height: calc(var(--bottom-nav) + env(safe-area-inset-bottom));
	padding-bottom: env(safe-area-inset-bottom);
	background: #fff; border-top: 1px solid var(--line);
	display: grid; grid-template-columns: repeat(3, 1fr);
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: .7rem; font-weight: 700; }
.bottom-nav a i { font-size: 1.3rem; }
.bottom-nav a.active { color: var(--brand); }

/* ── Login / password pages ──────────────────────────────────── */
.auth-body { min-height: 100vh; padding: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(1200px 600px at 10% -10%, #312e81 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #92400e 0%, transparent 55%), var(--ink); }
.auth-card { width: 100%; max-width: 420px; margin: 1rem; background: #fff; border-radius: 22px; padding: 1.75rem 1.5rem; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.auth-logo { width: 58px; height: 58px; border-radius: 16px; background: var(--accent); color: var(--ink); display: grid; place-items: center; font-size: 1.8rem; margin: 0 auto .75rem; }
.auth-card h1 { font-size: 1.3rem; font-weight: 800; text-align: center; margin: 0; }
.auth-card .sub { text-align: center; color: var(--muted); font-size: .88rem; margin: .25rem 0 1.25rem; }
.auth-card .form-control { height: 48px; border-radius: 12px; }
.auth-card .input-group .btn { border-radius: 0 12px 12px 0; }
.auth-card .input-group .form-control { border-radius: 12px 0 0 12px; }
.pw-rules { list-style: none; padding: 0; margin: .5rem 0 0; font-size: .8rem; }
.pw-rules li { color: var(--muted); }
.pw-rules li.ok { color: var(--ok); }
.pw-rules li i { margin-right: .3rem; }

/* Profile */
.profile-head { display: flex; gap: 1rem; align-items: center; }
.profile-av { width: 64px; height: 64px; border-radius: 20px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.4rem; }
.map-group { margin-bottom: .6rem; }
.map-group .k { font-size: .72rem; font-weight: 800; color: var(--muted); text-transform: uppercase; }

/* ── Page loader ─────────────────────────────────────────────── */
.page-loader {
	position: fixed; inset: 0; z-index: 2000;
	display: grid; place-items: center;
	background: rgba(241, 245, 249, .96);
	transition: opacity .25s ease, visibility .25s ease;
}
.auth-body .page-loader { background: rgba(15, 23, 42, .96); }
.page-loader.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.page-loader-box { position: relative; width: 84px; height: 84px; display: grid; place-items: center; }
.page-loader-logo {
	width: 52px; height: 52px; border-radius: 15px; background: var(--accent); color: var(--ink);
	display: grid; place-items: center; font-size: 1.5rem;
	animation: loaderPulse 1.2s ease-in-out infinite;
}
.page-loader-ring {
	position: absolute; inset: 0; border-radius: 50%;
	border: 3px solid rgba(79, 70, 229, .15); border-top-color: var(--brand);
	animation: loaderSpin .8s linear infinite;
}
.page-loader-text {
	position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: .75rem;
	font-size: .8rem; font-weight: 700; color: var(--muted); white-space: nowrap;
}
.auth-body .page-loader-text { color: #cbd5e1; }
@keyframes loaderSpin { to { transform: rotate(360deg); } }
@keyframes loaderPulse { 50% { transform: scale(.9); } }

/* Thin top bar while data loads in the background */
.ajax-bar {
	position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 2001;
	background: linear-gradient(90deg, var(--accent), var(--brand));
	opacity: 0; transition: width .4s ease, opacity .3s ease;
}
.ajax-bar.on { opacity: 1; width: 70%; transition: width 8s cubic-bezier(.1, .6, .2, 1), opacity .2s; }
.ajax-bar.done { opacity: 0; width: 100%; transition: width .2s ease, opacity .4s ease .2s; }
@media (prefers-reduced-motion: reduce) {
	.page-loader-ring, .page-loader-logo { animation: none; }
}
