:root {
  --navy: #0b1f3a;
  --navy-deep: #06172d;
  --teal: #0e8f87;
  --teal-dark: #08756f;
  --teal-soft: #e8f6f4;
  --gold: #c8a24a;
  --gold-soft: #fff6dc;
  --canvas: #f4f7fa;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #10243e;
  --muted: #667085;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --warning: #9a6700;
  --warning-soft: #fff8df;
  --shadow: 0 8px 28px rgba(18, 36, 62, .07);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--canvas); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.app-shell { min-height: 100vh; display: flex; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: 255px; display: flex; flex-direction: column; color: #fff; background: linear-gradient(180deg, #0d2a4d 0%, var(--navy-deep) 100%); box-shadow: 8px 0 24px rgba(4,19,37,.08); }
.sidebar-close { display: none; position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border: 0; border-radius: 50%; color: #fff; background: rgba(255,255,255,.1); font-size: 24px; cursor: pointer; }
.brand { padding: 27px 21px 20px; text-align: center; }
.brand-emblem { color: #fff; font-size: 40px; line-height: 1; font-weight: 800; letter-spacing: .07em; }
.brand-emblem.small { font-size: 34px; }
.brand-rule { height: 18px; margin: 4px auto 8px; width: 116px; display: flex; align-items: center; gap: 6px; color: var(--gold); font-size: 11px; }
.brand-rule::before, .brand-rule::after { content: ""; flex: 1; height: 1px; background: var(--gold); opacity: .9; }
.brand p { margin: 0; font-size: 12px; line-height: 1.4; font-weight: 650; }
.brand small { display: block; margin-top: 7px; color: #f7c958; font-size: 11.5px; }
.nav-list { padding: 8px 14px; display: grid; gap: 6px; }
.nav-item { min-height: 48px; display: flex; align-items: center; gap: 13px; padding: 0 14px; border-radius: 11px; color: #dbe7f4; text-decoration: none; font-weight: 600; transition: .18s ease; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.08); transform: translateX(2px); }
.nav-item.active { color: #fff; background: linear-gradient(90deg, rgba(14,143,135,.95), rgba(18,121,126,.82)); box-shadow: 0 8px 18px rgba(3, 25, 47, .18); }
.nav-icon, .panel-icon { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; background: rgba(255,255,255,.1); font-size: 10px; font-weight: 800; letter-spacing: .04em; }
.nav-item.active .nav-icon { background: rgba(255,255,255,.16); }
.sidebar-foot { margin: auto 16px 18px; padding: 15px; display: flex; align-items: center; gap: 11px; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; color: #dbe7f4; background: rgba(255,255,255,.04); }
.sidebar-foot strong, .sidebar-foot small { display: block; }
.sidebar-foot strong { color: #fff; font-size: 12px; }
.sidebar-foot small { margin-top: 3px; font-size: 10.5px; text-transform: capitalize; }
.lock-dot { color: #4fd1c5; }

.workspace { width: 100%; min-width: 0; margin-left: 255px; }
.topbar { height: 72px; padding: 0 29px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.96); position: sticky; top: 0; z-index: 25; backdrop-filter: blur(12px); }
.topbar-left, .topbar-actions, .profile, .page-actions, .row-actions { display: flex; align-items: center; }
.topbar-left { gap: 12px; }
.topbar-actions { gap: 15px; }
.search-box { width: min(330px, 31vw); height: 40px; display: flex; align-items: center; gap: 9px; padding: 0 13px; border: 1px solid var(--border); border-radius: 10px; background: #f9fbfc; color: var(--muted); }
.search-box:focus-within { border-color: #86c9c4; box-shadow: 0 0 0 3px rgba(14,143,135,.1); background: #fff; }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 10px; background: #fff; cursor: pointer; }
.mobile-menu { display: none; }
.date-label { color: var(--muted); font-weight: 600; font-size: 12px; }
.profile { gap: 9px; }
.profile strong, .profile small { display: block; }
.profile strong { font-size: 12.5px; }
.profile small { margin-top: 2px; color: var(--muted); font-size: 10.5px; }
.avatar, .identity > span { flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; color: #fff; background: linear-gradient(135deg, var(--teal), #075f68); font-weight: 750; }
.avatar { width: 38px; height: 38px; font-size: 12px; }
.logout-button { min-height: 35px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px; color: var(--navy); background: #fff; font-weight: 700; font-size: 12px; cursor: pointer; }
.logout-button:hover { border-color: #b9c6d4; background: #f8fafc; }

.content { max-width: 1500px; margin: 0 auto; padding: 30px 30px 45px; }
.page-heading { min-height: 72px; margin-bottom: 25px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.page-heading h1 { margin: 3px 0 5px; font-size: clamp(25px, 2.2vw, 34px); line-height: 1.15; letter-spacing: -.035em; }
.page-heading p { margin: 0; color: var(--muted); }
.eyebrow { margin: 0 !important; color: var(--teal) !important; font-size: 10px !important; font-weight: 800; letter-spacing: .14em; }
.page-actions { justify-content: flex-end; flex-wrap: wrap; gap: 9px; }
.button { min-height: 41px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 10px; text-decoration: none; font-weight: 750; font-size: 12.5px; cursor: pointer; transition: .16s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; background: linear-gradient(135deg, var(--teal), var(--teal-dark)); box-shadow: 0 7px 16px rgba(14,143,135,.2); }
.button.secondary { color: var(--navy); border-color: var(--border); background: #fff; }
.button.full { width: 100%; }
.file-button { cursor: pointer; }
.text-button { padding: 3px 4px; border: 0; color: var(--teal-dark); background: transparent; font-size: 12px; font-weight: 750; cursor: pointer; }
.text-button:hover { text-decoration: underline; }
.text-button:disabled { opacity: .4; cursor: not-allowed; text-decoration: none; }

.alert { margin: -8px 0 22px; padding: 13px 15px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid #bde5df; border-radius: 11px; color: #056158; background: var(--teal-soft); font-weight: 650; }
.alert.error { color: var(--danger); border-color: #fecdca; background: var(--danger-soft); }
.alert.warning { color: var(--warning); border-color: #f2d58a; background: var(--warning-soft); }
.alert button { border: 0; color: inherit; background: transparent; font-size: 20px; cursor: pointer; }

.metrics-grid { margin-bottom: 22px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.metric-card { min-height: 112px; padding: 20px; display: flex; align-items: center; gap: 15px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.metric-card .metric-icon { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 13px; color: var(--teal-dark); background: var(--teal-soft); font-size: 12px; font-weight: 850; }
.metric-card.gold .metric-icon { color: #8c6900; background: var(--gold-soft); }
.metric-card small, .metric-card strong { display: block; }
.metric-card small { color: var(--muted); font-weight: 650; }
.metric-card strong { margin-top: 5px; font-size: clamp(21px, 2vw, 29px); letter-spacing: -.03em; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(340px, .8fr); gap: 18px; }
.panel { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.panel-heading { min-height: 62px; padding: 0 19px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.panel-heading > div { display: flex; align-items: center; gap: 10px; }
.panel-heading h2 { margin: 0; font-size: 15px; }
.panel-heading a { color: var(--teal-dark); text-decoration: none; font-size: 12px; font-weight: 750; }
.panel-icon { color: var(--teal-dark); background: var(--teal-soft); }
.stack-list { padding: 5px 18px; }
.list-row { min-height: 66px; padding: 11px 2px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid #edf1f5; }
.list-row:last-child { border-bottom: 0; }
.list-row strong, .list-row small { display: block; }
.list-row strong { font-size: 12.5px; }
.list-row small, .list-row time { margin-top: 4px; color: var(--muted); font-size: 10.5px; }
.right-copy { display: flex; align-items: center; gap: 9px; text-align: right; }
.security-panel { margin-top: 18px; }
.security-form { padding: 19px; }
.spaced-panel { margin-top: 20px; }

.table-panel { overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 14px 17px; color: #586579; background: #f8fafc; text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; white-space: nowrap; }
td { padding: 15px 17px; border-top: 1px solid #edf1f5; vertical-align: middle; font-size: 12px; }
tbody tr:hover { background: #fbfdfd; }
.identity { min-width: 185px; display: flex; align-items: center; gap: 10px; }
.identity > span { width: 36px; height: 36px; font-size: 10px; }
.identity strong, .identity small, .cell-subtitle { display: block; }
.identity strong { font-size: 12px; }
.identity small, .cell-subtitle { margin-top: 3px; color: var(--muted); font-size: 10px; }
.row-actions { gap: 8px; white-space: nowrap; }
.status { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; border-radius: 999px; color: #056158; background: var(--teal-soft); font-size: 9.5px; font-style: normal; font-weight: 800; text-transform: uppercase; letter-spacing: .045em; }
.status.scheduled, .status.pending, .status.partial, .status.excused, .status.trainer { color: #8a6500; background: var(--gold-soft); }
.status.absent, .status.fail, .status.cancelled, .status.inactive, .status.refunded { color: var(--danger); background: var(--danger-soft); }
.status.completed, .status.pass, .status.paid, .status.present, .status.active, .status.admin { color: #056158; background: var(--teal-soft); }
.status.late, .status.student { color: #37518c; background: #edf2ff; }
.empty-state { padding: 34px 20px; color: var(--muted); text-align: center; }
.compact-form { display: flex; align-items: center; gap: 7px; }
.compact-form select { min-height: 32px; min-width: 112px; padding: 0 8px; }

.course-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.course-card { padding: 19px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.course-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.course-code { color: var(--teal-dark); font-size: 10.5px; font-weight: 850; letter-spacing: .06em; }
.course-card h2 { min-height: 43px; margin: 14px 0 16px; font-size: 17px; line-height: 1.3; }
.course-details { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.course-details small, .course-details strong { display: block; }
.course-details small { margin-bottom: 4px; color: var(--muted); font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em; }
.course-details strong { font-size: 11px; line-height: 1.35; }
.course-card .compact-form { margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--border); }

label { display: grid; gap: 6px; color: #35445a; font-size: 11.5px; font-weight: 700; }
input, select { width: 100%; min-height: 42px; padding: 0 11px; border: 1px solid #d7dee8; border-radius: 9px; outline: none; color: var(--text); background: #fff; }
input:focus, select:focus { border-color: #72c3bc; box-shadow: 0 0 0 3px rgba(14,143,135,.1); }
label small { color: var(--muted); font-size: 9.5px; font-weight: 500; }
.form-stack { display: grid; gap: 15px; }
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.inline-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 12px; align-items: end; }
.form-note { margin: 14px 0 0; padding: 11px; border-radius: 9px; color: #62501c; background: var(--gold-soft); font-size: 11px; }
fieldset { margin: 0; padding: 15px; border: 1px solid var(--border); border-radius: 11px; }
legend { padding: 0 7px; color: var(--navy); font-size: 11px; font-weight: 800; }

.modal { width: min(620px, calc(100vw - 28px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 16px; color: var(--text); background: transparent; box-shadow: 0 24px 70px rgba(4,19,37,.28); }
.modal::backdrop { background: rgba(4,19,37,.55); backdrop-filter: blur(3px); }
.modal-card { padding: 22px; border-radius: 16px; background: #fff; }
.modal-card.wide { width: min(720px, calc(100vw - 28px)); }
.modal-heading { margin-bottom: 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.modal-heading h2 { margin: 4px 0 0; font-size: 21px; }
.modal-heading button { width: 34px; height: 34px; border: 0; border-radius: 50%; color: var(--muted); background: #f2f5f8; font-size: 21px; cursor: pointer; }
.modal-actions { margin-top: 20px; padding-top: 16px; display: flex; justify-content: flex-end; gap: 9px; border-top: 1px solid var(--border); }

.auth-page { min-height: 100vh; padding: 28px; display: grid; place-items: center; background: radial-gradient(circle at 12% 12%, rgba(14,143,135,.18), transparent 33%), linear-gradient(145deg, var(--navy-deep), #0d2d50 62%, #10424f); }
.auth-shell { width: min(940px, 100%); min-height: 560px; display: grid; grid-template-columns: 1.05fr .95fr; overflow: hidden; border: 1px solid rgba(255,255,255,.12); border-radius: 22px; background: rgba(255,255,255,.04); box-shadow: 0 34px 90px rgba(0,0,0,.26); }
.auth-brand { padding: 58px; display: flex; flex-direction: column; justify-content: center; color: #fff; }
.auth-brand .brand-emblem { width: fit-content; padding-bottom: 12px; border-bottom: 2px solid var(--gold); }
.auth-brand p { margin: 18px 0 0; color: #dbe7f4; font-weight: 700; }
.auth-brand h1 { max-width: 420px; margin: 13px 0 12px; font-size: clamp(33px, 4vw, 50px); line-height: 1.08; letter-spacing: -.045em; }
.auth-brand span { max-width: 430px; color: #b9cada; line-height: 1.65; }
.auth-card { margin: 18px; padding: 42px; align-self: stretch; display: flex; flex-direction: column; justify-content: center; border-radius: 17px; background: #fff; }
.auth-card h2 { margin: 5px 0 8px; font-size: 27px; letter-spacing: -.03em; }
.auth-card .muted { margin: 0 0 24px; color: var(--muted); line-height: 1.55; }
.auth-card .alert { margin: 0 0 18px; }
.login-help { margin: 20px 0 0; color: var(--muted); text-align: center; font-size: 10.5px; line-height: 1.5; }
.install-shell { width: min(1100px, 100%); grid-template-columns: .78fr 1.22fr; }
.install-card { padding: 34px; }
.install-card fieldset + fieldset { margin-top: 13px; }
.success-mark { width: 65px; height: 65px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--teal); font-size: 30px; font-weight: 800; }
.install-card > p { color: var(--muted); line-height: 1.6; }

.is-hidden { display: none !important; }
.importing { opacity: .65; pointer-events: none; }

@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .course-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .sidebar { transform: translateX(-105%); transition: transform .22s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: grid; place-items: center; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 35; border: 0; background: rgba(5,17,32,.48); }
  .workspace { margin-left: 0; }
  .mobile-menu { display: grid; }
  .content { padding: 25px 18px 38px; }
  .topbar { padding: 0 17px; }
  .search-box { width: min(280px, 39vw); }
  .date-label { display: none; }
  .inline-form { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .auth-page { padding: 16px; }
  .auth-shell, .install-shell { grid-template-columns: 1fr; }
  .auth-brand { padding: 35px; }
  .auth-brand h1 { font-size: 32px; }
  .auth-card { margin: 0 12px 12px; padding: 32px; }
}

@media (max-width: 620px) {
  .topbar-actions { gap: 7px; }
  .profile > span:last-child, .date-label { display: none; }
  .logout-button { padding: 0 8px; }
  .search-box { width: 42vw; }
  .search-box input::placeholder { color: transparent; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .page-actions .button { flex: 1 1 auto; }
  .metrics-grid, .course-grid, .form-grid.two, .inline-form { grid-template-columns: 1fr; }
  .metric-card { min-height: 94px; }
  .course-details { grid-template-columns: 1fr; }
  .auth-page { padding: 0; }
  .auth-shell { min-height: 100vh; border-radius: 0; }
  .auth-brand { padding: 32px 24px 25px; }
  .auth-brand h1 { font-size: 29px; }
  .auth-card { margin: 0; padding: 28px 22px; border-radius: 18px 18px 0 0; }
  .modal-card, .modal-card.wide { width: 100%; padding: 18px; }
}

