.admin-dashboard {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #1f2a22;
  min-height: 100vh;
  background: #f6f7f5;
}

/* Topbar */

.admin-dashboard__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: #2f6b3a;
  color: #fff;
  flex-wrap: wrap;
}

.admin-dashboard__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 600;
  font-size: 15px;
}

.admin-dashboard__topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-dashboard__season-select {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #fff;
  text-decoration: none;
  opacity: .9;
}

.admin-dashboard__season-select:hover {
  color: #fff;
  opacity: 1;
  text-decoration: underline;
}

.admin-dashboard__user {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
}

.admin-dashboard__user:hover {
  color: #fff;
  text-decoration: underline;
}

.admin-role-badge {
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(255, 255, 255, .2);
  padding: 2px 8px;
  border-radius: 20px;
}

.admin-dashboard__logout {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: #fff;
  text-decoration: none;
  opacity: .85;
}

.admin-dashboard__logout:hover {
  opacity: 1;
  color: #fff;
  text-decoration: underline;
}

/* Secondary nav (tabs) */

.admin-subnav {
  display: flex;
  gap: 0;
  padding: 0 22px;
  background: #fff;
  border-bottom: 1px solid #e6e8e4;
  overflow-x: auto;
}

.admin-subnav__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 16px;
  font-size: 13.5px;
  font-weight: 400;
  color: #6b7280;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}

.admin-subnav__link:hover {
  color: #2f6b3a;
}

.admin-subnav__link--active {
  font-weight: 600;
  color: #2f6b3a;
  border-bottom-color: #2f6b3a;
}

/* Body */

.admin-dashboard__body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  max-width: 1100px;
  margin: 0 auto;
}

/* Pages whose content needs the whole window (the Rückmeldungen details table). Panels on such a
   page that are better off narrow opt back in with --readable. */
.admin-dashboard__body--wide {
  max-width: none;
}

.admin-dashboard__body--wide .admin-dashboard__panel--readable {
  width: 100%;
  max-width: 1100px;
  margin-inline: auto;
}

.admin-card {
  background: #fff;
  border: 1px solid #e6e8e4;
  border-radius: 9px;
  padding: 18px;
}

.admin-card__title {
  font-size: 14px;
  font-weight: 600;
  color: #1f2a22;
  margin-bottom: 12px;
}

/* Season summary card */

.admin-dashboard__season-card {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 16px 18px;
}

.admin-dashboard__season-card-info {
  flex: 1;
  min-width: 220px;
}

.admin-dashboard__season-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #1f2a22;
}

.admin-dashboard__season-card-meta {
  font-size: 12.5px;
  color: #6b7280;
  margin-top: 3px;
}

/* Stats grid */

.admin-dashboard__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.admin-stat {
  background: #fff;
  border: 1px solid #e6e8e4;
  border-radius: 9px;
  padding: 14px 16px;
}

.admin-stat__label {
  font-size: 11.5px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.admin-stat__value {
  font-size: 26px;
  font-weight: 700;
  color: #1f2a22;
  line-height: 1.2;
}

.admin-stat__value--accent {
  color: #2f6b3a;
}

/* CSV dropzone */

.admin-dropzone {
  border: 2px dashed #b9c9bb;
  border-radius: 9px;
  background: #f7faf7;
  padding: 24px;
  text-align: center;
}

.admin-dropzone__icon {
  font-size: 24px;
  color: #2f6b3a;
}

.admin-dropzone__text {
  font-size: 14px;
  color: #1f2a22;
  margin-top: 9px;
}

.admin-dropzone__link {
  color: #2f6b3a;
  font-weight: 600;
  text-decoration: underline;
}

.admin-dropzone__hint {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11.5px;
  color: #6b7280;
  margin-top: 7px;
}

.admin-import-status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 14px;
  background: #eff5ef;
  border: 1px solid #cfe0d2;
  border-radius: 8px;
}

