:root {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #7a7a7a;
  background: #f2f4f4;
  line-height: 1.4;
  --primary: #0b090a;
  --secondary: #161a1d;
  --text: #7a7a7a;
  --muted: #7a7a7a;
  --accent: #005f6a;
  --accent-dark: #004851;
  --accent-soft: #e4f0f1;
  --surface: #ffffff;
  --border: #d8dede;
  --danger: #a32626;
}

* { box-sizing: border-box; }
body { margin: 0; background: #f2f4f4; }
h1, h2, h3, strong, label { color: var(--secondary); }
a { color: var(--accent); text-decoration: none; }

header {
  min-height: 64px;
  background: var(--primary);
  border-bottom: 4px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(20px, calc((100% - 1280px) / 2));
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand { color: #fff; font-size: 1.2rem; font-weight: 750; }
nav { display: flex; gap: 18px; align-items: center; }
nav a, nav .link { color: #fff; }
nav a:hover, nav .link:hover { color: #9bd0d5; }
nav form { margin: 0; }
main { max-width: 1280px; margin: 28px auto; padding: 0 20px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 8px #0b090a0d;
}

.title, .toolbar, .inline, .actions, .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.title { margin-bottom: 20px; }
.title h1 { margin: 0; color: var(--primary); }
.grid { display: grid; gap: 16px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.event { display: flex; flex-direction: column; gap: 6px; color: inherit; }
.event:hover { border-color: var(--accent); }

.badge, .status {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.metrics a, .metrics > div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 8px;
  padding: 10px 12px;
  color: inherit;
}

.metrics strong { display: block; color: var(--primary); font-size: 1.35rem; line-height: 1.15; }
.metrics span { display: block; margin-top: 3px; color: var(--muted); font-size: .78rem; line-height: 1.2; }
.metrics .metric-total { background: var(--secondary); border-top-color: var(--accent); }
.metrics .metric-total strong { color: #fff; }
.metrics .metric-total span { color: #d7e5e6; }
.quick { margin-bottom: 18px; }
.toolbar { margin: 18px 0; }
.list-toolbar { align-items: flex-end; }
.list-controls { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 9px; }
.list-controls label { gap: 3px; color: var(--muted); font-size: .72rem; font-weight: 500; }
.list-controls input,
.list-controls select { min-height: 39px; background: var(--surface); color: var(--primary); font-size: .84rem; font-weight: 600; }
.list-controls .list-search { min-width: 230px; flex: 1 1 260px; }
.list-controls button,
.list-controls .button { min-height: 39px; padding-top: 9px; padding-bottom: 9px; white-space: nowrap; }
.list-actions { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.list-empty { padding: 24px 16px; color: var(--muted); text-align: center; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form .wide { grid-column: 1 / -1; }

/* Gastformular auf großen Bildschirmen bewusst dichter als andere Formulare. */
.title ~ .form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 12px;
  padding: 16px;
}

.title ~ .form h2 { margin: 6px 0 0; font-size: 1.15rem; color: var(--primary); }
.title ~ .form input,
.title ~ .form select,
.title ~ .form textarea { padding: 7px 9px; }
.title ~ .form textarea { min-height: 62px; }

/* Übersichtlich gegliedertes Kontakt- und Eventformular eines Gastes. */
.guest-page-title p { margin: 3px 0 0; }
.guest-form { padding: 0; overflow: hidden; }
.guest-section { padding: 22px 24px 24px; border-bottom: 1px solid var(--border); }
.guest-section-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.guest-section-heading h2 { margin: 0; color: var(--primary); font-size: 1.2rem; }
.guest-section-heading p { margin: 3px 0 0; color: var(--muted); font-size: .82rem; }
.guest-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px 14px; align-items: start; }
.guest-grid > label,
.guest-grid > fieldset { min-width: 0; }
.guest-grid > label {
  gap: 5px;
  color: #737b7c;
  font-size: .79rem;
  font-weight: 400;
  letter-spacing: .01em;
}
.guest-grid input,
.guest-grid select,
.guest-grid textarea {
  width: 100%;
  border-color: #c5cdce;
  background: #f0f3f3;
  color: var(--primary);
  font-size: .93rem;
  font-weight: 700;
  letter-spacing: 0;
}
.guest-grid input::placeholder,
.guest-grid textarea::placeholder { color: #92999a; font-weight: 400; opacity: 1; }
.guest-grid input:focus,
.guest-grid select:focus,
.guest-grid textarea:focus { background: #ffffff; }
.guest-grid textarea { min-height: 74px; }
.guest-grid .field-short { grid-column: span 2; }
.guest-grid .field-medium,
.guest-grid .field-third { grid-column: span 4; }
.guest-grid .field-half { grid-column: span 6; }
.guest-grid .field-long { grid-column: span 8; }
.guest-grid .field-full { grid-column: 1 / -1; }
.guest-grid .field-postal { grid-column: span 2; }
.guest-grid .field-city { grid-column: span 6; }
.guest-grid .field-country { grid-column: span 4; }
.required-mark { color: var(--danger); }
.category-fieldset { margin: 2px 0 0; padding: 10px 12px 12px; }
.category-fieldset legend { color: #737b7c; font-size: .79rem; font-weight: 400; }
.category-options { display: flex; flex-wrap: wrap; gap: 7px; }
.category-options label {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafa;
  font-size: .8rem;
  font-weight: 500;
}
.category-options input { width: auto; margin: 0; }
.category-options label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.guest-form-actions { display: flex; justify-content: flex-end; padding: 16px 24px; background: #f6f8f8; }
.guest-form-actions button { min-width: 220px; }
.guest-history { align-items: start; }

label { display: flex; flex-direction: column; gap: 4px; font-size: .86rem; font-weight: 600; }
input, select, textarea, button, .button {
  font: inherit;
  border: 1px solid #bdc7c8;
  border-radius: 7px;
  padding: 9px 11px;
  background: #fff;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid #005f6a38;
  border-color: var(--accent);
}

textarea { min-height: 80px; resize: vertical; }
button, .button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  cursor: pointer;
  text-align: center;
}
button:hover, .button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.secondary { background: #fff; color: var(--accent-dark); border-color: var(--accent); }
.secondary:hover { background: var(--accent-soft); color: var(--accent-dark); }
.link { background: none; border: 0; color: var(--accent); padding: 0; }
.danger { background: var(--danger); border-color: var(--danger); }
.danger:hover { background: #7f1d1d; border-color: #7f1d1d; }
.delete-guest { margin: 16px 0 0; text-align: right; }
.auth, .narrow { max-width: 440px; margin: 12vh auto; }

.flash { padding: 12px 16px; border-radius: 8px; margin: 12px 0; background: #e4f1ea; }
.flash.error { background: #fee2e2; }
.flash.warning { background: #fff4cf; }
.tablecard { padding: 0; overflow: hidden; }
.table { overflow: auto; }
.tr {
  display: grid;
  grid-template-columns: 40px 2fr 1.2fr 1.4fr 1fr 80px;
  gap: 10px;
  align-items: center;
  min-width: 900px;
  padding: 11px 16px;
  border-bottom: 1px solid #e9eded;
  color: inherit;
}
.tr:hover { background: #f5f9f9; }
.tr.th { font-size: .78rem; text-transform: uppercase; font-weight: 700; background: var(--secondary); color: #fff; }
.tr small { display: block; color: var(--muted); }
.status.accepted { background: #dcefe7; color: #155e4b; }
.status.declined { background: #f7dddd; color: #8c2020; }
.bulk { display: flex; gap: 10px; padding: 14px; background: #eef2f2; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.note { border-bottom: 1px solid var(--border); padding: 10px 0; }
.muted { color: var(--muted); }
details { border-bottom: 1px solid var(--border); padding: 8px 0; }
pre { white-space: pre-wrap; font-size: .75rem; }
.empty { text-align: center; padding: 15vh 0; }
fieldset { border: 1px solid var(--border); border-radius: 8px; display: flex; flex-wrap: wrap; gap: 12px; }
fieldset label { flex-direction: row; font-weight: 400; }
button:disabled { opacity: .45; cursor: not-allowed; }

/* Eventorganisation und manuell bestätigter Save-the-Date-Versand */
.event-tools {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: -2px 0 10px;
}
.event-tools .button { padding: 7px 10px; font-size: .84rem; }
.service-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.service-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.service-form .wide, .service-form .actions, .service-heading { grid-column: 1 / -1; }
.service-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.service-heading h2 { margin: 0; }
.service-heading .badge { background: var(--accent-soft); color: var(--accent-dark); }
.feature-columns { align-items: start; }
.feature-columns > * { margin-top: 0; }
.template-body { min-height: 260px; line-height: 1.45; }
.mail-subject-preview { margin: 0 0 8px; font-size: .88rem; }
.mail-html-preview { overflow-x: auto; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: #edf1f1; }
.mail-text-fallback { margin-top: 10px; }
.mail-text-fallback summary { cursor: pointer; color: var(--accent-dark); font-weight: 700; }
.mail-text-fallback .mail-preview { margin-top: 8px; }
.mail-preview { padding: 11px; border: 1px solid var(--border); border-radius: 8px; background: #f8fafa; font-size: .84rem; }
.mail-preview p { white-space: normal; line-height: 1.45; }
.mailing-form { margin-top: 16px; }
.selection-tools { display: flex; gap: 6px; }
.selection-tools button { padding: 6px 9px; font-size: .78rem; }
.mailing-list { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin: 10px 0 14px; }
.mailing-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) minmax(140px, auto);
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--border);
  font-weight: 400;
}
.mailing-row:last-child { border-bottom: 0; }
.mailing-row > span { min-width: 0; }
.mailing-row strong, .mailing-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mailing-row small { color: var(--muted); }
.mail-status { justify-self: end; border-radius: 999px; padding: 3px 8px; font-size: .75rem; background: #eef2f2; }
.mail-status.sent { color: #155e4b; background: #dcefe7; }
.mail-status.failed { color: #8c2020; background: #f7dddd; }
.confirm-send { flex-direction: row; align-items: flex-start; margin: 12px 0; padding: 11px; background: #fff4cf; border-radius: 8px; }
.history-list .row { gap: 12px; border-bottom: 1px solid var(--border); padding: 8px 0; }
.history-list .row span:last-child { color: var(--muted); text-align: right; }
.settings-form { display: grid; gap: 14px; }
.settings-section { margin-top: 14px; }
.settings-section h2 { margin-top: 0; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px 14px; }
.settings-grid small { color: var(--muted); font-weight: 400; }
.switch-label { flex-direction: row; align-items: center; }
.security-note { margin-top: 14px; padding: 10px 12px; border-left: 4px solid var(--accent); background: var(--accent-soft); font-size: .84rem; }
.test-mail-form { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(280px, 2fr) auto; gap: 10px; align-items: end; }
.test-mail-form .confirm-send { margin: 0; }

@media (max-width: 760px) {
  header { min-height: 0; padding: 11px 12px; align-items: flex-start; }
  .brand { font-size: 1rem; padding-top: 2px; }
  nav { gap: 8px 12px; flex-wrap: wrap; justify-content: flex-end; font-size: .82rem; }
  main { margin: 14px auto; padding: 0 8px; }
  .title { align-items: flex-start; gap: 8px; margin-bottom: 12px; }
  .title h1 { font-size: 1.45rem; }
  .metrics { grid-template-columns: repeat(2, 1fr); gap: 6px; margin: 10px 0; }
  .metrics a, .metrics > div { padding: 8px 9px; }
  .metrics strong { font-size: 1.18rem; }
  .metrics span { font-size: .72rem; }
  .card { padding: 13px; }
  .form, .two { grid-template-columns: 1fr; }
  .title ~ .form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 11px; }
  .form .wide, .title ~ .form .wide { grid-column: 1 / -1; }
  .inline, .toolbar, .bulk { align-items: stretch; flex-direction: column; }
  .toolbar { gap: 8px; margin: 12px 0; }
  .list-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
  .list-controls .list-search { grid-column: 1 / -1; min-width: 0; }
  .list-controls button,
  .list-controls .button { width: 100%; }
  .list-actions { display: grid; grid-template-columns: 1fr 1fr; }

  /* Zwei kompakte Zeilen je Gast statt einer hohen Kartenansicht. */
  .table { overflow: visible; }
  .tr.th { display: none; }
  .tr {
    min-width: 0;
    grid-template-columns: 22px minmax(0, 1.35fr) minmax(70px, 1fr) minmax(68px, .8fr);
    grid-template-rows: auto auto;
    gap: 4px 7px;
    padding: 8px 9px;
    font-size: .78rem;
  }
  .tr > span:nth-child(1) { grid-column: 1; grid-row: 1 / 3; align-self: center; }
  .tr > span:nth-child(2) { grid-column: 2 / 4; grid-row: 1; min-width: 0; }
  .tr > span:nth-child(2) strong,
  .tr > span:nth-child(2) small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tr > span:nth-child(3) { grid-column: 2; grid-row: 2; }
  .tr > span:nth-child(4) { grid-column: 3; grid-row: 2; }
  .tr > span:nth-child(5) { grid-column: 4; grid-row: 2; }
  .tr > span:nth-child(6) { grid-column: 4; grid-row: 1; text-align: right; font-weight: 700; }
  .tr > span:nth-child(3)::before { content: "F: "; color: var(--muted); font-size: .7rem; }
  .tr > span:nth-child(4)::before { content: "E: "; color: var(--muted); font-size: .7rem; }
  .tr > span:nth-child(5)::before { content: "R: "; color: var(--muted); font-size: .7rem; }
  .tr .status { padding: 2px 5px; }
  .bulk { padding: 10px; }
  .event-tools { justify-content: stretch; }
  .event-tools .button { flex: 1; }
  .selection-tools { width: 100%; }
  .selection-tools button { flex: 1; }
  .service-grid, .service-form { grid-template-columns: 1fr; }
  .service-form .wide, .service-form .actions, .service-heading { grid-column: auto; }
  .mailing-row { grid-template-columns: 22px minmax(0, 1fr); }
  .mail-status { grid-column: 2; justify-self: start; }
  .history-list .row { align-items: flex-start; flex-direction: column; }
  .history-list .row span:last-child { text-align: left; }
  .settings-grid, .test-mail-form { grid-template-columns: 1fr; }
  .guest-page-title { align-items: flex-start; }
  .guest-page-title .button { white-space: nowrap; }
  .guest-section { padding: 16px 14px 18px; }
  .guest-section-heading { margin-bottom: 12px; }
  .guest-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 10px; }
  .guest-grid .field-short,
  .guest-grid .field-medium,
  .guest-grid .field-third,
  .guest-grid .field-postal,
  .guest-grid .field-city { grid-column: span 1; }
  .guest-grid .field-half,
  .guest-grid .field-long,
  .guest-grid .field-full,
  .guest-grid .field-country { grid-column: 1 / -1; }
  .guest-form-actions { padding: 12px 14px; }
  .guest-form-actions button { width: 100%; min-width: 0; }
}

@media (min-width: 761px) and (max-width: 1050px) {
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .guest-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .guest-grid .field-short,
  .guest-grid .field-third,
  .guest-grid .field-postal,
  .guest-grid .field-city,
  .guest-grid .field-country { grid-column: span 2; }
  .guest-grid .field-medium,
  .guest-grid .field-half { grid-column: span 3; }
  .guest-grid .field-long,
  .guest-grid .field-full { grid-column: 1 / -1; }
}

@media (max-width: 430px) {
  .title ~ .form { grid-template-columns: 1fr; }
  .title ~ .form .wide { grid-column: auto; }
  .guest-page-title { flex-direction: column; }
  .guest-page-title .button { width: 100%; }
}
