body {
  margin: 40px auto;
  max-width: 800px;
  font: .8em/1.5 Helvetica;
  color: #444;
  font-size: 15px;
  padding: 0 10px;
}

h1, h2, h3 {
  line-height: 1.5;
}

div.title {
  font-weight: bold;
}

li {
  margin: 0.2em 0;
  line-height: 1.5;
}

.back-button {
  display: inline-block;
  border: 1px solid #ddd;
  background: #f9f9f9;
  padding: 0.4em 0.7em;
  text-decoration: none;
  color: inherit;
}

.flowchart {
  height: auto;
  width: 100%;
}

.semester-plan {
  height: auto;
  width: 100%;
  margin-top: 0.7em;
  border: 1px solid #ddd;
}

.references {
  list-style: none;
  counter-reset: ref -1;
  padding-left: 0;
}

.references li {
  counter-increment: ref;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.3em;
  margin: 0.2em 0;
}

.references li::before {
  content: "[" counter(ref) "]";
}

.references a {
  overflow-wrap: anywhere;
}

.decision-box {
  border: 1px solid #ddd;
  padding: 1.2em;
  margin: 2em auto;
  max-width: 900px;
  width: calc(100vw - 40px);
  box-sizing: border-box;
  border-radius: 8px;
  background: #f9f9f9;
}

.decision-note {
  white-space: pre-line;
}

#answers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
}

.decision-box button {
  display: inline-block;
  margin: 0.3em 0.3em 0.3em 0;
  padding: 0.6em 0.9em;
  font: inherit;
  cursor: pointer;
  border: 1px solid #ddd;
}

.decision-note {
  width: 100%;
}

.decision-nav {
  width: 100%;
  margin-top: 0.8em;
  display: flex;
  gap: 0.4em;
}

.decision-nav button {
  font-size: 0.8em;
  padding: 0.35em 0.6em;
  background: #eee;
  color: #555;
}

table {
  border-collapse: collapse;
  width: 900px;
  margin: 1em 0;
}

th, td {
  border: 1px solid #ddd;
  padding: 0.5em;
  text-align: left;
}

th {
  background: #f0f0f0;
}

.detail-table {
  width: 100%;
}

.detail-table th {
  width: 9em;
}

.application-documents th {
  width: 13em;
}

.program-overview-mobile {
  display: none;
}

.program-overview-mobile select {
  width: 100%;
  box-sizing: border-box;
  margin: 1em 0 0;
  padding: 0.5em;
  font: inherit;
  border: 1px solid #ddd;
  background: #f9f9f9;
  color: #444;
}

.program-overview-details {
  width: 100%;
}

.program-overview-details th {
  width: 7.5em;
}

details {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0.7em 0.9em;
  margin: 0.6em 0;
  background: #f9f9f9;
}

summary {
  cursor: pointer;
  font-weight: bold;
}

details p {
  margin-bottom: 0;
}

.deadline-calendar {
  position: relative;
  display: grid;
  grid-template-columns: 4.5em repeat(6, minmax(5.5em, 1fr));
  margin: 1em auto 0;
  max-width: 900px;
  width: calc(100vw - 40px);
  border: 1px solid #ddd;
  box-sizing: border-box;
  overflow-x: auto;
}

.deadline-calendars {
  margin: 1em auto 0;
}

.deadline-filter {
  display: flex;
  gap: 0.5em;
  margin: 0.8em 0;
}

.deadline-filter button {
  border: 1px solid #ddd;
  background: #f9f9f9;
  padding: 0.4em 0.7em;
  font: inherit;
  cursor: pointer;
}

.deadline-filter button.is-active {
  background: #eee;
  font-weight: bold;
}

.funding-tabs {
  margin: 1em 0;
}

.funding-tabs input {
  position: absolute;
  opacity: 0;
}

.funding-tab-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  margin-bottom: 1em;
}

