/* ==========================================================================
   KastenKummer – Design
   Reduziert: neutrale Grautöne, Systemschrift (SF Pro auf Apple-Geräten),
   eine einzige Signalfarbe – sparsam eingesetzt. Hell- und Dunkelmodus.
   Farbe ändern: nur --signal anpassen.
   ========================================================================== */

:root {
  color-scheme: light dark;

  --bg:        #f5f5f7;
  --surface:   #ffffff;
  --field:     #f2f2f4;
  --field-hi:  #e8e8ed;
  --fill:      rgba(118, 118, 128, .12);
  --ink:       #1d1d1f;
  --ink-hover: #3a3a3c;
  --on-ink:    #ffffff;
  --text:      #1d1d1f;
  --text-2:    #6e6e73;
  --text-3:    #a1a1a6;
  --hairline:  rgba(0, 0, 0, .08);
  --seg-on:    #ffffff;

  --signal:    #ff5314;           /* die eine Farbe */
  --red:       #d70015;

  --shadow:    0 1px 1px rgba(0, 0, 0, .03), 0 18px 48px -24px rgba(0, 0, 0, .16);
  --shadow-sm: 0 1px 1px rgba(0, 0, 0, .03), 0 6px 18px -10px rgba(0, 0, 0, .12);

  --r-xl: 28px;
  --r-lg: 20px;
  --r-md: 14px;

  /* Eigene Schrift optional: siehe public/fonts/LIESMICH.txt */
  --font-display: "KastenKummer Display", -apple-system, BlinkMacSystemFont,
                  "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-body:    "KastenKummer Text", -apple-system, BlinkMacSystemFont,
                  "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #000000;
    --surface:   #161617;
    --field:     #232325;
    --field-hi:  #2e2e31;
    --fill:      rgba(118, 118, 128, .24);
    --ink:       #f5f5f7;
    --ink-hover: #ffffff;
    --on-ink:    #000000;
    --text:      #f5f5f7;
    --text-2:    #a1a1a6;
    --text-3:    #6e6e73;
    --hairline:  rgba(255, 255, 255, .1);
    --seg-on:    #48484a;
    --signal:    #ff6a33;
    --red:       #ff6961;
    --shadow:    0 0 0 1px rgba(255, 255, 255, .06);
    --shadow-sm: 0 0 0 1px rgba(255, 255, 255, .06);
  }
}

/* --------------------------------------------------------------------------
   Grundgerüst
   -------------------------------------------------------------------------- */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -.022em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
  overflow-x: hidden;
}

::selection { background: var(--signal); color: #fff; }

a { color: var(--text); text-decoration: underline; text-decoration-color: var(--text-3); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--text); }

.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.shell {
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  padding-inline: 20px;
  padding-block: max(52px, env(safe-area-inset-top)) max(28px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
.shell.wide { max-width: 720px; }
.shell > main, .shell > section { flex: 1 0 auto; }

/* --------------------------------------------------------------------------
   Logo – Icon + Wortmarke, "by Platzhalter" klein rechtsbündig darunter
   -------------------------------------------------------------------------- */

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.app-icon {
  display: block;
  width: 64px;
  height: 64px;
  border-radius: 15px;
}
.wordmark { display: inline-flex; flex-direction: column; align-items: flex-end; }
.wm {
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1;
  letter-spacing: -.04em;
  color: var(--text);
  white-space: nowrap;
}
.wm .k1 { font-weight: 700; }
.wm .k2 { font-weight: 400; color: var(--text-2); }
.by {
  margin-top: 6px;
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--text-3);
}

.brand.small { flex-direction: row; gap: 12px; }
.brand.small .app-icon { width: 40px; height: 40px; border-radius: 10px; }
.brand.small .wm { font-size: 22px; }

/* --------------------------------------------------------------------------
   Überschrift
   -------------------------------------------------------------------------- */

.hero { text-align: center; margin: 56px 0 36px; }
.title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(38px, 10.8vw, 60px);
  line-height: 1.02;
  letter-spacing: -.048em;
  margin: 0 0 18px;
  text-wrap: balance;
}
.title .muted { color: var(--text-3); }
.lead {
  margin: 0 auto;
  max-width: 32ch;
  font-size: 18px;
  line-height: 1.45;
  color: var(--text-2);
  text-wrap: pretty;
}

/* --------------------------------------------------------------------------
   Karte
   -------------------------------------------------------------------------- */

.panel {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  padding: 22px;
}
@media (min-width: 540px) { .panel { padding: 30px; } }

/* --------------------------------------------------------------------------
   Formular
   -------------------------------------------------------------------------- */

