:root {
  --ink: #213244;
  --muted: #6d7f90;
  --line: #dfe7ec;
  --green: #0d716b;
  --green-strong: #075b56;
  --green-soft: #e8f4f2;
  --surface: #fff;
  --canvas: #f4f7f9;
  --shadow: 0 16px 40px rgba(25, 49, 67, .08);
  color: var(--ink);
  background: var(--canvas);
}

body { background: var(--canvas); }
button { border-color: #d9e3e8; border-radius: 8px; font-weight: 600; }
button:hover { border-color: #9cb8b7; background: #f8fbfb; }
button:focus-visible, input:focus-visible, select:focus-visible { outline-color: #0d716b55; }
button.primary { background: var(--green); border-color: var(--green); }
button.primary:hover { background: var(--green-strong); border-color: var(--green-strong); }
input, select { border-color: #d6e1e7; border-radius: 8px; }
input:focus, select:focus { border-color: #78aaa6; }

/* Login */
.login { min-height: 100vh; padding: 36px; background: radial-gradient(circle at 10% 10%, #e5efed 0, transparent 34%), #f4f7f9; }
.login-shell { width: min(1080px, 100%); min-height: 620px; display: grid; grid-template-columns: 1.05fr 1fr; overflow: hidden; background: #fff; border: 1px solid #e0e8ec; border-radius: 18px; box-shadow: 0 28px 80px rgba(20, 44, 59, .13); }
.login-intro { position: relative; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; padding: 42px 48px 38px; color: #fff; background: linear-gradient(145deg, #0c2c3a 0%, #134a4b 100%); }
.login-intro::before { content: ""; position: absolute; width: 420px; height: 420px; right: -235px; top: 95px; border: 1px solid #ffffff21; border-radius: 50%; box-shadow: 0 0 0 70px #ffffff08, 0 0 0 140px #ffffff05; pointer-events: none; }
.login-brand, .brand { display: flex; align-items: center; gap: 12px; }
.brand-emblem { display: grid; place-items: center; flex: none; width: 43px; height: 43px; border-radius: 11px; background: #fff; color: #0b5855; font-size: 20px; font-weight: 800; box-shadow: 0 6px 18px #082f3526; }
.login-brand { position: relative; font-size: 16px; font-weight: 700; letter-spacing: .02em; }
.login-intro-copy { position: relative; padding: 28px 0 54px; }
.login-intro .eyebrow { color: #9fd2ca; font-size: 11px; font-weight: 700; letter-spacing: .16em; }
.login-intro h1 { margin: 22px 0 16px; color: #fff; font-size: clamp(32px, 3vw, 44px); line-height: 1.28; font-weight: 730; letter-spacing: -.035em; }
.login-intro p { max-width: 360px; margin: 0; color: #c2d9dc; font-size: 15px; line-height: 1.9; }
.login-features { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 31px; }
.login-features span { padding: 8px 12px; color: #dcefed; border: 1px solid #ffffff30; border-radius: 7px; background: #ffffff0c; font-size: 12px; }
.login-intro small { position: relative; color: #a7c8ca; font-size: 11px; }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: 54px clamp(36px, 5vw, 76px); }
.login-panel-header { margin-bottom: 27px; }
.login-kicker { color: var(--green); font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.login-panel-header h2 { margin: 9px 0 8px; color: #1d3040; font-size: 29px; font-weight: 750; }
.login-panel-header p { margin: 0; color: var(--muted); font-size: 13px; }
.login .login-panel form { display: grid; gap: 18px; width: 100%; padding: 0; border: 0; border-radius: 0; box-shadow: none; }
.login .login-panel form::before { display: none; }
.login .login-panel label { display: grid; gap: 8px; color: #34495b; font-size: 13px; font-weight: 700; }
.login .login-panel input { min-height: 48px; padding: 12px 14px; background: #fbfcfd; }
.login .login-panel button { min-height: 48px; margin-top: 8px; font-size: 14px; }
#login-error { margin: -5px 0 0; padding: 11px 13px; color: #a73737; background: #fff2f2; border: 1px solid #f2d5d5; border-radius: 8px; font-size: 12px; }
#login-error[hidden] { display: none; }
.login-panel-footer { margin-top: 40px; color: #9aa9b5; font-size: 11px; text-align: center; }

/* Workspace shell */
.shell { grid-template-columns: 268px minmax(0, 1fr); background: var(--canvas); }
.sidebar { padding: 26px 16px 18px; background: #102b3b; box-shadow: 6px 0 24px #0a25300a; }
.brand { padding: 0 10px 33px; color: #fff; }
.brand::before { display: none; }
.brand .brand-emblem { width: 40px; height: 40px; font-size: 18px; }
.brand-copy { display: grid; gap: 3px; }
.brand-copy strong { font-size: 16px; line-height: 1.1; }
.brand-copy small { color: #9db7c2; font-size: 10px; font-weight: 500; letter-spacing: .12em; }
.side-label { display: flex; align-items: center; justify-content: space-between; padding: 0 11px 11px; color: #9cb5bf; font-size: 11px; letter-spacing: .08em; }
.side-label span { min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 5px; border-radius: 5px; background: #ffffff1a; color: #d4e4e8; font-size: 10px; }
.class-list { gap: 5px; }
.class-btn { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 7px 10px; color: #c8d8df; border-radius: 8px; }
.class-btn.active { background: #ffffff17; border-color: #ffffff1b; }
.class-btn.active::before { left: -16px; top: 8px; bottom: 8px; width: 3px; background: #50c9b5; }
.class-monogram { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border: 1px solid #ffffff26; border-radius: 7px; color: #bad5d4; font-size: 11px; }
.class-btn.active .class-monogram { color: #fff; border-color: #61b6ad66; background: #1b726e; }
.class-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-empty { margin: 6px 10px; color: #a5bcc5; font-size: 12px; }
.sidebar footer { gap: 14px; padding: 18px 9px 4px; border-color: #ffffff20; }
.account { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sidebar footer .account-avatar { width: 34px; height: 34px; display: grid; place-items: center; flex: none; border-radius: 9px; background: #277271; color: #fff; font-size: 15px; font-weight: 700; }
.account-meta { display: grid; gap: 3px; min-width: 0; }
.account-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.account-meta small { color: #9eb8bf; font-size: 10px; }
.sidebar footer #logout { width: 100%; min-height: 36px; text-align: left; padding: 7px 10px; color: #bcd0d7; border-color: #ffffff28; }
.sidebar footer #logout:hover { color: #fff; background: #ffffff12; }
.main { min-height: 100vh; }
.topbar { min-height: 104px; height: auto; padding: 19px clamp(24px, 3vw, 48px); background: #fff; border-bottom: 1px solid var(--line); }
.topbar-title { min-width: 0; }
.breadcrumb { margin-bottom: 7px; color: #8293a1; font-size: 11px; font-weight: 650; letter-spacing: .02em; }
.breadcrumb span { margin: 0 7px; color: #b9c6ce; }
.topbar h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 22px; font-weight: 750; }
.topbar-title p { margin: 5px 0 0; color: #8594a1; font-size: 11px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.topbar #new-class { background: var(--green); border-color: var(--green); color: #fff; }
.topbar #new-class:hover { background: var(--green-strong); }
.content { max-width: 1560px; padding: 29px clamp(24px, 3vw, 48px) 64px; }
.workspace-context { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; background: #fff; border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 3px 12px #17354b05; }
.context-label { display: block; color: #8595a2; font-size: 11px; margin-bottom: 7px; }
.context-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.context-meta span { display: inline-flex; align-items: center; min-height: 25px; padding: 3px 9px; background: #f1f6f7; border-radius: 5px; color: #3b5762; font-size: 11px; font-weight: 650; }
#display-button { color: var(--green-strong); border-color: #bcdad5; background: #f4faf9; }
#display-button:hover { background: #e9f4f2; }
.tabs { gap: 2px; margin: 18px 0 27px; padding: 0 13px; background: #fff; border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 3px 12px #17354b05; }
.tabs button { min-height: 54px; padding: 16px 17px; color: #687c89; }
.tabs button:hover { background: #f7fafa; }
.tabs button.active { color: var(--green-strong); font-weight: 750; }
.tabs button.active::after { left: 17px; right: 17px; height: 3px; background: var(--green); }
.toolbar { gap: 10px; margin-bottom: 18px; }
.toolbar h2 { font-size: 19px; font-weight: 740; }
.toolbar select, .toolbar input { max-width: 230px; }

/* Data and content */
.overview-heading { margin: 3px 0 19px; }
.overview-heading h2 { color: #23374a; font-size: 22px; }
.overview-heading p { color: #8192a0; }
.stat-row { gap: 14px; margin-bottom: 22px; }
.stat { min-height: 121px; padding: 19px 21px; border-radius: 11px; border-color: var(--line); color: #697e8b; font-size: 12px; box-shadow: 0 4px 15px #17354b07; }
.stat::after { width: 26px; height: 3px; top: 22px; right: 20px; border-radius: 3px; background: #67ada5; }
.stat:nth-child(3)::after { background: #d6a24f; }
.stat:nth-child(4)::after { background: #8b9fb9; }
.stat strong { margin-top: 19px; color: #203646; font-size: 31px; font-weight: 750; }
.overview-grid { gap: 16px; }
.panel, .table-wrap, .rank-item { border-color: var(--line); border-radius: 11px; box-shadow: 0 4px 16px #17354b06; }
.panel { padding: 24px; }
.overview-grid h3 { color: #263b4c; font-size: 16px; }
.overview-session-list { gap: 8px; }
.overview-session-list button { min-height: 62px; padding: 10px 14px; background: #fbfcfd; border-color: #e5ebef; }
.overview-session-list button:hover { background: #f3f8f8; }
.overview-session-list strong { color: #294153; font-size: 13px; }
.overview-session-list small { font-size: 11px; }
.overview-current { padding: 15px; background: #f0f7f5; border: 1px solid #e0efec; }
.overview-actions { margin: 21px 0; }
.table-wrap { overflow: auto; }
table { border-collapse: collapse; }
th { height: 47px; padding: 12px 17px; background: #f7f9fb; color: #6f8190; font-size: 11px; font-weight: 750; letter-spacing: .02em; }
td { height: 61px; padding: 11px 17px; color: #31485a; font-size: 13px; }
th, td { border-bottom-color: #e9eef1; }
tbody tr:hover { background: #f8fbfb; }
.student-cell { color: #2b4354; }
.avatar { border-radius: 9px; color: #28746d; background: #e8f4f1; }
.pill { padding: 6px 10px; border-radius: 6px; font-size: 11px; }
.pill.present { color: #19704f; background: #e6f5ec; }
.pill.late { color: #93610c; background: #fff3de; }
.pill.leave { color: #526b9b; background: #ebf0fc; }
.pill.absent { color: #a74440; background: #fcebe9; }
.pill.unmarked { color: #647788; background: #edf1f4; }
.student-entry-bar { margin: 5px 0 18px; padding: 15px 17px; background: #eef7f5; border-color: #cfe6e0; border-left: 4px solid #2a8a7d; border-radius: 9px; }
.student-entry-bar > div:first-child { gap: 15px; }
.student-entry-bar > div:first-child strong { color: #12635b; }
.rank-item { min-height: 86px; padding: 14px 17px; }
.rank-item .number { border-radius: 7px; }
.empty { border-color: #cfdde2; border-radius: 11px; }
.panel h2 { color: #263b4c; font-size: 18px; }
.button-link { border-radius: 8px; color: var(--green-strong); }
.inactive-panel { margin-top: 25px; }
.modal-backdrop { background: #102734a6; backdrop-filter: blur(5px); }
.modal { border-color: #dfe8eb; border-radius: 14px; box-shadow: 0 30px 90px #0d263a45; }
.modal h2 { color: #23384a; font-size: 20px; }
.modal label { color: #344c5c; }
#toast { background: #183b45; border-radius: 9px; box-shadow: 0 12px 36px #17354b29; }

@media (max-width: 1100px) {
  .shell { grid-template-columns: 228px minmax(0, 1fr); }
  .content { padding: 24px; }
  .topbar { padding: 18px 24px; }
  .tabs button { padding-inline: 12px; }
}

@media (max-width: 760px) {
  .login { padding: 0; }
  .login-shell { min-height: 100vh; grid-template-columns: 1fr; border: 0; border-radius: 0; box-shadow: none; }
  .login-intro { min-height: 210px; padding: 23px 24px; }
  .login-intro-copy { padding: 24px 0 0; }
  .login-intro h1 { margin: 8px 0 6px; font-size: 24px; }
  .login-intro p { font-size: 12px; line-height: 1.5; }
  .login-features, .login-intro > small, .login-intro .eyebrow { display: none; }
  .login-panel { justify-content: flex-start; padding: 35px 25px 50px; }
  .login-panel-header { margin-bottom: 24px; }
  .login-panel-header h2 { font-size: 25px; }
  .shell { display: block; }
  .sidebar { height: auto; padding: 12px 15px 10px; }
  .brand { padding: 0 1px 10px; }
  .brand .brand-emblem { width: 32px; height: 32px; font-size: 15px; }
  .brand-copy strong { font-size: 14px; }
  .brand-copy small { font-size: 9px; }
  .side-label, .sidebar footer { display: none; }
  .class-list { display: flex; gap: 6px; overflow-x: auto; }
  .class-btn { width: auto; min-height: 35px; flex: none; padding: 6px 9px; white-space: nowrap; }
  .class-monogram { display: none; }
  .class-name { max-width: 170px; }
  .topbar { min-height: 76px; padding: 12px 16px; }
  .breadcrumb, .topbar-title p { display: none; }
  .topbar h1 { font-size: 17px; }
  .topbar-actions { gap: 5px; }
  .topbar-actions button { min-height: 35px; padding: 7px 9px; font-size: 11px; }
  .content { padding: 17px 15px 38px; }
  .workspace-context { padding: 13px 14px; }
  .context-label { margin-bottom: 5px; }
  .tabs { gap: 0; margin: 13px 0 20px; padding: 0 6px; overflow-x: auto; border-radius: 9px; }
  .tabs button { min-height: 45px; padding: 11px 12px; flex: 0 0 auto; }
  .tabs button.active::after { left: 11px; right: 11px; }
  .toolbar h2 { font-size: 16px; }
  .stat-row { gap: 8px; }
  .stat { min-height: 93px; padding: 14px; }
  .stat strong { margin-top: 15px; font-size: 25px; }
  .overview-heading h2 { font-size: 19px; }
  .overview-grid { grid-template-columns: 1fr; }
  .panel { padding: 17px; }
  th, td { padding: 9px 12px; }
  .student-entry-bar { padding: 12px; }
}

@media (max-width: 460px) {
  .login-intro { min-height: 195px; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .topbar-title { width: 100%; }
  .topbar-actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .workspace-context { align-items: flex-start; }
  .context-meta { gap: 5px; }
  .context-meta span { font-size: 10px; }
  #display-button { min-height: 33px; padding: 6px 8px; font-size: 11px; white-space: nowrap; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-heading { align-items: flex-start; }
  .overview-heading button { max-width: 142px; }
}
