:root {
  --green-950: #003622;
  --green-900: #004a2f;
  --green-800: #005c3a;
  --green-700: #087148;
  --green-100: #dcece4;
  --green-50: #eef6f2;
  --yellow: #f2c400;
  --yellow-soft: #fff7d2;
  --red: #d5222a;
  --red-soft: #fff0f1;
  --ink: #17211b;
  --muted: #667169;
  --line: #dce2de;
  --canvas: #f5f7f6;
  --surface: #ffffff;
  --radius: 6px;
  --shadow: 0 6px 18px rgba(18, 57, 38, .06);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); font-size: 14px; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
a { color: inherit; }
.icon { width: 20px; height: 20px; flex: none; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; z-index: 40; height: 100vh; display: flex; flex-direction: column; color: #fff; background: var(--green-900); }
.brand { height: 92px; display: grid; place-items: center; padding: 12px 18px; background: #fff; border-right: 1px solid var(--line); }
.brand img { width: 100%; height: 68px; object-fit: contain; }
.main-nav { display: grid; gap: 4px; padding: 24px 14px 12px; overflow-y: auto; }
.main-nav a { min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-left: 3px solid transparent; border-radius: 4px; color: rgba(255,255,255,.82); text-decoration: none; font-weight: 680; }
.main-nav a:hover { color: #fff; background: rgba(255,255,255,.07); }
.main-nav a.active { color: var(--yellow); background: rgba(255,255,255,.06); border-left-color: var(--yellow); }
.main-nav a b { min-width: 20px; margin-left: auto; padding: 2px 6px; border-radius: 10px; color: var(--green-950); background: var(--yellow); font-size: 10px; text-align: center; }
.nav-section { margin: 16px 11px 5px; color: rgba(255,255,255,.46); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.sidebar-profile { position: relative; margin: auto 14px 14px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.14); }
.profile-trigger { width: 100%; min-height: 50px; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 0; border-radius: 5px; color: inherit; background: transparent; cursor: pointer; text-align: left; }
.profile-trigger:hover { background: rgba(255,255,255,.08); }
.profile-trigger > span:not(.avatar) { min-width: 0; }
.profile-trigger strong, .profile-trigger small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-trigger small { margin-top: 2px; color: rgba(255,255,255,.64); font-size: 11px; }
.profile-trigger > .icon:last-child { width: 16px; margin-left: auto; transition: transform .16s ease; }
.profile-menu.open .profile-trigger > .icon:last-child { transform: rotate(90deg); }
.avatar, .avatar-image { width: 38px; height: 38px; flex: none; border-radius: 50%; }
.avatar { display: grid; place-items: center; color: var(--green-900); background: var(--green-100); }
.avatar-image { object-fit: cover; border: 2px solid #fff; background: #fff; }
.profile-dropdown { position: absolute; z-index: 80; left: 0; bottom: calc(100% + 8px); display: none; width: 240px; overflow: hidden; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 18px 38px rgba(0,35,20,.22); }
.profile-menu.open .profile-dropdown { display: block; }
.profile-dropdown.align-right { top: calc(100% + 8px); right: 0; bottom: auto; left: auto; }
.profile-summary { padding: 13px 14px; border-bottom: 1px solid var(--line); }
.profile-summary strong, .profile-summary small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-summary small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.profile-dropdown > a, .role-switcher button { width: 100%; min-height: 40px; display: flex; align-items: center; gap: 9px; padding: 9px 13px; border: 0; color: #324039; background: #fff; text-decoration: none; cursor: pointer; font-size: 12px; font-weight: 680; text-align: left; }
.profile-dropdown > a:hover, .role-switcher button:hover, .role-switcher button.selected { color: var(--green-900); background: var(--green-50); }
.profile-dropdown > a .icon, .role-switcher .icon { width: 17px; }
.profile-dropdown > a.danger-link { color: var(--red); border-top: 1px solid var(--line); }
.role-switcher { padding: 7px 0; border-bottom: 1px solid var(--line); }
.role-switcher > span { display: block; padding: 4px 13px 6px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.role-switcher form { margin: 0; }

.app-main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; min-height: 76px; display: flex; align-items: center; gap: 16px; padding: 10px clamp(18px,3vw,36px); background: rgba(255,255,255,.97); border-bottom: 1px solid var(--line); }
.topbar-title h1 { margin: 0; font-size: 20px; letter-spacing: 0; }
.menu-selection { position: absolute; left: 50%; min-height: 40px; display: inline-flex; align-items: center; gap: 9px; padding: 8px 14px; border: 1px solid #a9c8b8; border-radius: 5px; color: var(--green-900); background: #fff; text-decoration: none; font-weight: 750; transform: translateX(-50%); }
.menu-selection:hover { background: var(--green-50); }
.topbar-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.notification-link, .icon-button { position: relative; width: 40px; height: 40px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 5px; color: var(--green-900); background: #fff; cursor: pointer; text-decoration: none; }
.notification-link b { position: absolute; top: -5px; right: -5px; min-width: 18px; padding: 2px 5px; border-radius: 10px; color: #fff; background: var(--red); font-size: 10px; }
.top-profile { width: auto; min-width: 180px; color: var(--ink); }
.top-profile small { color: var(--muted); }
.menu-toggle { display: none; }
.sidebar-scrim { display: none; }
.mobile-nav { display: none; }
.page-content { width: min(1500px,100%); margin: 0 auto; padding: 28px clamp(16px,3vw,36px) 54px; }

.page-heading { display: flex; align-items: end; gap: 16px; margin-bottom: 20px; }
.page-heading > div { min-width: 0; }
.page-heading h2 { margin: 0; font-size: 28px; line-height: 1.15; letter-spacing: 0; }
.page-heading p { margin: 7px 0 0; color: var(--muted); line-height: 1.5; }
.page-heading .button { margin-left: auto; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.panel-header { min-height: 58px; display: flex; align-items: center; gap: 14px; padding: 13px 17px; border-bottom: 1px solid var(--line); }
.panel-header h2, .panel-header h3 { margin: 0; font-size: 15px; letter-spacing: 0; }
.panel-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.panel-actions { display: flex; gap: 8px; margin-left: auto; }
.panel-body { padding: 17px; }

.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border: 1px solid var(--green-800); border-radius: 5px; color: #fff; background: var(--green-800); text-decoration: none; font-weight: 750; cursor: pointer; }
.button:hover { background: var(--green-950); }
.button.secondary { color: var(--green-900); background: #fff; }
.button.secondary:hover { background: var(--green-50); }
.button.danger { border-color: var(--red); background: var(--red); }
.button.small { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.button .icon { width: 17px; }

input, select, textarea { width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid #c9d2cc; border-radius: 5px; color: var(--ink); background: #fff; outline: none; }
textarea { min-height: 100px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--green-700); }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { border-color: var(--green-700); outline: 3px solid rgba(8,113,72,.16); outline-offset: 1px; }
label { display: grid; gap: 6px; }
label > span, .field-label { color: #465149; font-size: 12px; font-weight: 750; }
label small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 17px; padding-top: 15px; border-top: 1px solid var(--line); }
.filter-bar { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin-bottom: 17px; padding: 13px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.filter-bar label { min-width: 180px; }
.search-control { position: relative; width: min(360px,100%); }
.search-control .icon { position: absolute; top: 11px; left: 11px; width: 18px; color: var(--muted); }
.search-control input { padding-left: 38px; }

.notice { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; padding: 12px 14px; border: 1px solid #bcdac9; border-radius: 5px; color: var(--green-950); background: var(--green-50); }
.notice.error { color: #8e1d24; border-color: #edc4c6; background: var(--red-soft); }
.notice.warning { color: #685400; border-color: #eadb8e; background: var(--yellow-soft); }
.notice .icon { width: 18px; }
.badge { min-height: 25px; display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 12px; color: #47534c; background: #edf1ef; font-size: 11px; font-weight: 800; white-space: nowrap; }
.badge.success { color: var(--green-900); background: var(--green-100); }
.badge.warning { color: #705a00; background: var(--yellow-soft); }
.badge.danger { color: #96232a; background: var(--red-soft); }

.dashboard-intro { margin-bottom: 20px; }
.dashboard-intro h2 { margin: 0; font-size: 30px; letter-spacing: 0; }
.dashboard-intro p { margin: 7px 0 0; color: var(--muted); }
.active-course { overflow: hidden; }
.active-course-main { display: grid; grid-template-columns: minmax(0,1fr) minmax(310px,.7fr); gap: 24px; padding: 24px; }
.course-identity { display: grid; grid-template-columns: 52px 1fr; gap: 15px; align-items: center; }
.course-symbol { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 6px; color: #fff; background: var(--green-800); }
.course-symbol .icon { width: 27px; height: 27px; }
.course-identity small, .label-upper { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.course-identity h3 { margin: 0; font-size: 20px; }
.course-identity p { margin: 5px 0 0; color: var(--muted); }
.progress-summary { padding-left: 24px; border-left: 1px solid var(--line); }
.progress-summary strong { display: block; color: var(--green-800); font-size: 38px; line-height: 1; }
.progress-track { height: 8px; margin: 10px 0 8px; overflow: hidden; border-radius: 4px; background: #e7ece9; }
.progress-track span { display: block; height: 100%; background: var(--green-800); }
.progress-summary small { color: var(--muted); }
.next-lesson { min-height: 108px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 20px; padding: 18px 24px; border-top: 1px solid var(--line); }
.next-lesson h4 { margin: 0 0 6px; font-size: 15px; }
.next-lesson p { margin: 0; color: var(--muted); }
.dashboard-columns { display: grid; grid-template-columns: 1fr 1fr .9fr; gap: 16px; margin-top: 16px; }
.compact-list { margin: 0; padding: 0; list-style: none; }
.compact-list li { display: flex; align-items: center; gap: 11px; min-height: 64px; padding: 10px 0; border-bottom: 1px solid #edf1ee; }
.compact-list li:last-child { border-bottom: 0; }
.compact-list .list-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: var(--green-800); background: var(--green-50); }
.compact-list .list-icon.warning { color: #7b6300; background: var(--yellow-soft); }
.compact-list .list-icon.danger { color: var(--red); background: var(--red-soft); }
.compact-list .list-icon .icon { width: 17px; }
.compact-list .list-copy { min-width: 0; flex: 1; }
.compact-list strong, .compact-list small { display: block; }
.compact-list small { margin-top: 3px; color: var(--muted); }
.empty-inline { padding: 24px 5px; color: var(--muted); text-align: center; }
.metric-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 12px; margin-bottom: 18px; }
.metric { min-height: 96px; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.metric span { color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; }
.metric strong { display: block; margin-top: 10px; color: var(--green-800); font-size: 28px; line-height: 1; }

.table-wrap { max-width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { padding: 10px 12px; border-bottom: 1px solid var(--line); color: #4d5851; background: #f3f6f4; font-size: 10px; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 12px; border-bottom: 1px solid #edf1ee; vertical-align: middle; }
.data-table tbody tr:hover { background: #f9fbfa; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.person-cell { min-width: 220px; }
.person-cell strong, .person-cell small { display: block; }
.person-cell small { margin-top: 3px; color: var(--muted); }
.row-actions { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.course-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.course-card { min-width: 0; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.course-cover { aspect-ratio: 16 / 6; display: grid; place-items: center; color: #fff; background: var(--green-800); }
.course-cover img { width: 100%; height: 100%; object-fit: cover; }
.course-cover .icon { width: 42px; height: 42px; opacity: .85; }
.course-card-body { padding: 15px; }
.course-card-body h3 { margin: 8px 0 6px; font-size: 16px; }
.course-card-body p { min-height: 40px; margin: 0; color: var(--muted); line-height: 1.45; }
.course-card-footer { display: flex; align-items: center; gap: 10px; margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); }
.course-card-footer .button { margin-left: auto; }
.curriculum { display: grid; gap: 10px; }
.module-row { border: 1px solid var(--line); border-radius: 5px; }
.module-heading { min-height: 52px; display: flex; align-items: center; gap: 10px; padding: 10px 13px; background: #f5f8f6; }
.module-heading strong { flex: 1; }
.lesson-list { margin: 0; padding: 0; list-style: none; }
.lesson-list li { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 9px 13px; border-top: 1px solid var(--line); }
.lesson-list li > a { min-width: 0; flex: 1; color: var(--ink); text-decoration: none; }
.lesson-list li > a:hover { color: var(--green-800); }
.lesson-content { max-width: 920px; }
.lesson-block { margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.lesson-block:last-child { border-bottom: 0; }
.lesson-block h3 { margin: 0 0 10px; }
.lesson-block p { line-height: 1.7; white-space: pre-wrap; }
.lesson-media { width: 100%; border-radius: 5px; background: #101713; }
.two-column { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 18px; align-items: start; }
.sticky-panel { position: sticky; top: 96px; }
.option-list { display: grid; gap: 9px; }
.option-item { display: flex; align-items: flex-start; gap: 9px; padding: 11px; border: 1px solid var(--line); border-radius: 5px; }
.question-block { padding: 17px; border-bottom: 1px solid var(--line); }
.question-block:last-child { border-bottom: 0; }
.question-block h3 { margin: 0 0 13px; font-size: 15px; }
.score-big { color: var(--green-800); font-size: 42px; font-weight: 850; }
.empty-state { min-height: 320px; display: grid; place-items: center; align-content: center; gap: 12px; padding: 28px; text-align: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.empty-state h1, .empty-state h2, .empty-state p { margin: 0; }
.empty-state p { max-width: 520px; color: var(--muted); line-height: 1.5; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--green-950); }
.login-shell { width: min(980px,100%); min-height: 590px; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; border-radius: 8px; background: #fff; box-shadow: 0 28px 70px rgba(0,0,0,.28); }
.login-identity { display: flex; flex-direction: column; justify-content: space-between; padding: 44px; color: #fff; background: var(--green-800); }
.login-identity img { width: 100%; height: 120px; object-fit: contain; background: #fff; border-radius: 6px; padding: 10px; }
.login-identity h1 { margin: 0 0 12px; font-size: 36px; letter-spacing: 0; }
.login-identity p { margin: 0; color: rgba(255,255,255,.78); line-height: 1.6; }
.login-identity small { color: rgba(255,255,255,.62); }
.login-form { display: grid; align-content: center; padding: 52px; }
.login-form h2 { margin: 0; font-size: 27px; }
.login-form > p { margin: 9px 0 26px; color: var(--muted); line-height: 1.5; }
.login-form label { margin-bottom: 14px; }
.login-form .button { width: 100%; margin-top: 6px; }
.login-back { margin-bottom: 22px; color: var(--green-800); font-size: 12px; font-weight: 750; text-decoration: none; }

.profile-grid { display: grid; grid-template-columns: 300px minmax(0,700px); gap: 18px; align-items: start; }
.profile-card { padding: 24px; text-align: center; }
.profile-photo-large { width: 112px; height: 112px; display: grid; place-items: center; margin: 0 auto 15px; border: 4px solid #fff; border-radius: 50%; object-fit: cover; color: var(--green-800); background: var(--green-50); box-shadow: 0 0 0 1px var(--line); }
.profile-photo-large .icon { width: 42px; height: 42px; }
.profile-card h2 { margin: 0; font-size: 19px; }
.profile-card > p { margin: 6px 0 18px; color: var(--muted); overflow-wrap: anywhere; }
.profile-meta { margin: 0; border-top: 1px solid var(--line); text-align: left; }
.profile-meta div { padding: 12px 0; border-bottom: 1px solid var(--line); }
.profile-meta dt { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.profile-meta dd { margin: 4px 0 0; font-weight: 700; }

@media (max-width: 1160px) {
  .dashboard-columns { grid-template-columns: 1fr 1fr; }
  .dashboard-columns > :last-child { grid-column: 1 / -1; }
  .metric-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .course-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .top-profile > span { display: none; }
  .top-profile { min-width: 0; }
}

@media (max-width: 860px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; width: min(286px,86vw); transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 35; background: rgba(0,28,17,.55); }
  .sidebar-open .sidebar-scrim { display: block; }
  .menu-toggle { display: inline-grid; }
  .topbar-title { display: none; }
  .topbar { min-height: 68px; padding: 9px 14px; }
  .menu-selection { font-size: 12px; padding: 8px 10px; }
  .notification-link { display: none; }
  .page-content { padding-top: 18px; padding-bottom: 92px; }
  .mobile-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 32; height: 66px; display: grid; grid-template-columns: repeat(4,1fr); padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 1px solid var(--line); }
  .mobile-nav a { display: grid; place-items: center; align-content: center; gap: 3px; color: var(--muted); text-decoration: none; font-size: 10px; font-weight: 700; }
  .mobile-nav .icon { width: 20px; }
  .active-course-main { grid-template-columns: 1fr; }
  .progress-summary { padding: 15px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .two-column, .profile-grid { grid-template-columns: 1fr; }
  .sticky-panel { position: static; }
}

@media (max-width: 620px) {
  .dashboard-intro h2, .page-heading h2 { font-size: 24px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-heading .button { margin-left: 0; }
  .active-course-main { padding: 18px; }
  .next-lesson { grid-template-columns: 1fr; padding: 16px 18px; }
  .next-lesson .button { width: 100%; }
  .dashboard-columns, .metric-grid, .course-grid, .form-grid { grid-template-columns: 1fr; }
  .dashboard-columns > :last-child, .form-grid .span-2 { grid-column: auto; }
  .panel-header { align-items: flex-start; flex-direction: column; }
  .panel-actions { width: 100%; margin-left: 0; }
  .panel-actions .button { flex: 1; }
  .filter-bar { align-items: stretch; }
  .filter-bar label, .filter-bar .button, .search-control { width: 100%; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .button { width: 100%; }
  .login-page { padding: 0; background: #fff; }
  .login-shell { min-height: 100vh; display: block; border-radius: 0; box-shadow: none; }
  .login-identity { min-height: 235px; padding: 27px 24px; }
  .login-identity img { height: 84px; }
  .login-identity h1 { margin-top: 20px; font-size: 28px; }
  .login-identity small { display: none; }
  .login-form { padding: 34px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
