/* ===========================================================================
   OneFuture — Trainer Management System
   Modern SaaS-style design system.
   ---------------------------------------------------------------------------
   Structure:
   1.  Design tokens (CSS variables)
   2.  Base / typography
   3.  Layout shell (sidebar, topbar, content, bottom nav)
   4.  Cards & stat cards
   5.  Class cards (dashboard)
   6.  Buttons
   7.  Badges & status
   8.  Tables
   9.  Forms
   10. Timeline-style lists (sessions/tasks previews)
   11. Toasts & alerts
   12. Empty states
   13. Timetable grid
   14. Login
   15. Utilities & misc
   16. Responsive refinements
   =========================================================================== */

/* ----------------------------- 1. Tokens --------------------------------- */

:root {
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;

  /* Brand — deep indigo */
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-darker: #3730a3;
  --brand-soft: #eef2ff;
  --brand-soft-strong: #e0e7ff;

  /* Surfaces & text */
  --bg: #f6f8fc;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e6e8ef;
  --line-strong: #d7dbe5;

  /* Status */
  --success: #16a34a;
  --success-dark: #15803d;
  --success-soft: #ecfdf3;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-dark: #b91c1c;
  --danger-soft: #fef2f2;
  --info: #2563eb;
  --info-soft: #eff6ff;

  /* Geometry */
  --radius: 0.8rem;
  --radius-sm: 0.55rem;
  --radius-lg: 1rem;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 6px 18px rgba(15, 23, 42, 0.07);
  --sidebar-w: 264px;
  --sidebar-w-collapsed: 80px;
  --topbar-h: 60px;
  --bottomnav-h: 62px;
  --focus-ring: 0 0 0 0.25rem rgba(79, 70, 229, 0.16);
}

/* ----------------------------- 2. Base ----------------------------------- */

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

h1, h2, h3, h4, h5, h6 { color: var(--ink); }

/* ----------------------------- 3. Layout shell --------------------------- */

.app-shell { min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 1030;
  padding: 1.1rem 0.9rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  font-size: 1.06rem;
  color: var(--ink);
  padding: 0.25rem 0.55rem 1.1rem;
  line-height: 1.2;
}

.sidebar-brand small {
  display: block;
  font-weight: 500;
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-darker));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.brand-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar .nav { gap: 1px; }

.sidebar .nav-section {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  padding: 0.85rem 0.6rem 0.3rem;
  font-weight: 700;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink-2);
  border-radius: 0.6rem;
  padding: 0.55rem 0.7rem;
  margin-bottom: 2px;
  font-weight: 500;
  font-size: 0.9rem;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; }

