:root {
  --dca-ink: #172033;
  --dca-muted: #667085;
  --dca-line: #ddd5c7;
  --dca-paper: #fffaf0;
  --dca-bg: #f5f1e8;
  --dca-accent: #295f8f;
  --dca-accent-rgb: 41, 95, 143;
  --dca-ok: #227950;
  --dca-warn: #a15c00;
  --bs-body-bg: var(--dca-bg);
  --bs-body-color: var(--dca-ink);
  --bs-primary: var(--dca-accent);
  --bs-primary-rgb: var(--dca-accent-rgb);
  --bs-link-color: var(--dca-accent);
  --bs-link-hover-color: #1d466b;
  --bs-border-color: var(--dca-line);
  color-scheme: light;
}

body {
  background:
    radial-gradient(circle at top left, rgb(41 95 143 / 12%), transparent 34rem),
    linear-gradient(180deg, #f8f4ec 0%, var(--dca-bg) 42%);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-header {
  background: linear-gradient(135deg, var(--dca-ink), #24344f);
  color: white;
  overflow: hidden;
  padding: 1.125rem 0;
  width: 100%;
}

.app-header a {
  color: #d7eaff;
}

.app-topbar {
  padding-block: .125rem;
}

.app-container {
  box-sizing: border-box;
  width: 100%;
  padding-inline: clamp(1rem, 2.5vw, 2.5rem);
}

.app-topbar-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
  gap: 1rem;
  align-items: center;
  min-width: 0;
  width: 100%;
}

.app-brand {
  flex: 0 0 auto;
  color: white;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: .01em;
  text-decoration: none;
}

.app-brand:hover {
  color: white;
}

.app-nav {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}

.app-nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: .55rem .95rem;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 999px;
  color: #d7eaff;
  font-weight: 650;
  text-decoration: none;
}

.app-nav-link:hover,
.app-nav-link.active {
  background: rgb(255 255 255 / 13%);
  border-color: rgb(255 255 255 / 28%);
  color: white;
}

