/*
 * Shared form and action-button refinements.
 * Loaded by the mock shell for every role and feature page.
 */

[hidden] {
  display: none !important;
}

.avatar img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.request-error-state {
  display: grid;
  justify-items: start;
  gap: 10px;
  margin-bottom: 24px;
  padding: 24px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  background: var(--surface);
}

.request-error-status {
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.request-error-icon {
  color: var(--primary);
  font-size: 32px;
}

.request-error-state h2,
.request-error-state p {
  margin: 0;
}

.request-error-state h2 {
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
}

.request-error-content {
  display: grid;
  justify-items: start;
  gap: 16px;
  color: var(--muted);
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  min-height: 46px;
  padding: 11px 16px 11px var(--control-padding-left, 16px) !important;
  line-height: 1.4;
}

textarea {
  padding-block: 12px;
}

select:not([multiple]) {
  appearance: none;
  padding-right: 44px !important;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Cpath fill='%236f6f6f' d='m7 10 5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center !important;
  background-size: 20px;
}

select[multiple] {
  padding: 12px 16px !important;
}

input::placeholder,
textarea::placeholder {
  color: #8a8a8a;
  opacity: 1;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-height: 0;
  margin: 0;
}

label {
  gap: 8px;
  line-height: 1.35;
}

.fields {
  column-gap: 20px;
  row-gap: 18px;
}

.form-section {
  gap: 20px;
}

.filters {
  gap: 14px;
}

.filters > .search {
  flex: 0 1 50%;
  width: 50%;
}

.search input {
  /* Reserve icon space through the shared padding rule, without competing overrides. */
  --control-padding-left: 56px;
  text-indent: 0;
}

.search .material-symbols-rounded {
  top: 50%;
  left: 16px;
  z-index: 1;
  width: 24px;
  height: 24px;
  overflow: hidden;
  transform: translateY(-50%);
  line-height: 1;
  pointer-events: none;
}

.filters > select {
  width: auto;
  min-width: 0;
  flex: 1 1 0;
}

.module-row {
  align-items: flex-start;
}

.module-row-actions {
  display: flex;
  min-width: 110px;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.module-row-summary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  white-space: nowrap;
}

.primary-link {
  color: var(--primary) !important;
  font-weight: 500;
  text-decoration: none;
}

button.primary-link {
  min-height: auto;
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  font-weight: 500;
  line-height: inherit;
}

.primary-link:hover {
  color: var(--primary-dark) !important;
  text-decoration: underline;
}

.table td:last-child a,
.table td:last-child .secondary-btn,
.list-row > a:not(.btn):not(.secondary-btn),
.section-head > a:not(.btn):not(.secondary-btn),
.card > a.secondary-btn {
  color: var(--primary) !important;
  font-weight: 500;
}

.table td:last-child a:hover,
.table td:last-child .secondary-btn:hover,
.list-row > a:not(.btn):not(.secondary-btn):hover,
.section-head > a:not(.btn):not(.secondary-btn):hover,
.card > a.secondary-btn:hover {
  color: var(--primary-dark) !important;
}

.table td:last-child .secondary-btn {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-decoration: none;
}

.table td:last-child .secondary-btn:hover {
  background: transparent;
  text-decoration: underline;
}

.person > span:last-child {
  display: grid;
  gap: 3px;
}

.person small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
}

.card > blockquote {
  margin: 10px 0 18px;
  line-height: 1.6;
}

.module-detail-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
}

.module-detail-copy {
  min-width: 0;
  flex: 1;
}

.module-detail-copy h1 {
  margin: 10px 0 6px;
}

.module-detail-copy p {
  max-width: 760px;
  margin: 0;
}

.module-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.module-assessment-action {
  display: grid;
  min-width: 250px;
  gap: 10px;
  padding-left: 24px;
  border-left: 1px solid var(--line);
}

.module-assessment-action small,
.module-assessment-action span {
  color: var(--muted);
}

.module-assessment-action .btn {
  width: 100%;
}

.learning-content {
  max-width: none;
  min-height: 420px;
}

.assessment-type-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.assessment-type-item {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.assessment-type-item p {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.5;
}

.assessment-card {
  display: flex;
  min-height: 100%;
  flex-direction: column;
}

.assessment-card .assessment-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 18px;
}

