/* KYT Online - GitHub-style theme + Wikipedia-style wiki navigation.
   Loaded LAST on every page so it overrides design-system, platform, site-shell. */

:root {
  --color-bg: #ffffff;
  --color-bg-elevated: #ffffff;
  --color-bg-muted: #f6f8fa;
  --color-border: #d0d7de;
  --color-border-strong: #afb8c1;
  --color-text: #1f2328;
  --color-text-secondary: #424a53;
  --color-text-muted: #656d76;
  --color-brand: #0969da;
  --color-brand-hover: #0550ae;
  --color-brand-light: #ddf4ff;
  --color-brand-dark: #0550ae;
  --color-success: #1a7f37;
  --color-success-bg: #dafbe1;
  --color-warning: #9a6700;
  --color-warning-bg: #fff8c5;
  --color-error: #cf222e;
  --color-error-bg: #ffebe9;
  --color-info: #0969da;
  --color-info-bg: #ddf4ff;
  --gh-green: #1f883d;
  --gh-green-hover: #1a7f37;
  --gh-header: #f6f8fa;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  --font-serif: "Linux Libertine", "Georgia", "Times", serif;
  --radius-md: 6px;
  --radius-lg: 6px;
  --shadow-sm: 0 1px 0 rgb(31 35 40 / .04);
  --shadow-md: 0 3px 6px rgb(140 149 159 / .15);
}

body.dark-theme {
  --color-bg: #0d1117;
  --color-bg-elevated: #161b22;
  --color-bg-muted: #161b22;
  --color-border: #30363d;
  --color-border-strong: #484f58;
  --color-text: #e6edf3;
  --color-text-secondary: #c9d1d9;
  --color-text-muted: #8b949e;
  --color-brand: #2f81f6;
  --color-brand-hover: #58a6ff;
  --color-brand-light: #121d2f;
  --color-brand-dark: #79c0ff;
  --color-success: #3fb950;
  --color-success-bg: #12261e;
  --color-warning: #d29922;
  --color-warning-bg: #272115;
  --color-error: #f85149;
  --color-error-bg: #2d1214;
  --color-info: #58a6ff;
  --color-info-bg: #121d2f;
  --gh-green: #238636;
  --gh-green-hover: #2ea043;
  --gh-header: #010409;
  --shadow-sm: none;
  --shadow-md: 0 8px 24px rgb(1 4 9 / .6);
}

