/* Kandidierenden-Portal: eigenständige Oberfläche, ohne das Support-Portal zu verändern. */
body.kandi-page {
  --k-bg: #f5f7fa;
  --k-surface: #ffffff;
  --k-surface-soft: #f8fafc;
  --k-line: #dfe5eb;
  --k-line-strong: #cbd4de;
  --k-text: #142033;
  --k-muted: #667386;
  --k-navy: #18334d;
  --k-navy-soft: #eaf1f7;
  --k-red-soft: #fff0f2;
  --k-shadow: 0 10px 30px rgb(31 48 65 / 7%);
  min-height: 100vh;
  padding-bottom: 0;
  background: #fff;
  color: var(--ink);
}

.kandi-page :is(button, a, input, select, textarea, summary):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--red) 42%, transparent);
  outline-offset: 2px;
}

.kandi-page .topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 64px;
  padding: 0 24px;
  border-bottom: 1px solid var(--k-line);
  background: rgb(255 255 255 / 94%);
  box-shadow: 0 1px 5px rgb(25 43 60 / 4%);
  backdrop-filter: blur(14px);
}

.kandi-page .who {
  max-width: 220px;
  overflow: hidden;
  color: var(--k-text);
  font-size: .82rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.who-avatar,
.k-profile-avatar {
  display: grid;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: var(--k-navy);
  color: #fff;
  font-weight: 750;
  letter-spacing: .02em;
}

.who-avatar {
  width: 32px;
  height: 32px;
  font-size: .72rem;
}
.who-avatar:empty { display: none; }

.kandi-page #logoutBtn {
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--k-line);
  border-radius: 9px;
  color: var(--k-muted);
}

/* Login */
.kandi-page #authView {
  max-width: 1120px;
  min-height: calc(100vh - 64px);
  margin: 0 auto;
  padding: clamp(30px, 6vw, 76px) 28px;
}

.k-auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(380px, .92fr);
  min-height: 610px;
  overflow: hidden;
  border: 1px solid var(--k-line);
  border-radius: 24px;
  background: var(--k-surface);
  box-shadow: 0 22px 70px rgb(18 39 59 / 12%);
}

.k-auth-story {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: #b51446;
}

.k-auth-story img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.k-auth-card {
  align-self: center;
  padding: clamp(34px, 5vw, 64px);
}

.k-auth-card h1 { margin-top: 7px; color: var(--k-text); font-size: 2rem; }
.k-auth-card .field { margin-top: 20px; }
.k-auth-card .field input { min-height: 48px; border-color: var(--k-line-strong); background: var(--k-surface); }
.k-auth-card .small { margin-top: 9px; color: var(--k-muted); font-size: .78rem; }
.k-auth-card .btn-pri { min-height: 48px; }
.k-auth-help { margin-top: 30px; color: var(--k-muted); font-size: .8rem; text-align: center; }
.k-auth-help a { color: var(--red); font-weight: 650; }

/* App-Rahmen und Hauptnavigation */
.kandi-page #appView {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: calc(100vh - 64px);
  max-width: none;
  margin: 0;
  padding: 0;
  background: var(--k-bg);
}

.kandi-page #appView > .tabs-wrap {
  position: sticky;
  top: 64px;
  z-index: 18;
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  width: 230px;
  height: calc(100vh - 64px);
  padding: 22px 14px 16px;
  border: 0;
  border-right: 1px solid var(--k-line);
  background: var(--k-surface);
}

.kandi-page #tabsWrap::before,
.kandi-page #tabsWrap::after,
.kandi-page .tabs-more { display: none; }

.kandi-page #tabs {
  display: flex;
  flex-direction: column;
  gap: 5px;
  height: 100%;
  padding: 0;
  overflow: visible;
}

.k-nav-label {
  padding: 0 12px 9px;
  color: #8b96a3;
  font-size: .67rem;
  font-weight: 750;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.kandi-page #tabs > button {
  position: relative;
  flex: none;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 9px;
  color: #5d6979;
  font-size: .82rem;
  font-weight: 600;
  text-align: left;
  white-space: normal;
}

.kandi-page #tabs > button:hover { background: var(--k-surface-soft); color: var(--k-text); }
.kandi-page #tabs > button.on { background: var(--k-red-soft); color: var(--red); }
.kandi-page #tabs > button.on::before {
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: -14px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--red);
  content: "";
}