.assessment-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 6px;
  background: var(--success-soft);
}

.assessment-result.pending {
  background: var(--warning-soft);
}

.assessment-result b {
  font-size: 18px;
}

.result-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.result-score {
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
}

.question-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.answer-comparison {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.result-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.result-option {
  display: flex;
  position: relative;
  min-height: 48px;
  align-items: center;
  justify-content: flex-start;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.result-option.correct {
  border-color: #65a985;
  background: var(--success-soft);
  color: var(--success);
}

.result-option.incorrect {
  border-color: #d76e73;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.selected-answer-indicator {
  position: absolute;
  top: 9px;
  right: 10px;
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

.selected-answer-indicator.correct {
  color: var(--success);
}

.selected-answer-indicator.incorrect {
  color: var(--primary-dark);
}

.result-option:has(> .selected-answer-indicator) {
  padding-right: 46px;
}

.answer-review {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.answer-review small,
.answer-review b {
  display: block;
}

.answer-review b {
  margin-top: 6px;
}

.answer-review.correct {
  border-color: #7bbb9b;
  background: var(--success-soft);
}

.answer-review.incorrect {
  border-color: #e4a2a5;
  background: var(--primary-soft);
}

.result-explanation {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-left: 3px solid var(--info);
  background: var(--info-soft);
}

.btn {
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: none;
}

.btn:hover {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
  box-shadow: none;
}

.btn:focus,
.btn:focus-visible,
.btn:active {
  box-shadow: none;
}

.btn:focus-visible {
  outline: 2px solid rgba(226, 27, 35, 0.24);
  outline-offset: 2px;
}

dialog.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(440px, 100%);
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

dialog.drawer[open] {
  animation: drawer-enter 180ms ease-out;
}

dialog.drawer::backdrop {
  background: rgba(20, 20, 20, 0.42);
}

.drawer-panel {
  display: flex;
  min-height: 100%;
  max-height: 100dvh;
  overflow-y: auto;
  flex-direction: column;
  padding: 28px;
  background: #fff;
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h2,
.drawer-head p {
  margin: 0;
}

.drawer-head p {
  margin-top: 5px;
}

.drawer-body {
  display: grid;
  gap: 20px;
  padding-top: 22px;
}

.drawer-body fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.drawer-body legend {
  margin-bottom: 8px;
  color: #555;
  font-size: 12px;
  font-weight: 500;
}

.drawer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: auto;
  padding-top: 24px;
}

@keyframes drawer-enter {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@media (max-width: 600px) {
  .filters > .search,
  .filters > select {
    width: 100%;
    flex-basis: auto;
  }

  .drawer-panel {
    padding: 22px 18px;
  }

  .module-detail-hero {
    flex-direction: column;
  }

  .module-assessment-action {
    width: 100%;
    padding-top: 20px;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .assessment-type-guide {
    grid-template-columns: 1fr;
  }

  .result-summary,
  .question-result-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .answer-comparison {
    grid-template-columns: 1fr;
  }

  .result-options {
    grid-template-columns: 1fr;
  }
}

/* Shared typography, spacing, controls and overlays. */
body {
  font-family: Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* Small layout helpers retained locally after removing the Tailwind CDN. */
.text-2xl {
  font-size: 22px;
}
.font-bold {
  font-weight: 700;
}
.text-red-600 {
  color: var(--primary-dark);
}
.text-blue-600 {
  color: var(--info);
}
.mt-2 {
  margin-top: 8px;
}
.my-8 {
  margin-block: 32px;
}
.fit-content-control {
  width: auto;
}
button,
input,
select,
textarea {
  font-family: inherit;
}
.main .top {
  align-items: flex-start;
  margin-bottom: 24px;
}
.main .top h1 {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
}
.main h2 {
  font-size: 17px;
  font-weight: 500;
  line-height: 1.35;
}
.main h3 {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
}
.table th,
.table td b,
.table td strong,
.list-row b,
.cohort-card h2,
.program-card h2,
.module-card h2,
.question-preview header b,
.question-card b {
  font-weight: 500;
}
.table td,
.table th {
  vertical-align: middle;
}
.table td small,
.person small {
  font-weight: 400;
  color: var(--muted);
}
.btn,
.secondary-btn,
.danger-btn {
  min-height: 40px;
  padding: 9px 16px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  box-shadow: none;
}
.secondary-btn,
.danger-btn {
  border: 1px solid var(--line);
  background: var(--surface);
}
.secondary-btn {
  color: var(--ink);
}
.danger-btn {
  color: var(--primary-dark);
}
.secondary-btn:hover:not(:disabled),
.danger-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-soft);
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.action-row,
.inline-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.action-row {
  justify-content: flex-end;
}
.filters .search {
  position: relative;
  min-width: 0;
}
.filters .search .material-symbols-rounded {
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
dialog:not(.drawer) {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 28px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
}
dialog::backdrop {
  background: rgba(20, 20, 20, 0.42);
}
dialog:not(.drawer) h2 {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 500;
}
dialog:not(.drawer) p {
  line-height: 1.5;
}
dialog:not(.drawer) .action-row {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
dialog:not(.drawer) .form-section {
  display: grid;
  gap: 20px;
  margin: 0;
}
.drawer-head h2 {
  font-size: 20px;
  font-weight: 500;
}
.drawer-actions {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 20px;
}
@media (max-width: 600px) {
  dialog:not(.drawer) {
    padding: 20px;
    max-height: calc(100dvh - 32px);
  }
  .drawer-panel {
    padding: 20px;
  }
}
/* Canonical list surfaces: compact summary rows inside one bordered card. */
.table {
  background: var(--surface);
}

.table thead {
  background: var(--page);
}

.table tbody tr {
  transition: background-color 120ms ease-out;
}

.table tbody tr:hover {
  background: #fafafa;
}

.table tbody tr:focus-within {
  background: var(--primary-soft);
}

.table tfoot {
  border-top: 1px solid var(--line);
  background: var(--page);
}

.table tfoot th,
.table tfoot td {
  padding: 12px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

.main .program-grid,
.main .cohort-grid,
.main .module-grid,
[data-assignment-grid] {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.program-grid > .card,
.cohort-grid > .card,
.module-grid > .card,
[data-assignment-grid] > .card {
  min-height: 0;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}

.program-grid > .card:last-child,
.cohort-grid > .card:last-child,
.module-grid > .card:last-child,
[data-assignment-grid] > .card:last-child {
  border-bottom: 0;
}

.program-grid > .program-card,
.module-grid > .module-card {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) minmax(300px, 2fr) auto;
  grid-template-areas:
    "title details status"
    "description details action";
  align-items: center;
  gap: 6px 24px;
  padding: 16px 18px;
}

.program-grid > .program-card > h2,
.module-grid > .module-card > h2 {
  grid-area: title;
  margin: 0;
  font-size: 14px;
  font-weight: 500;
}

.program-grid > .program-card > p,
.module-grid > .module-card > p {
  grid-area: description;
  margin: 0;
  color: var(--muted);
}

.program-grid > .program-card > .chip,
.module-grid > .module-card > .chip {
  grid-area: status;
  justify-self: end;
}

.program-grid > .program-card > .detail-list,
.module-grid > .module-card > .detail-list {
  grid-area: details;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 20px;
  margin: 0;
}

.program-grid > .program-card > .secondary-btn,
.module-grid > .module-card > .module-card-actions {
  grid-area: action;
  justify-self: end;
  align-self: end;
  margin: 0;
}

.cohort-grid > .cohort-card {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) repeat(3, minmax(130px, 1fr)) auto;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
}

.cohort-grid > .cohort-card > .cohort-card-head {
  display: grid;
  gap: 8px;
  padding: 0;
  border: 0;
}

.cohort-grid > .cohort-card h2,
.cohort-grid > .card:not(.cohort-card) h2,
[data-assignment-grid] > .assessment-card > h2,
.module-row h3 {
  font-size: 14px;
  font-weight: 500;
}

.program-grid .secondary-btn,
.module-grid .secondary-btn,
.module-grid .btn,
.cohort-grid .secondary-btn,
[data-assignment-grid] .btn {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  box-shadow: none;
}

.program-grid .secondary-btn:hover,
.module-grid .secondary-btn:hover,
.module-grid .btn:hover,
.cohort-grid .secondary-btn:hover,
[data-assignment-grid] .btn:hover {
  background: transparent;
  color: var(--primary-dark);
  text-decoration: underline;
}

.cohort-grid > .cohort-card > .cohort-card-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
  padding: 0;
  border: 0;
}

.cohort-grid > .cohort-card > .cohort-card-schedule {
  min-height: 0;
  grid-template-rows: auto;
}

.cohort-grid > .cohort-card > .cohort-card-schedule span {
  grid-column: auto;
}

.cohort-grid > .cohort-card > .cohort-card-actions {
  margin: 0;
  padding: 0;
}

.cohort-grid > .card:not(.cohort-card) {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(280px, 1.5fr) auto;
  align-items: center;
  gap: 6px 20px;
  padding: 16px 18px;
}

.cohort-grid > .card:not(.cohort-card) > .chip,
.cohort-grid > .card:not(.cohort-card) > a {
  justify-self: end;
}

.cohort-grid > .card:not(.cohort-card) > h2,
.cohort-grid > .card:not(.cohort-card) > p {
  margin: 0;
}

.cohort-grid > .card:not(.cohort-card) > .schedule {
  grid-row: 1 / span 2;
  grid-column: 2;
}

[data-assignment-grid] > .assessment-card {
  display: grid;
  grid-template-columns: minmax(180px, auto) minmax(220px, 1fr) minmax(280px, 1.5fr) auto;
  grid-template-areas:
    "badges title details action"
    "badges description details action";
  align-items: center;
  gap: 8px 20px;
  padding: 16px 18px;
}

[data-assignment-grid] > .assessment-card > div:first-child {
  grid-area: badges;
}

[data-assignment-grid] > .assessment-card > h2 {
  grid-area: title;
  margin: 0;
}

[data-assignment-grid] > .assessment-card > p {
  grid-area: description;
  margin: 0;
  color: var(--muted);
}

[data-assignment-grid] > .assessment-card > .detail-list,
[data-assignment-grid] > .assessment-card > .assessment-result {
  grid-area: details;
  margin: 0;
}

[data-assignment-grid] > .assessment-card > .assessment-card-actions {
  grid-area: action;
  justify-self: end;
  margin: 0;
  padding: 0;
}

/* Simple card footer: the user's third Tailwind pagination example. */
.pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 14px 12px 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.pagination[hidden] {
  display: none;
}
.pagination-summary {
  order: 0;
  margin-right: auto;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.pagination > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 44px;
  width: auto;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.pagination > button:first-child {
  order: 1;
}
.pagination > button:last-child {
  order: 2;
}
.pagination > button:hover:not(:disabled) {
  background: var(--page);
}
.pagination > button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.pagination > button:disabled {
  opacity: 0.45;
  cursor: default;
}
@media (max-width: 600px) {
  .pagination-summary {
    display: none;
  }
  .pagination {
    justify-content: space-between;
  }

  .program-grid > .program-card,
  .module-grid > .module-card,
  .cohort-grid > .cohort-card,
  .cohort-grid > .card:not(.cohort-card),
  [data-assignment-grid] > .assessment-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: none;
    gap: 8px 12px;
    padding: 16px;
  }

  .program-grid > .program-card > *,
  .module-grid > .module-card > *,
  .cohort-grid > .cohort-card > *,
  .cohort-grid > .card:not(.cohort-card) > *,
  [data-assignment-grid] > .assessment-card > * {
    grid-area: auto;
    grid-column: 1 / -1;
  }

  .program-grid > .program-card > .chip,
  .module-grid > .module-card > .chip {
    grid-row: 1;
    grid-column: 2;
  }

  .program-grid > .program-card > h2,
  .module-grid > .module-card > h2 {
    grid-row: 1;
    grid-column: 1;
  }

  .program-grid > .program-card > .detail-list,
  .module-grid > .module-card > .detail-list {
    grid-template-columns: 1fr;
  }

  .program-grid > .program-card > .secondary-btn,
  .module-grid > .module-card > .module-card-actions,
  [data-assignment-grid] > .assessment-card > .assessment-card-actions {
    justify-self: start;
  }
}