.funding-tab-labels label {
  border: 1px solid #ddd;
  background: #f9f9f9;
  padding: 0.4em 0.7em;
  cursor: pointer;
}

#funding-erasmus:checked ~ .funding-tab-labels label[for="funding-erasmus"],
#funding-daad:checked ~ .funding-tab-labels label[for="funding-daad"],
#funding-hamburglobal:checked ~ .funding-tab-labels label[for="funding-hamburglobal"] {
  background: #eee;
  font-weight: bold;
}

.funding-panel {
  display: none;
  border: 1px solid #ddd;
  background: #f9f9f9;
  padding: 1em;
}

#funding-erasmus:checked ~ .funding-panels #funding-panel-erasmus,
#funding-daad:checked ~ .funding-panels #funding-panel-daad,
#funding-hamburglobal:checked ~ .funding-panels #funding-panel-hamburglobal {
  display: block;
}

.calendar-year,
.calendar-month {
  border-right: 1px solid #ddd;
  border-bottom: 1px solid #ddd;
  box-sizing: border-box;
}

.calendar-year {
  grid-row: 1 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  background: #f0f0f0;
}

.calendar-year:not(:first-child),
.calendar-month.is-year-start {
  border-top: 2px solid #bbb;
}

.calendar-month {
  position: relative;
  padding: 0.35em;
  background: #f9f9f9;
  transition: background 0.15s ease;
}

.month-name {
  font-size: 0.75em;
  color: #777;
}

.deadline-card {
  z-index: 1;
  align-self: center;
  justify-self: stretch;
  margin: 1.6em 0.25em 0.25em;
  padding: 0.25em 0.35em;
  border: 1px solid #bbb;
  background: white;
  box-sizing: border-box;
  cursor: default;
  font-size: 0.85em;
  line-height: 1.25;
  user-select: none;
}

.deadline-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.deadline-card.erasmus-study {
  border-color: #c44;
  background: #f5d6d6;
}

.deadline-card.zentralaustausch {
  border-color: #3f6fb5;
  background: #d8e5f7;
}

.deadline-calendar.active-zentralaustausch .calendar-month.is-active-period {
  background: #bed3f0;
}

.deadline-card.rise {
  border-color: #4f8a5b;
  background: #d9ecd8;
}

.deadline-calendar.active-rise .calendar-month.is-active-period {
  background: #bee0bd;
}

.deadline-card.hamburglobal {
  border-color: #8a6b2f;
  background: #f0e2bf;
}

.deadline-calendar.active-hamburglobal .calendar-month.is-active-period {
  background: #e5ce93;
}

.deadline-card.erasmus-study:hover {
  background: #efbcbc;
}

.deadline-card.zentralaustausch:hover {
  background: #bed3f0;
}

.deadline-card.rise:hover {
  background: #bee0bd;
}

.deadline-card.hamburglobal:hover {
  background: #e5ce93;
}

.deadline-calendar.active-erasmus-study .calendar-month.is-active-period {
  background: #efbcbc;
}

.deadline-calendar.is-filtering .deadline-card:not(.is-active-card) {
  opacity: 0;
  pointer-events: none;
}

.deadline-calendar .deadline-card.is-hidden-by-filter {
  display: none;
}

#theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #f0f0f0;
  color: #333;
  border: 1px solid #ddd;
  padding: 0.5em 0.8em;
  font-size: 14px;
  border-radius: 4px;
  cursor: pointer;
  z-index: 1000;
  transition: all 0.3s ease;
}

#theme-toggle:hover {
  background: #e0e0e0;
}

html.dark-mode #theme-toggle {
  background: #333;
  color: #e0e0e0;
  border-color: #555;
}

html.dark-mode #theme-toggle:hover {
  background: #404040;
}