.k-nav-icon { width: 23px; color: currentColor; font-size: 1.15rem; text-align: center; }
.kandi-page #tabs .tdot { margin-left: auto; }
.k-nav-foot { display: grid; gap: 4px; margin-top: auto; padding-top: 18px; border-top: 1px solid var(--k-line); }
.k-nav-foot :is(a, button) { min-height: 38px; padding: 8px 12px; color: var(--k-muted); font-size: .78rem; font-weight: 600; text-align: left; text-decoration: none; }
.k-nav-foot :is(a, button):hover { color: var(--red); }

.kandi-page #appView > .tab {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  width: min(1180px, 100%);
  min-width: 0;
  padding: 34px 38px 72px;
}

.kandi-page #appView > .tab:not(.on) { display: none; }
.kandi-page #appView > .tab.on { display: block; }

/* Seitentitel und wiederverwendbare Flächen */
.k-page-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.k-page-head h1 { margin-top: 3px; color: var(--k-text); font-size: clamp(1.8rem, 3vw, 2.45rem); letter-spacing: -.04em; }
.k-page-head .lead { max-width: 720px; margin-top: 7px; color: var(--k-muted); font-size: .95rem; }
.k-eyebrow { margin: 0; color: var(--red); font-size: .68rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }

.k-surface,
.k-profile-summary {
  border: 1px solid var(--k-line);
  border-radius: 14px;
  background: var(--k-surface);
  box-shadow: var(--k-shadow);
}

.k-surface { padding: 20px; }
.k-surface-head { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.k-surface h2,
.k-surface-head h2 { margin: 2px 0 0; color: var(--k-text); font-size: 1.04rem; }
.k-surface-head p:not(.k-eyebrow) { max-width: 760px; margin-top: 8px; color: var(--k-muted); font-size: .85rem; }

/* Cockpit */
.k-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.k-stat {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--k-line);
  border-radius: 13px;
  background: var(--k-surface);
  box-shadow: 0 5px 18px rgb(31 48 65 / 4%);
  text-align: left;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}

