/* Student comments on graded work. Keep the native desktop column width;
   the layout helper releases that column when the panel stacks on mobile. */
/* Clipping preserves the editor's horizontal boundary without making body a
   separate scroll container that prevents the feedback column from sticking. */
body[data-hypatia-design="modern"][data-role="student"][data-hypatia-editor="true"][feedback-panel] { overflow-x: clip !important; }
body[data-hypatia-design="modern"][data-role="student"] #feedback-panel.hypatia-student-feedback {
  position: sticky;
  top: calc(var(--ht-solve-top, 68px) + 8px);
  max-height: var(--ht-feedback-available-height, calc(100vh - var(--ht-solve-top, 68px) - var(--ht-solve-bottom-reserve, 60px) - 28px));
  min-height: 0;
  padding: 0 !important;
  background: var(--ht-paper) !important;
  border: 1px solid var(--ht-line) !important;
  border-radius: 14px !important;
  box-shadow: 0 4px 20px #172f4208;
  overflow: hidden;
}
body[data-hypatia-design="modern"][data-role="student"] #feedback-panel.hypatia-student-feedback:not(.d-none) {
  display: flex;
  flex-direction: column;
}
body[data-hypatia-design="modern"] .hypatia-feedback-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--ht-line);
}
body[data-hypatia-design="modern"] #hypatia-feedback-heading {
  flex: 1;
  margin: 0;
  color: var(--ht-ink);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.01em;
  line-height: 1.4;
}
body[data-hypatia-design="modern"] .hypatia-feedback-count {
  display: inline-grid;
  place-items: center;
  min-width: 25px;
  min-height: 25px;
  padding: 2px 7px;
  border-radius: 7px;
  background: var(--ht-selected);
  color: var(--ht-blue);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
body[data-hypatia-design="modern"] .hypatia-feedback-toggle { display: none; }
body[data-hypatia-design="modern"] .hypatia-student-feedback #feedback-comments-list {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px;
  scrollbar-width: thin;
}
body[data-hypatia-design="modern"] .hypatia-student-feedback #feedback-comments-list[hidden] { display: none; }
body[data-hypatia-design="modern"] .hypatia-student-feedback #feedback-comments-list > .card {
  margin-bottom: 12px !important;
  border: 1px solid var(--ht-line);
  border-radius: 10px !important;
  background: var(--ht-soft);
  box-shadow: none;
  transition: border-color .15s ease;
}
body[data-hypatia-design="modern"] .hypatia-student-feedback #feedback-comments-list > .card:last-child { margin-bottom: 0 !important; }
body[data-hypatia-design="modern"] .hypatia-student-feedback #feedback-comments-list > .card:is(:hover, :focus-visible) {
  border-color: var(--ht-light);
  background: var(--ht-selected) !important;
}
body[data-hypatia-design="modern"] .hypatia-student-feedback #feedback-comments-list > .card:focus-visible {
  outline: 2px solid var(--ht-light);
  outline-offset: 2px;
}
body[data-hypatia-design="modern"] .hypatia-student-feedback .card-body {
  padding: 14px !important;
  min-width: 0;
}
body[data-hypatia-design="modern"] .hypatia-student-feedback .card-body > .font-weight-bold {
  margin-bottom: 7px !important;
  color: var(--ht-blue);
  font-size: 12px;
  font-weight: 600 !important;
  line-height: 1.5;
}
body[data-hypatia-design="modern"] .hypatia-student-feedback .comment-text {
  margin: 0;
  color: var(--ht-ink);
  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
@media (max-width: 1000px) {
  body[data-hypatia-design="modern"][data-role="student"] .hypatia-feedback-workspace { flex-wrap: wrap; }
  body[data-hypatia-design="modern"][data-role="student"] .hypatia-feedback-workspace > section.editor { flex-basis: 100%; }
  body[data-hypatia-design="modern"][data-role="student"] #feedback-panel.hypatia-student-feedback {
    position: relative;
    top: auto;
    order: -1;
    width: calc(100% - 32px) !important;
    max-width: none;
    flex: 0 0 calc(100% - 32px);
    margin: 0 16px 16px !important;
    max-height: none;
    box-shadow: none;
  }
  body[data-hypatia-design="modern"] .hypatia-feedback-header {
    min-height: 56px;
    padding: 5px 6px 5px 16px;
    gap: 8px;
  }
  body[data-hypatia-design="modern"] .hypatia-student-feedback[data-feedback-expanded="false"] .hypatia-feedback-header { border-bottom: 0; }
  body[data-hypatia-design="modern"] .hypatia-feedback-toggle {
    display: inline-grid;
    place-items: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ht-blue);
    cursor: pointer;
  }
  body[data-hypatia-design="modern"] .hypatia-feedback-toggle:hover { background: var(--ht-selected); }
  body[data-hypatia-design="modern"] .hypatia-feedback-toggle > svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  body[data-hypatia-design="modern"] .hypatia-feedback-toggle[aria-expanded="true"] > svg { transform: rotate(180deg); }
  body[data-hypatia-design="modern"] .hypatia-student-feedback #feedback-comments-list {
    max-height: min(50vh, 420px);
    max-height: min(50dvh, 420px);
    padding: 14px;
  }
}
@media print {
  body[data-hypatia-design="modern"][data-role="student"] #feedback-panel.hypatia-student-feedback {
    position: static;
    max-height: none;
    overflow: visible;
    break-inside: avoid;
  }
  body[data-hypatia-design="modern"] .hypatia-student-feedback #feedback-comments-list,
  body[data-hypatia-design="modern"] .hypatia-student-feedback #feedback-comments-list[hidden] { display: block !important; max-height: none; overflow: visible; }
  body[data-hypatia-design="modern"] .hypatia-feedback-toggle { display: none; }
}