.field { display: block; margin-bottom: 18px; }
.field > .label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0 4px 9px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-2);
}
.field .opt { font-weight: 500; letter-spacing: .04em; text-transform: none; color: var(--text-3); font-size: 12px; }

textarea, input[type="text"], input[type="password"], input[type="search"], select {
  width: 100%;
  max-width: 100%;
  font: inherit;
  font-size: 17px;
  letter-spacing: -.022em;
  color: var(--text);
  background-color: var(--field);
  border: 0;
  border-radius: var(--r-md);
  padding: 15px 16px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color .2s, box-shadow .2s;
}
textarea::placeholder, input::placeholder { color: var(--text-3); }
textarea { min-height: 180px; resize: vertical; line-height: 1.5; }
textarea:focus, input:focus, select:focus {
  background-color: var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--ink);
}
select {
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%238e8e93' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

.counter {
  display: block;
  margin: 8px 4px 0 0;
  text-align: right;
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.counter.warn { color: var(--signal); }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 340px) { .row2 { grid-template-columns: 1fr; gap: 0; } }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.022em;
  cursor: pointer;
  text-decoration: none !important;
  -webkit-tap-highlight-color: transparent;
  transition: transform .18s cubic-bezier(.3, .7, .4, 1.3), background-color .2s, box-shadow .2s;
}
.btn:active { transform: scale(.975); }
.btn:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.full { width: 100%; }

.btn.primary { color: var(--on-ink); background: var(--ink); }
.btn.primary:hover { background: var(--ink-hover); }
.btn.primary .arrow { transition: transform .2s; }
.btn.primary:hover .arrow { transform: translateX(3px); }

.btn.secondary { color: var(--text); background: var(--fill); }
.btn.secondary:hover { background: var(--field-hi); }

.linkbtn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--text-3);
  text-underline-offset: 3px;
  cursor: pointer;
}
.linkbtn:hover { text-decoration-color: var(--text); }

/* kleine Pillen im Admin */
.btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.01em;
  white-space: nowrap;
  cursor: pointer;
  color: var(--text);
  background: var(--fill);
  transition: background-color .15s, transform .12s;
}
.btn-sm:hover { background: var(--field-hi); }
.btn-sm:active { transform: scale(.96); }
.btn-sm:disabled { opacity: .45; cursor: wait; }
.btn-sm:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.btn-sm.done { background: var(--ink); color: var(--on-ink); }
.btn-sm.done:hover { background: var(--ink-hover); }
.btn-sm.danger { background: transparent; color: var(--red); }
.btn-sm.danger:hover { background: rgba(255, 59, 48, .1); }

/* Ladekringel */
.spin {
  display: inline-block;
  width: 20px;
  height: 20px;
  font-size: 0;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}
.spin.big { width: 26px; height: 26px; margin-bottom: 12px; color: var(--text-3); }
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   Hinweise
   -------------------------------------------------------------------------- */

.error {
  background: rgba(255, 59, 48, .09);
  color: var(--red);
  border-radius: var(--r-md);
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 18px;
}
.fineprint {
  margin: 18px auto 0;
  max-width: 42ch;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-3);
  letter-spacing: -.01em;
}
.fineprint a { color: var(--text-2); text-decoration-color: var(--text-3); }

.promises {
  list-style: none;
  padding: 0;
  margin: 40px 0 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--hairline);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.promises li {
  background: var(--bg);
  padding: 16px 8px 14px;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.3;
  color: var(--text-2);
}
.promises b {
  display: block;
  margin-bottom: 4px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.035em;
  color: var(--text);
}
.promises b .dot { color: var(--signal); }

/* --------------------------------------------------------------------------
   Danke
   -------------------------------------------------------------------------- */

.thanks { text-align: center; padding: 22px 4px 8px; }
.check {
  width: 72px;
  height: 72px;
  margin: 0 auto 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--on-ink);
  animation: pop .55s cubic-bezier(.2, 1.4, .4, 1);
}
.check path { stroke: currentColor; stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .4s .22s ease-out forwards; }
@keyframes pop  { from { transform: scale(.5); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
.thanks h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 30px;
  line-height: 1.08;
  letter-spacing: -.045em;
  margin: 0 0 14px;
  text-wrap: balance;
}
.thanks h2 .muted { color: var(--text-3); }
.thanks p { color: var(--text-2); margin: 0 auto 10px; max-width: 34ch; }
.thanks .btn { margin-top: 22px; }

/* --------------------------------------------------------------------------
   Footer – dezent
   -------------------------------------------------------------------------- */

.foot {
  margin-top: 56px;
  text-align: center;
  font-size: 11.5px;
  line-height: 1.7;
  letter-spacing: -.005em;
  color: var(--text-3);
}
.foot a { color: var(--text-3); text-decoration: none; }
.foot a:hover { color: var(--text-2); }
.foot nav a + a::before { content: "·"; display: inline-block; margin: 0 9px; color: var(--text-3); }

/* --------------------------------------------------------------------------
   Admin
   -------------------------------------------------------------------------- */

.admin-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}
.admin-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 4px 16px;
  font-size: 14px;
  color: var(--text-2);
}
.admin-meta b { color: var(--text); font-weight: 600; }
.admin-meta a { font-size: 14px; }

