:root {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  color: #2d2022;
  background: #f5f2f1;
  --wine: #861f2d;
  --deep: #54101b;
  --gold: #d6aa58;
  --line: #ded4d2;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
.button {
  border: 1px solid var(--wine);
  border-radius: 0.6rem;
  padding: 0.7rem 1rem;
  background: var(--wine);
  color: white;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button.secondary,
.button.secondary {
  background: white;
  color: var(--wine);
}
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfc3c1;
  border-radius: 0.5rem;
  padding: 0.7rem;
  background: white;
}
label {
  display: grid;
  gap: 0.35rem;
  font-weight: 650;
}
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) 1.2fr;
}
.brand-panel {
  padding: 4rem;
  color: white;
  background: linear-gradient(145deg, var(--deep), #7c1b2a);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.brand-panel h1 {
  font-family: Georgia, serif;
  font-size: clamp(2.8rem, 6vw, 5.5rem);
  font-weight: 400;
  margin: 1rem 0;
}
.login-main {
  display: grid;
  place-items: center;
  padding: 2rem;
}
.login-card {
  width: min(560px, 100%);
  background: white;
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  padding: 2.5rem;
  box-shadow: 0 1rem 3rem #4b172019;
}
.login-card form {
  display: grid;
  gap: 1rem;
}
.eyebrow {
  color: var(--wine);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  font-weight: 800;
  text-transform: uppercase;
}
.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}
aside {
  background: #eee9e8;
  border-right: 1px solid var(--line);
  padding: 1.4rem;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  margin-bottom: 2rem;
}
.seal {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--wine);
  color: white;
  display: grid;
  place-items: center;
  font-family: Georgia, serif;
}
nav {
  display: grid;
  gap: 0.4rem;
}
nav button {
  text-align: left;
  background: transparent;
  color: #49383b;
  border-color: transparent;
}
nav button.active {
  background: white;
  color: var(--wine);
  border-color: var(--line);
}
.role-list {
  border-top: 1px solid var(--line);
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  font-size: 0.8rem;
}
main {
  min-width: 0;
}
header {
  background: white;
  border-bottom: 1px solid var(--line);
  min-height: 74px;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.content {
  padding: 2rem;
  max-width: 1500px;
  margin: 0 auto;
}
h1,
h2 {
  font-family: Georgia, serif;
  font-weight: 500;
}
h1 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  margin: 0.25rem 0 1.5rem;
}
h2 {
  font-size: 1.65rem;
  margin: 0 0 1rem;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.4rem;
  box-shadow: 0 0.7rem 2rem #4b17200d;
  overflow: auto;
}
.metric {
  font-family: Georgia, serif;
  color: var(--wine);
  font-size: 2.4rem;
}
.toolbar,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: end;
  margin: 1rem 0;
}
.toolbar > label {
  min-width: 180px;
  flex: 1;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
}
th,
td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 0.65rem;
  vertical-align: top;
}
th {
  color: var(--wine);
  background: #faf6f1;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}
.pill {
  display: inline-block;
  border-radius: 2rem;
  background: #f6e6e9;
  color: var(--wine);
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 800;
}
.notice {
  border-left: 3px solid var(--gold);
  background: #fff8e9;
  padding: 0.9rem;
  margin: 1rem 0;
}
.error {
  border-left-color: #b42318;
  background: #fff1f0;
}
.empty {
  color: #79696b;
  padding: 1rem;
  border: 1px dashed var(--line);
  border-radius: 0.6rem;
}
.weekly-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 0.65rem;
  min-width: 960px;
}
.weekly-grid > section {
  min-height: 130px;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  padding: 0.65rem;
  background: #faf8f7;
}
.weekly-grid > section > strong {
  display: block;
  color: var(--wine);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}
.weekly-grid > section > div {
  display: grid;
  gap: 0.15rem;
  margin-top: 0.45rem;
  padding: 0.5rem;
  background: white;
  border-left: 3px solid var(--gold);
  font-size: 0.78rem;
}
.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: #1f1012a8;
  padding: 1rem;
}
.modal > section {
  width: min(720px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: white;
  border-radius: 1rem;
  padding: 1.5rem;
}
@media (max-width: 800px) {
  .login {
    grid-template-columns: 1fr;
  }
  .brand-panel {
    padding: 2rem;
    min-height: 260px;
  }
  .shell {
    grid-template-columns: 1fr;
  }
  aside {
    position: static;
  }
  nav {
    grid-template-columns: repeat(2, 1fr);
  }
  header {
    padding: 1rem;
  }
  .content {
    padding: 1rem;
  }
}
.schedule-header {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.schedule-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1rem 0;
  font-size: 0.85rem;
}

.schedule-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-dot {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  display: inline-block;
}

.weekly-grid > section > .schedule-item,
.daily-grid > section > .schedule-item {
  display: grid;
  gap: 0.25rem;
  margin-top: 0.55rem;
  padding: 0.65rem;
  background: white;
  border-left: 4px solid;
  border-radius: 0.45rem;
  font-size: 0.8rem;
}

.daily-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr);
  gap: 0.65rem;
}

