/* Shared visual layer. Keep business forms, result states and print output intact. */
:root {
  --brand: #087f73;
  --line: #dfe7ed;
  --muted: #586b7e;
  --surface: #ffffff;
  --ink: #193449;
  --header-height: 80px;
  --sidebar-width: 244px;
  color: var(--ink);
  background: #f3f6f8;
  line-height: 1.65;
}
body { background: radial-gradient(ellipse at 100% 0, #e1efec 0, transparent 42%), #f3f6f8; }
header {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: var(--header-height);
  padding: 14px 28px;
  gap: 16px;
  background: var(--surface);
  box-shadow: 0 2px 12px #19344905;
}
.brand { white-space: nowrap; font-size: 16px; gap: 10px; color: #126859; }
.brand small { font-size: 11px; line-height: 1.5; margin-top: 2px; }
header nav { gap: 0; min-width: 0; }
main { max-width: 1280px; scroll-margin-top: calc(var(--header-height) + 16px); }
h1 { font-size: clamp(26px, 2.8vw, 36px); margin: 8px 0 14px; overflow-wrap: anywhere; }
h2 { font-size: 21px; }
h3 { line-height: 1.5; }
p { overflow-wrap: anywhere; }
.card {
  border-radius: 18px;
  box-shadow: 0 4px 18px #19344905;
  padding: 24px;
}
.hero {
  background: linear-gradient(115deg, #123e49, #087f73);
  border: 0;
  color: white;
  padding: 32px;
  border-radius: 20px;
  position: relative;
  overflow: hidden;
}
.hero h1, .hero p, .hero .eyebrow { color: white; }
.hero p { opacity: .92; max-width: 65ch; }
.hero .eyebrow { opacity: .8; letter-spacing: .12em; }
.grid, .learning-grid { gap: 18px; }
.grid > .card, .learning-grid > .card { display: flex; flex-direction: column; min-width: 0; }
.grid > .card { margin: 0; }
.grid > .card > .actions { margin-top: auto; padding-top: 18px; margin-bottom: 0; }
.grid > .card h2, .learning-grid > .card h2 { font-size: 19px; overflow-wrap: anywhere; }
.learning-grid > .card > a.button { margin-top: auto; align-self: flex-start; }
.badge { align-self: flex-start; font-weight: 600; line-height: 1.5; }
.stat, .score { font-variant-numeric: tabular-nums; }
.stat { color: #126859; }
button, .button { border-radius: 10px; min-height: 44px; line-height: 1.4; }
button:hover, .button:hover { background: #06665d; }
button.secondary, .button.secondary { background: #edf2f6; color: #304b62; border-color: #dfe7ed; }
button.secondary:hover, .button.secondary:hover { background: #e2eaf0; border-color: #c6d4df; }
button.danger, .button.danger { background: #fff1f1; color: #a52c2c; border-color: #f2d4d4; }
button.danger:hover, .button.danger:hover { background: #ffe3e3; }
button:disabled, .button:disabled { cursor: not-allowed; }
input, textarea, select { border-color: #c4d1dc; font-weight: 400; }
input:hover, textarea:hover, select:hover { border-color: #8197aa; }
input:disabled, select:disabled, textarea:disabled { background: #f1f4f6; color: #586b7e; }
label { font-size: 14px; font-weight: 600; }
input[type=search] { background: #fff; padding-left: 16px; }
input[type=file] { padding: 10px; font-size: 14px; }
input[type=file]::file-selector-button { border: 0; border-radius: 6px; padding: 8px 12px; margin-right: 12px; color: #304b62; background: #edf2f6; font: inherit; cursor: pointer; }
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible, summary:focus-visible, .scroll:focus-visible {
  outline: 3px solid #0b847a;
  outline-offset: 3px;
}
main:focus { outline: none; }
.search-label { max-width: 640px; margin: 24px 0; }
#class-empty { padding: 24px; border: 1px dashed #b9cbd6; border-radius: 14px; color: var(--muted); background: white; }
#message:not(:empty) { margin-bottom: 20px; }
.error, .success { border: 1px solid; font-size: 14px; }
.error { border-color: #f1cbc8; }
.success { border-color: #c6e5d4; }
.scroll { max-width: 100%; border-radius: 16px; overscroll-behavior-x: contain; }
.scroll table { min-width: 640px; }
th { background: #eff4f7; color: #40596e; font-weight: 650; }
td { line-height: 1.6; }
tbody tr:hover { background: #f7fafb; }
td button { margin: 3px 4px 3px 0; }
.scroll:focus-visible { outline-offset: -3px; }
.editor-savebar, .learning-save { box-shadow: 0 -4px 20px #19344909; }
.editor-savebar p { flex-basis: 100%; }
.import-panel > summary { font-size: 16px; color: #126859; }
.import-panel[open] > summary { margin-bottom: 16px; }
.card-tools { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 8px; }
.card-tools summary { font-size: 13px; color: var(--muted); font-weight: 500; }
.card-tools .actions { margin: 8px 0 0; }
.card-tools button { font-size: 13px; padding: 8px 12px; }
.skip-link {
  position: fixed;
  top: 10px;
  left: 16px;
  z-index: 100;
  transform: translateY(-160%);
  padding: 12px 18px;
  background: #fff;
  border: 1px solid var(--brand);
  border-radius: 10px;
  font-weight: 600;
}
.skip-link:focus { transform: translateY(0); }
.avatar { display: inline-flex; align-items: center; justify-content: center; background: #e4f2ef; width: 38px; height: 38px; color: #096d61; border: 1px solid #c9e3dc; border-radius: 12px; font-weight: 700; flex-shrink: 0; }
.profile-menu { position: relative; }
.profile-menu > summary { display: flex; align-items: center; gap: 10px; padding: 4px 8px; border-radius: 10px; font-size: 14px; list-style: none; }
.profile-menu > summary:hover, .profile-menu[open] > summary { background: #f0f5f6; }
.profile-menu > summary::-webkit-details-marker { display: none; }
.profile-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-chevron { color: var(--muted); }
.profile-panel { position: absolute; right: 0; top: 58px; z-index: 40; width: 280px; max-width: calc(100vw - 32px); background: white; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 16px 48px #19344920; padding: 20px; }
.profile-panel strong, .profile-panel small, .profile-panel a { display: block; overflow-wrap: anywhere; }
.profile-panel small { margin-top: 4px; }
.profile-panel a { padding: 14px 0; margin-top: 12px; border-top: 1px solid var(--line); font-weight: 600; text-decoration: none; }
.profile-logout { background: #fff1f1; color: #a52c2c; width: 100%; text-align: left; }
.profile-logout:hover { background: #ffe3e3; }
.workspace #workspace-nav { position: fixed; left: 0; top: var(--header-height); bottom: 0; width: var(--sidebar-width); padding: 24px 16px; background: #fff; border-right: 1px solid var(--line); overflow: auto; z-index: 20; }
.workspace-menu > summary { display: none; }
.workspace-menu:not([open]) > nav { display: flex; }
.workspace-menu nav { flex-direction: column; gap: 5px; }
.workspace-menu a, .nav-ai { display: flex; align-items: center; gap: 12px; padding: 11px 12px; text-decoration: none; color: #486075; border-radius: 10px; font-size: 14px; min-height: 46px; font-weight: 500; }
.nav-icon { width: 21px; height: 21px; flex-shrink: 0; }
.workspace-menu a:hover, .nav-ai:hover { background: #f0f5f6; color: #126859; }
.workspace-menu a[aria-current] { background: #e7f4ef; color: #086c60; font-weight: 700; box-shadow: inset 3px 0 #087f73; }
.nav-label { font-size: 10px; letter-spacing: .12em; color: #64798a; margin: 24px 12px 8px; font-weight: 700; }
.nav-label:first-child { margin-top: 0; }
.nav-ai { background: transparent; text-align: left; width: 100%; }
.workspace-note { margin: 32px 12px 0; padding-top: 20px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.workspace-note strong { color: #355368; font-weight: 600; }
.workspace main { margin-left: var(--sidebar-width); max-width: none; padding: 32px clamp(24px, 3.5vw, 56px) 56px; }
.workspace footer { margin-left: var(--sidebar-width); }
.workspace.exam-focus #workspace-nav { display: none; }
.workspace.exam-focus main, .workspace.exam-focus footer { margin-left: 0; }
.exam-focus main { max-width: 1060px; margin-right: auto; margin-left: auto !important; }
.timer { background: #123e49; top: calc(var(--header-height) + 12px); box-shadow: 0 6px 18px #19344914; }
#saved { overflow-wrap: anywhere; }
.option { background: #f8fafb; display: flex; align-items: flex-start; gap: 12px; font-size: 16px; font-weight: 400; line-height: 1.7; }
.option input[type=radio] { flex-shrink: 0; margin: 7px 0 0; }
.option:hover { border-color: #8badab; background: #f0f7f5; }
.option:has(input:checked) { background: #eaf6ef; border-color: var(--brand); }
.wrong .badge { background: #fee4e4; color: #a32424; }
.card[id^=question] { scroll-margin-top: calc(var(--header-height) + 120px); }
.learning-outline { top: calc(var(--header-height) + 16px); }
.lesson-link { line-height: 1.55; }
.lesson-link.selected { background: #087e70; color: white; border-color: #087e70; }
.space-file { gap: 16px; }
.login-layout { gap: 56px; margin: 44px auto; }
.login-card { box-shadow: 0 16px 48px #1934490c; border-radius: 22px; padding: 32px; }
.login-card h2 { font-size: 26px; }
.login-intro h1 { color: #123e49; }
.login-intro p { font-size: 17px; max-width: 48ch; }
.login-points { gap: 14px; font-size: 14px; }
.login-screen { background: radial-gradient(ellipse at 0 20%, #dcefea, transparent 55%), #f3f6f8; }
.login-screen header { position: static; background: transparent; border: 0; box-shadow: none; }
.login-screen footer { border: 0; }
.login-show { font-weight: 400; }
.login-show input { width: 18px; height: 18px; margin-right: 0; }
@media (min-width: 1600px) {
  .workspace main { max-width: 1400px; margin-right: auto; }
}
@media (max-width: 1100px) {
  :root { --sidebar-width: 216px; }
  .workspace main { padding: 28px 24px 48px; }
  .workspace .learning-layout { grid-template-columns: 1fr; }
  .workspace .learning-outline { position: static; }
  .workspace .learning-outline #lesson-list { max-height: 240px; overflow: auto; }
}
@media (max-width: 900px) {
  :root { --header-height: 72px; }
  header { padding: 12px 20px; }
  .profile-name { max-width: 150px; }
  .login-layout { gap: 28px; }
}
@media (max-width: 760px) {
  :root { --header-height: 72px; --sidebar-width: 0px; }
  header { padding: 12px 16px; }
  .brand { font-size: 14px; }
  .brand small { font-size: 10px; }
  .profile-name { display: none; }
  .profile-menu > summary { padding: 0; gap: 8px; }
  .profile-panel { top: 50px; }
  .workspace #workspace-nav { position: static; width: 100%; padding: 0 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .workspace-menu > summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 12px 0; color: #40596e; font-size: 14px; }
  .workspace-menu > summary::-webkit-details-marker { display: none; }
  .workspace-menu[open] .menu-chevron { transform: rotate(180deg); }
  .workspace-menu:not([open]) > nav { display: none; }
  .workspace-menu[open] > nav { display: flex; padding: 4px 0 16px; }
  .workspace-note { display: none; }
  .nav-label { margin-top: 16px; }
  .workspace main, .workspace footer { margin-left: 0; }
  .workspace main, main { padding: 24px 16px 40px; }
  .card { padding: 20px; border-radius: 16px; }
  .hero { padding: 24px; border-radius: 16px; }
  .learning-heading h1 { font-size: 26px; }
  .learning-grid { grid-template-columns: 1fr; }
  .grid > .card > .actions { gap: 8px; }
  .login-layout { margin: 20px auto; gap: 16px; }
  .login-intro h1 { font-size: 30px; }
  .login-card { padding: 24px; margin-top: 8px; }
  .workspace.exam-focus main { padding-top: 16px; }
  .timer { top: calc(var(--header-height) + 8px); }
  .editor-savebar, .learning-save { bottom: 8px; padding: 12px; }
  .editor-savebar button, .learning-save button { flex-grow: 1; }
  .search-label { margin: 20px 0; }
  .scroll { padding: 12px; }
  .scroll table { min-width: 680px; }
  .option { padding: 14px; }
  .score { font-size: 52px; }
  dialog { padding: 20px; border-radius: 18px; }
}
@media (max-width: 380px) {
  .brand { font-size: 12px; gap: 6px; }
  .brand small { font-size: 9px; }
  .profile-chevron { display: none; }
  .card { padding: 16px; }
  .timer { font-size: 14px; }
}
@media print {
  #workspace-nav, .profile-menu, .skip-link { display: none !important; }
  .workspace main, .workspace footer { margin: 0; padding: 0; }
  body { background: white; }
  .hero { background: white; color: black; }
  .hero h1, .hero p, .hero .eyebrow { color: black; }
  .grid > .card, .learning-grid > .card { display: block; }
  .scroll { overflow: visible; padding: 0; max-width: none; }
  .scroll table { min-width: 0; }
  tbody tr:hover { background: white; }
  .stat, .score { color: black; }
  .error, .success { border: 0; }
}