html, body { background: var(--color-bg); color: var(--color-text); font-family: var(--font-sans); font-size: 14px; line-height: 1.5; }
a { color: var(--color-brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.platform-page a:visited { color: var(--color-brand); }
:focus-visible { outline: 2px solid var(--color-brand); outline-offset: -1px; border-radius: 6px; }

/* ---- Header bar (GitHub global nav) ---- */
[data-site-header], .site-bar, .topbar { background: var(--gh-header); border-bottom: 1px solid var(--color-border); }
.site-bar a, .site-bar button { color: var(--color-text); border-radius: 6px; font-weight: 600; font-size: 14px; }
.site-bar a:hover, .site-bar button:hover, .site-bar a[aria-current] { background: var(--color-bg-muted); color: var(--color-text); text-decoration: none; }
.site-bar a[aria-current] { box-shadow: inset 0 -2px 0 #f78166; border-radius: 6px 6px 0 0; }
.site-brand { color: var(--color-text); }
[data-site-footer] { border-top: 1px solid var(--color-border); color: var(--color-text-muted); background: transparent; }

/* ---- Sidebar / workspace navigation ---- */
.sidebar { background: var(--color-bg); border-right: 1px solid var(--color-border); }
.sidebar a, .sidebar button, .nav-item { border-radius: 6px; color: var(--color-text); }
.sidebar a:hover, .sidebar button:hover, .nav-item:hover { background: var(--color-bg-muted); text-decoration: none; }
.sidebar [aria-current], .sidebar .active, .nav-item.active { background: var(--color-bg-muted); box-shadow: inset 3px 0 0 #f78166; font-weight: 600; }

/* ---- Cards, boxes, modals ---- */
.card, .modal, .box { background: var(--color-bg-elevated); border: 1px solid var(--color-border); border-radius: 6px; box-shadow: none; }
.card-footer, .card-header { background: var(--color-bg-muted); border-color: var(--color-border); }
.modal { box-shadow: var(--shadow-md); }

/* ---- Buttons ---- */
.btn { border-radius: 6px; font-size: 14px; font-weight: 500; padding: 5px 16px; line-height: 20px; border: 1px solid var(--color-border); transition: background-color .1s; }
.btn-primary { background: var(--gh-green); border-color: rgb(31 35 40 / .15); color: #fff; }
.btn-primary:hover { background: var(--gh-green-hover); color: #fff; text-decoration: none; }
.btn-secondary, .btn-ghost { background: var(--color-bg-muted); color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover, .btn-ghost:hover { background: var(--color-border); border-color: var(--color-border-strong); text-decoration: none; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 3px 12px; font-size: 12px; }
.btn-danger { background: var(--color-bg-muted); color: var(--color-error); }
.btn-danger:hover { background: var(--color-error); color: #fff; }

/* ---- Forms ---- */
.form-input, .form-select, .form-textarea, input[type=search], input[type=text], input[type=email], input[type=password], select, textarea {
  background: var(--color-bg); color: var(--color-text); border: 1px solid var(--color-border); border-radius: 6px; padding: 5px 12px; font-size: 14px; }
.form-input:focus, .form-select:focus, .form-textarea:focus, input:focus, select:focus, textarea:focus { border-color: var(--color-brand); outline: 2px solid var(--color-brand); outline-offset: -1px; }
.form-label { font-weight: 600; font-size: 14px; color: var(--color-text); }
.form-help { color: var(--color-text-muted); font-size: 12px; }

/* ---- Badges (GitHub labels) ---- */
.badge { border: 1px solid var(--color-border); background: transparent; color: var(--color-text-muted); border-radius: 2em; padding: 0 7px; font-size: 12px; font-weight: 500; line-height: 18px; }
.badge-success { color: var(--color-success); border-color: var(--color-success); }
.badge-warning { color: var(--color-warning); border-color: var(--color-warning); }
.badge-error { color: var(--color-error); border-color: var(--color-error); }

/* ---- Tables and resource lists (GitHub file-list look) ---- */
table { border-collapse: collapse; width: 100%; }
th { background: var(--color-bg-muted); text-align: left; font-weight: 600; }
th, td { border: 1px solid var(--color-border); padding: 6px 13px; }
.resource-list { border: 1px solid var(--color-border); border-radius: 6px; overflow: hidden; background: var(--color-bg); }
.resource-list > * { padding: 8px 16px; border-top: 1px solid var(--color-border); }
.resource-list > *:first-child { border-top: 0; }
.resource-list > *:hover { background: var(--color-bg-muted); }

/* ---- Page headers: GitHub repo-header feel ---- */
.platform-page .page-header { padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--color-border); }
.platform-page .page-header h1 { font-size: 24px; font-weight: 600; }
.container { max-width: 1280px; margin-inline: auto; padding-inline: 16px; }

/* ============================================================
   WIKI CATALOGUE - compact GitHub repository list
   ============================================================ */
.platform-page .wiki-grid { display: block; border: 1px solid var(--color-border); border-radius: 6px; overflow: hidden; background: var(--color-bg); }
.wiki-directory-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 16px; border: 0; border-top: 1px solid var(--color-border); border-radius: 0; background: transparent; box-shadow: none; }
.wiki-directory-row:first-child { border-top: 0; }
.wiki-directory-row:hover { background: var(--color-bg-muted); }
.wiki-directory-row h2 { margin: 0; font-size: 20px; font-weight: 600; }
.wiki-directory-row .wiki-desc { flex-basis: 100%; margin: 0; color: var(--color-text-muted); font-size: 14px; }
.wiki-directory-row .badge { margin-left: 0; }
.wiki-empty { padding: 48px 16px; text-align: center; color: var(--color-text-muted); border: 1px dashed var(--color-border); border-radius: 6px; }
.wiki-empty h2 { color: var(--color-text); font-size: 20px; margin-bottom: 8px; }

/* ============================================================
   WIKI READER - Wikipedia-style navigation
   Left rail: Contents (sticky) + Tools. Main: article.
   ============================================================ */
.wiki-breadcrumb ol { font-size: 12px; }
.wiki-article { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 32px; align-items: start; }
.wiki-article:has(#wiki-toc:not([hidden])) { grid-template-columns: 224px minmax(0, 1fr); }
.wiki-article > .wiki-header { grid-column: 1 / -1; }
.wiki-article > #wiki-toc { grid-column: 1; grid-row: 2; position: sticky; top: 16px; margin: 0 !important; padding: 0 !important; border: 0 !important; max-height: calc(100vh - 32px); overflow-y: auto; }
.wiki-article > #wiki-content { grid-column: 2; grid-row: 2; }
.wiki-article:not(:has(#wiki-toc:not([hidden]))) > #wiki-content { grid-column: 1; }
.wiki-article > #wiki-links { grid-column: 2; grid-row: 3; }
.wiki-article:not(:has(#wiki-toc:not([hidden]))) > #wiki-links { grid-column: 1; }
.wiki-article > #tutor-actions { grid-column: 1; grid-row: 3; flex-direction: column; border: 0 !important; margin: 16px 0 0 !important; padding: 0 !important; align-self: start; position: sticky; top: 16px; }
.wiki-article:has(#wiki-toc:not([hidden])) > #tutor-actions { top: auto; position: static; }
.wiki-article > #tutor-actions .btn { width: 100%; text-align: left; }

#wiki-toc { font-size: 14px; border-left: 0; }
#wiki-toc h2 { font-size: 12px !important; font-weight: 600; color: var(--color-text-muted); letter-spacing: .02em; margin: 0 0 8px !important; padding-bottom: 4px; border-bottom: 1px solid var(--color-border); }
#wiki-toc ul { gap: 0 !important; }
#wiki-toc a { display: block; padding: 4px 8px 4px 12px; border-left: 2px solid transparent; color: var(--color-text-secondary); line-height: 1.35; }
#wiki-toc a:hover { background: var(--color-bg-muted); border-left-color: var(--color-border-strong); text-decoration: none; }
#wiki-toc a[aria-current="page"] { color: var(--color-text); font-weight: 600; border-left-color: #f78166; background: var(--color-bg-muted); }

.platform-page .wiki-title { font-family: var(--font-serif); font-weight: 400; font-size: 1.9rem; line-height: 1.25; margin: 0; }
.wiki-header { border-bottom: 1px solid var(--color-border) !important; }
.platform-page .wiki-content { font-size: 15px; line-height: 1.7 !important; max-width: 52rem !important; }
.platform-page .wiki-content h2, .wiki-content h2 { font-family: var(--font-serif); font-weight: 400; font-size: 1.5rem; border-bottom: 1px solid var(--color-border); padding-bottom: 4px; margin: 1.6em 0 .6em; }
.wiki-content h3 { font-size: 1.15rem; font-weight: 700; margin: 1.3em 0 .4em; }
.wiki-content a { color: var(--color-brand); }
.wiki-content pre { background: var(--color-bg-muted); border: 1px solid var(--color-border); border-radius: 6px; padding: 16px; overflow-x: auto; font-size: 85%; }
.wiki-content code { background: rgb(110 118 129 / .25); border-radius: 6px; padding: .2em .4em; font-size: 85%; font-family: var(--font-mono); }
.wiki-content pre code { background: transparent; padding: 0; }
.wiki-content blockquote { border-left: 4px solid var(--color-border); color: var(--color-text-muted); padding: 0 1em; margin: 0 0 16px; }
.wiki-content table { display: block; overflow-x: auto; }
.wiki-neighbours { display: flex; justify-content: space-between; gap: 16px; margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--color-border); }

/* Narrow screens: contents collapse above the article */
@media (max-width: 800px) {
  .wiki-article:has(#wiki-toc:not([hidden])) { grid-template-columns: minmax(0, 1fr); }
  .wiki-article > #wiki-toc, .wiki-article > #wiki-content, .wiki-article > #wiki-links, .wiki-article > #tutor-actions { grid-column: 1; grid-row: auto; position: static; max-height: none; }
  .wiki-article > #wiki-toc { margin-bottom: 16px !important; padding: 8px !important; border: 1px solid var(--color-border) !important; border-radius: 6px; }
  .wiki-article > #tutor-actions { flex-direction: row; }
  .wiki-article > #tutor-actions .btn { width: auto; }
  .platform-page .wiki-title { font-size: 1.5rem; }
}

/* ============================================================
   SHARED SHELL - top bar + left sidebar (public, wiki, bookings)
   ============================================================ */
[data-site-header] { position: sticky; top: 0; z-index: 30; }
.gh-topbar { display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 16px; }
.gh-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--color-text); font-weight: 600; font-size: 16px; white-space: nowrap; }
.gh-brand:hover { text-decoration: none; }
.gh-brand-pic { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 6px; background: var(--color-brand); color: #fff; font-size: 11px; font-weight: 700; }
.gh-gap { flex: 1; }
.gh-actions { display: flex; align-items: center; gap: 8px; }
.gh-icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--color-border); border-radius: 6px; background: transparent; color: var(--color-text); font-size: 16px; cursor: pointer; }
.gh-icon-btn:hover { background: var(--color-bg-muted); border-color: var(--color-border-strong); text-decoration: none; }
.gh-menu-btn { display: none; }
.gh-signin { padding: 5px 16px; border: 1px solid var(--color-border); border-radius: 6px; background: var(--color-bg-muted); color: var(--color-text); font-weight: 500; cursor: pointer; }
.gh-signin:hover { background: var(--color-border); text-decoration: none; }
.gh-profile { position: relative; }
.gh-avatar { width: 32px; height: 32px; padding: 0; border-radius: 50%; border: 1px solid var(--color-border-strong); background: var(--color-bg-muted); color: var(--color-text); font-size: 12px; font-weight: 600; cursor: pointer; }
.gh-avatar:hover { border-color: var(--color-brand); }
.gh-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 224px; padding: 8px 0; background: var(--color-bg-elevated); border: 1px solid var(--color-border); border-radius: 12px; box-shadow: var(--shadow-md); z-index: 40; }
.gh-menu[hidden] { display: none; }
.gh-menu-head { display: grid; padding: 4px 16px 8px; border-bottom: 1px solid var(--color-border); margin-bottom: 4px; }
.gh-menu-head span { color: var(--color-text-muted); font-size: 12px; }
.gh-menu hr { border: 0; border-top: 1px solid var(--color-border); margin: 4px 0; }
.gh-menu-item { display: block; width: calc(100% - 16px); margin: 0 8px; padding: 6px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--color-text); font: inherit; text-align: left; cursor: pointer; }
.gh-menu-item:hover { background: var(--color-bg-muted); text-decoration: none; }

body.gh-shell { display: grid; grid-template-columns: 256px minmax(0, 1fr); grid-template-rows: auto 1fr auto; min-height: 100vh; }
body.gh-shell > [data-site-header] { grid-column: 1 / -1; grid-row: 1; }
body.gh-shell > .gh-side { grid-column: 1; grid-row: 2 / span 2; }
body.gh-shell > main { grid-column: 2; grid-row: 2; min-width: 0; }
body.gh-shell > [data-site-footer] { grid-column: 2; grid-row: 3; margin-top: 0; }
.gh-side { position: sticky; top: 56px; align-self: start; height: calc(100vh - 56px); overflow-y: auto; padding: 16px 8px; background: var(--color-bg); border-right: 1px solid var(--color-border); }
.gh-nav-group { margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--color-border); }
.gh-nav-title { margin: 0 0 4px; padding: 0 12px; font-size: 12px; font-weight: 600; color: var(--color-text-muted); }
.gh-nav-item { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 6px; color: var(--color-text); position: relative; }
.gh-nav-item:hover { background: var(--color-bg-muted); text-decoration: none; }
.gh-nav-item[aria-current="page"] { background: var(--color-bg-muted); font-weight: 600; }
.gh-nav-item[aria-current="page"]::before { content: ""; position: absolute; left: -8px; top: 6px; bottom: 6px; width: 3px; border-radius: 6px; background: #f78166; }
.gh-nav-icon { width: 16px; text-align: center; color: var(--color-text-muted); }
.gh-side-foot { display: flex; gap: 12px; padding: 0 12px; font-size: 12px; }
.gh-scrim { display: none; }
body.gh-shell > [data-site-footer] .site-frame { width: auto; margin: 0; padding-inline: 16px; }

@media (max-width: 900px) {
  body.gh-shell { grid-template-columns: minmax(0, 1fr); }
  body.gh-shell > main, body.gh-shell > [data-site-footer] { grid-column: 1; }
  .gh-menu-btn { display: inline-grid; }
  .gh-side { position: fixed; left: 0; top: 56px; bottom: 0; width: 280px; z-index: 35; transform: translateX(-100%); transition: transform .15s; }
  body.gh-side-open .gh-side { transform: none; }
  body.gh-side-open .gh-scrim { display: block; position: fixed; inset: 56px 0 0 0; background: rgb(1 4 9 / .6); z-index: 34; }
  .gh-brand-name { font-size: 15px; }
}

/* Legacy --platform-* vars were resolved at :root, so they ignored body.dark-theme.
   Re-declare on body so they follow the active theme. */
body {
  --platform-ink: var(--color-text);
  --platform-muted: var(--color-text-secondary);
  --platform-paper: var(--color-bg-elevated);
  --platform-bg: var(--color-bg);
  --platform-line: var(--color-border);
  --platform-blue: var(--color-brand);
  --platform-navy: var(--color-brand-dark);
}

/* platform.css styles every ".platform-page button" solid blue with padding; out-specify it for the shell */
.platform-page .gh-icon-btn, .platform-page .gh-avatar { background: transparent; color: var(--color-text); padding: 0; border-radius: 6px; font-weight: 400; }
.platform-page .gh-avatar { border-radius: 50%; background: var(--color-bg-muted); font-weight: 600; }
.platform-page .gh-icon-btn:hover { background: var(--color-bg-muted); }
.platform-page .gh-signin { background: var(--color-bg-muted); color: var(--color-text); }
.platform-page .gh-menu-item { background: transparent; color: var(--color-text); padding: 6px 8px; border-radius: 6px; font-weight: 400; }
.platform-page .gh-menu-item:hover { background: var(--color-bg-muted); }
.platform-page .gh-menu-btn { background: transparent; }
/* platform.css gives every article/form rounded padding + paper background */
.platform-page .wiki-directory-row { border-radius: 0; background: transparent; padding: 16px; border-width: 1px 0 0; }
.platform-page .wiki-directory-row:first-child { border-top: 0; }
.platform-page .wiki-article, .platform-page article.wiki-article { padding: 0; border: 0; border-radius: 0; background: transparent; }

/* platform.css hard-codes #fff on #reader/#editor */
.platform-page #reader, .platform-page #editor { background: transparent; border: 0; border-radius: 0; padding: 0; }
.platform-page #editor { background: var(--color-bg-elevated); border: 1px solid var(--color-border); border-radius: 6px; padding: 24px; }
.platform-page .wiki-title { border-bottom: 0; padding-bottom: 0; }

/* Keep the workspace column anchored to its navigation rail. */
#shell #main{width:100%;margin-inline:0}
#shell .work-area-heading,#shell .course-grid{width:100%}
#shell #group-filter[hidden]{display:none!important}
#shell .topbar>.flex-1:has(#group-filter[hidden]){visibility:hidden}
#shell .sidebar-nav :is(button,a){gap:.65rem}
#shell .sidebar-nav .ui-icon,.gh-topbar .ui-icon,.gh-side .ui-icon{flex:none;display:block;width:18px;height:18px}
#shell .sidebar-nav :is(button.active,a[aria-current],.class-shortcut.active){background:var(--color-bg-muted);color:var(--color-brand);box-shadow:inset 2px 0 var(--color-brand)}
#shell .class-shortcut .class-dot{background:transparent;color:inherit}

/* Keep article chrome and text on the same reading column. */
.wiki-breadcrumb{margin-bottom:.8rem}
.wiki-breadcrumb ol,.wiki-breadcrumb li,#wiki-toc ul,#wiki-toc li{list-style:none;margin:0;padding:0}
.wiki-breadcrumb ol{display:flex;flex-wrap:wrap;align-items:center;gap:.35rem .55rem}
.wiki-breadcrumb li+li::before{content:"/";color:var(--color-text-muted);margin-right:.55rem}
.wiki-article{column-gap:1.5rem;row-gap:.75rem}
.wiki-article:has(#wiki-toc:not([hidden])){grid-template-columns:minmax(8rem,13rem) minmax(0,1fr)}
.wiki-article:has(#wiki-toc:not([hidden]))>.wiki-header{grid-column:2}
.wiki-header{margin:0;padding-bottom:.55rem;border-bottom:1px solid var(--color-border)}
.wiki-meta{margin-top:.35rem}
.wiki-article>#wiki-toc{grid-row:1/span 2;top:72px}
.wiki-article>#wiki-content> :first-child{margin-top:0}
.wiki-neighbours:empty{display:none}
@media(max-width:767px){
 .wiki-article:has(#wiki-toc:not([hidden])){grid-template-columns:minmax(0,1fr)}
 .wiki-article:has(#wiki-toc:not([hidden]))>.wiki-header,.wiki-article>#wiki-toc{grid-column:1;grid-row:auto;position:static}
 .wiki-article>#wiki-content{grid-row:4}
}

#shell .sidebar-nav .nav-item,#shell #wire-secondary-nav button{padding-inline:.7rem;font-size:13px;font-weight:600}
#shell .work-area-title>.btn{padding:0;color:var(--color-brand);font-size:1rem}
#shell .work-area-title{margin:0 0 .25rem}

/* All workspace navigation groups share the same two columns. */
#shell .sidebar-nav {
    --rail-inset: .75rem;
    --rail-icon: 18px;
    --rail-gap: .625rem;
}
#shell .sidebar-nav :is(.nav-item, .class-shortcut, #wire-secondary-nav button, button[data-view]) {
    display: grid;
    grid-template-columns: var(--rail-icon) minmax(0, 1fr);
    justify-items: start;
    align-items: center;
    gap: var(--rail-gap);
    margin: 0;
    padding-inline: var(--rail-inset);
    border-inline: 0;
    font-size: 13px;
    text-align: left;
}
#shell .sidebar-nav :is([data-outline], .class-dot) {
    display: grid;
    place-items: center;
    width: var(--rail-icon);
    height: var(--rail-icon);
    margin: 0;
    padding: 0;
}
#shell .sidebar-nav :is(.nav-section, #classroom-nav > p) {
    padding-inline: var(--rail-inset);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.custom-icon{width:18px;height:18px;object-fit:contain;vertical-align:middle;flex:none}
.empty-state-icon .custom-icon-empty{width:32px;height:32px}
body.dark-theme :is(.custom-icon-office,.custom-icon-empty,.custom-icon-quiz){filter:brightness(0) invert(.86)}
.password-toggle .ui-icon,.toolbar-btn .ui-icon{vertical-align:middle}

/* Signed-in deep links use the workspace shell instead of the public grid. */
body.gh-shell:has(#shell:not([hidden])){display:block}

/* File browser controls and rows use the theme palette in both modes. */
#shell .drive{min-width:0;width:100%;color:var(--color-text)}
#shell .drive :is(button,summary,a){color:var(--color-text)}
#shell .drive :is(.btn-primary,.primary){color:#fff}
#shell .drive :is(button,summary):hover{background-color:var(--color-bg-muted)}
#shell .drive :is(.btn-primary,.primary):hover{background-color:var(--color-brand-hover)}
#shell .drive :is(button.selected,[aria-pressed="true"]){color:var(--color-brand);border-color:var(--color-brand);background:var(--color-brand-light)}
.drive-heading,.drive-commandbar,.drive-location,.drive-location>div,.drive-filter-tools,.drive-modes,.drive-views,.drive-selection-bar{display:flex;align-items:center;flex-wrap:wrap;gap:.5rem;min-width:0}
.drive-heading,.drive-location{justify-content:space-between}
.drive-heading{margin-bottom:1rem}
.drive-commandbar,.drive-location,.drive-selection-bar{margin-bottom:.75rem}
.drive-search{display:flex;align-items:center;gap:.5rem;min-width:0;max-width:100%}
.drive-search input{min-width:0;max-width:100%}
.drive-count,.drive-privacy,.drive-open small{color:var(--color-text-secondary)}
.drive :is(.ui-icon,.custom-icon){flex:none}
.drive :is(.drive-new,.drive-file-menu){position:relative}
.drive :is(.drive-new,.drive-file-menu)>summary{list-style:none;display:inline-flex;align-items:center;gap:.45rem;padding:.35rem .6rem;border:1px solid var(--color-border);border-radius:6px;cursor:pointer}
.drive :is(.drive-new,.drive-file-menu)>summary::-webkit-details-marker{display:none}
.drive :is(.drive-new,.drive-file-menu)>div{background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:6px;padding:.3rem}
.drive .drive-new>div{position:absolute;left:0;top:100%;z-index:5;min-width:12rem}
.drive .drive-file-menu[open]>div{display:grid;gap:.25rem;margin-top:.25rem}
.drive .drive-open{display:flex;align-items:center;gap:.6rem;min-width:0;max-width:100%;padding:.25rem 0;text-align:left;overflow-wrap:anywhere}
.drive .drive-open small{display:block;margin-top:.1rem}
.drive-file-icon{display:inline-flex;align-items:center;gap:.3rem;flex:none}
.drive-table-wrap{max-width:100%}
.drive-table{width:100%;table-layout:fixed}
.drive-table th:first-child{width:45%}
.drive-table :is(th,td){overflow-wrap:anywhere}
.drive-privacy{display:flex;gap:.4rem;align-items:flex-start;margin-top:.75rem}
@media(max-width:680px){
 .drive-heading,.drive-location,.drive-commandbar{align-items:flex-start}
 .drive-heading,.drive-location{flex-direction:column}
 .drive-search{width:100%}
 .drive-search input{flex:1}
 .drive-table :is(th:nth-child(n+2):nth-child(-n+4),td.drive-owner,td.drive-modified,td.drive-size){display:none}
 .drive-table th:first-child{width:auto}
 .drive-table th:last-child{width:3.5rem}
 .drive .drive-file-menu[open]>div{position:absolute;right:0;z-index:5;width:max-content;max-width:calc(100vw - 2rem)}
}

/* Native controls inherit the page palette unless a component sets its own. */
body{color-scheme:light}
body.dark-theme{color-scheme:dark}
:where(button,input,select,textarea,summary){color:inherit;font-family:inherit}
#signin-panel{padding:1.25rem clamp(1rem,4vw,1.75rem) 1.5rem;box-shadow:var(--shadow-md)}
#signin-panel :is(.signin-close,.signin-tabs button,.password-toggle){color:var(--color-text)}
#signin-panel :is(.signin-close,.password-toggle){display:grid;place-items:center;border:1px solid var(--color-border);border-radius:6px;background:var(--color-bg-muted)}
#signin-panel .signin-close{width:44px}
#signin-panel .signin-close:hover,#signin-panel .password-toggle:hover{background:var(--color-border)}
#signin-panel .signin-tabs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.25rem}
#signin-panel .signin-tabs button{text-align:center;border-radius:6px 6px 0 0}
#signin-panel .signin-tabs [aria-selected="true"]{color:var(--color-text);background:var(--color-bg-muted)}
#signin-panel .signin-form h2{margin:.5rem 0}
#signin-panel .signin-form>p{color:var(--color-text-secondary);margin:.5rem 0 1rem}
#signin-panel .signin-form .form-group{margin-bottom:.9rem}
#signin-panel .signin-form .btn-primary{width:100%;min-height:44px;background:#1661c0;color:white}
#signin-panel .signin-form .btn-primary:hover{background:#1351a0}
#shell :is(.class-breadcrumb button,.announce-prompt,.upcoming-panel button,.comment-prompt button,.stream-post .file-menu button){color:var(--color-text)}
#shell :is(.announce-prompt,.upcoming-panel button,.comment-prompt button):hover{background:var(--color-bg-muted)}
#shell .stream-post-heading small{margin-top:.2rem}
#shell .stream-attachments{margin-bottom:.25rem}
#shell .stream-assignment-status{display:flex;flex-wrap:wrap;gap:.5rem;color:var(--color-text-secondary)}
#shell .sidebar-nav{scrollbar-width:thin;scrollbar-color:var(--color-border-strong) transparent}
.drive-folders{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,15rem),1fr));gap:.5rem;margin-bottom:.75rem}
.drive-folders>button,.drive-folders .selection-item{min-width:0}
.drive-folders button{display:flex;align-items:center;gap:.5rem;padding:.5rem;text-align:left;overflow-wrap:anywhere}
.drive-folders button span{margin-left:auto;color:var(--color-text-secondary)}
.drive-select{display:inline-flex;align-items:center;margin-inline-end:.5rem}
.drive td:first-child:has(.drive-select) .drive-open{display:inline-flex;vertical-align:middle;max-width:calc(100% - 2rem)}

/* Work-area tabs, directory, and resource navigation. */
#shell .class-breadcrumb button{color:var(--color-brand);border-color:transparent;padding-inline:0}
#shell .class-tabs{border-width:0 0 1px;background:transparent;gap:.2rem}
#shell .class-tabs button{border-radius:0}
#shell .class-tabs button:hover{background:var(--color-bg-muted)}
#shell .classwork-tools,#shell .library-actions,#shell .search-bar,#shell .post-card .actions{display:flex;align-items:center;flex-wrap:wrap;gap:.6rem;margin-block:.7rem}
#shell :is(.classwork-tools,.topic-list,.classwork-open,.search-bar,.library-actions,.post-card .actions) :is(button,select,summary),#shell .classwork-open{color:var(--color-text)}
#shell :is(.classwork-tools,.library-actions) .primary{color:white}
#shell .classwork-open:hover{background:var(--color-bg-muted)}
#shell .classwork-date,#shell .classwork-status{color:var(--color-text-secondary)}
#shell .classwork-date{margin-left:auto}
#shell .people-page{max-width:52rem}
#shell .people-heading{display:flex;align-items:center;flex-wrap:wrap;gap:.65rem;margin:1rem 0 .4rem}
#shell .people-heading h2{margin:0;font-size:1.15rem}
#shell .people-heading>span{color:var(--color-text-secondary)}
#shell .people-heading button{margin-left:auto;color:var(--color-text)}
#shell .person-row{display:flex;align-items:center;gap:.7rem;border-block-start:1px solid var(--color-border);padding:.55rem 0;min-height:44px}
#shell .person-row button{color:var(--color-text)}
#shell .person-row .avatar{display:grid;place-items:center;min-width:32px;height:32px;border-radius:50%;background:var(--color-bg-muted);color:var(--color-text)}
#shell .page-title{display:flex;flex-direction:row;align-items:flex-start;justify-content:space-between;text-align:left;margin-inline:0}
#shell .page-title>div{min-width:0}
#shell .page-title .eyebrow{display:none}
#shell .search-bar input{flex:1 1 15rem;min-width:0}
#shell .post-card .actions .danger-text{color:var(--color-error)}
#shell .student-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.65rem;margin:1rem 0}
#shell .student-stats>div{display:grid;gap:.2rem;padding:.75rem;border:1px solid var(--color-border);border-radius:6px;background:var(--color-bg-elevated);overflow-wrap:anywhere}
#shell .student-stats strong{font-size:1.25rem}
#shell .student-stats span,#shell .student-table td small{color:var(--color-text-secondary)}
#shell .student-filters{display:grid;grid-template-columns:minmax(0,2fr) repeat(2,minmax(0,1fr));gap:.75rem;margin-bottom:.75rem}
#shell .student-filters label{display:grid;gap:.35rem;margin:0;min-width:0}
#shell .student-filters :is(input,select){width:100%;min-width:0}
#shell .student-table td small{display:block;margin-top:.2rem;overflow-wrap:anywhere}
#shell .student-table td button{color:var(--color-text)}
#shell .wire-session-main{flex-wrap:wrap}
.student-work-empty{border:1px solid var(--color-border);border-radius:6px;padding:1rem;color:var(--color-text-secondary)}
.student-work-empty p{margin:0 0 .6rem}
.gh-side .gh-nav-item{display:grid;grid-template-columns:18px minmax(0,1fr);color:var(--color-text);gap:.625rem}
.gh-side .gh-nav-item[aria-current="page"]{color:var(--color-brand)}
.gh-side .gh-nav-item[aria-current="page"]::before{background:var(--color-brand);left:0}
@media(max-width:680px){
 #shell .student-stats{grid-template-columns:repeat(2,minmax(0,1fr))}
 #shell .student-filters{grid-template-columns:minmax(0,1fr)}
 #shell .classwork-date{margin-left:0}
}

#signin-panel .password-input input[type="text"]{-webkit-text-security:none}
#shell .settings-save{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:.75rem;padding-top:1rem;border-top:1px solid var(--color-border)}
#shell .settings-save .primary{background:#1661c0;color:white;border-radius:6px;padding:.55rem .9rem;min-height:36px}
#shell .settings-save .primary:hover{background:#1351a0}

/* Drive grid and bulk upload share the workspace theme. */
.drive-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,13rem),1fr));gap:.75rem}
.drive-tile{position:relative;min-width:0;display:grid;grid-template-rows:auto 1fr auto;gap:.55rem;padding:.7rem;border:1px solid var(--color-border);border-radius:6px;background:var(--color-bg-elevated)}
.drive-tile-heading{display:flex;align-items:center;gap:.4rem;min-width:0}
.drive-tile-heading>button{flex:1;min-width:0;text-align:left;overflow-wrap:anywhere}
.drive-tile .drive-preview{display:flex;align-items:center;justify-content:center;gap:.5rem;min-height:5rem;padding:.65rem;background:var(--color-bg-muted);border:1px solid var(--color-border);border-radius:6px}
.drive-tile>small{color:var(--color-text-secondary)}
.drive :is(.drive-tile,.drive-table tr,.selection-folder).is-selected{background:var(--color-brand-light)}
.drive .drive-tile .drive-file-menu[open]>div{position:absolute;right:0;z-index:6;display:grid;width:max-content;max-width:calc(100vw - 2rem)}
#bulk-upload{width:min(38rem,calc(100% - 1.5rem));max-height:calc(100dvh - 1.5rem);margin:auto;padding:0;overflow:auto;border:1px solid var(--color-border);border-radius:8px;background:var(--color-bg-elevated);color:var(--color-text);box-shadow:var(--shadow-md)}
#bulk-upload::backdrop{background:#0b132580}
#bulk-upload .bulk-heading,#bulk-upload .bulk-footer{display:flex;align-items:center;gap:.65rem;padding:.85rem 1rem}
#bulk-upload .bulk-heading{justify-content:space-between;border-bottom:1px solid var(--color-border)}
#bulk-upload .bulk-heading h2{font-size:1.2rem;margin:0}
#bulk-upload .bulk-heading button{display:grid;place-items:center;width:44px;height:44px;border-radius:6px}
#bulk-upload .bulk-heading button:hover{background:var(--color-bg-muted)}
#bulk-upload .bulk-body{padding:1rem}
#bulk-upload .bulk-choices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.65rem;margin-bottom:.8rem}
#bulk-upload .bulk-choices label{position:relative;display:flex;align-items:center;justify-content:center;gap:.45rem;padding:.8rem .5rem;min-height:60px;border:1px dashed var(--color-border-strong);border-radius:6px;background:var(--color-bg-muted);cursor:pointer;text-align:center}
#bulk-upload .bulk-choices label:focus-within{outline:2px solid var(--color-brand);outline-offset:2px}
#bulk-upload .bulk-choices input{position:absolute;width:1px;height:1px;opacity:0}
#bulk-upload .bulk-body>label:not(.bulk-unzip){display:grid;gap:.35rem}
#bulk-upload .bulk-body select{width:100%}
#bulk-upload .bulk-unzip{display:flex;align-items:center;gap:.5rem;margin:.8rem 0}
#bulk-selection{padding:.65rem;border:1px solid var(--color-border);border-radius:6px;overflow-wrap:anywhere}
#bulk-selection ul{max-height:8rem;overflow:auto}
#bulk-upload :is(.field-help,#bulk-selection small){color:var(--color-text-secondary)}
#bulk-upload #bulk-error{color:var(--color-error);white-space:pre-wrap}
#bulk-upload .bulk-footer{justify-content:flex-end;border-top:1px solid var(--color-border)}
#bulk-upload .bulk-footer button{min-height:40px;padding:.4rem .8rem;border:1px solid var(--color-border);border-radius:6px}
#bulk-upload #bulk-start{background:#1661c0;color:white}
@media(max-width:430px){#bulk-upload .bulk-choices{grid-template-columns:minmax(0,1fr)}}

/* Match the public and workspace sidebar navigation. */
.gh-side,#shell>.sidebar{background:var(--color-bg)}
#shell .sidebar-nav{padding:8px}
#shell .sidebar-nav .nav-divider{display:none}
#shell .sidebar-nav .nav-section,#shell .sidebar-nav #classroom-nav>p{margin:0;padding:10px 12px 5px;text-transform:none;letter-spacing:0;font-size:13px;font-weight:500;color:var(--color-text-muted)}
#shell .sidebar-nav :is(#workspace-nav-label,#workspace-account-label,#classroom-nav,.gh-side-foot){margin-top:12px;border-block-start:1px solid var(--color-border)}
#shell .sidebar-nav #classroom-nav{padding-block:.25rem}
#shell .sidebar-nav .gh-side-foot{padding-block:.75rem}
#shell .sidebar-nav .gh-side-foot a{display:inline;min-height:0;width:auto}
#shell .sidebar-nav :is(.nav-item,.class-shortcut,button[data-view]),.gh-side .gh-nav-item{position:relative;color:var(--color-brand);font-size:14px;font-weight:500;min-height:34px;padding:6px 12px;gap:8px;border-radius:6px}
#shell .sidebar-nav :is(.nav-item,.class-shortcut,button[data-view]):hover,.gh-side .gh-nav-item:hover{background:var(--color-bg-muted)}
#shell .sidebar-nav :is(.nav-item,.class-shortcut,button[data-view]).active,.gh-side .gh-nav-item[aria-current="page"]{background:var(--color-bg-muted);color:var(--color-text);font-weight:650;box-shadow:inset 3px 0 var(--color-brand)}
.gh-side .gh-nav-item[aria-current="page"]::before{display:none}
#shell .sidebar-nav .class-shortcut small{color:inherit}

.revision-table-wrap{max-width:100%;overflow:auto;margin:.8rem 0 1rem}
.revision-table-wrap caption{padding-bottom:.4rem;text-align:left;font-weight:650}
.revision-table-wrap table{width:100%;border-collapse:collapse}
.revision-table-wrap :is(td,th){padding:.45rem .55rem}
.revision-figure{margin:1rem 0}
.revision-figure img{display:block;width:min(100%,44rem);height:auto}
.revision-figure img.revision-symbol{width:120px;background:white;padding:.35rem;border-radius:6px}
.revision-figure figcaption{color:var(--color-text-secondary);margin-top:.4rem}
.revision-article details{margin:.6rem 0;padding:.55rem .7rem;border:1px solid var(--color-border);border-radius:6px}
#revision-assessment{max-width:52rem;margin-bottom:1.1rem}
body.dark-theme :is(#shell .sidebar-nav .active,.gh-side .gh-nav-item[aria-current="page"]){color:#fff}

.revision-page > main { padding-block: clamp(1.25rem, 3vw, 2rem) 2rem; }
.revision-page .page-header { padding-bottom: 1rem; margin-bottom: 1.25rem; }
.revision-page .page-header h1 { max-width: none; margin: 0 0 .5rem; }
#revision-description { margin: 0; }
#revision-description:not(:empty) + a { display: inline-block; margin-top: .5rem; }
#revision-assessment:empty, #revision-status:empty { display: none; }
.revision-page #topics-title { margin: 0 0 .85rem; }
.revision-board-list { display: grid; gap: .75rem; max-width: 48rem; }
.revision-board-list article {
  padding: .85rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg-elevated);
}
.revision-board-list h3 { margin: 0; font-size: 1.06rem; }
.revision-board-list p { margin: .35rem 0 0; color: var(--color-text-secondary); }
#shell .drive-grid{grid-template-columns:repeat(auto-fill,minmax(min(100%,17rem),1fr));align-items:start}
#shell .drive-tile{display:block;padding:.55rem .65rem}
#shell .drive-tile-heading>.drive-open{flex:1;min-width:0;min-height:44px}
#shell .drive-tile-heading>.drive-open>span:last-child{min-width:0;overflow-wrap:anywhere}
#shell .drive-tile-heading>.drive-open>svg{flex:none}
#shell .drive-tile-heading>.drive-select{margin:0;flex:none}
#shell .drive-file-menu>summary{min-height:36px}
#shell .drive-file-menu[open]>div{position:absolute;inset-inline-end:0;z-index:7;width:max-content;max-width:calc(100vw - 2rem);box-shadow:var(--shadow-md)}
