/* Learn Spark Academy – portal styles (admin, manager, teacher, student) */
:root {
  --navy: #0e1629;
  --navy-2: #17223c;
  --navy-3: #22304f;
  --spark: #ffb21c;
  --spark-2: #f7931e;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #182033;
  --muted: #6b768a;
  --border: #e5e9f0;
  --green: #15803d;
  --green-bg: #dcfce7;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --amber: #a16207;
  --amber-bg: #fef3c7;
  --blue: #1d4ed8;
  --blue-bg: #dbeafe;
  --purple: #6d28d9;
  --purple-bg: #ede9fe;
  --grey: #475569;
  --grey-bg: #eef1f5;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(14, 22, 41, .06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; font-weight: 900; }
h2 { font-size: 18px; } h3 { font-size: 16px; } h4 { font-size: 14px; }
p { margin: 0 0 .8em; }
code { background: var(--grey-bg); padding: 1px 6px; border-radius: 6px; font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .mb0 { margin-bottom: 0; }
.ico { width: 18px; height: 18px; flex: none; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--navy); color: #fff; padding: 18px 12px 30px; z-index: 40; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; border-bottom: 1px solid rgba(255,255,255,.08); color: #fff; }
.brand:hover { text-decoration: none; }
.brand img { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; }
.brand strong { display: block; font-size: 16px; letter-spacing: .2px; }
.brand small { display: block; color: #8d9ab3; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; }
.nav-label { margin: 18px 10px 6px; color: #6f7d97; font-size: 10px; font-weight: 900; letter-spacing: .9px; text-transform: uppercase; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; margin-bottom: 2px; border-radius: 10px; color: #c6cfdd; font-weight: 800; font-size: 13px; }
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255,178,28,.13); color: var(--spark); }
.nav a span { flex: 1; }
.nav-badge { font-style: normal; background: var(--spark); color: var(--navy); border-radius: 999px; font-size: 11px; padding: 0 7px; font-weight: 900; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; min-height: 70px; padding: 12px 28px; background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
.topbar-title { flex: 1; min-width: 0; }
.topbar h1 { font-size: 21px; margin: 0; }
.topbar p { margin: 2px 0 0; color: var(--muted); font-size: 12px; font-weight: 700; }
.topbar-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 5px 12px 5px 5px; border: 1px solid var(--border); border-radius: 999px; color: var(--text); font-weight: 800; font-size: 13px; }
.user-chip:hover { text-decoration: none; background: var(--bg); }
.user-chip small { display: block; font-size: 10px; color: var(--muted); line-height: 1.1; }
.user-chip-text { line-height: 1.2; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--spark), var(--spark-2)); color: var(--navy); display: grid; place-items: center; font-weight: 900; font-size: 12px; flex: none; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.content { padding: 24px 28px 60px; max-width: 1400px; }
.icon-btn { border: 1px solid var(--border); background: #fff; border-radius: 10px; width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer; color: var(--text); }
.sidebar-backdrop { display: none; }
.menu-btn { display: none; }

/* ---------- Cards & grid ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card.flush { padding: 0; }
.card.flush .card-head { padding: 16px 20px 0; }
.card.empty { text-align: center; padding: 50px 20px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid > .card { margin-bottom: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { display: block; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); color: var(--text); }
a.stat:hover { text-decoration: none; border-color: var(--spark); }
.stat-label { color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: .5px; text-transform: uppercase; }
.stat-value { font-size: 26px; font-weight: 900; margin-top: 4px; line-height: 1.1; }
.stat-sub { color: var(--muted); font-size: 12px; margin-top: 4px; font-weight: 700; }
.stat.warn .stat-value { color: var(--amber); }
.stat.good .stat-value { color: var(--green); }
.stat.bad .stat-value { color: var(--red); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; margin: 0; }
.kv dt { color: var(--muted); font-weight: 800; font-size: 12px; }
.kv dd { margin: 0; font-weight: 700; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: .4px; text-transform: uppercase; padding: 10px 12px; border-bottom: 1px solid var(--border); background: #fafbfd; white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fbfcfe; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.table td.num, .table th.num { text-align: right; white-space: nowrap; }
.name-cell { display: flex; align-items: center; gap: 10px; }
.name-cell strong { display: block; }
.name-cell small { color: var(--muted); }

/* ---------- Badges & chips ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 900; white-space: nowrap; }
.badge + .badge { margin-left: 4px; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-grey { background: var(--grey-bg); color: var(--grey); }
.badge-outline { border: 1px solid var(--border); color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { padding: 6px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--border); font-weight: 800; color: var(--text); font-size: 13px; }
.chip:hover { text-decoration: none; border-color: var(--spark); }
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- Forms ---------- */
label { display: block; font-size: 12px; font-weight: 800; color: #334155; }
.input, select, textarea, input[type=text], input[type=email], input[type=number], input[type=date], input[type=month], input[type=time], input[type=password], input[type=tel], input[type=search], input[type=file] {
  width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid #cfd7e3; border-radius: 9px; background: #fff; color: var(--text); font: inherit; font-size: 14px; margin-top: 5px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--spark-2); box-shadow: 0 0 0 3px rgba(255,178,28,.2); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--navy); vertical-align: middle; margin: 0 6px 0 0; }
.check { display: flex; align-items: center; font-weight: 700; font-size: 13px; gap: 2px; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.stack > * + * { margin-top: 14px; }
.hint { color: var(--muted); font-size: 12px; font-weight: 600; margin-top: 4px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; align-items: center; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filters label { min-width: 150px; flex: 1 1 150px; max-width: 240px; }
.filters .grow { max-width: none; flex: 2 1 220px; }
.filters .btn { margin-top: 0; }
fieldset { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin: 0 0 16px; }
legend { font-weight: 900; padding: 0 6px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 7px 15px; border-radius: 9px; border: 1px solid var(--border); background: #fff; color: var(--text); font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: #b9c3d3; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-3); border-color: var(--navy-3); }
.btn-spark { background: var(--spark); border-color: var(--spark); color: var(--navy); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--red); }
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.inline-form { display: inline; margin: 0; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 15px; border-radius: 10px; margin-bottom: 16px; font-weight: 700; border: 1px solid transparent; }
.alert-success { background: var(--green-bg); color: var(--green); border-color: #bbf7d0; }
.alert-error { background: var(--red-bg); color: var(--red); border-color: #fecaca; }
.alert-warning { background: var(--amber-bg); color: var(--amber); border-color: #fde68a; }
.alert-info { background: var(--blue-bg); color: var(--blue); border-color: #bfdbfe; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; font-weight: 800; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.active { color: var(--text); border-bottom-color: var(--spark); }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 6px; flex-wrap: wrap; padding: 16px 20px; }
.pagination a, .pagination span { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--border); background: #fff; font-weight: 800; color: var(--text); padding: 0 8px; }
.pagination a.current { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- Dialog ---------- */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(620px, calc(100vw - 24px)); box-shadow: 0 30px 80px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(14,22,41,.55); }
.dialog-body { padding: 22px; max-height: calc(100vh - 80px); overflow-y: auto; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.dialog-head h3 { margin: 0; }
.dialog-close { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }

/* ---------- Attendance ---------- */
.att-row td { vertical-align: top; }
.att-options { display: flex; gap: 4px; flex-wrap: wrap; }
.att-options input { position: absolute; opacity: 0; pointer-events: none; }
.att-options label { cursor: pointer; padding: 6px 11px; border-radius: 8px; border: 1px solid var(--border); background: #fff; font-size: 12px; margin: 0; }
.att-options input:checked + label.p { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.att-options input:checked + label.a { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.att-options input:checked + label.l { background: var(--amber-bg); border-color: var(--amber); color: var(--amber); }
.att-options input:focus-visible + label { outline: 2px solid var(--spark); }
.att-remark { min-height: 34px !important; margin-top: 0 !important; font-size: 13px !important; }
.batch-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.batch-card { display: block; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; color: var(--text); }
.batch-card:hover { text-decoration: none; border-color: var(--spark); }
.batch-card.active { border-color: var(--navy); box-shadow: 0 0 0 2px var(--navy) inset; }
.batch-card strong { display: block; font-size: 15px; }
.batch-card .time { color: var(--muted); font-weight: 800; font-size: 12px; }

/* ---------- Schedule / timetable ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px dashed var(--border); align-items: center; }
.timeline li:last-child { border-bottom: 0; }
.date-pill { width: 56px; flex: none; text-align: center; border-radius: 12px; background: var(--grey-bg); padding: 6px 0; line-height: 1.1; }
.date-pill b { display: block; font-size: 20px; }
.date-pill small { font-size: 10px; font-weight: 900; text-transform: uppercase; color: var(--muted); }
.date-pill.today { background: var(--spark); }
.date-pill.today small { color: var(--navy); }
.timeline .info { flex: 1; min-width: 0; }
.timeline .info strong { display: block; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week-day { background: #fafbfd; border: 1px solid var(--border); border-radius: 12px; padding: 10px; min-height: 110px; }
.week-day h4 { font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .4px; }
.slot { background: #fff; border-left: 3px solid var(--spark); border-radius: 8px; padding: 6px 8px; margin-bottom: 6px; font-size: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.slot b { display: block; }

/* ---------- Notices ---------- */
.notice-list { display: grid; gap: 12px; }
.notice { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: #fff; }
.notice-event { border-left: 4px solid var(--blue); }
.notice-holiday { border-left: 4px solid var(--spark); }
.notice-notice { border-left: 4px solid var(--grey); }
.notice-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.notice-date { color: var(--muted); font-size: 12px; font-weight: 800; margin-left: auto; }
.notice h4 { margin: 0 0 4px; font-size: 15px; }
.notice p { margin: 0; color: #3b4558; }

/* ---------- Progress ---------- */
.bar { height: 8px; background: var(--grey-bg); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--spark), var(--spark-2)); }

/* ---------- Auth pages ---------- */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1000px 500px at 10% -10%, rgba(255,178,28,.22), transparent 60%), radial-gradient(800px 500px at 100% 110%, rgba(37,99,235,.18), transparent 60%), var(--navy); }
.auth-card { width: 100%; max-width: 430px; background: #fff; border-radius: 20px; padding: 32px 30px; box-shadow: 0 30px 70px rgba(0,0,0,.35); }
.auth-logo { width: 84px; height: 84px; border-radius: 18px; display: block; margin: 0 auto 14px; }
.auth-card h1 { text-align: center; font-size: 24px; }
.auth-card > p.muted { text-align: center; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--grey-bg); border-radius: 12px; padding: 4px; margin: 18px 0; }
.auth-tabs button { border: 0; background: none; padding: 9px; border-radius: 9px; font: inherit; font-weight: 900; color: var(--muted); cursor: pointer; }
.auth-tabs button.active { background: #fff; color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.auth-foot { text-align: center; margin-top: 18px; font-size: 13px; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2-1 { grid-template-columns: 1fr; }
  .week-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 270px; transform: translateX(-100%); transition: transform .2s ease; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .menu-btn { display: grid; }
  .topbar { padding: 10px 16px; }
  .topbar h1 { font-size: 18px; }
  .user-chip-text { display: none; }
  .user-chip { padding: 4px; }
  .content { padding: 16px 16px 50px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .week-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .filters label { max-width: none; }
  .table.responsive thead { display: none; }
  .table.responsive tr { display: block; border-bottom: 1px solid var(--border); padding: 8px 0; }
  .table.responsive td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 5px 14px; text-align: right; }
  .table.responsive td::before { content: attr(data-label); font-weight: 800; color: var(--muted); font-size: 11px; text-transform: uppercase; text-align: left; }
  .table.responsive td.att-cell { display: block; text-align: left; }
  .table.responsive td.att-cell::before { display: block; margin-bottom: 4px; }
  .table.responsive .actions { justify-content: flex-end; }
}
@media print {
  .sidebar, .topbar, .filters, .btn, .chips { display: none !important; }
  .layout { display: block; }
  .card { box-shadow: none; }
}