.app-userbar {
  display: flex;
  gap: .875rem;
  align-items: center;
  color: rgb(255 255 255 / 70%);
  font-size: .875rem;
  justify-content: flex-end;
  justify-self: end;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.app-userbar span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-userbar .logout-form {
  flex: 0 0 auto;
}

.app-userbar .logout-form button {
  white-space: nowrap;
}

.app-nav-separator {
  color: rgb(255 255 255 / 35%);
  font-weight: 700;
}

.app-nav-current {
  color: white;
  font-weight: 700;
}

@media (max-width: 760px) {
  .app-container {
    padding-inline: 1rem;
  }

  .app-topbar-inner {
    align-items: flex-start;
    grid-template-columns: 1fr;
  }

  .app-nav,
  .app-userbar {
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
  }

  .app-userbar span {
    white-space: normal;
  }
}

.app-shell {
  padding-block: 2rem;
}

.app-card {
  background: rgb(255 250 240 / 92%);
  border: 1px solid var(--dca-line);
  border-radius: 1.25rem;
  box-shadow: 0 .75rem 2rem rgb(23 32 51 / 7%);
}

.app-card-muted {
  background: #fbf5ea;
}

.text-muted-soft {
  color: var(--dca-muted);
}

.btn-primary {
  --bs-btn-bg: var(--dca-accent);
  --bs-btn-border-color: var(--dca-accent);
  --bs-btn-hover-bg: #214f78;
  --bs-btn-hover-border-color: #214f78;
}

.btn {
  --bs-btn-border-radius: .75rem;
  --bs-btn-font-weight: 650;
  box-shadow: 0 .25rem .75rem rgb(23 32 51 / 5%);
}

.btn-sm {
  --bs-btn-border-radius: .625rem;
}

.badge-soft {
  background: #ece5d8;
  color: #344054;
}

.badge-ok {
  background: #dff3e8;
  color: var(--dca-ok);
}

.badge-warn {
  background: #fff0d5;
  color: var(--dca-warn);
}

.logout-form {
  display: inline;
}

.logout-form button {
  border: 0;
  padding: 0;
  background: transparent;
  color: #d7eaff;
  text-decoration: underline;
}

body > header:not(.app-header) {
  background: linear-gradient(135deg, var(--dca-ink), #24344f);
  color: white;
  padding: 1.5rem clamp(1rem, 4vw, 2.5rem);
}

body > header:not(.app-header) a {
  color: #d7eaff;
}

body > main:not(.app-shell) {
  padding: 1.5rem clamp(1rem, 4vw, 2.5rem);
}

.button {
  display: inline-block;
  padding: .625rem .875rem;
  border-radius: .625rem;
  background: var(--dca-accent);
  color: white;
  text-decoration: none;
}

.button:hover {
  color: white;
  background: #214f78;
}

.button.secondary,
button.secondary {
  background: #5b6472;
  color: white;
}

.pill {
  display: inline-block;
  padding: .25rem .5625rem;
  border-radius: 999px;
  background: #ece5d8;
  color: #344054;
  font-size: .875rem;
}

.pill.ok {
  background: #dff3e8;
  color: var(--dca-ok);
}

.pill.warn {
  background: #fff0d5;
  color: var(--dca-warn);
}

.muted {
  color: var(--dca-muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .625rem;
  margin-top: .875rem;
}

.tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
}

.tab {
  padding: .625rem .875rem;
  border-radius: 999px;
  background: #e5ddcf;
  color: var(--dca-ink);
  text-decoration: none;
}

.tab.active {
  background: var(--dca-ink);
  color: white;
}

.trainer-table-card {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 1rem;
}

.trainer-table-wrap {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
}

.trainer-table {
  width: 100%;
  border-collapse: collapse;
}

.trainer-dashboard-table {
  min-width: 68rem;
}

.trainer-assessment-table {
  min-width: 52rem;
}

.trainer-assessment-table th {
  text-align: left;
}

.trainer-table th,
.trainer-table td {
  padding: .75rem;
  vertical-align: middle;
}

.secretary-dashboard {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(15rem, 1fr) minmax(0, 2fr);
  align-items: start;
}

.flash-messages {
  position: fixed;
  top: 5.5rem;
  right: 1.5rem;
  z-index: 1080;
  display: grid;
  gap: .625rem;
  width: min(24rem, calc(100vw - 2rem));
}

.flash-message {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1rem;
  border: 1px solid transparent;
  border-radius: .875rem;
  box-shadow: 0 .75rem 2rem rgb(23 32 51 / 18%);
  animation: flash-message-in .18s ease-out;
  transition: opacity .18s ease, transform .18s ease;
}

.flash-message-success {
  border-color: #b9e4c9;
  background: #f0fbf5;
  color: var(--dca-ok);
}

.flash-message-error {
  border-color: #f2b8b5;
  background: #fff1f0;
  color: #9f2d28;
}

.flash-message-close {
  padding: 0;
  border: 0;
  background: transparent;
  color: currentColor;
  font-size: 1.35rem;
  line-height: 1;
}

.flash-message-hiding {
  opacity: 0;
  transform: translateY(-.5rem);
}

@keyframes flash-message-in {
  from {
    opacity: 0;
    transform: translateY(-.5rem);
  }
}

.overdue-card {
  min-width: 0;
}

.weekly-course-list {
  min-width: 0;
}

.overdue-card-header {
  margin-top: -.9rem;
  padding: .45rem 1.25rem 0;
}

.weekly-course-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: .75rem 1.25rem 0;
}

.weekly-course-date {
  display: flex;
  gap: .5rem;
  align-items: baseline;
}

.weekly-course-date span {
  color: var(--dca-muted);
  font-size: .8rem;
}

.weekly-course-content {
  padding: 1rem 1.25rem 1.25rem;
}

.weekly-course-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.week-nav-button {
  padding: .4rem .7rem;
  border: 1px solid rgb(23 32 51 / 14%);
  border-radius: .875rem;
  background: white;
  color: var(--dca-ink);
  font-size: .8rem;
  font-weight: 750;
}

.week-nav-button:hover,
.week-nav-button:focus-visible {
  border-color: var(--dca-accent);
  background: #f8f4ec;
  color: var(--dca-accent);
}

.week-nav-button-current {
  border-color: var(--dca-ink);
  background: var(--dca-ink);
  color: white;
}

.week-nav-button-current:hover,
.week-nav-button-current:focus-visible {
  background: var(--dca-accent);
  color: white;
}

.metric-tile {
  display: grid;
  place-items: center;
  min-width: 4rem;
  padding: .55rem .7rem;
  border-radius: .875rem;
  background: var(--dca-ink);
  color: white;
}

.metric-tile strong {
  font-size: 1.55rem;
  line-height: 1;
}

.metric-tile span {
  font-size: .75rem;
}

.trainer-ranking {
  display: grid;
  gap: .625rem;
  padding: 0 1.25rem 1.25rem;
}

.overdue-card-empty {
  padding: 0 1.25rem 1.25rem;
}

.trainer-ranking li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .625rem;
  align-items: center;
  padding: .75rem;
  border: 1px solid rgb(23 32 51 / 8%);
  border-radius: .875rem;
  background: white;
}