.admin-import-status__icon {
  color: #2f6b3a;
}

.admin-import-status__text {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  color: #1f2a22;
}

.admin-import-status__detail {
  color: #6b7280;
}

/* Cards with table header (search, actions) */

.admin-card--table {
  padding: 0;
  overflow: hidden;
}

.admin-card--table .admin-card__title {
  margin-bottom: 0;
}

.admin-card__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #eceee9;
}

.admin-card__header .admin-card__title {
  flex: 1;
}

.admin-search {
  position: relative;
}

.admin-search i {
  position: absolute;
  left: 10px;
  top: 9px;
  font-size: 12px;
  color: #9aa39c;
}

.admin-search input {
  padding-left: 30px;
  width: 200px;
  font-size: 13px;
}

/* Scroll container around a table: vertically once there are more rows than fit the window,
   horizontally when the columns are wider than the card. The header stays visible while scrolling —
   the background has to sit on the cells, since a sticky thead paints nothing itself. */
.admin-table-scroll {
  overflow: auto;
  max-height: calc(100vh - 300px);
}

.admin-table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f6f7f5;
}

.admin-dashboard table {
  font-size: 13.5px;
  margin-bottom: 0;
}

.admin-dashboard table thead {
  background: #f6f7f5;
}

.admin-dashboard table thead tr {
  color: #6b7280;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.admin-dashboard table th {
  padding: 10px 18px;
  font-weight: 600;
}

.admin-dashboard table td {
  padding: 11px 18px;
  color: #1f2a22;
  vertical-align: middle;
}

.admin-dashboard table .admin-mono {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  color: #6b7280;
}

.admin-card__footer {
  padding: 11px 18px;
  border-top: 1px solid #eceee9;
  font-size: 12.5px;
  color: #6b7280;
}

.admin-badge {
  display: inline-block;
  font-weight: 600;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  color: #fff;
  background: #6b7280;
}

.admin-badge--answered,
.admin-badge--admin {
  background: #2f6b3a;
}

.admin-badge--sent,
.admin-badge--viewer {
  background: #e5e7e1;
  color: #3d4a41;
}

.admin-badge--open {
  background: #fdeccd;
  color: #7a5b1f;
}

.admin-badge--bounced {
  background: #fdecea;
  color: #a13a30;
}

/* Two column layout */

.admin-dashboard__two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}

@media (max-width: 760px) {
  .admin-dashboard__two-col,
  .admin-dashboard__stats {
    grid-template-columns: 1fr;
  }
}

.admin-field {
  margin-bottom: 11px;
}

.admin-field label {
  font-size: 12.5px;
  color: #4b5563;
  margin-bottom: 4px;
  display: block;
}

.admin-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Evaluation card */

.admin-eval__row {
  margin-bottom: 11px;
}

.admin-eval__row-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #4b5563;
  margin-bottom: 4px;
}

/* Back link / table row actions */

.admin-back-link {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  color: #4b5563;
  text-decoration: none;
}

.admin-back-link:hover {
  color: #2f6b3a;
}

/* Secondary detail under a table cell's main value (e.g. the Biet-Partner under a Gebot). */
.admin-table__subline {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}

.admin-table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  color: #9aa39c;
}

.admin-table-actions a {
  color: #6b7280;
}

.admin-table-actions a:hover {
  color: #2f6b3a;
}

.admin-table-actions__disabled {
  color: #d7dbd4;
  cursor: not-allowed;
}

.admin-table-actions form {
  display: inline-flex;
}

.admin-table-actions__button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: #6b7280;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.admin-table-actions__button:hover {
  color: #2f6b3a;
}

/* Test-mail modal */

.admin-modal {
  border: 1px solid #e6e8e4;
  border-radius: 9px;
  padding: 18px;
  width: min(360px, calc(100vw - 32px));
}

.admin-modal::backdrop {
  background: rgba(31, 42, 34, .35);
}

