/* LMS Analytics – Tangaza University. Styled after the Staff Portal. Hand-written, no build step. */

@font-face {
    font-family: "Inter";
    src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #efebe8;
    --surface: #ffffff;
    --surface-2: #f7f4f2;
    --border: #e4ddd8;
    --border-strong: #d6cdc6;
    --text: #1c1917;
    --muted: #6b635d;
    --faint: #9a918a;

    --ink: #232323;          /* sidebar, hero */
    --ink-2: #333333;        /* active sidebar item */
    --ink-text: #e9e6e3;
    --ink-muted: #9f9993;

    --red: #b8162c;
    --red-hover: #9c1225;
    --red-soft: #fbe9eb;
    --gold: #d9a21b;
    --gold-soft: #fcf5e3;
    --gold-line: #e3b341;
    --green: #15803d;
    --green-soft: #e3f6e9;
    --amber: #a16207;
    --amber-soft: #fdf6e3;
    --blue: #1d4ed8;
    --blue-soft: #e8eefc;

    --table-head: #e7dedb;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(28, 25, 23, .04);
    --sidebar-w: 300px;
    --topbar-h: 70px;
    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
[x-cloak] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ------------------------------------------------------------------ shell */

.topbar {
    position: sticky; top: 0; z-index: 30;
    height: var(--topbar-h);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 22px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.topbar::after { /* gold rule under the brand, as on the portal */
    content: ""; position: absolute; left: 0; bottom: -1px; width: var(--sidebar-w); height: 3px; background: var(--gold-line);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 42px; height: 42px; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -.01em; display: block; }
.brand-sub { display: block; font-size: 12px; font-weight: 600; letter-spacing: .2em; color: var(--gold); text-transform: uppercase; }

.user-menu { position: relative; }
.user-button {
    display: flex; align-items: center; gap: 10px;
    background: none; border: 0; padding: 6px 8px; border-radius: 10px;
    font: inherit; font-weight: 600; color: var(--text); cursor: pointer;
}
.user-button:hover { background: var(--surface-2); }
.avatar {
    width: 40px; height: 40px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--ink); color: var(--gold); font-weight: 700; font-size: 14px;
    border: 2px solid var(--gold-line);
}
.user-button .chev { color: var(--red); }
.dropdown {
    position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,.12); padding: 6px; z-index: 40;
}
.dropdown-head { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.dropdown-head small { display: block; color: var(--muted); }
.dropdown a, .dropdown button {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 9px 12px; border: 0; background: none; border-radius: 8px;
    font: inherit; font-size: 14px; color: var(--text); text-align: left; cursor: pointer;
}
.dropdown a:hover, .dropdown button:hover { background: var(--surface-2); text-decoration: none; }

.menu-toggle { display: none; background: none; border: 0; padding: 8px; margin-right: 6px; cursor: pointer; color: var(--text); }

.layout { display: flex; min-height: calc(100vh - var(--topbar-h)); }

.sidebar {
    width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
    background: var(--ink); color: var(--ink-text);
    padding: 26px 10px 30px;
    position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto;
}
.nav-section { padding: 0 14px; margin: 14px 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .14em; color: var(--ink-muted); text-transform: uppercase; }
.nav-section:first-child { margin-top: 0; }
.nav-divider { border: 0; border-top: 1px solid #3d3d3d; margin: 18px 0 10px; }
.nav-divider.strong { border-top-color: #cfc8c2; }
.nav-link {
    position: relative; display: flex; align-items: center; gap: 14px;
    padding: 12px 16px; margin: 2px 0; border-radius: 10px;
    color: var(--ink-text); font-size: 16px; font-weight: 500;
}
.nav-link svg { width: 21px; height: 21px; color: #bdb6b0; flex: none; }
.nav-link:hover { background: #2c2c2c; text-decoration: none; }
.nav-link.active { background: var(--ink-2); font-weight: 700; color: #fff; }
.nav-link.active::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 4px; background: var(--gold-line); }
.nav-link.active svg { color: var(--gold-line); }
.nav-link .ext { margin-left: auto; width: 15px; height: 15px; opacity: .6; }

.main { flex: 1; min-width: 0; padding: 30px 36px 60px; }
.main-inner { max-width: 1500px; margin: 0 auto; }

.backdrop { display: none; }

@media (max-width: 1024px) {
    :root { --sidebar-w: 270px; }
    .menu-toggle { display: inline-flex; }
    .topbar::after { display: none; }
    .sidebar { position: fixed; left: 0; top: var(--topbar-h); bottom: 0; height: auto; z-index: 25; transform: translateX(-100%); transition: transform .2s ease; }
    .sidebar.open { transform: none; }
    .backdrop.open { display: block; position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(0,0,0,.35); z-index: 20; }
    .main { padding: 22px 16px 50px; }
    .brand-name { font-size: 15px; }
    .user-button .user-name { display: none; }
}

/* ------------------------------------------------------------------ page header */

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-title { display: flex; align-items: center; gap: 14px; font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.page-title::before { content: ""; width: 5px; height: 34px; border-radius: 3px; background: var(--red); }
.page-sub { margin: 6px 0 0 19px; color: var(--muted); font-size: 16px; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.crumbs { margin: 0 0 10px 19px; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); }

/* ------------------------------------------------------------------ hero */

.hero {
    position: relative; overflow: hidden;
    background: var(--ink); color: #fff;
    border-radius: 22px; padding: 34px 40px 36px; margin-bottom: 26px;
}
.hero::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: linear-gradient(90deg, var(--red), #d24a1c 45%, var(--gold-line)); }
.hero-date { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: #353535; font-size: 13px; font-weight: 600; color: #ddd8d3; }
.hero-date::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--gold-line); }
.hero h1 { margin-top: 18px; font-size: 38px; font-weight: 800; letter-spacing: -.02em; }
.hero p { margin: 8px 0 0; color: #bcb5ae; font-size: 17px; }

/* ------------------------------------------------------------------ cards & grids */

.grid { display: grid; gap: 22px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-main { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 22px; }
.mt { margin-top: 22px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 17px; font-weight: 700; }
.card-head .meta { color: var(--muted); font-size: 14px; }
.card-body { padding: 22px 24px; }
.card-foot { padding: 14px 24px; border-top: 1px solid var(--border); color: var(--muted); font-size: 14px; }

.stat { padding: 24px 24px 22px; }
.stat-label { font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.stat-value { margin-top: 12px; font-size: 34px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.stat-note { margin-top: 8px; color: var(--muted); font-size: 14.5px; }
.delta { font-weight: 700; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }

.label { font-size: 12.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

.empty { padding: 44px 24px; text-align: center; color: var(--muted); font-size: 16px; }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; }

/* ------------------------------------------------------------------ notices */

.notice { padding: 16px 22px; border-radius: 12px; border: 1px solid #f0d995; background: var(--amber-soft); color: #3d3204; font-size: 15.5px; margin-bottom: 22px; }
.notice.error { border-color: #f1b8bf; background: var(--red-soft); color: #6b0f1a; }
.notice.success { border-color: #b5e3c3; background: var(--green-soft); color: #134e2a; }
.notice.info { border-color: #c8d6f7; background: var(--blue-soft); color: #1e3a8a; }

/* ------------------------------------------------------------------ tables */

.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.card > .table-wrap { border-radius: 0 0 var(--radius) var(--radius); }
table.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th {
    padding: 14px 18px; text-align: left; white-space: nowrap;
    background: var(--table-head); color: #5b524c;
    font-size: 12.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
}
.table td { padding: 15px 18px; border-top: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover td { background: #fbf9f8; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .strong { font-weight: 700; }
.table .sub { display: block; color: var(--muted); font-size: 13px; }
.table a.row-link { color: var(--text); font-weight: 600; }
.table th button.sort { all: unset; cursor: pointer; }
.table th button.sort:hover { color: var(--text); }
.table th .arrow { color: var(--red); }
.rank { color: var(--red); font-weight: 800; width: 30px; }

/* ------------------------------------------------------------------ pills & bars */

.pill { display: inline-flex; align-items: center; padding: 3px 11px; border-radius: 999px; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.gold { background: var(--gold-soft); color: #8a6100; }
.pill.gray { background: #eeeae7; color: #5b524c; }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.dark { background: var(--ink); color: #fff; }

.bar { height: 8px; border-radius: 6px; background: #efe9e5; overflow: hidden; min-width: 70px; }
.bar > span { display: block; height: 100%; background: var(--red); border-radius: 6px; }
.bar.gold > span { background: var(--gold); }

/* ------------------------------------------------------------------ forms & buttons */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 20px; border-radius: 10px; border: 1px solid transparent;
    font: inherit; font-size: 15.5px; font-weight: 700; cursor: pointer; white-space: nowrap;
    transition: background .15s, border-color .15s;
}
.btn:hover { text-decoration: none; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: none; color: var(--red); padding-left: 8px; padding-right: 8px; }
.btn-danger { background: var(--surface); color: var(--red); border-color: #efc2c8; }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { padding: 7px 14px; font-size: 14px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.loading { opacity: .6; cursor: default; }

.field { margin-bottom: 18px; }
.field > label, .field-label { display: block; margin-bottom: 7px; font-weight: 600; font-size: 15.5px; }
.input, .select, textarea.input {
    width: 100%; padding: 12px 15px;
    font: inherit; font-size: 16px; color: var(--text);
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.input:focus, .select:focus { outline: 2px solid rgba(184, 22, 44, .18); border-color: var(--red); }
.input::placeholder { color: var(--faint); }
.select { appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231c1917' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.hint { margin-top: 6px; color: var(--muted); font-size: 13.5px; }
.error-text { margin-top: 6px; color: var(--red); font-size: 14px; font-weight: 500; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--red); }

.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.toolbar .input, .toolbar .select { width: auto; padding-top: 9px; padding-bottom: 9px; font-size: 15px; }
.toolbar .search { flex: 1; min-width: 220px; }
.segmented { display: inline-flex; padding: 3px; background: #ece6e2; border-radius: 10px; }
.segmented button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: 14px; }
.pager .btns { display: flex; gap: 8px; }

/* ------------------------------------------------------------------ insights */

.insight { display: grid; grid-template-columns: 6px 1fr; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.insight + .insight { margin-top: 14px; }
.insight::before { content: ""; background: var(--faint); }
.insight.critical::before { background: var(--red); }
.insight.warning::before { background: var(--gold); }
.insight.info::before { background: #64748b; }
.insight.positive::before { background: var(--green); }
.insight-body { padding: 16px 20px; }
.insight-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.insight-title { font-weight: 700; font-size: 16px; }
.insight-detail { margin: 6px 0 0; color: #3f3934; }
.insight-rec { margin: 10px 0 0; padding: 10px 14px; border-radius: 9px; background: var(--surface-2); font-size: 14.5px; }
.insight-rec b { color: var(--red); }
.insight-link { display: inline-block; margin-top: 10px; font-weight: 600; font-size: 14.5px; }

/* ------------------------------------------------------------------ charts & heatmap */

.chart-box { position: relative; height: 300px; }
.chart-box.sm { height: 230px; }
.heatmap { display: grid; grid-template-columns: 44px repeat(24, minmax(14px, 1fr)); gap: 3px; font-size: 11px; color: var(--muted); }
.heatmap .cell { aspect-ratio: 1; border-radius: 3px; background: #f1ece8; }
.heatmap .day { display: flex; align-items: center; font-weight: 600; }
.heatmap .hour { text-align: center; }
.legend { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.legend span.sw { width: 14px; height: 14px; border-radius: 3px; }

/* ------------------------------------------------------------------ details list */

.details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 30px; }
.details dt { font-size: 12.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.details dd { margin: 5px 0 0; font-size: 16.5px; word-break: break-word; }
@media (max-width: 640px) { .details { grid-template-columns: 1fr; } }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 120px 1fr; gap: 14px; padding: 12px 0; border-top: 1px solid var(--border); }
.timeline li:first-child { border-top: 0; }
.timeline time { color: var(--muted); font-size: 14px; }

/* ------------------------------------------------------------------ auth pages */

.auth { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; background: var(--surface); }
.auth-art {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
    padding: 40px; color: #fff;
    background: linear-gradient(180deg, rgba(25, 18, 16, .78), rgba(40, 18, 18, .86)), url("../img/campus.jpg") center / cover no-repeat;
}
.auth-art img { width: 120px; height: 120px; }
.auth-art h1 { margin-top: 22px; font-size: 40px; font-weight: 800; letter-spacing: -.02em; }
.auth-art .brand-sub { margin-top: 8px; font-size: 15px; letter-spacing: .3em; }
.auth-art p { max-width: 460px; margin: 26px 0 0; color: #e2dbd5; font-size: 17px; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-form { width: 100%; max-width: 560px; }
.auth-form h2 { font-size: 32px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 26px; }
.auth-form .btn-primary { padding: 13px; font-size: 16.5px; }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 50px; }
.password-wrap button { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: none; padding: 6px; color: var(--muted); cursor: pointer; }
.auth-divider { display: flex; align-items: center; gap: 14px; margin: 30px 0 22px; color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.auth-links { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.auth-links a { display: inline-flex; align-items: center; gap: 9px; padding: 10px 20px; border: 1px solid var(--border-strong); border-radius: 10px; color: var(--text); font-weight: 600; }
.auth-links a svg { width: 18px; height: 18px; color: var(--red); }
.auth-links a:hover { background: var(--surface-2); text-decoration: none; }
.auth-foot { margin-top: 30px; text-align: center; color: var(--muted); font-size: 14px; }
@media (max-width: 900px) {
    .auth { grid-template-columns: 1fr; }
    .auth-art { min-height: 260px; padding: 30px; }
    .auth-art img { width: 80px; height: 80px; }
    .auth-art h1 { font-size: 28px; }
    .auth-art p { display: none; }
}

/* ------------------------------------------------------------------ misc */

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.flex { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.course-list { max-height: 360px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 6px; }
.course-list label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14.5px; }
.course-list label:hover { background: var(--surface-2); }
.course-list input { margin-top: 3px; accent-color: var(--red); }
.course-list .sub { display: block; font-size: 13px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
pre.json { margin: 0; max-height: 420px; overflow: auto; padding: 16px; border-radius: 10px; background: #1f1f1f; color: #e6e1dc; font-size: 12.5px; }
[wire\:loading].loading-line, .loading-line { height: 3px; background: linear-gradient(90deg, var(--red), var(--gold-line)); }
