/* Roboto Slab (Apache License 2.0, assets/fonts/LICENSE-roboto-slab.txt):
   the typeface of www.unitn.it, served from this origin (AI-114). One
   variable file covers every weight. The family has no italic: the browser
   slants the upright face for emphasis. */
@font-face {
  font-family: "Roboto Slab";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("assets/fonts/roboto-slab-latin-variable.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  /* Look modelled on www.unitn.it (AI-114): white header with the University
     mark, Roboto Slab, square shapes, dark footer. The red accents of the
     University site become the yellow of the Department (DEM): text on the
     yellow is always dark, yellow only as a surface or a border. */
  --ink: #3b3b3b;
  --ink-strong: #231f20;
  --muted: #5c5c5c;
  --line: #dcdcdc;
  --surface: #ffffff;
  --surface-soft: #f3f3f3;
  --canvas: #ffffff;
  --footer: #323232;
  --brand: #edb700;
  --brand-dark: #c99b00;
  --brand-pale: #fff6d6;
  --brand-ink: #6b5300;
  --green: var(--brand-ink);
  --green-dark: var(--brand-ink);
  --green-pale: var(--brand-pale);
  --danger: #9b3628;
  --warning: #8a5a09;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
  --radius: 0;
  /* One left and right edge for header, menu, content and footer. */
  --page-max: 1440px;
  --gutter: clamp(14px, 4vw, 48px);
  --edge: calc(max(0px, (100% - var(--page-max)) / 2) + var(--gutter));
  --view-pad: clamp(16px, 3vw, 32px);
  /* Heights of the fixed parts: the chat layout between them is sized from
     the window height (AI-084). The header and footer values include their
     4px yellow line. */
  --header-h: 72px;
  --tabs-h: 49px;
  --footer-h: 40px;
  --chrome-h: calc(var(--header-h) + var(--tabs-h) + var(--footer-h));
  font-family: "Roboto Slab", Helvetica, Arial, sans-serif;
  font-synthesis: style;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

/* The menu is shown only to the signed-in staff (AI-118): without it the
   bar takes no height. The class is on <html>, where --chrome-h is computed. */
:root:not(.staff-menu) {
  --tabs-h: 0px;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  margin: 0;
  /* A column as tall as the window: the footer stays at the bottom even
     when the content is short (AI-114). */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--canvas);
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  /* Opaque, high-contrast ring (WCAG 2.4.7, AI-089). */
  outline: 3px solid var(--brand-ink);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 30;
  padding: 10px 14px;
  color: #fff;
  background: var(--ink);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

/* White header with the University mark, closed by the yellow line of the
   Department (AI-114). Heights in :root. */
.app-header {
  height: var(--header-h);
  color: var(--ink-strong);
  background: var(--surface);
  border-bottom: 4px solid var(--brand);
}

.header-inner {
  width: min(var(--page-max), 100%);
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

/* The name of the service leads to the main page (AI-057); the University
   mark leads to the University site, in a new tab (AI-116). */
.brand-link {
  color: inherit;
  text-decoration: none;
}

.brand-logo-link {
  display: block;
  flex: 0 0 auto;
}

.brand-link:hover strong {
  text-decoration: underline;
}

/* The mark is never recoloured or stretched: only its height is set. */
.brand-logo {
  display: block;
  width: auto;
  height: 48px;
  flex: 0 0 auto;
}

.brand-block > .brand-link {
  display: grid;
  gap: 2px;
  /* As tall as the mark also when it holds one line (phones): a target
     of at least 24px. */
  align-content: center;
  min-width: 0;
  min-height: 38px;
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

.brand-block strong {
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.2;
}

.brand-link span {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.2;
}

.service-state {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.82rem;
}

.state-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #bdbdbd;
}

.service-state.is-online .state-dot {
  background: #1f7a3f;
}

.service-state.is-offline .state-dot {
  background: var(--danger);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* The only place for sign-in, account name and sign-out, the same in every
   section (AI-114). */
.account-area {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

/* A long name is cut here; the full name is in its title. */
.account-name {
  max-width: 22ch;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-login,
.header-logout {
  min-height: 38px;
  padding: 6px 16px;
  border: 1px solid var(--footer);
  border-radius: 0;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
}

.header-login {
  color: #fff;
  background: var(--footer);
}

.header-login:hover {
  background: #000;
}

/* Link to the sign-in of the main page, on the page of a course (AI-121). */
a.header-login {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

a.header-login[hidden] {
  display: none;
}

.header-logout {
  color: var(--ink-strong);
  background: var(--surface);
}

.header-logout:hover {
  background: var(--surface-soft);
}

.primary-tabs {
  height: var(--tabs-h);
  padding: 0 var(--edge);
  display: flex;
  gap: 30px;
  overflow-x: auto;
  /* Only sideways: the underline of the active tab must not open a tiny
     vertical scrollbar at the right end of the bar (AI-084). */
  overflow-y: hidden;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

/* The label sits on the common edge; the 6px of padding, taken back by the
   margin, leave room for the focus ring around the text. */
.tab-button {
  position: relative;
  min-width: 44px;
  min-height: 48px;
  margin: 0 -6px;
  padding: 0 6px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.tab-button::after {
  position: absolute;
  right: 6px;
  bottom: 0;
  left: 6px;
  height: 4px;
  content: "";
  background: transparent;
}

.tab-button:hover {
  color: var(--ink-strong);
}

/* The current section is not marked by the yellow alone: darker and
   heavier text too. */
.tab-button.is-active {
  color: var(--ink-strong);
  font-weight: 700;
}

/* The bar clips what leaves it: the focus ring stays inside the button. */
.tab-button:focus-visible {
  outline-offset: -3px;
}

.tab-button.is-active::after {
  background: var(--brand);
}

@media (forced-colors: active) {
  .tab-button.is-active::after {
    background: CanvasText;
  }
}

/* The page fills the window: header, menu, content, footer. */
main {
  flex: 1 0 auto;
  min-height: calc(100vh - var(--chrome-h));
}

.view {
  width: min(var(--page-max), 100%);
  min-height: calc(100vh - var(--chrome-h));
  margin: 0 auto;
  padding: var(--view-pad) var(--gutter);
}

.view[hidden] {
  display: none;
}

/* Signature of the page (AI-114): dark band of www.unitn.it with the yellow
   line of the Department. One line on wide windows. */
.app-footer {
  min-height: var(--footer-h);
  display: flex;
  align-items: center;
  color: #fff;
  background: var(--footer);
  border-top: 4px solid var(--brand);
  font-size: 0.82rem;
}

.footer-inner {
  width: min(var(--page-max), 100%);
  /* It is a paragraph: no margin of its own. With 5px above and below a
     single line makes the footer exactly --footer-h tall. */
  margin: 0 auto;
  padding: 5px var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 10px;
  line-height: 1.4;
}

/* 24px tall at least, also when the links stack on a phone. */
.app-footer a {
  display: inline-block;
  padding-block: 3px;
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.app-footer a:hover {
  color: var(--brand);
}

.app-footer a:focus-visible {
  outline-color: #fff;
}

.footer-separator {
  color: var(--brand);
}

/* The chat fills the window below the bars: the column on the left and the
   conversation scroll on their own (AI-084). On phones the layout stacks and
   the page scrolls as a whole. */
.chat-layout {
  display: grid;
  grid-template-columns: minmax(230px, 300px) minmax(0, 1fr);
  gap: 24px;
  height: calc(100vh - var(--chrome-h) - 2 * var(--view-pad));
  height: calc(100dvh - var(--chrome-h) - 2 * var(--view-pad));
  min-height: 420px;
}

.chat-layout.is-collapsed {
  grid-template-columns: 40px minmax(0, 1fr);
}

.chat-layout.is-collapsed .course-sidebar {
  padding: 6px 6px 6px 0;
}

.chat-layout.is-collapsed .course-sidebar > :not(.sidebar-toggle) {
  display: none;
}

.sidebar-toggle {
  display: block;
  width: 32px;
  min-height: 32px;
  margin: 0 0 8px auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--brand-ink);
  background: #fff;
  font-size: 0.8rem;
  line-height: 1;
}

.sidebar-toggle:hover {
  background: var(--brand-pale);
}

.course-sidebar,
.chat-tool,
.course-list-panel,
.admin-panel,
.analytics-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.course-sidebar {
  padding: 16px 16px 16px 2px;
  align-self: stretch;
  min-height: 0;
  overflow-y: auto;
  border: 0;
  border-right: 3px solid var(--brand);
  border-radius: 0;
  background: transparent;
}

label,
.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

select,
input,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #bdbdbd;
  border-radius: var(--radius);
  background: #fff;
}

select:disabled,
input:disabled,
textarea:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.course-sidebar select {
  margin-top: 7px;
}

.course-facts,
.provider-facts {
  margin: 22px 0;
}

.course-facts > div,
.provider-facts > div {
  padding: 10px 0;
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-size: 0.78rem;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.88rem;
  font-weight: 650;
}

.status-badge,
.source-state {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: 4px 7px;
  align-items: center;
  color: var(--green-dark);
  background: var(--green-pale);
  border-radius: var(--radius);
  font-size: 0.72rem;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.source-state {
  color: var(--warning);
  background: #fff1cf;
}

.primary-button,
.secondary-button,
.text-button,
.icon-button {
  min-height: 42px;
  border-radius: var(--radius);
  font-weight: 700;
}

.primary-button {
  padding: 10px 18px;
  border: 1px solid var(--brand);
  color: var(--ink);
  background: var(--brand);
  border-radius: var(--radius);
}

.primary-button:hover:not(:disabled) {
  background: var(--brand-dark);
}

.secondary-button {
  padding: 10px 15px;
  border: 1px solid var(--brand-dark);
  color: var(--brand-ink);
  background: #fff;
  border-radius: var(--radius);
}

.secondary-button:hover:not(:disabled) {
  background: var(--brand-pale);
}

.text-button {
  padding: 8px;
  border: 0;
  color: var(--brand-ink);
  background: transparent;
}

.icon-button,
.close-button {
  width: 42px;
  padding: 0;
  border: 1px solid var(--line);
  color: var(--green-dark);
  background: #fff;
  font-size: 1.2rem;
}

.course-sidebar .secondary-button {
  width: 100%;
}

.chat-tool {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) repeat(5, auto);
  overflow-x: hidden;
  overflow-y: auto;
  border: 0;
  background: transparent;
}

.chat-heading,
.section-heading,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Closed yellow frame around the chat heading (AI-085). */
.chat-heading {
  padding: 10px 16px;
  border: 3px solid var(--brand);
  border-radius: var(--radius);
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--ink-strong);
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  font-weight: 700;
  line-height: 1.2;
}

h2 {
  margin-bottom: 12px;
  font-size: 1.04rem;
  line-height: 1.3;
}

.messages {
  min-width: 0;
  min-height: 0;
  padding: 20px 4px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  background: transparent;
}

.empty-chat {
  margin: auto;
  width: min(660px, 100%);
  /* Never squeezed: when the window is too low the conversation area
     scrolls, instead of cutting the last suggested question (AI-115). */
  flex-shrink: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  border-bottom: 4px solid var(--brand);
}

.empty-chat img {
  display: none;
  width: 100%;
  aspect-ratio: 3 / 1;
  object-fit: cover;
}

.empty-chat div {
  padding: 18px 20px;
}

.empty-chat p,
.supporting-copy,
.field-note {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.message {
  width: min(100%, 860px);
  padding: 4px 0;
  border: 0;
  border-radius: 0;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message.user {
  align-self: flex-end;
  width: auto;
  max-width: min(78%, 720px);
  padding: 10px 16px;
  color: var(--ink);
  background: var(--surface-soft);
  border-radius: 20px;
}

.message.assistant {
  align-self: flex-start;
  background: transparent;
}

.message small {
  display: block;
  margin-top: 8px;
  color: inherit;
  opacity: 0.7;
}

.message-text {
  white-space: pre-wrap;
}

.usage-panel,
.reports-panel {
  grid-column: 1 / -1;
}

/* Problematic and unanswered requests for the administrator (AI-077). */
.report-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.report-tab[aria-pressed="true"] {
  border-color: var(--brand);
  color: var(--ink);
  background: var(--brand);
}

.report-tab[aria-pressed="true"]:hover:not(:disabled) {
  background: var(--brand-dark);
}

.report-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px 12px;
  align-items: end;
  margin-bottom: 8px;
}

.report-filters select {
  width: 100%;
}

/* Download of the unanswered list (AI-108): its own row under the filters,
   outside the filter grid, so it never sits beside a select. */
.report-download {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 8px;
}

.report-download .supporting-copy {
  flex-basis: 100%;
  margin: 0;
}

/* Rules of use above the export form (AI-108): space before the first label. */
#export-hint {
  margin-bottom: 12px;
}

.report-list {
  display: grid;
  gap: 10px;
}

.report-item {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.report-item[data-category="violence"],
.report-item[data-category="crisis"] {
  border-left-color: var(--danger);
}

.report-item[data-category="distress"] {
  border-left-color: var(--warning);
}

.report-badge {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  color: var(--ink);
  background: var(--surface-soft);
  font-size: 0.75rem;
  font-weight: 700;
}

.report-item .text-button {
  min-height: 32px;
  padding: 4px 0;
}

.usage-table {
  border-collapse: collapse;
  font-size: 0.8rem;
  overflow-wrap: break-word;
}

.usage-table th,
.usage-table td {
  padding: 5px 8px;
  border: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.usage-table th:first-child,
.usage-table td:first-child {
  text-align: left;
}

.usage-table th {
  background: var(--surface-soft);
  font-weight: 650;
}

/* Register of the staff accesses (AI-120): the width of the analysis grid,
   like the usage panel; the table scrolls inside its panel (.table-scroll). */
.access-log-panel {
  grid-column: 1 / -1;
}

.access-log-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: end;
  margin-bottom: 8px;
}

.access-log-controls select {
  min-width: 170px;
}

.access-log-anomalies-title {
  margin: 8px 0 4px;
  font-size: 0.95rem;
}

.access-log-anomaly-list {
  margin: 0 0 8px;
  padding-left: 1.2em;
  color: var(--danger);
}

.access-log-table th,
.access-log-table td {
  text-align: left;
}

.access-log-table td.access-log-detail {
  min-width: 16em;
  max-width: 32em;
  white-space: normal;
}

.access-log-table tr.access-log-not-ok td {
  color: var(--danger);
}

.privacy-translation {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92em;
}

/* Rendered answers (AI-021): markdown subset and formulas from render.js. */
.message-text.rich-text {
  white-space: normal;
}

.rich-text p {
  margin: 0 0 0.6em;
}

.rich-text > :last-child {
  margin-bottom: 0;
}

.rich-text ul,
.rich-text ol {
  margin: 0 0 0.6em;
  padding-left: 1.3em;
}

.rich-text li {
  margin: 0.15em 0;
}

.rich-text .answer-heading {
  margin-top: 0.4em;
  font-weight: 650;
}

.rich-text code {
  padding: 0 0.25em;
  border-radius: var(--radius);
  background: var(--surface-soft, #eef2f0);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
}

.rich-text pre {
  margin: 0 0 0.6em;
  padding: 8px 10px;
  overflow-x: auto;
  border-radius: var(--radius);
  background: var(--surface-soft, #eef2f0);
  white-space: pre;
}

.rich-text pre code {
  padding: 0;
  background: none;
}

.math-inline,
.math-block {
  font-family: "Cambria Math", "STIX Two Math", "Latin Modern Math", "Times New Roman", serif;
  font-style: normal;
}

.math-inline {
  white-space: nowrap;
}

.math-block {
  display: block;
  margin: 0.5em 0 0.7em;
  overflow-x: auto;
  font-size: 1.08em;
  text-align: center;
}

.math-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin: 0 0.12em;
  font-size: 0.92em;
  vertical-align: middle;
}

.math-num {
  padding: 0 0.2em 0.05em;
  border-bottom: 1px solid currentColor;
}

.math-den {
  padding: 0.05em 0.2em 0;
}

.math-over {
  text-decoration: overline;
}

.math-sqrt {
  padding: 0 0.1em;
  border-top: 1px solid currentColor;
}

.table-scroll {
  margin: 0.4em 0 0.7em;
  overflow-x: auto;
}

.rich-text table {
  border-collapse: collapse;
  font-size: 0.86rem;
  /* Wrap between words only; the wrapper scrolls on narrow screens. */
  overflow-wrap: break-word;
}

.rich-text th,
.rich-text td {
  padding: 4px 8px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.rich-text th {
  background: var(--surface-soft, #eef2f0);
  font-weight: 650;
}

.message-citations {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
}

.message-citations strong {
  color: var(--ink);
}

.message-citations ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.message-citations a {
  color: var(--green-dark);
  text-decoration: underline;
}

.message-citations li {
  margin-top: 3px;
  overflow-wrap: anywhere;
}

/* "Continua sotto" (AI-115): shown by the script while part of the
   conversation is under the visible area. It lies over the end of the area
   and takes no room of its own (32px tall, margins of -40 and 8px). */
.messages-more {
  position: relative;
  z-index: 1;
  justify-self: center;
  min-height: 32px;
  margin: -40px 0 8px;
  padding: 4px 16px;
  border: 1px solid var(--footer);
  border-radius: 999px;
  color: #fff;
  background: var(--footer);
  font-size: 0.82rem;
  font-weight: 600;
}

.messages-more:hover {
  background: #000;
}

/* The question box is one line tall and grows with the text (the script
   sets its height, up to max-height); the button keeps its height at the
   bottom (AI-115, asked by the user: less room for box and button). */
.composer {
  padding: 14px 4px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  border-top: 0;
}

.composer .primary-button {
  min-width: 64px;
  min-height: 48px;
  font-size: 1rem;
}

.composer textarea {
  min-height: 48px;
  max-height: 160px;
  resize: none;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.composer-hint {
  margin: 8px 0 0;
  padding: 0 4px 6px;
  color: var(--ink);
  font-size: 0.78rem;
}

.answer-rating {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.answer-rating-label {
  margin-right: 6px;
}

.rating-star {
  min-width: 28px;
  min-height: 28px;
  padding: 2px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}

.rating-star.is-selected {
  color: var(--brand-dark);
}

.rating-star:hover,
.rating-star:focus-visible {
  color: var(--brand-dark);
}

.answer-rating-status {
  margin-left: 8px;
}

.privacy-line {
  margin: 0;
  padding: 0 4px 13px;
  color: var(--muted);
  font-size: 0.74rem;
}

.link-button {
  padding: 0;
  border: 0;
  color: var(--green-dark);
  background: none;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* Chat additions (AI-073): daily counter, waiting clock, copy button,
   previous conversations. */
.usage-line {
  margin: 0;
  padding: 0 4px 4px;
  color: var(--brand-ink);
  font-size: 0.78rem;
  font-weight: 600;
}

.usage-line.is-exhausted {
  color: var(--danger);
}

.message.thinking {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  width: auto;
  color: var(--muted);
}

.thinking-label {
  animation: thinking-pulse 1.4s ease-in-out infinite;
}

.thinking-time {
  font-variant-numeric: tabular-nums;
  font-size: 0.86rem;
}

@keyframes thinking-pulse {
  50% {
    opacity: 0.45;
  }
}

@media (prefers-reduced-motion: reduce) {
  .thinking-label {
    animation: none;
  }
}

.message-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.copy-answer {
  padding: 4px 6px;
  font-size: 0.8rem;
  font-weight: 600;
}

.copy-buffer {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.conversation-history {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.conversation-history h2 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.conversation-history ul {
  display: grid;
  gap: 4px;
  max-height: 280px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.conversation-button {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.conversation-button:hover {
  background: var(--surface-soft);
}

.conversation-button.is-active {
  border-color: var(--green);
  background: var(--green-pale);
}

.conversation-title {
  overflow: hidden;
  font-size: 0.84rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-button small {
  color: var(--muted);
  font-size: 0.72rem;
}

.section-heading {
  margin-bottom: 20px;
}

.course-list-panel,
.admin-panel,
.analytics-panel {
  border-bottom: 4px solid var(--brand);
  border-radius: var(--radius);
}

.management-grid,
.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.course-list-panel,
.admin-panel,
.analytics-panel {
  padding: 20px;
}

.panel-heading {
  min-height: 42px;
  margin-bottom: 14px;
}

.panel-heading h2 {
  margin-bottom: 0;
}

.course-list {
  display: grid;
  gap: 10px;
}

.course-item {
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.course-item h3 {
  margin: 0 0 4px;
  font-size: 0.98rem;
}

.course-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.document-list {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  padding: 9px 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.document-list li {
  padding: 5px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

.document-list .document-name {
  flex: 1 1 12rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.document-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.document-status-action,
.document-ingest-action,
.document-chunks-action {
  min-height: 32px;
  padding: 5px 9px;
  font-size: 0.74rem;
}

.ingestion-summary {
  flex: 1 1 100%;
  display: grid;
  gap: 2px;
  font-size: 0.74rem;
  line-height: 1.45;
}

.ingestion-warning {
  color: var(--warning);
}

.ingestion-error {
  color: #9b3628;
}

.document-status-action.is-danger {
  border-color: #c88479;
  color: #9b3628;
}

.course-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.course-teachers {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.teacher-chip {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  overflow-wrap: anywhere;
  gap: 6px;
  padding: 2px 4px 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
}

.teacher-chip.is-inactive {
  color: var(--muted);
}

.teacher-unassign {
  min-height: 28px;
  padding: 2px 6px;
  font-size: 0.72rem;
}

#assign-teacher-form {
  margin-top: 18px;
}

.course-status-action {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 0.78rem;
}

.course-status-action.is-danger {
  border-color: #c88479;
  color: #9b3628;
}

.stacked-form {
  display: grid;
  gap: 8px;
}

.stacked-form label:not(:first-child) {
  margin-top: 6px;
}

.stacked-form .primary-button {
  margin-top: 8px;
  justify-self: start;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-row label {
  margin: 6px 0 8px;
}

.checkbox-row {
  min-height: 40px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 550;
  text-transform: none;
}

.checkbox-row input {
  width: 18px;
  min-height: 18px;
  margin: 0;
}

.divider {
  height: 1px;
  margin: 26px 0 20px;
  background: var(--line);
}

.test-output {
  min-height: 44px;
  margin-top: 16px;
  padding: 10px 12px;
  display: block;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-wrap: anywhere;
  font-size: 0.82rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  padding: 20px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.6);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  padding: clamp(22px, 5vw, 36px);
  overflow-y: auto;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.modal-panel p {
  color: var(--muted);
  line-height: 1.6;
}

.compact-modal {
  width: min(430px, 100%);
}

.wide-modal {
  width: min(820px, 100%);
}

.search-form {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.chunk-list {
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
  list-style: none;
}

.chunk-item {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.chunk-item strong {
  display: block;
  margin-bottom: 6px;
  color: var(--green-dark);
  font-size: 0.8rem;
}

.modal-panel .chunk-text {
  margin: 0;
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.close-button {
  position: absolute;
  top: 14px;
  right: 14px;
  border: 0;
  font-size: 1.45rem;
}

.toast-region {
  position: fixed;
  /* On the right edge of the content and above the footer, so a message
     never covers the signature (AI-114). */
  right: var(--edge);
  bottom: calc(var(--footer-h) + 12px);
  z-index: 40;
  width: min(380px, calc(100% - 2 * var(--gutter)));
  display: grid;
  gap: 8px;
}

.toast {
  padding: 12px 14px;
  color: #fff;
  background: var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  line-height: 1.4;
}

.toast.error {
  background: #8f3426;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 1200px) {
  .account-name {
    max-width: 40ch;
  }
}

/* On a computer the header and the air around the content grow with the
   height of the window, from 60 to 72px and from 14 to 32px between 860
   and about 930px: no jump in the room left to the conversation (AI-114).
   The name of the Department stays on one line; a long account name is
   cut first. */
@media (min-width: 821px) {
  :root {
    --header-h: clamp(60px, calc(60px + (100vh - 860px) / 4), 72px);
    --view-pad: clamp(14px, min(3vw, calc(14px + (100vh - 860px) / 4)), 32px);
  }

  .brand-logo {
    height: clamp(40px, calc(var(--header-h) - 20px), 48px);
  }

  .brand-block {
    flex-shrink: 0;
  }

  .brand-link span {
    white-space: nowrap;
  }

  .header-right {
    min-width: 0;
  }

  /* The conversation scrolls in its own area and the page decides where it
     stands while an answer is written (AI-115): the browser must not keep
     it glued to the end. On phones the page scrolls as a whole and the
     browser keeps what is on screen where it is. */
  .messages {
    overflow-anchor: none;
  }
}

/* Laptop windows (up to 860px tall): the lowest header and the least air,
   so the conversation keeps the room it had before the footer (AI-114). */
@media (min-width: 821px) and (max-height: 860px) {
  :root {
    --header-h: 60px;
    --view-pad: 14px;
  }

  /* The box of an empty chat is more compact, so that three suggested
     questions fit a laptop window without scrolling (AI-115). */
  .messages:has(> .empty-chat:not([hidden])) {
    padding-block: 6px;
  }

  .empty-chat div {
    padding: 12px 16px;
  }

  .empty-chat h2 {
    margin-bottom: 8px;
  }

  /* With .empty-chat in front: the base rules come later in this file. */
  .empty-chat .suggestions {
    margin-top: 10px;
  }

  .empty-chat .suggestions h3 {
    margin-bottom: 6px;
  }

  .empty-chat .suggestion-list {
    gap: 6px;
  }

  .empty-chat .suggestion-button {
    min-height: 40px;
    padding: 7px 12px;
  }

  .brand-logo {
    height: 40px;
  }
}

/* Lower still (a laptop window with the bars of the browser): less air
   around the title and the question box, and no introduction in the box of
   an empty chat, so that the three suggested questions stay in view
   (AI-115). The name of the course is in the title above. */
@media (min-width: 821px) and (max-height: 720px) {
  .chat-heading {
    padding: 6px 16px;
  }

  .composer {
    padding-top: 8px;
  }

  /* Only when the suggested questions are shown: the same paragraph also
     carries "select a course" and "course not available". */
  .empty-chat:has(.suggestions:not([hidden])) #empty-chat-copy {
    display: none;
  }
}

@media (max-width: 820px) {
  /* minmax(0, 1fr): a wide table scrolls inside its panel instead of
     widening the page. */
  .chat-layout,
  .management-grid,
  .analytics-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Tablets and phones (AI-114): the page scrolls as a whole and the
     header grows to two rows when name and account do not fit. */
  main,
  .view {
    min-height: 0;
  }

  .app-header {
    height: auto;
    min-height: 56px;
  }

  .header-inner {
    height: auto;
    min-height: 52px;
    padding: 6px var(--gutter);
    flex-wrap: wrap;
    gap: 6px 12px;
  }

  .brand-block {
    flex: 0 0 auto;
    gap: 10px;
  }

  .brand-logo {
    height: 38px;
  }

  .brand-block > .brand-link {
    padding-left: 10px;
  }

  .brand-block strong {
    font-size: 0.95rem;
  }

  .brand-link span {
    display: none;
  }

  /* Only the dot shows; the text stays for assistive technology. */
  #service-state-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .header-right {
    min-width: 0;
    margin-left: auto;
    gap: 10px;
  }

  .header-login,
  .header-logout {
    min-height: 34px;
    padding: 4px 10px;
    font-size: 0.82rem;
  }

  .account-name {
    max-width: 14ch;
  }

  /* The footer is not fixed here: the usual corner. */
  .toast-region {
    bottom: 16px;
  }

  .chat-layout,
  .chat-layout.is-collapsed {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    min-height: auto;
  }

  .chat-layout.is-collapsed .course-sidebar > :not(.sidebar-toggle) {
    display: revert;
  }

  .sidebar-toggle {
    display: none;
  }

  .course-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 14px;
    align-items: end;
    padding: 12px 0 16px;
    border-right: 0;
    border-bottom: 3px solid var(--brand);
    overflow: visible;
  }

  .course-sidebar > label {
    grid-column: 1 / -1;
  }

  .course-sidebar .course-facts {
    grid-column: 1 / -1;
    margin: 8px 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .course-facts > div {
    padding: 8px;
    display: block;
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }

  .course-facts dd {
    margin-top: 4px;
  }

  .course-sidebar .secondary-button {
    width: auto;
  }

  .chat-tool {
    min-height: 590px;
  }
}

@media (max-width: 560px) {
  .search-form {
    grid-template-columns: 1fr;
  }

  /* One 12px edge for header, menu, content and footer. */
  .header-inner {
    padding: 6px 12px;
  }

  .toast-region {
    right: 12px;
    width: calc(100% - 24px);
  }

  .primary-tabs {
    padding: 0 12px;
    gap: 20px;
  }

  .tab-button {
    flex: 0 0 auto;
    font-size: 0.86rem;
  }

  .view {
    padding: 12px;
  }

  /* The signature is a short list, one item per line. */
  .footer-inner {
    padding: 8px 12px;
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-separator {
    display: none;
  }

  .course-sidebar {
    padding: 10px 0 14px;
    grid-template-columns: 1fr;
  }

  .course-sidebar > label,
  .course-sidebar .course-facts {
    grid-column: 1;
  }

  .course-sidebar .secondary-button {
    width: 100%;
  }

  .chat-tool {
    min-height: calc(100vh - 310px);
  }

  .chat-heading,
  .section-heading {
    align-items: flex-start;
  }

  .section-heading {
    display: grid;
  }

  .messages {
    padding: 12px;
  }

  .message {
    width: 90%;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .composer .primary-button {
    width: 100%;
  }

  .empty-chat img {
    aspect-ratio: 2 / 1;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .course-list-panel,
  .admin-panel,
  .analytics-panel {
    padding: 15px;
  }

  .course-item {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* The narrowest phones: the four sections of the menu fit the width. */
@media (max-width: 360px) {
  .primary-tabs {
    gap: 12px;
  }

  .tab-button {
    font-size: 0.8rem;
  }
}

/* On paper backgrounds are dropped: the signature must not print white. */
@media print {
  /* Fixed parts would print over the text of every page. */
  .skip-link,
  .toast-region {
    display: none;
  }

  .app-footer {
    color: var(--ink);
    background: none;
    border-top-color: var(--line);
  }

  .app-footer a {
    color: var(--ink);
  }
}

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

/* Course chat page (AI-053): the chat of one course, without course choice
   or sign-in (the account area of the header is hidden, AI-114) and so
   without the menu, which is for the signed-in staff (AI-118). Its header
   has a link to the sign-in of the main page (AI-121). */
.course-page .account-area,
.course-page label[for="chat-course"],
.course-page #chat-course {
  display: none;
}

/* Suggested questions shown while the chat is empty (AI-053). */
.suggestions {
  margin-top: 16px;
}

.suggestions h3 {
  margin: 0 0 8px;
  font-size: 0.88rem;
}

.suggestion-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.suggestion-button {
  width: 100%;
  min-height: 44px;
  /* Reached with the keyboard in a low window, the whole button and its
     focus ring are scrolled into view. */
  scroll-margin-block: 8px 18px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--green-dark);
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
}

.suggestion-button:hover {
  border-color: var(--green);
  background: var(--green-pale);
}

/* Course page link and suggestion editor in the staff course list. */
.course-page-link,
.course-suggestions {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
}

.course-suggestions h4 {
  margin: 0;
  font-size: 0.88rem;
}

.course-link-row,
.suggestion-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.course-link-row input,
.suggestion-row input[type="text"] {
  flex: 1 1 16rem;
  width: auto;
  min-width: 0;
}

.suggestion-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.suggestion-toggle input {
  width: auto;
  min-height: 0;
}

/* Links to the single-course chat pages (AI-057). */
.course-pages {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.course-pages h2 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.course-pages ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.course-pages a {
  color: var(--green-dark);
  font-size: 0.86rem;
  font-weight: 600;
}

/* Review queue and teacher FAQ (AI-062). */
.course-review {
  grid-column: 1 / -1;
  margin-top: 12px;
}

/* Download of the course questions (AI-107): a full row of the course card,
   so the explanation does not squeeze the review button beside it. */
.course-questions-download {
  grid-column: 1 / -1;
  margin-top: 8px;
}

.course-questions-download .supporting-copy {
  margin: 6px 0 0;
}

.review-groups,
.faq-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.review-group,
.faq-item {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.review-question {
  margin: 0 0 4px;
  font-weight: 600;
}

.review-meta {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.review-answer {
  margin: 6px 0;
  white-space: pre-wrap;
}

.review-actions,
.faq-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.faq-form {
  display: grid;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

/* Course dashboard (AI-110): one column of panels; charts are lists whose
   labels and numbers are text, with the bar as decoration only. */
.dashboard-notice {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--brand-pale);
  line-height: 1.5;
}

.dashboard-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: end;
  margin-bottom: 8px;
}

.dashboard-controls > div {
  flex: 1 1 240px;
  min-width: 0;
}

.dashboard-controls select {
  margin-top: 6px;
}

/* Full row under the controls, so the selects and the button stay aligned. */
.dashboard-day-note {
  flex: 1 0 100%;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.dashboard-status {
  min-height: 1.55em;
  margin: 8px 0 16px;
}

.dashboard-status.is-error {
  color: var(--danger);
  font-weight: 650;
}

.dashboard-content {
  display: grid;
  gap: 18px;
}

.dashboard-section {
  min-width: 0;
  overflow-wrap: anywhere;
}

.dashboard-section h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.dashboard-intro {
  margin-bottom: 14px;
}

.dashboard-note {
  margin-top: 12px;
}

.dashboard-empty {
  margin: 0;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface-soft);
}

.dashboard-tiles,
.dashboard-bars,
.dashboard-list,
.dashboard-terms {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dashboard-tiles {
  display: grid;
  /* Six tiles: three by two, two by three under 820 px, one column on phones. */
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-tile {
  min-width: 0;
  padding: 14px 16px;
  display: grid;
  gap: 2px;
  align-content: start;
  border: 1px solid var(--line);
  border-top: 4px solid var(--brand);
  border-radius: var(--radius);
  background: var(--surface);
}

.dashboard-tile-value {
  color: var(--brand-ink);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.dashboard-tile-label {
  font-weight: 650;
}

.dashboard-tile-context {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.dashboard-bars {
  display: grid;
  gap: 6px;
}

.dashboard-bar {
  display: grid;
  grid-template-columns: minmax(0, 16rem) minmax(0, 1fr) minmax(5.5rem, auto);
  gap: 2px 12px;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}

.dashboard-bar-label {
  grid-column: 1;
  grid-row: 1;
  font-size: 0.88rem;
}

.dashboard-bar-track {
  grid-column: 2;
  grid-row: 1;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.dashboard-bar-fill {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: 999px;
  background: var(--brand);
}

.dashboard-bar-value {
  grid-column: 3;
  grid-row: 1;
  font-size: 0.85rem;
  font-weight: 650;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.dashboard-bar-note,
.dashboard-bar details {
  grid-column: 1 / -1;
}

.dashboard-bar-note,
.dashboard-sources {
  color: var(--muted);
  font-size: 0.8rem;
}

.dashboard-sources {
  margin: 6px 0 0;
}

.dashboard-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 28px;
}

.dashboard-columns .dashboard-bar {
  grid-template-columns: minmax(0, 12rem) minmax(0, 1fr) minmax(5.5rem, auto);
}

.dashboard-material + .dashboard-material {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.dashboard-list {
  display: grid;
  gap: 8px;
}

.dashboard-item {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.dashboard-suggestion {
  border-left: 4px solid var(--brand);
}

.dashboard-detail {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.dashboard-section summary {
  min-height: 32px;
  padding: 4px 0;
  cursor: pointer;
  color: var(--brand-ink);
  font-weight: 650;
}

.dashboard-section summary:focus-visible {
  outline: 3px solid var(--brand-ink);
  outline-offset: 2px;
}

.dashboard-group summary {
  color: var(--ink);
}

.dashboard-group-label {
  margin-right: 8px;
}

.dashboard-texts {
  margin: 6px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 4px;
  line-height: 1.45;
}

.dashboard-terms {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dashboard-terms li {
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  font-size: 0.85rem;
}

.dashboard-terms strong {
  color: var(--brand-ink);
}

/* Suggested questions (AI-111): an outlined badge, apart from the filled
   ones for counts and stars, and a quiet count next to a group's size. */
.dashboard-suggested-badge {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--muted);
  font-weight: 600;
}

.dashboard-suggested-count {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
}

@media (max-width: 820px) {
  .dashboard-columns {
    grid-template-columns: 1fr;
  }

  .dashboard-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .dashboard-bar,
  .dashboard-columns .dashboard-bar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .dashboard-bar-label {
    grid-column: 1 / -1;
  }

  .dashboard-bar-track {
    grid-column: 1;
    grid-row: 2;
  }

  .dashboard-bar-value {
    grid-column: 2;
    grid-row: 2;
  }

  .dashboard-controls .primary-button {
    width: 100%;
  }

  .dashboard-tiles {
    grid-template-columns: 1fr;
  }

  .dashboard-tile-value {
    font-size: 1.6rem;
  }
}