.admin-modal__status {
  font-size: 12.5px;
  color: #6b7280;
  min-height: 1.4em;
  margin-top: 8px;
}

.admin-modal__status--success {
  color: #2f6b3a;
}

.admin-modal__status--error {
  color: #c0392b;
}

.admin-modal__actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.admin-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: #1f2a22;
  margin-bottom: 10px;
}

.admin-modal__close {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 2px;
}

.admin-modal__close:hover {
  color: #2f6b3a;
}

/* File-viewer modal (Rückmeldungen) */

.admin-modal--viewer {
  width: min(720px, calc(100vw - 32px));
  height: min(80vh, 900px);
}

/* `dialog` is display:none by default (UA stylesheet) and only display:block once [open] — a bare
   class selector here would outrank that and leave the modal sitting inline on the page even
   closed, so the flex layout only kicks in once showModal() has set [open]. */
.admin-modal--viewer[open] {
  display: flex;
  flex-direction: column;
}

.admin-modal--viewer__body {
  flex: 1;
  min-height: 0;
}

.admin-modal--viewer__body iframe,
.admin-modal--viewer__body img {
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: contain;
}

/* Document chips (Rückmeldungen) */

.admin-doc-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  margin: 0 8px 4px 0;
}

.admin-doc-chip__name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 0;
  color: #4b5563;
  cursor: pointer;
  text-decoration: underline;
}

.admin-doc-chip__name:hover {
  color: #2f6b3a;
}

.admin-doc-chip__download {
  color: #6b7280;
}

.admin-doc-chip__download:hover {
  color: #2f6b3a;
}

/* Quick filters (Rückmeldungen) */

.admin-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid #e6e8e4;
}

.admin-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-filter-pill {
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid #e6e8e4;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
}

.admin-filter-pill:hover {
  color: #2f6b3a;
}

.admin-filter-pill--active {
  font-weight: 600;
  color: #2f6b3a;
  border-color: #2f6b3a;
  background: #eaf2ea;
}

/* Sub-tabs (Rückmeldungen: Statistik / Details) */

.admin-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: #f6f7f5;
  border-radius: 10px;
  margin-bottom: 18px;
}

.admin-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 7px;
  border: none;
  background: none;
  color: #6b7280;
  cursor: pointer;
}

.admin-tab:hover {
  color: #2f6b3a;
}

.admin-tab--active {
  background: #fff;
  color: #1f2a22;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(31, 42, 34, .12);
}

/* Pie charts (Rückmeldungen statistics) */

.admin-pie-chart {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.admin-pie {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  flex-shrink: 0;
}

.admin-pie--empty {
  background: #e5e7e1;
}

.admin-pie-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  min-width: 160px;
}

.admin-pie-legend__item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #4b5563;
  margin-bottom: 6px;
}

.admin-pie-legend__swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.admin-pie-legend__label {
  flex: 1;
}

.admin-pie-legend__value {
  color: #6b7280;
  white-space: nowrap;
}

/* Mail template editor */

.admin-mail-template {
  display: grid;
  grid-template-columns: 1fr 330px;
  gap: 22px;
  align-items: start;
}

@media (max-width: 760px) {
  .admin-mail-template {
    grid-template-columns: 1fr;
  }
}

.admin-mail-field {
  position: relative;
}

.admin-mail-field__input {
  position: relative;
  z-index: 1;
  background: transparent;
  resize: none;
}

.admin-mail-field__highlight {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: transparent;
  border-color: transparent;
  pointer-events: none;
}

.admin-mail-field__token {
  color: transparent;
  border-radius: 3px;
  padding: 0;
}

.admin-mail-field__token--ok {
  background: rgba(47, 107, 58, .14);
}

.admin-mail-field__token--bad {
  background: rgba(220, 38, 38, .35);
  box-shadow: inset 0 -2px 0 #b3261e;
}