@media (max-width: 700px) {
  #theme-toggle {
    display: none;
  }

  body {
    margin: 24px auto;
    font-size: 16px;
  }

  h1 {
    font-size: 1.7em;
  }

  a {
    overflow-wrap: anywhere;
  }

  .back-button {
    box-sizing: border-box;
    width: 100%;
    text-align: center;
  }

  .detail-table,
  .detail-table tbody,
  .detail-table tr,
  .detail-table th,
  .detail-table td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  .detail-table tr {
    border: 1px solid #ddd;
    margin: 0.7em 0;
  }

  .detail-table th,
  .detail-table td {
    border: 0;
  }

  .detail-table th {
    border-bottom: 1px solid #ddd;
  }
}

@media (prefers-color-scheme: dark) {
  html:not(.light-mode) body {
    background: #1a1a1a;
    color: #e0e0e0;
  }

  html:not(.light-mode) a {
    color: #64b5f6;
  }

  html:not(.light-mode) a:visited {
    color: #ba68c8;
  }

  html:not(.light-mode) table {
    background: #2a2a2a;
  }

  html:not(.light-mode) th, html:not(.light-mode) td {
    border-color: #444;
  }

  html:not(.light-mode) th {
    background: #333;
    color: #e0e0e0;
  }

  html:not(.light-mode) td {
    color: #e0e0e0;
  }

  html:not(.light-mode) .program-overview-mobile select {
    background: #333;
    color: #e0e0e0;
    border-color: #555;
  }

  html:not(.light-mode) .decision-box {
    background: #252525;
    border-color: #444;
  }

  html:not(.light-mode) .decision-box button {
    background: #333;
    color: #e0e0e0;
    border-color: #555;
  }

  html:not(.light-mode) .decision-box button:hover {
    background: #404040;
  }

  html:not(.light-mode) .decision-nav button {
    background: #333;
    color: #b0b0b0;
  }

  html:not(.light-mode) .decision-nav button:hover {
    background: #404040;
  }

  html:not(.light-mode) details {
    background: #252525;
    border-color: #444;
  }

  html:not(.light-mode) summary {
    color: #e0e0e0;
  }

  html:not(.light-mode) .deadline-filter button {
    background: #333;
    color: #e0e0e0;
    border-color: #555;
  }

  html:not(.light-mode) .deadline-filter button:hover {
    background: #404040;
  }

  html:not(.light-mode) .deadline-filter button.is-active {
    background: #404040;
  }

  html:not(.light-mode) .deadline-calendar {
    background: #1a1a1a;
    border-color: #444;
  }

  html:not(.light-mode) .calendar-year {
    background: #333;
    color: #e0e0e0;
    border-color: #444;
  }

  html:not(.light-mode) .calendar-month {
    background: #252525;
    border-color: #444;
  }

  html:not(.light-mode) .calendar-month:hover {
    background: #303030;
  }

  html:not(.light-mode) .month-name {
    color: #999;
  }

  html:not(.light-mode) .deadline-card {
    background: #2a2a2a;
    border-color: #555;
    color: #e0e0e0;
  }

  html:not(.light-mode) .deadline-card.erasmus-study {
    border-color: #d76b6b;
    background: #3a2424;
  }

  html:not(.light-mode) .deadline-card.erasmus-study:hover {
    background: #4a3434;
  }

  html:not(.light-mode) .deadline-card.zentralaustausch {
    border-color: #6ba5d8;
    background: #1e2d42;
  }

  html:not(.light-mode) .deadline-card.zentralaustausch:hover {
    background: #2a3d52;
  }

  html:not(.light-mode) .deadline-calendar.active-zentralaustausch .calendar-month.is-active-period {
    background: #2a3d52;
  }

  html:not(.light-mode) .deadline-card.rise {
    border-color: #7ba878;
    background: #1f3420;
  }

  html:not(.light-mode) .deadline-card.rise:hover {
    background: #2a4428;
  }

  html:not(.light-mode) .deadline-calendar.active-rise .calendar-month.is-active-period {
    background: #2a4428;
  }

  html:not(.light-mode) .deadline-card.hamburglobal {
    border-color: #b89c5f;
    background: #3a3420;
  }

  html:not(.light-mode) .deadline-card.hamburglobal:hover {
    background: #4a4428;
  }

  html:not(.light-mode) .deadline-calendar.active-hamburglobal .calendar-month.is-active-period {
    background: #4a4428;
  }

  html:not(.light-mode) .deadline-calendar.active-erasmus-study .calendar-month.is-active-period {
    background: #4a3434;
  }

  html:not(.light-mode) .funding-tabs input,
  html:not(.light-mode) .funding-tab-labels label {
    border-color: #555;
  }

  html:not(.light-mode) .funding-tab-labels label {
    background: #333;
    color: #e0e0e0;
  }

  html:not(.light-mode) .funding-tab-labels label:hover {
    background: #404040;
  }

  html:not(.light-mode) #funding-erasmus:checked ~ .funding-tab-labels label[for="funding-erasmus"],
  html:not(.light-mode) #funding-daad:checked ~ .funding-tab-labels label[for="funding-daad"],
  html:not(.light-mode) #funding-hamburglobal:checked ~ .funding-tab-labels label[for="funding-hamburglobal"] {
    background: #404040;
  }

  html:not(.light-mode) .funding-panel {
    background: #252525;
    border-color: #444;
    color: #e0e0e0;
  }

  html:not(.light-mode) h1, html:not(.light-mode) h2, html:not(.light-mode) h3 {
    color: #e0e0e0;
  }
}