.k-stat:hover { transform: translateY(-2px); border-color: var(--k-line-strong); box-shadow: var(--k-shadow); }
.k-stat > span:last-child { display: flex; min-width: 0; flex-direction: column; }
.k-stat-icon { display: grid; flex: none; width: 42px; height: 42px; place-items: center; border-radius: 10px; background: var(--k-navy-soft); color: var(--k-navy); font-size: 1.25rem; }
.k-stat small { color: var(--k-muted); font-size: .7rem; }
.k-stat b { margin-top: 1px; color: var(--k-text); font-size: 1.2rem; line-height: 1.2; }
.k-stat em { overflow: hidden; margin-top: 4px; color: var(--k-muted); font-size: .69rem; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.k-home-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 20px; align-items: start; }
.kandi-page .todolist { gap: 9px; margin-top: 16px; }
.kandi-page .todo-card { padding: 13px 14px; border-radius: 10px; box-shadow: none; }
.kandi-page .todo-card.done { border-color: #b8dfc3; }
.kandi-page .todo-card .tk { width: 25px; height: 25px; }
.k-quick > button { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 48px; border-bottom: 1px solid var(--k-line); color: var(--k-text); font-size: .85rem; font-weight: 600; text-align: left; }
.k-quick > button:last-child { border-bottom: 0; }
.k-quick > button i { color: var(--red); font-size: 1.25rem; font-style: normal; }
.k-quick > button:hover span { color: var(--red); }

/* Termine */
.kandi-page .calendar-subscribe { margin: 0 0 17px; padding: 17px 19px; border-color: #cbdde9; border-radius: 13px; background: #eef6fb; box-shadow: none; }
.kandi-page .calendar-subscribe-icon { display: grid; width: 39px; height: 39px; place-items: center; border-radius: 10px; background: var(--k-surface); font-size: 1.1rem; }
.kandi-page .calendar-subscribe-content > p { max-width: 720px; }
.kandi-page .profile-calendar-subscribe { margin-bottom: 20px; }
.kandi-page .termine-sec { margin-top: 11px; border-color: var(--k-line); border-radius: 13px; box-shadow: 0 3px 14px rgb(31 48 65 / 3%); }
.kandi-page .termine-sec > summary { min-height: 58px; padding: 15px 18px; font-size: .94rem; }
.kandi-page .termine-sec > *:not(summary) { margin-right: 18px; margin-left: 18px; }
.kandi-page .fslot { border-color: var(--k-line); border-radius: 9px; }
.kandi-page .event-slot { min-height: 64px; align-items: center; }
.kandi-page .event-lead-intro { border-color: var(--k-line); background: var(--k-surface-soft); }
.kandi-page .event-lead-button { border-color: var(--k-navy); background: var(--k-navy); color: #fff; }
.kandi-page .event-lead-button.is-on { border-color: var(--green); background: var(--k-surface); color: var(--green); }
.kandi-page .event-guide-link { border-color: var(--k-line); background: var(--k-surface-soft); }
.kandi-page .event-guide-trigger { border-color: var(--k-line-strong); background: var(--k-surface); color: var(--k-text); }
.kandi-page .event-guide-dialog { border-color: var(--k-line); background: var(--k-surface); color: var(--k-text); }
.kandi-page .event-guide-dialog-head,
.kandi-page .event-guide-dialog footer { border-color: var(--k-line); background: var(--k-surface); }
.kandi-page .event-guide-dialog-body .event-guide-lead { background: var(--k-surface-soft); }

/* Briefkästelen */
.kandi-page .flyer-plan-intro,
.kandi-page .flyer-plan-form-panel,
.kandi-page .flyer-district-card,
.kandi-page .flyer-own-plan { border-color: var(--k-line); background: var(--k-surface); box-shadow: 0 4px 16px rgb(31 48 65 / 4%); }
.kandi-page .flyer-plan-intro { padding: 20px; border-radius: 14px; }
.kandi-page .flyer-plan-intro h2 { color: var(--k-text); }
.kandi-page .flyer-district-grid { gap: 14px; }
.kandi-page .flyer-district-card { padding: 17px; }
.kandi-page .flyer-planning h3 { margin-top: 26px; color: var(--k-text); }

/* Social Media */
.k-editorial-intro { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.k-editorial-intro > div:first-child { max-width: 720px; }
.k-editorial-intro p:not(.k-eyebrow) { margin: 8px 0 0; color: var(--k-muted); font-size: .86rem; }
.k-editorial-tools { display: flex; flex: none; align-items: center; gap: 12px; }
.k-filter-toggle { display: flex !important; align-items: center; gap: 7px; margin: 0 !important; padding: 9px 11px; border: 1px solid var(--k-line); border-radius: 9px; color: var(--k-text); font-size: .78rem; font-weight: 650; white-space: nowrap; cursor: pointer; }
.k-filter-toggle input { flex: none; }
.kandi-page .k-editorial-group { border-color: var(--k-line); background: var(--k-surface); box-shadow: 0 4px 16px rgb(31 48 65 / 4%); }
.kandi-page .k-editorial-group > summary { color: var(--k-text); }
.kandi-page .k-editorial-group > summary small { color: var(--k-muted); }
.kandi-page .k-editorial-group-count { background: var(--k-surface-soft); color: var(--k-muted); }
.kandi-page .k-editorial-grid { gap: 14px; }
.kandi-page #editorialItems .card { padding: 18px; border-color: var(--k-line); border-radius: 13px; box-shadow: 0 4px 16px rgb(31 48 65 / 4%); }
.kandi-page #editorialItems h3 { color: var(--k-text); font-size: 1rem; }
.kandi-page #editorialItems p { font-size: .84rem; }
.kandi-page .k-editorial-card-head > p { color: var(--k-muted); }
.kandi-page .k-editorial-key { color: var(--k-muted); }
.kandi-page .k-editorial-state { background: var(--k-surface-soft); color: var(--k-muted); }
.kandi-page .k-editorial-dates > div,
.kandi-page .k-editorial-assignment { border-color: var(--k-line); background: var(--k-surface-soft); }
.kandi-page .k-editorial-dates span,
.kandi-page .k-editorial-how p { color: var(--k-muted); }
.kandi-page .k-editorial-how,
.kandi-page .k-editorial-claim,
.kandi-page .k-editorial-claim-form { border-color: var(--k-line); }
.kandi-page .k-editorial-claim.is-mine { background: color-mix(in srgb, var(--red) 6%, var(--k-surface)); }
.kandi-page .editorial-guide-dialog { width: min(900px, calc(100vw - 32px)); }
.editorial-guide-dialog-body h2 { scroll-margin-top: 14px; margin: 1.7rem 0 .55rem; color: var(--k-text); font-size: 1.08rem; line-height: 1.35; }
.editorial-guide-dialog-body h2:first-of-type { margin-top: 1.25rem; }
.editorial-guide-toc { padding: 14px 16px; border: 1px solid var(--k-line); border-radius: 11px; background: var(--k-surface-soft); }
.editorial-guide-toc > strong { display: block; margin-bottom: 7px; color: var(--k-text); font-size: .8rem; }
.editorial-guide-toc ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 22px; margin: 0; padding-left: 20px; }
.editorial-guide-toc li { margin: 0; padding: 0; font-size: .78rem; }
.editorial-guide-toc a { color: var(--k-navy); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.editorial-guide-table { overflow-x: auto; margin: .75rem 0 1.2rem; border: 1px solid var(--k-line); border-radius: 10px; }
.editorial-guide-table table { width: 100%; min-width: 580px; border-collapse: collapse; }
.editorial-guide-table :is(th,td) { padding: 10px 12px; border-bottom: 1px solid var(--k-line); font-size: .79rem; line-height: 1.5; text-align: left; vertical-align: top; }
.editorial-guide-table th { background: var(--k-surface-soft); color: var(--k-text); }
.editorial-guide-table tr:last-child td { border-bottom: 0; }

/* Material */
.k-info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.kandi-page .k-info-grid .info-card { min-height: 108px; margin-top: 0; padding: 18px; border-color: var(--k-line); border-radius: 13px; box-shadow: 0 4px 16px rgb(31 48 65 / 4%); }
.kandi-page .k-info-grid a.info-card:hover { transform: translateY(-1px); border-color: var(--red); }
.kandi-page .k-info-grid .info-card-button { width: 100%; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.kandi-page .k-info-grid .info-card-button:hover { transform: translateY(-1px); border-color: var(--red); }

/* Profil */
.k-profile-summary { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(230px, 300px); align-items: center; gap: 16px; margin-bottom: 18px; padding: 18px 20px; }
.k-profile-avatar { width: 50px; height: 50px; background: var(--red); font-size: .9rem; }
.k-profile-summary h2 { margin: 0; color: var(--k-text); font-size: 1.08rem; }
.k-profile-summary p { margin-top: 3px; color: var(--k-muted); font-size: .78rem; }
.k-profile-progress { display: grid; gap: 7px; }
.k-profile-progress span { color: var(--k-muted); font-size: .72rem; text-align: right; }
.k-profile-progress b { color: var(--k-text); }
.k-profile-progress progress { width: 100%; height: 8px; overflow: hidden; border: 0; border-radius: 999px; accent-color: var(--red); }
.k-profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.k-profile-grid .k-surface { min-width: 0; }
.k-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.kandi-page .k-profile-grid .field { margin-top: 14px; }
.kandi-page .k-profile-grid :is(input, textarea, select) { border-color: var(--k-line-strong); background: var(--k-surface-soft); }
.k-profile-save { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin: 16px 0; }
.k-profile-save .msg { flex: 1; margin: 0; }
.k-profile-save .btn-pri { width: auto; min-width: 180px; margin: 0; }
.kandi-page #referralLinks { margin-top: 0; padding: 20px; border-color: var(--k-line); border-radius: 14px; }
.k-referral-list { display: grid; gap: 12px; margin-top: 18px; }
.k-referral-row > label { display: block; margin-bottom: 5px; color: var(--k-text); font-size: .78rem; font-weight: 650; }
.k-referral-row > div { display: flex; min-width: 0; }
.kandi-page .k-referral-row input { min-width: 0; flex: 1; border: 1px solid var(--k-line-strong); border-radius: 9px 0 0 9px; background: var(--k-surface-soft); color: var(--k-muted); }
.k-referral-row button { flex: none; padding: 0 14px; border: 1px solid var(--k-navy); border-radius: 0 9px 9px 0; background: var(--k-navy); color: #fff; font-size: .78rem; font-weight: 650; }

@media (max-width: 1080px) {
  .kandi-page #appView { grid-template-columns: 206px minmax(0, 1fr); }
  .kandi-page #appView > .tabs-wrap { width: 206px; }
  .kandi-page #appView > .tab { padding-right: 26px; padding-left: 26px; }
  .k-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .k-editorial-intro { align-items: flex-start; flex-direction: column; }
  .k-editorial-tools { width: 100%; justify-content: space-between; }
}

@media (max-width: 760px) {
  body.kandi-page { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .kandi-page .topbar { min-height: 56px; padding: 0 15px; }
  .kandi-page .topbar .who,
  .kandi-page #logoutBtn { display: none !important; }
  .kandi-page #authView { min-height: calc(100vh - 56px); padding: 20px 15px 30px; }
  .k-auth-shell { display: block; min-height: 0; border-radius: 17px; }
  .k-auth-story { min-height: 0; }
  .k-auth-card { padding: 28px 22px 32px; }

  .kandi-page #appView { display: block; min-height: calc(100vh - 56px); }
  .kandi-page #appView > .tabs-wrap {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 45;
    width: 100%;
    height: calc(70px + env(safe-area-inset-bottom));
    padding: 0 4px env(safe-area-inset-bottom);
    border-top: 1px solid var(--k-line);
    border-right: 0;
    background: rgb(255 255 255 / 97%);
    box-shadow: 0 -7px 24px rgb(27 46 62 / 8%);
    backdrop-filter: blur(14px);
  }
  .kandi-page #tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; height: 70px; }
  .k-nav-label,
  .k-nav-foot { display: none; }
  .kandi-page #tabs > button { justify-content: center; align-content: center; flex-direction: column; gap: 2px; min-height: 70px; padding: 6px 1px 5px; border-radius: 0; font-size: .57rem; line-height: 1.12; text-align: center; }
  .kandi-page #tabs > button.on { background: transparent; color: var(--red); }
  .kandi-page #tabs > button.on::before { top: 0; right: 23%; bottom: auto; left: 23%; width: auto; height: 3px; border-radius: 0 0 4px 4px; }
  .k-nav-icon { width: auto; font-size: 1.15rem; line-height: 1.2; }
  .kandi-page #tabs .tdot { position: absolute; top: 11px; right: calc(50% - 17px); width: 6px; height: 6px; margin: 0; }
  .kandi-page #appView > .tab { width: 100%; padding: 23px 15px 28px; }
  .k-page-head { margin-bottom: 18px; }
  .k-page-head h1 { font-size: 1.72rem; }
  .k-page-head .lead { font-size: .86rem; }
  .k-stat-grid { gap: 9px; margin-bottom: 13px; }
  .k-stat { min-height: 100px; align-items: flex-start; flex-direction: column; gap: 8px; padding: 13px; }
  .k-stat-icon { width: 33px; height: 33px; font-size: 1rem; }
  .k-stat b { font-size: 1rem; }
  .k-stat em { max-width: 100%; }
  .k-home-grid,
  .k-info-grid,
  .k-profile-grid,
  .kandi-page .k-editorial-grid { grid-template-columns: 1fr; gap: 12px; }
  .k-surface { padding: 16px; }
  .kandi-page .calendar-subscribe { padding: 15px; }
  .kandi-page .calendar-subscribe-icon { display: none; }
  .calendar-subscribe-actions { align-items: stretch; flex-direction: column; }
  .kandi-page .calendar-btn { min-height: 42px; }
  .kandi-page .termine-sec > summary { padding: 13px 14px; font-size: .88rem; }
  .kandi-page .termine-sec > *:not(summary) { margin-right: 14px; margin-left: 14px; }
  .kandi-page .event-slot { align-items: stretch; flex-direction: column; }
  .kandi-page .event-slot .fbtn { align-self: flex-start; }
  .kandi-page .event-lead-intro { flex-direction: column; gap: 3px; }
  .kandi-page .event-slot-actions-kandi { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .kandi-page .event-slot-actions-kandi :is(.event-lead-button,.fbtn) { width: 100%; align-self: stretch; white-space: normal; }
  .k-editorial-tools { align-items: stretch; flex-direction: column; }
  .k-filter-toggle { justify-content: center; }
  .kandi-page .editorial-guide-dialog { width: 100vw; }
  .editorial-guide-toc ol { grid-template-columns: 1fr; }
  .k-profile-summary { grid-template-columns: auto minmax(0, 1fr); padding: 16px; }
  .k-profile-progress { grid-column: 1 / -1; }
  .k-profile-progress span { text-align: left; }
  .k-profile-save { align-items: stretch; flex-direction: column; }
  .k-profile-save .btn-pri { width: 100%; }
  .k-field-grid { grid-template-columns: 1fr; }
  .k-referral-row > div { align-items: stretch; flex-direction: column; gap: 6px; }
  .kandi-page .k-referral-row input,
  .k-referral-row button { min-height: 42px; border-radius: 9px; }
  .kandi-page .k-info-grid .info-card { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .kandi-page *,
  .kandi-page *::before,
  .kandi-page *::after { scroll-behavior: auto !important; transition: none !important; }
}