.sidebar .nav-link:hover { background: #f1f5f9; color: var(--ink); }

.sidebar .nav-link.active {
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 600;
  border-color: transparent;
  box-shadow: inset 3px 0 0 var(--brand);
}

.sidebar .logout-form { margin-top: auto; }

/* Sidebar collapse (desktop) */
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.9rem;
  border: 1px solid var(--line);
  background: #fafbfd;
  color: var(--muted);
  border-radius: 0.6rem;
  padding: 0.5rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 600;
  width: 100%;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sidebar-toggle:hover {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-color: transparent;
}

.sidebar-toggle i { transition: transform 0.18s ease; }

body.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); padding: 1.1rem 0.6rem; }
body.sidebar-collapsed .app-main { margin-left: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .sidebar-toggle span { display: none; }
body.sidebar-collapsed .sidebar-toggle i { transform: rotate(180deg); }
body.sidebar-collapsed .sidebar-brand { justify-content: center; padding-left: 0; padding-right: 0; }
body.sidebar-collapsed .sidebar-brand .brand-text,
body.sidebar-collapsed .sidebar .nav-section,
body.sidebar-collapsed .sidebar .nav-link span,
body.sidebar-collapsed .side-user .side-user-text,
body.sidebar-collapsed .side-user .logout-form { display: none; }
body.sidebar-collapsed .sidebar .nav-link { justify-content: center; padding: 0.6rem; }
body.sidebar-collapsed .side-user { display: flex; justify-content: center; padding: 0.5rem; }

/* User card at the bottom of the sidebar */
.side-user {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fafbfd;
  padding: 0.75rem;
}

.side-user .avatar { width: 38px; height: 38px; font-size: 0.85rem; }

.side-user-text { min-width: 0; }

.side-user-name {
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-user-meta {
  font-size: 0.72rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Avatar (initials circle) */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  user-select: none;
}

/* Main column */
.app-main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  height: var(--topbar-h);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.topbar-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.25;
}

.topbar-breadcrumb {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-date {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

.app-content { flex: 1; padding-bottom: 3.5rem; }

.app-content > .container-app {
  max-width: 1480px;
  margin-inline: auto;
}

/* Mobile bottom navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1040;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav .bn-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 2px 7px;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 600;
  border-top: 2px solid transparent;
  transition: color 0.15s ease;
}

.bottom-nav .bn-item i { font-size: 1.2rem; line-height: 1; }

.bottom-nav .bn-item.active {
  color: var(--brand-dark);
  border-top-color: var(--brand);
}

.bottom-nav .bn-item:active { background: var(--brand-soft); }

/* ----------------------------- 4. Cards ---------------------------------- */

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background: var(--surface);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.8rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.card-body { padding: 1.1rem; }

.card-footer {
  background: #fafbfd;
  border-top: 1px solid var(--line);
}

/* Section card headers with subtle icon */
.card-title-sm {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0;
}

/* Stat cards */
.stat-card { transition: transform 0.15s ease, box-shadow 0.15s ease; }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-card .stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.stat-value { font-size: 1.55rem; font-weight: 700; line-height: 1.15; color: var(--ink); }

.stat-hint { font-size: 0.75rem; color: var(--muted); }

/* KPI cards (admin dashboard) */
.kpi-card { height: 100%; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.kpi-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.kpi-card .stat-value { font-size: 1.9rem; }

.kpi-card .stat-label { font-size: 0.7rem; }

/* Quick action buttons */
.qa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 0.7rem;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 0.86rem;
  width: 100%;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.qa-btn:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
  background: var(--brand-soft);
  box-shadow: var(--shadow-sm);
}

.qa-btn i { font-size: 1.05rem; }

/* Card section headers with supporting line */
.card-head-title { font-weight: 700; font-size: 0.95rem; color: var(--ink); line-height: 1.3; }

.card-head-sub { font-size: 0.78rem; color: var(--muted); margin-top: 1px; }

.view-all {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.view-all:hover { color: var(--brand-dark); }

/* Welcome header */
.welcome-head h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 0.15rem;
}

.welcome-sub { color: var(--muted); font-size: 0.92rem; }

/* Soft tables (admin activity) */
.table-soft thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
  border-bottom: 1px solid var(--line-strong);
  padding: 0.7rem 1.1rem;
  background: #fafbfd;
}

.table-soft td {
  padding: 0.85rem 1.1rem;
  vertical-align: middle;
  border-color: var(--line);
}

.table-soft tbody tr { transition: background 0.12s ease; }
.table-soft tbody tr:hover { background: #f8fafc; }

/* Status badge with dot indicator */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.72rem;
  padding: 0.32rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Activity cards (mobile) */
.activity-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 0.95rem;
  background: var(--surface);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.activity-card + .activity-card { margin-top: 0.65rem; }
.activity-card:hover { box-shadow: var(--shadow-md); border-color: var(--line-strong); }

.activity-card .act-time { font-weight: 700; font-size: 0.85rem; color: var(--brand-dark); }

.activity-card .act-trainer { font-weight: 600; color: var(--ink); font-size: 0.92rem; }

.activity-card .act-meta { font-size: 0.8rem; color: var(--muted); }

/* Compact list rows (upcoming / pending) */
.mini-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}

.mini-row:last-child { border-bottom: 0; }

.mini-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 1rem;
  flex-shrink: 0;
}

.mini-body { min-width: 0; flex: 1; }

.mini-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-sub {
  font-size: 0.78rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-time {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--ink-2);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ----------------------------- 5. Class cards (dashboard) ---------------- */

.class-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem 1.1rem;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.class-card + .class-card { margin-top: 0.75rem; }

.class-card:hover { box-shadow: var(--shadow-md); }

.class-card--current {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
  background: linear-gradient(180deg, #fcfcff, #fff);
}

.class-card--current::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 0.9rem;
  bottom: 0.9rem;
  width: 4px;
  border-radius: 4px;
  background: var(--brand);
}

.class-time {
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.class-time .bi { color: var(--muted); font-size: 0.9rem; }

.class-name { font-weight: 600; font-size: 0.98rem; color: var(--ink); }

.class-meta { color: var(--muted); font-size: 0.84rem; }

/* Live pill */
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--brand);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 2rem;
  padding: 0.3rem 0.7rem;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  animation: livePulse 1.4s infinite;
}

@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55); }
  70% { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

/* "Next up" hint */
.next-up {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--info);
  background: var(--info-soft);
  border: 1px dashed #bfdbfe;
  border-radius: 2rem;
  padding: 0.25rem 0.65rem;
}