html.dark-mode {
  color-scheme: dark;
}

html.dark-mode body {
  background: #1a1a1a;
  color: #e0e0e0;
}

html.dark-mode a {
  color: #64b5f6;
}

html.dark-mode a:visited {
  color: #ba68c8;
}

html.dark-mode table {
  background: #2a2a2a;
}

html.dark-mode th,
html.dark-mode td {
  border-color: #444;
}

html.dark-mode th {
  background: #333;
  color: #e0e0e0;
}

html.dark-mode td {
  color: #e0e0e0;
}

html.dark-mode .program-overview-mobile select {
  background: #333;
  color: #e0e0e0;
  border-color: #555;
}

html.dark-mode .decision-box {
  background: #252525;
  border-color: #444;
}

html.dark-mode .decision-box button {
  background: #333;
  color: #e0e0e0;
  border-color: #555;
}

html.dark-mode .decision-box button:hover {
  background: #404040;
}

html.dark-mode .decision-nav button {
  background: #333;
  color: #b0b0b0;
}

html.dark-mode .decision-nav button:hover {
  background: #404040;
}

html.dark-mode details {
  background: #252525;
  border-color: #444;
}

html.dark-mode summary {
  color: #e0e0e0;
}

html.dark-mode .deadline-filter button {
  background: #333;
  color: #e0e0e0;
  border-color: #555;
}

html.dark-mode .deadline-filter button:hover {
  background: #404040;
}

html.dark-mode .deadline-filter button.is-active {
  background: #404040;
}

html.dark-mode .deadline-calendar {
  background: #1a1a1a;
  border-color: #444;
}

html.dark-mode .calendar-year {
  background: #333;
  color: #e0e0e0;
  border-color: #444;
}

html.dark-mode .calendar-month {
  background: #252525;
  border-color: #444;
}

html.dark-mode .calendar-month:hover {
  background: #303030;
}

html.dark-mode .month-name {
  color: #999;
}

html.dark-mode .deadline-card {
  background: #2a2a2a;
  border-color: #555;
  color: #e0e0e0;
}

html.dark-mode .deadline-card.erasmus-study {
  border-color: #d76b6b;
  background: #3a2424;
}

html.dark-mode .deadline-card.erasmus-study:hover {
  background: #4a3434;
}

html.dark-mode .deadline-card.zentralaustausch {
  border-color: #6ba5d8;
  background: #1e2d42;
}