.trainer-ranking .rank {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  background: #ece5d8;
  color: var(--dca-muted);
  font-size: .8rem;
  font-weight: 800;
}

.trainer-ranking .trainer-name {
  min-width: 0;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trainer-ranking .trainer-count {
  min-width: 2.25rem;
  padding: .35rem .6rem;
  border-radius: 999px;
  background: #fff0d5;
  color: var(--dca-warn);
  font-weight: 850;
  text-align: center;
}

.weekly-course-items {
  display: grid;
  gap: .625rem;
  margin-bottom: 1rem;
}

.weekly-course-empty {
  display: grid;
  gap: .2rem;
  padding: 1.5rem;
  border: 1px dashed #b9aa92;
  border-radius: 1rem;
  color: var(--dca-muted);
  text-align: center;
}

.new-course-group {
  margin-top: 1rem;
}

.course-week-card {
  overflow: hidden;
  border: 1px solid rgb(23 32 51 / 10%);
  border-radius: 1rem;
  background: white;
}

.course-week-card[open] {
  border-color: rgb(23 32 51 / 20%);
  box-shadow: 0 .5rem 1.25rem rgb(23 32 51 / 6%);
}

.course-week-summary {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  cursor: pointer;
  list-style: none;
}

.course-week-summary::-webkit-details-marker {
  display: none;
}

.course-week-identity {
  display: grid;
  flex: 1;
  gap: 1rem;
  grid-template-columns: minmax(10rem, 1.3fr) repeat(2, minmax(8rem, 1fr));
  align-items: center;
}

.course-week-kicker {
  display: block;
  color: var(--dca-muted);
  font-size: .7rem;
  font-weight: 750;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.course-week-summary-status {
  display: flex;
  gap: .75rem;
  align-items: center;
}

.course-week-chevron {
  width: .65rem;
  height: .65rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform .15s ease;
}

.course-week-card[open] .course-week-chevron {
  transform: rotate(225deg);
}

.course-week-details {
  padding: 0 1rem 1rem;
  border-top: 1px solid rgb(23 32 51 / 8%);
}

.course-week-form {
  padding-top: 1rem;
}

.course-week-fields {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.course-week-participants {
  margin-top: 1.25rem;
  padding: 1rem;
  border-radius: .875rem;
  background: #f8f4ec;
}

.participant-roster {
  display: grid;
  gap: .35rem;
}

.participant-roster[hidden] {
  display: none;
}

.participant-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .75rem;
  align-items: center;
  padding: .65rem .75rem;
  border: 1px solid rgb(23 32 51 / 8%);
  border-radius: .75rem;
  background: white;
}

.participant-row small {
  display: block;
  color: var(--dca-muted);
}

.participant-status {
  color: var(--dca-muted);
  font-size: .75rem;
  font-weight: 650;
}

.course-week-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
}

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

@media (max-width: 700px) {
  .flash-messages {
    top: 4.75rem;
    right: 1rem;
  }

  .course-week-identity,
  .course-week-fields {
    grid-template-columns: 1fr;
  }

  .course-week-summary,
  .participant-row {
    align-items: start;
  }

  .participant-status {
    grid-column: 2;
  }
}
