/* Kita-Post – Süßwasserpiraten theme. Sand, sea, coral. */
@font-face { font-family: "Baloo 2"; src: url(baloo2.woff2) format("woff2"); font-weight: 600 700; font-display: swap; }
:root {
  --sand: #fbf5e9; --card: #ffffff; --ink: #1d2a3a; --mut: #6a7686; --line: #eadfca;
  --sea: #12355b; --sea2: #1d5a8c; --teal: #179c8c; --coral: #f0643f; --sun: #ffc845;
  --bad: #c2391b; --signal: #3a76f0; --wa: #25a35a; --bubble: #dcf8c6; --bubble-ink: #1d2a3a;
  --shadow: 0 2px 0 rgba(18, 53, 91, .08), 0 8px 24px rgba(18, 53, 91, .07);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --sand: #0f1a26; --card: #172636; --ink: #eef3f8; --mut: #9fb0c2; --line: #263a50;
    --sea: #0b2440; --sea2: #15476f; --bubble: #1f4d3a; --bubble-ink: #eef3f8; --bad: #ff8a6b;
    --shadow: 0 2px 0 rgba(0, 0, 0, .25), 0 8px 24px rgba(0, 0, 0, .25);
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--sand); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, sans-serif; }
h1, h2, h3, .fun { font-family: "Baloo 2", system-ui, sans-serif; }
main { max-width: 680px; margin: 0 auto; padding: 0 16px 48px; }