html.dark-mode .deadline-card.zentralaustausch:hover {
  background: #2a3d52;
}

html.dark-mode .deadline-calendar.active-zentralaustausch .calendar-month.is-active-period {
  background: #2a3d52;
}

html.dark-mode .deadline-card.rise {
  border-color: #7ba878;
  background: #1f3420;
}

html.dark-mode .deadline-card.rise:hover {
  background: #2a4428;
}

html.dark-mode .deadline-calendar.active-rise .calendar-month.is-active-period {
  background: #2a4428;
}

html.dark-mode .deadline-card.hamburglobal {
  border-color: #b89c5f;
  background: #3a3420;
}

html.dark-mode .deadline-card.hamburglobal:hover {
  background: #4a4428;
}

html.dark-mode .deadline-calendar.active-hamburglobal .calendar-month.is-active-period {
  background: #4a4428;
}

html.dark-mode .deadline-calendar.active-erasmus-study .calendar-month.is-active-period {
  background: #4a3434;
}

html.dark-mode .funding-tabs input,
html.dark-mode .funding-tab-labels label {
  border-color: #555;
}

html.dark-mode .funding-tab-labels label {
  background: #333;
  color: #e0e0e0;
}

html.dark-mode .funding-tab-labels label:hover {
  background: #404040;
}

html.dark-mode #funding-erasmus:checked ~ .funding-tab-labels label[for="funding-erasmus"],
html.dark-mode #funding-daad:checked ~ .funding-tab-labels label[for="funding-daad"],
html.dark-mode #funding-hamburglobal:checked ~ .funding-tab-labels label[for="funding-hamburglobal"] {
  background: #404040;
}

html.dark-mode .funding-panel {
  background: #252525;
  border-color: #444;
  color: #e0e0e0;
}

html.dark-mode h1,
html.dark-mode h2,
html.dark-mode h3 {
  color: #e0e0e0;
}

@media (max-width: 700px) {
  .program-overview.is-enhanced {
    display: none;
  }

  .program-overview-mobile.is-enhanced {
    display: block;
  }

  .decision-box {
    width: 100%;
    margin: 1.5em 0;
    padding: 1em;
  }

  .decision-box h2 {
    margin-top: 0;
    font-size: 1.25em;
  }

  #answers {
    display: grid;
    gap: 0.6em;
  }

  .decision-note {
    margin: 0 0 0.2em;
  }

  .decision-box button {
    width: 100%;
    margin: 0;
    padding: 0.75em 0.9em;
    text-align: left;
    border-radius: 6px;
    background: #fff7d6;
  }

  .decision-nav {
    margin-top: 0.3em;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5em;
  }

  .decision-nav button {
    padding: 0.45em 0.6em;
    font-size: 0.85em;
    text-align: center;
    background: #eee;
    color: #555;
  }

  html.dark-mode .decision-box button {
    background: #3a3420;
    color: #e0e0e0;
    border-color: #555;
  }

  html.dark-mode .decision-nav button {
    background: #333;
    color: #b0b0b0;
  }

  .deadline-calendar {
    grid-template-columns: 2.8em repeat(6, minmax(0, 1fr));
    max-width: none;
    width: 100%;
    overflow-x: visible;
  }

  .calendar-month {
    padding: 0.25em;
  }

  .calendar-year {
    font-size: 0.8em;
  }

  .month-name {
    font-size: 0.68em;
  }

  .deadline-card {
    margin: 1.35em 0.15em 0.15em;
    padding: 0.18em 0.2em;
    font-size: 0.52em;
    line-height: 1.1;
  }
}

@media (max-width: 700px) and (prefers-color-scheme: dark) {
  html:not(.light-mode) .decision-box button {
    background: #3a3420;
    color: #e0e0e0;
    border-color: #555;
  }

  html:not(.light-mode) .decision-nav button {
    background: #333;
    color: #b0b0b0;
  }
}