.daily-grid > section {
  min-height: 240px;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  padding: 0.8rem;
  background: #faf8f7;
}

.daily-grid > section > strong {
  display: block;
  color: var(--wine);
  margin-bottom: 0.5rem;
}

.schedule-confirmed {
  border-color: #2f7d46 !important;
}

.schedule-pending {
  border-color: #c78b16 !important;
}

.schedule-vacant {
  border-color: #b43b3b !important;
}

.legend-dot.schedule-confirmed {
  background: #2f7d46;
}

.legend-dot.schedule-pending {
  background: #c78b16;
}

.legend-dot.schedule-vacant {
  background: #b43b3b;
}

.schedule-item-heading {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: start;
}

.schedule-status {
  font-size: 0.7rem;
  font-weight: 700;
}

.schedule-time {
  font-weight: 700;
}

.status-counter {
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.status-counter:hover {
  border-color: var(--wine);
}
.candidate-action {
  display: grid;
  gap: 0.35rem;
  padding: 0.75rem;
  margin: 0.5rem 0;
  border: 1px solid #d8d8d8;
  border-radius: 0.5rem;
}

.candidate-action strong {
  font-size: 0.95rem;
}

.candidate-action span {
  font-size: 0.85rem;
}

.candidate-action button {
  justify-self: start;
  margin-top: 0.25rem;
}

.candidate-blocked {
  opacity: 0.7;
}

.candidate-blocked button {
  cursor: not-allowed;
}
.plan-card,
.replacement-card {
  padding: 1rem 0;
  border-bottom: 1px solid #ddd;
}

.plan-card:last-child,
.replacement-card:last-child {
  border-bottom: 0;
}

.plan-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.plan-card-header h2,
.replacement-card h3 {
  margin: 0.25rem 0;
}

.plan-context {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.plan-context div {
  display: grid;
  gap: 0.2rem;
}

.plan-context small {
  opacity: 0.7;
}

.plan-status {
  font-weight: 600;
  white-space: nowrap;
}

.plan-card.historical {
  opacity: 0.62;
}

.historical-note,
.plan-readonly {
  font-size: 0.85rem;
  opacity: 0.72;
}

.plan-row-actions {
  margin-top: 0.75rem;
}
.vacancy-card {
  padding: 1rem 0;
  border-bottom: 1px solid #ddd;
}

.vacancy-card:last-child {
  border-bottom: 0;
}

.vacancy-status {
  font-weight: 600;
  white-space: nowrap;
}

.vacancy-actions {
  margin-top: 1rem;
}

.vacancy-note {
  margin: 0.75rem 0;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 0.5rem;
}

.vacancy-note small {
  display: block;
  margin-bottom: 0.25rem;
  opacity: 0.7;
}

/* UAT hardening: institutional status trail and scalable coverage close */
.status-track {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.9rem 0;
}
.status-step {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
}
.status-done { border-color: #2f7d46; background: #edf7f0; }
.status-waiting { border-color: #c78b16; background: #fff8e9; }
.status-error { border-color: #b43b3b; background: #fff1f0; }
.teacher-proposal-card {
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.teacher-proposal-card:last-child { border-bottom: 0; }
.coverage-workbench .schedule-header input { min-width: 260px; }
.coverage-table td:first-child,
.coverage-table th:first-child { width: 2.5rem; text-align: center; }
.coverage-table input[type="checkbox"] { width: 1rem; height: 1rem; }

/* Proposal response deadlines */
.proposal-deadline {
  margin: 0.75rem 0;
  padding: 0.7rem 0.8rem;
  border-radius: 0.5rem;
  font-weight: 700;
  border: 1px solid var(--line);
}
.deadline-normal { background: #f7f7f7; }
.deadline-risk, .deadline-at_risk { background: #fff8e9; border-color: #c78b16; }
.deadline-expired { background: #fff1f0; border-color: #b43b3b; }
.deadline-not-configured { background: #f5f2f2; border-color: #8a7f81; }


/* Cycle map and coordinator section creation */
.cycle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.8rem;
}
.cycle-column {
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  padding: 0.7rem;
  background: #fff;
}
.cycle-heading {
  font-weight: 800;
  margin-bottom: 0.6rem;
}
.cycle-item {
  display: grid;
  gap: 0.25rem;
  padding: 0.65rem;
  margin-bottom: 0.55rem;
  border-left: 4px solid var(--line);
  border-radius: 0.45rem;
  background: #fafafa;
}
.cycle-item.schedule-confirmed { border-left-color: #2f7d46; }
.cycle-item.schedule-pending { border-left-color: #c78b16; }
.cycle-item.schedule-vacant { border-left-color: #b43b3b; }