/* header with waves */
header { background: linear-gradient(160deg, var(--sea), var(--sea2)); color: #fff; padding: 20px 16px 44px; position: relative; }
header .in { max-width: 680px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
header h1 { margin: 0; font-size: 1.9rem; line-height: 1.1; }
header .sub { opacity: .8; font-size: .9rem; }
header svg { position: absolute; left: 0; bottom: -1px; width: 100%; height: 32px; }
header svg path { fill: var(--sand); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .85rem; background: rgba(255, 255, 255, .14); color: inherit; text-decoration: none; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #ccc; }
.dot.on { background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, .25); } .dot.off { background: var(--coral); }

h2 { font-size: 1.35rem; margin: 28px 0 8px; }
h2 small { display: block; font: .85rem system-ui, sans-serif; color: var(--mut); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px; margin: 10px 0; box-shadow: var(--shadow); }
.compose { margin-top: -20px; position: relative; border-top: 5px solid var(--sun); }
.mut { color: var(--mut); font-size: .88rem; } .bad { color: var(--bad); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.text { white-space: pre-wrap; overflow-wrap: anywhere; }
.banner { background: #fde7df; color: #7a2410; border: 0; }

textarea, input, select { font: inherit; color: var(--ink); background: var(--sand); border: 2px solid var(--line); border-radius: 12px; padding: 8px 10px; max-width: 100%; }
textarea { width: 100%; min-height: 8rem; resize: vertical; }
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--teal); }
button, .btn { font: 600 .95rem system-ui, sans-serif; padding: 9px 16px; border-radius: 12px; border: 0; cursor: pointer; background: var(--coral); color: #fff; text-decoration: none; display: inline-block; box-shadow: 0 3px 0 rgba(0, 0, 0, .15); }
button:active { transform: translateY(2px); box-shadow: none; }
button.ghost, .btn.ghost { background: transparent; color: var(--sea2); box-shadow: none; border: 2px solid var(--line); }
button.small { padding: 4px 10px; font-size: .85rem; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) button.ghost, :root:not([data-theme="light"]) .btn.ghost { color: #8cc4f0; } }
form.inline { display: inline; }

/* chips + toggles */
.chip { border: 2px dashed var(--line); background: transparent; color: var(--ink); border-radius: 999px; padding: 3px 11px; font: 500 .85rem system-ui, sans-serif; box-shadow: none; text-decoration: none; display: inline-block; }
.chip:hover { border-color: var(--teal); color: var(--teal); }
.seg { display: inline-flex; background: var(--sand); border: 2px solid var(--line); border-radius: 14px; padding: 3px; }
.seg input, .toggle input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { padding: 6px 12px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: .92rem; }
.seg input:checked + label { background: var(--sea2); color: #fff; }
.toggle label { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 999px; border: 2px solid var(--line); cursor: pointer; font-weight: 600; font-size: .92rem; opacity: .55; }
.toggle input:checked + label { opacity: 1; }
.toggle input[value=signal]:checked + label { border-color: var(--signal); color: var(--signal); }
.toggle input[value=whatsapp]:checked + label { border-color: var(--wa); color: var(--wa); }

/* preview bubble */
.preview { background: repeating-linear-gradient(45deg, transparent 0 12px, rgba(23, 156, 140, .05) 12px 24px), var(--sand); border-radius: 14px; padding: 12px; margin-top: 12px; }
.bubble { background: var(--bubble); color: var(--bubble-ink); border-radius: 14px 14px 4px 14px; padding: 8px 12px; margin-left: auto; max-width: 92%; width: fit-content; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 1px 1px rgba(0, 0, 0, .1); }
.bubble:empty::before { content: "Hier erscheint deine Nachricht …"; opacity: .5; }
.when { font-weight: 700; color: var(--teal); } .when.late { color: var(--bad); }

/* timeline */
.event { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 12px; }
.event > div { min-width: 0; }
.date { background: var(--sea2); color: #fff; border-radius: 14px; text-align: center; padding: 6px 0; height: fit-content; }
.date b { display: block; font: 700 1.6rem/1 "Baloo 2", system-ui, sans-serif; } .date span { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.event h3 { margin: 0; font-size: 1.15rem; line-height: 1.2; }
.mini { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px dashed var(--line); font-size: .92rem; min-width: 0; }
.mini > * { flex-shrink: 0; }
.mini .t { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) { .mini .t { display: none; } .mini > span:nth-child(2) { flex: 1; } }
.edit { color: var(--sea2); font-size: .85rem; font-weight: 600; text-decoration: none; }
.badge { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 7px; border-radius: 6px; background: var(--line); color: var(--ink); }
.badge.s-geplant { background: #d6ece8; color: #0f5c52; } .badge.s-gesendet { background: #dcefe0; color: #22663a; }
.badge.s-fehler, .badge.s-verpasst { background: #fbe0d8; color: #8a2a12; } .badge.s-entwurf { background: #fff0c7; color: #6b5200; }
.tag { font-size: .75rem; font-weight: 700; border-radius: 6px; padding: 0 5px; color: #fff; }
.tag.signal { background: var(--signal); } .tag.whatsapp { background: var(--wa); }
.empty { text-align: center; padding: 22px; }
.qr { background: #fff; padding: 10px; display: inline-block; border-radius: 12px; margin: 8px 0; }
.code { font: 700 1.8rem ui-monospace, monospace; letter-spacing: .15em; background: var(--sand); padding: 6px 14px; border-radius: 10px; display: inline-block; }
details summary { cursor: pointer; font-weight: 600; }

/* to-dos */
.todo { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px dashed var(--line); }
.todo:first-child { border-top: 0; }
.todo .tt { flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }
.todo.done .tt { text-decoration: line-through; color: var(--mut); }
button.check { width: 24px; height: 24px; padding: 0; border-radius: 7px; border: 2px solid var(--teal); background: transparent; box-shadow: none; position: relative; }
button.check.on { background: var(--teal); }
button.check.on::after { content: ""; position: absolute; left: 7px; top: 3px; width: 6px; height: 11px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.owner { font-size: .75rem; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: var(--line); }
.owner.o-jannis { background: #dbe7f6; color: #1d4a7a; } .owner.o-sylvia { background: #f6dde8; color: #7a1d4a; }
button.pill { border: 0; box-shadow: none; cursor: pointer; font: inherit; font-size: .85rem; }
details.card > summary { padding: 2px 0; }

.okbanner { background: #dcefe0; color: #22663a; border: 0; font-weight: 600; }
dialog#send-dialog { max-width: min(92vw, 520px); width: 100%; color: var(--ink); }
dialog#send-dialog::backdrop { background: rgba(10, 20, 35, .55); }
#dlg-to div { font-weight: 700; }

/* tabs: bottom bar on phones, top bar on wide screens */
.js .tab:not(.on) { display: none; }
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(18, 53, 91, .08); }
nav.tabs a { flex: 1; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; text-decoration: none; color: var(--mut); font: 600 .82rem system-ui, sans-serif; border-radius: 12px; position: relative; }
nav.tabs a.on { color: var(--sea2); background: var(--sand); }
nav.tabs .count { position: absolute; top: 4px; right: calc(50% - 26px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--coral); color: #fff; font-size: .7rem; line-height: 18px; text-align: center; }
main { padding-bottom: 96px; }
@media (min-width: 760px) {
  nav.tabs { position: sticky; top: 0; bottom: auto; border-top: 0; border-bottom: 1px solid var(--line); border-radius: 0 0 14px 14px;
    margin: -20px 0 12px; box-shadow: var(--shadow); }
  main { padding-bottom: 48px; }
  .compose { margin-top: 0; }
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) nav.tabs a.on { color: #8cc4f0; } }

/* touch targets: at least 44px for buttons, 36px for chips */
button, .btn { min-height: 44px; }
button.small, .btn.small { min-height: 40px; padding: 6px 14px; }
.chip { min-height: 36px; display: inline-flex; align-items: center; padding: 4px 12px; }
.seg label, .toggle label { min-height: 40px; display: inline-flex; align-items: center; }
a.edit { display: inline-flex; align-items: center; min-height: 40px; padding: 0 6px; }
button.check { width: 32px; height: 32px; min-height: 32px; }
button.check.on::after { left: 10px; top: 5px; width: 7px; height: 13px; }
input, select { min-height: 44px; }
button.pill { min-height: 32px; }

/* forms */
.stack { display: grid; gap: 10px; margin-top: 10px; }
.stack label { display: grid; gap: 4px; font-size: .9rem; color: var(--mut); }
.stack label input, .stack label textarea { color: var(--ink); width: 100%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 380px) { .grid2 { grid-template-columns: 1fr; } }

/* dialogs centred (a .card margin would pin them to the corner) */
dialog.card { margin: auto; max-width: min(92vw, 520px); width: 100%; color: var(--ink); }
dialog.card::backdrop { background: rgba(10, 20, 35, .55); }

/* compact rows */
.todo { flex-wrap: nowrap; align-items: flex-start; }
.todo .tbody { flex: 1; min-width: 0; }
.todo .tt { overflow-wrap: anywhere; padding-top: 4px; }
.tmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: .85rem; }
button.linkbtn { background: none; border: 0; box-shadow: none; color: var(--sea2); font-weight: 600; font-size: .85rem; padding: 0 6px; min-height: 40px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) button.linkbtn { color: #8cc4f0; } }
.row.actions { gap: 4px 12px; }
.text.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.text.clamp.open { display: block; }

/* phones: mini rows in two lines instead of one squeezed column */
@media (max-width: 520px) {
  .event { grid-template-columns: 52px minmax(0, 1fr); gap: 10px; }
  .mini { flex-wrap: wrap; row-gap: 2px; }
  .mini > span:nth-child(2) { order: -1; flex: 1 0 100%; white-space: nowrap; }
  .mini a.edit { margin-left: auto; }
}