/* Quick actions */
.quick-action {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0.7rem 0.85rem;
  color: var(--ink-2);
  font-weight: 500;
  font-size: 0.9rem;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.quick-action:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
  transform: translateY(-1px);
}

.quick-action i {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  background: var(--brand-soft);
  color: var(--brand-dark);
  flex-shrink: 0;
}

/* Status dot */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.4rem;
}
.status-dot.current { background: var(--brand); }
.status-dot.upcoming { background: var(--info); }
.status-dot.completed { background: var(--success); }
.status-dot.past { background: #cbd5e1; }

/* ----------------------------- 6. Buttons -------------------------------- */

.btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease;
}

.btn:focus-visible { box-shadow: var(--focus-ring); }

.btn:disabled { opacity: 0.55; pointer-events: none; }

.btn-brand {
  background: var(--brand);
  border: 1px solid var(--brand);
  color: #fff;
}
.btn-brand:hover, .btn-brand:focus {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}
.btn-brand:active { background: var(--brand-darker) !important; border-color: var(--brand-darker) !important; }

.btn-soft {
  background: var(--brand-soft);
  border: 1px solid transparent;
  color: var(--brand-dark);
}
.btn-soft:hover { background: var(--brand-soft-strong); color: var(--brand-darker); }

.btn-outline-brand {
  border: 1px solid var(--brand);
  color: var(--brand);
  background: transparent;
}
.btn-outline-brand:hover { background: var(--brand); color: #fff; }

.btn-light {
  background: #fff;
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
}
.btn-light:hover { background: #f1f5f9; border-color: var(--line-strong); color: var(--ink); }

.btn-danger {
  background: var(--danger);
  border: 1px solid var(--danger);
  color: #fff;
}
.btn-danger:hover { background: var(--danger-dark); border-color: var(--danger-dark); color: #fff; }

.btn-sm { min-height: 30px; padding: 0.2rem 0.6rem; font-size: 0.82rem; border-radius: 0.45rem; }

.btn-lg { min-height: 46px; padding: 0.6rem 1.25rem; font-size: 0.98rem; }

/* ----------------------------- 7. Badges & status ------------------------ */

.badge {
  font-weight: 600;
  padding: 0.42em 0.75em;
  border-radius: 2rem;
  font-size: 0.72rem;
  letter-spacing: 0.01em;
}

.badge-soft-brand { background: var(--brand-soft); color: var(--brand-dark); }
.badge-soft-success { background: var(--success-soft); color: var(--success-dark); }
.badge-soft-warning { background: var(--warning-soft); color: var(--warning); }
.badge-soft-danger { background: var(--danger-soft); color: var(--danger-dark); }
.badge-soft-info { background: var(--info-soft); color: var(--info); }
.badge-soft-muted { background: #f1f5f9; color: #64748b; }

.badge-priority-high { background: var(--danger-soft); color: var(--danger-dark); }
.badge-priority-medium { background: var(--warning-soft); color: var(--warning); }
.badge-priority-low { background: #f1f5f9; color: #64748b; }

/* Timetable card (used on dashboard + mobile views) */
.tt-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem 1.1rem;
  transition: box-shadow 0.15s ease;
}

.tt-card:hover { box-shadow: var(--shadow-md); }

.tt-card.current {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.tt-time { font-weight: 700; font-size: 0.98rem; color: var(--ink); }
.tt-subject { font-weight: 600; }
.tt-class { color: var(--muted); font-size: 0.88rem; }

/* ----------------------------- 8. Tables --------------------------------- */

.table { --bs-table-hover-bg: #f8fafc; }

.table thead th {
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  white-space: nowrap;
  padding: 0.7rem 0.9rem;
}

.table td { vertical-align: middle; padding: 0.75rem 0.9rem; border-color: var(--line); }

.table-hover tbody tr:hover { --bs-table-hover-bg: #f8fafc; }

/* ----------------------------- 9. Forms ---------------------------------- */

.form-label {
  font-weight: 600;
  font-size: 0.84rem;
  color: var(--ink-2);
  margin-bottom: 0.35rem;
}

.form-label .req { color: var(--danger); margin-left: 2px; }

.form-control, .form-select {
  border-radius: var(--radius-sm);
  border-color: var(--line-strong);
  padding: 0.55rem 0.8rem;
  min-height: 42px;
  font-size: 0.92rem;
}

.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}

.form-control.is-invalid, .form-select.is-invalid {
  border-color: var(--danger);
  box-shadow: none;
}

.form-text { font-size: 0.78rem; color: var(--muted); }

.field-error {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--danger-dark);
  font-size: 0.8rem;
  font-weight: 500;
  margin-top: 0.4rem;
}

/* Chips / filter pills */
.chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 2rem;
  padding: 0.35rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-2);
  transition: all 0.15s ease;
}

.chip:hover { border-color: var(--brand); color: var(--brand-dark); }

.chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

/* ----------------------------- 10. List rows ----------------------------- */

.list-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.list-row:last-child { border-bottom: 0; padding-bottom: 0.15rem; }
.list-row:first-child { padding-top: 0.15rem; }

/* ----------------------------- 11. Toasts & alerts ----------------------- */

.toast-wrap {
  position: fixed;
  top: calc(var(--topbar-h) + 12px);
  right: 12px;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(92vw, 380px);
}

.app-toast {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 0.8rem 1rem;
  animation: toastIn 0.25s ease;
}

.app-toast--success { border-left-color: var(--success); }
.app-toast--warning { border-left-color: var(--warning); }
.app-toast--error { border-left-color: var(--danger); }

.app-toast .toast-ic {
  font-size: 1.05rem;
  line-height: 1.4;
  flex-shrink: 0;
}
.app-toast--success .toast-ic { color: var(--success); }
.app-toast--warning .toast-ic { color: var(--warning); }
.app-toast--error .toast-ic { color: var(--danger); }

.app-toast .toast-body { font-size: 0.86rem; color: var(--ink-2); flex: 1; }

.app-toast .toast-x {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.15rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 0.3rem;
}
.app-toast .toast-x:hover { color: var(--ink); background: #f1f5f9; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

.app-toast.toast-out { opacity: 0; transform: translateX(16px); transition: all 0.3s ease; }

/* Inline alerts (kept for non-message alerts) */
.alert { border-radius: var(--radius-sm); border: 0; font-size: 0.88rem; }

/* ----------------------------- 12. Empty states -------------------------- */

.empty-state {
  text-align: center;
  padding: 2.4rem 1rem;
  color: var(--muted);
}

.empty-state .empty-icon {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: #f1f5f9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #94a3b8;
  margin-bottom: 0.85rem;
}

.empty-state h6 { color: var(--ink); font-weight: 700; font-size: 0.95rem; margin-bottom: 0.25rem; }

.empty-state > div:last-child { font-size: 0.85rem; }

/* ----------------------------- 13. Timetable grid ------------------------ */

.timetable-grid { font-size: 0.85rem; }

.timetable-grid .tt-day-col {
  background: #f8fafc;
  font-weight: 600;
  color: var(--ink-2);
  width: 120px;
  text-align: center;
  vertical-align: middle;
}

.timetable-grid td { min-width: 120px; height: 100px; }

.timetable-grid .today-col { background: var(--brand-soft); }

.tt-cell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.6rem;
  color: var(--ink-2);
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  height: 100%;
}

.tt-cell:hover {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
  color: var(--ink);
}

.tt-cell-class { display: block; font-weight: 700; font-size: 0.9rem; color: var(--ink); }
.tt-cell-time { display: block; font-size: 0.75rem; color: var(--muted); margin-top: 2px; }

.tt-muted { color: var(--muted); }

/* Mobile day blocks */
.tt-day-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }

.tt-day-heading {
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--ink);
  padding: 0.65rem 0.9rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tt-day-block .tt-card { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; margin: 0 !important; }
.tt-day-block .tt-card:hover { background: #fafbfd; }
.tt-day-block .tt-card:last-child { border-bottom: 0; }

/* ----------------------------- 14. Login --------------------------------- */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(52rem 30rem at 110% -10%, rgba(79, 70, 229, 0.14), transparent 60%),
    radial-gradient(40rem 26rem at -20% 110%, rgba(37, 99, 235, 0.1), transparent 60%),
    var(--bg);
}

.login-card { width: 100%; max-width: 400px; }

.login-brand { text-align: center; margin-bottom: 1.4rem; }

.login-brand .brand-logo { width: 58px; height: 58px; object-fit: contain; }

.login-brand h1 { font-size: 1.35rem; font-weight: 700; margin-top: 0.8rem; margin-bottom: 0.15rem; letter-spacing: -0.01em; }

.login-brand p { color: var(--muted); font-size: 0.88rem; margin: 0; }

.login-card .card { box-shadow: var(--shadow-md); border-radius: var(--radius-lg); }

/* ----------------------------- 15. Utilities & misc ---------------------- */

.text-muted-2 { color: var(--muted); }

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px dashed var(--line);
}
.detail-row .k { color: var(--muted); font-size: 0.84rem; }
.detail-row .v { font-weight: 500; text-align: right; }

.page-head { margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.32rem; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.page-head .sub { color: var(--muted); font-size: 0.88rem; margin-top: 0.2rem; }

.week-day-head {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 700;
}
.week-day-head.today { color: var(--brand-dark); }

/* Filter form */
.filter-card .card-body { padding: 0.9rem 1.1rem; }

/* Page section spacing */
.section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  margin-bottom: 0.9rem;
}

.section-title .bi { color: var(--brand); }

/* Modal polish */
.modal-content { border: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.modal-header, .modal-footer { border-color: var(--line); }

/* Pagination */
.pagination .page-link {
  color: var(--brand-dark);
  border-color: var(--line);
  border-radius: var(--radius-sm) !important;
  margin: 0 2px;
  font-weight: 600;
  font-size: 0.85rem;
}

.pagination .page-item.active .page-link {
  background: var(--brand);
  border-color: var(--brand);
}

/* Dropdown polish */
.dropdown-menu {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 0.35rem;
}

.dropdown-item {
  border-radius: 0.4rem;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.5rem 0.7rem;
}

.dropdown-item:hover { background: var(--brand-soft); color: var(--brand-dark); }

.dropdown-item.text-danger:hover { background: var(--danger-soft); color: var(--danger-dark); }

/* ----------------------------- 16. Responsive ---------------------------- */

/* Holiday banner */
.holiday-banner {
  text-align: center;
  padding: 2.5rem 1rem;
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px dashed #f59e0b;
  border-radius: var(--radius);
}

.holiday-icon {
  font-size: 2.8rem;
  margin-bottom: 0.6rem;
  line-height: 1;
}

.holiday-title {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  margin-bottom: 0.3rem;
}

.holiday-text {
  color: var(--ink-2);
  font-size: 0.92rem;
  margin-bottom: 0.15rem;
}

.holiday-sub {
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 0;
}

/* Icon button (three-dot menu trigger) */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-icon:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger);
}

.btn-icon i { font-size: 1rem; }

@media (max-width: 991.98px) {
  .app-main { margin-left: 0; }
  .sidebar-fixed { display: none !important; }
  .app-content { padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0) + 1rem); }
  .bottom-nav { display: flex; }
}

@media (min-width: 992px) {
  .bottom-nav { display: none; }
}

@media (max-width: 575.98px) {
  body { font-size: 0.93rem; }
  .topbar { padding: 0 0.9rem; }
  .app-content { padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0) + 1.25rem); }
  .btn { min-height: 42px; }
  .btn-sm { min-height: 32px; }
  .card-body { padding: 0.95rem; }
  .class-card { padding: 0.9rem 0.95rem; }
  .stat-value { font-size: 1.4rem; }
  .table-responsive { border: 0; }
}