.login-title {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 32px;
  line-height: 1.05;
  letter-spacing: -.045em;
  margin: 48px 0 28px;
}
.login-title .muted { color: var(--text-3); }

.segmented {
  display: flex;
  width: 100%;
  max-width: 320px;
  margin: 0 auto 18px;
  padding: 3px;
  border-radius: 11px;
  background: var(--fill);
}
.segmented .tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.01em;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color .2s, color .2s, box-shadow .2s;
}
.segmented .tab.active {
  background: var(--seg-on);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .1), 0 0 0 .5px rgba(0, 0, 0, .04);
}
.segmented .tab:focus-visible { outline: 2px solid var(--signal); outline-offset: 1px; }
.tab .n {
  margin-left: 5px;
  font-weight: 500;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.tab.active .n { color: var(--signal); font-weight: 700; }

.toolbar { display: flex; gap: 10px; margin-bottom: 18px; }
.toolbar input[type="search"] {
  flex: 1;
  padding-left: 42px;
  background-color: var(--surface);
  box-shadow: var(--shadow-sm);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='5.2' fill='none' stroke='%238e8e93' stroke-width='1.8'/%3E%3Cpath d='m11 11 3.4 3.4' stroke='%238e8e93' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 16px center;
}
.toolbar input[type="search"]:focus { box-shadow: inset 0 0 0 1.5px var(--ink); }
.toolbar input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
.iconbtn {
  flex: none;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--text-2);
  cursor: pointer;
  transition: color .15s, transform .3s;
}
.iconbtn:hover { color: var(--text); }
.iconbtn:active { transform: rotate(-120deg); }
.iconbtn:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

.msg-list { display: flex; flex-direction: column; gap: 12px; }
.msg {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px 16px;
}
.msg.archived .msg-body { color: var(--text-2); }
.msg-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.meta-tag { color: var(--text-2); }
.meta-tag.ok { color: var(--text); }
.meta-tag.ok::before { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 6px 1px 0; border-radius: 50%; background: var(--signal); vertical-align: middle; }
.msg-body {
  margin: 10px 0 16px;
  font-size: 17px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
}

.empty {
  text-align: center;
  padding: 56px 20px;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--text-2);
  font-size: 15px;
}
.empty .big { display: block; font-size: 38px; line-height: 1; margin: 0 auto 14px; filter: grayscale(1); opacity: .6; }

/* --------------------------------------------------------------------------
   Rechtstexte
   -------------------------------------------------------------------------- */

.back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  color: var(--text-2);
  text-decoration: none;
}
.back:hover { color: var(--text); }
.legal-title {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(34px, 9vw, 44px);
  letter-spacing: -.048em;
  line-height: 1.04;
  margin: 36px 0 8px;
  text-wrap: balance;
}
.legal-sub { text-align: center; color: var(--text-3); font-size: 14px; margin: 0 0 30px; }
.legal { font-size: 16px; line-height: 1.6; letter-spacing: -.012em; }
.legal h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -.03em;
  margin: 32px 0 8px;
}
.legal h2:first-child { margin-top: 0; }
.legal h3 { font-size: 16px; font-weight: 600; margin: 22px 0 6px; }
.legal p, .legal li { color: var(--text-2); }
.legal strong { color: var(--text); font-weight: 600; }
.legal p { margin: 0 0 12px; }
.legal ul { margin: 0 0 12px; padding-left: 20px; }
.legal li { margin-bottom: 4px; }
.legal .adr { font-style: normal; line-height: 1.65; color: var(--text); }
.legal .box { background: var(--field); border-radius: var(--r-md); padding: 16px 18px; margin: 0 0 14px; }
.legal .box p { margin: 0; }
.legal .box.hint { background: transparent; box-shadow: inset 0 0 0 1px var(--hairline); }
.legal .box.hint p { color: var(--text); }

/* --------------------------------------------------------------------------
   Bewegung reduzieren
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .check path { stroke-dashoffset: 0; }
}

/* Pfeil am Absende-Button */
#submit::after { content: "→"; font-weight: 500; transition: transform .2s; }
#submit:hover::after { transform: translateX(3px); }
#submit:disabled::after { display: none; }