.admin-mail-warning {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 4px 0 14px;
  padding: 10px 12px;
  background: #fdf4f3;
  border: 1px solid #f0cdc9;
  border-radius: 8px;
  font-size: 12.5px;
  color: #8a2f27;
  line-height: 1.5;
}

.admin-mail-warning i {
  margin-top: 1px;
}

.admin-mail-placeholders {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.admin-mail-placeholder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: #f6f9f6;
  border: 1px solid #cfe0d2;
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 13px;
  color: #4b5563;
  cursor: pointer;
}

.admin-mail-placeholder:hover {
  border-color: #7aab84;
  background: #eff5ef;
}

.admin-mail-placeholder code {
  color: #2f6b3a;
  font-weight: 600;
  font-size: 12px;
}

.admin-mail-preview {
  grid-column: 1 / -1;
}

.admin-mail-preview__meta {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 10px;
}

.admin-mail-preview__subject {
  font-size: 14px;
  font-weight: 600;
  color: #1f2a22;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid #eceee9;
}

.admin-mail-preview__body {
  font-size: 13.5px;
  color: #1f2a22;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.admin-mail-preview__token--bad {
  background: rgba(220, 38, 38, .35);
  box-shadow: inset 0 -2px 0 #b3261e;
  color: #8a2f27;
  border-radius: 3px;
  font-weight: 600;
}

/* ---------------------------------------------------------------------------
   Mailversand (app/views/admin/season_mailings)
   --------------------------------------------------------------------------- */

.admin-mailing__checks {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
}

.admin-mailing__check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #1f2a22;
  padding: 5px 0;
}

.admin-mailing__check--ok i {
  color: #2f6b3a;
}

.admin-mailing__check--missing i {
  color: #b3261e;
}

.admin-mailing__check-fix {
  font-size: 12.5px;
  margin-left: 4px;
}

.admin-mailing__preview-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #6b7280;
}

.admin-mailing__preview-picker select {
  width: auto;
  min-width: 200px;
}

/* The preview is laid out like a message in a mail client: an envelope header of
   Von/An/Betreff rows above a plain-text message pane. */
.admin-mailing__mail {
  border: 1px solid #e6e8e4;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.admin-mailing__mail-header {
  background: #f6f7f5;
  border-bottom: 1px solid #e6e8e4;
  padding: 12px 16px;
}

.admin-mailing__mail-row {
  display: flex;
  gap: 12px;
  padding: 3px 0;
  align-items: baseline;
}

.admin-mailing__mail-label {
  flex: 0 0 62px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #6b7280;
  font-weight: 600;
}

.admin-mailing__mail-value {
  font-size: 13px;
  color: #1f2a22;
  word-break: break-word;
}

.admin-mailing__mail-value--subject {
  font-size: 14.5px;
  font-weight: 600;
}

.admin-mailing__mail-body {
  padding: 16px;
  font-size: 13.5px;
  color: #1f2a22;
  line-height: 1.65;
  white-space: pre-wrap;
  word-wrap: break-word;
  min-height: 120px;
}

.admin-mailing__preview-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #eceee9;
}

.admin-mailing__status {
  font-size: 12.5px;
  color: #6b7280;
}

.admin-mailing__status--ok {
  color: #2f6b3a;
}

.admin-mailing__status--error {
  color: #b3261e;
}

.admin-mailing__kinds {
  display: flex;
  gap: 16px;
}

.admin-mailing__kind {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #1f2a22;
  cursor: pointer;
}

.admin-mailing__kind .form-check-input {
  margin-top: 0;
}

.admin-mailing__row--blocked {
  color: #9ca3af;
}

.admin-mailing__send {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-mailing__count {
  font-size: 13px;
  color: #4b5563;
}

.admin-mailing__run-counts {
  font-size: 13px;
  color: #1f2a22;
  margin: 10px 0 0;
}

.admin-mailing__failures {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #eceee9;
}

.admin-mailing__failures ul {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 13px;
  color: #8a2f27;
}
