/* feelgood.fm colours. The station's orange #ff440f and pink #f31e58 are too light for text
   (3.4:1 and 4.1:1 on white), so they appear only in decoration (header line, equalizer, logo);
   text, buttons and badges use darker shades of them.
   Every text/background pair is at least 4.5:1 and every control border at least 3:1, in
   both themes. Colour never carries meaning alone: unread counts, "neu" and the open chat
   are also text or aria-current. */
:root {
  color-scheme: light dark;
  --brand-orange: #ff440f;
  --brand-pink: #f31e58;
  --bg: #f9f3f3;
  --surface: #ffffff;
  --fg: #1d1a1b;
  --muted: #5a5052;
  --accent: #c0350b;
  --on-accent: #ffffff;
  --accent-soft: #feefe8;
  --pink: #c8174a;
  --on-pink: #ffffff;
  --in: #ffffff;
  --out: #feefe8;
  --line: #e8dcdc;   /* decorative separators */
  --field: #7a6e70;  /* borders that outline a control */
  --focus: #0b3d91;
  --error: #b00020;
  --danger: #a4161a;
  --warn: #fff4ce;
  --warn-line: #b38600;
  --radius: .6rem;
  --shadow: 0 1px 2px rgb(60 20 10 / .08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131012;
    --surface: #1d191b;
    --fg: #f5eeee;
    --muted: #c2b7b9;
    --accent: #ff6a3d;
    --on-accent: #1b0a04;
    --accent-soft: #3a1f17;
    --pink: #ff7aa0;
    --on-pink: #1b0a10;
    --in: #241f21;
    --out: #3a1f17;
    --line: #3a3236;
    --field: #978b8e;
    --focus: #ffd166;
    --error: #ff8a80;
    --danger: #ff8a80;
    --warn: #4a3b00;
    --warn-line: #ffcc4d;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
body { margin: 0; font: 1rem/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--fg); }
a { color: var(--accent); text-underline-offset: .15em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.75rem 0 .6rem; }
h3 { font-size: 1.05rem; margin: 1.5rem 0 .5rem; }
p { margin: .5rem 0; }

/* Controls: large targets, visible borders. */
button, input, textarea { font: inherit; }
input, textarea { max-width: 100%; padding: .55rem .7rem; border: 1px solid var(--field); border-radius: .4rem;
  background: var(--surface); color: var(--fg); }
input[type=checkbox] { width: 1.25rem; height: 1.25rem; vertical-align: middle; accent-color: var(--accent); }
textarea { width: 100%; min-height: 6rem; resize: vertical; }
button { min-height: 2.75rem; padding: .5rem 1.1rem; border: 2px solid var(--accent); border-radius: .4rem;
  background: var(--accent); color: var(--on-accent); font-weight: 600; cursor: pointer; }
button[aria-disabled="true"] { cursor: progress; }
/* Secondary and destructive buttons: outlined. */
header.site button, td.actions button { background: transparent; color: var(--accent); }
section[aria-labelledby="h-delete"] button { background: transparent; color: var(--danger); border-color: var(--danger); }
@media (hover: hover) {
  button:hover { filter: brightness(1.08); }
  header.site button:hover, td.actions button:hover { background: var(--accent-soft); filter: none; }
  a:hover { text-decoration-thickness: 2px; }
}

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; padding: .6rem 1rem; background: var(--surface); color: var(--accent);
  border: 2px solid var(--accent); border-radius: .4rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

header.site { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; align-items: center; justify-content: space-between;
  padding: .5rem 1.25rem; background: var(--surface);
  border-bottom: 4px solid var(--accent); /* fallback, and what high-contrast mode shows */
  border-image: linear-gradient(90deg, var(--brand-orange), var(--brand-pink)) 1; }
header.site p { margin: 0; }
.brand { font-size: 1.15rem; font-weight: 700; }
.brand a { display: inline-flex; gap: .6rem; align-items: center; color: var(--fg); text-decoration: none; }
.brand img { display: block; }
.hero { display: block; margin: 0 auto 1rem; }
header nav { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: center; }
form.inline { display: inline; }

.status, .alert:not(:empty) { margin: 0; padding: .65rem 1.25rem; background: var(--warn); font-weight: 600;
  border-bottom: 1px solid var(--warn-line); border-left: 6px solid var(--warn-line); }
.alert:empty { display: block; height: 0; overflow: hidden; } /* stays in the accessibility tree */
.notice { font-weight: 600; }
.error { color: var(--error); font-weight: 600; }
.hint, .phone { color: var(--muted); }
.hint { font-size: .95rem; }

/* Chat list and conversation side by side; stacked on narrow screens (DOM order unchanged). */
.layout { display: grid; grid-template-columns: minmax(15rem, 22rem) minmax(0, 1fr); min-height: calc(100vh - 4rem); }
nav.chats { padding: 0 .75rem 1rem; background: var(--surface); border-right: 1px solid var(--line); }
@media (max-width: 48rem) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  nav.chats { border-right: 0; border-bottom: 1px solid var(--line); }
}
nav.chats h2 { margin-top: 1rem; padding-left: .5rem; }
#chats { list-style: none; margin: 0; padding: 0; }
#chats li + li { margin-top: .25rem; }
#chats a { display: block; padding: .6rem .75rem; border-left: 4px solid transparent; border-radius: .5rem;
  color: var(--fg); text-decoration: none; }
#chats a[aria-current="page"] { background: var(--accent-soft); border-left-color: var(--accent); }
@media (hover: hover) { #chats a:hover { background: var(--accent-soft); } }
#chats .name { font-weight: 600; }
#chats .phone { font-size: .9rem; }
#chats .count { display: table; margin-top: .25rem; padding: 0 .55rem; border-radius: 1rem;
  background: var(--pink); color: var(--on-pink); font-size: .85rem; font-weight: 700; }
#chats .count:empty { display: none; }

main { min-width: 0; padding: 1.25rem 1.5rem; }
main.page { max-width: 60rem; }
main.page > section { margin: 1.25rem 0; padding: .25rem 1.25rem 1rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); }
main.narrow { max-width: 28rem; margin: 2rem auto; padding: 1.5rem 1.75rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
main.narrow input { width: 100%; }
@media (max-width: 30rem) { main.narrow { margin: 1rem; padding: 1.25rem; } }
h1 .phone { font-size: 1rem; font-weight: 400; }

/* Messages as bubbles: incoming left, studio replies right. */
.messages { display: flex; flex-direction: column; gap: .6rem; margin: 0; padding: 0; list-style: none; }
.msg { align-self: flex-start; max-width: min(42rem, 88%); padding: .55rem .85rem; background: var(--in);
  border: 1px solid var(--line); border-radius: .2rem var(--radius) var(--radius) var(--radius); box-shadow: var(--shadow); }
.msg.out { align-self: flex-end; background: var(--out); border-radius: var(--radius) .2rem var(--radius) var(--radius); }
.msg p { margin: .2rem 0; }
.meta { font-size: .9rem; color: var(--muted); }
.meta strong { color: var(--fg); }
.new { display: inline-block; padding: 0 .45rem; border-radius: 1rem; background: var(--pink); color: var(--on-pink);
  font-size: .8rem; font-weight: 700; }
.empty::before { /* decorative equalizer, as in the station logo */
  content: ""; display: block; width: 168px; max-width: 100%; height: 48px; margin: 2rem 0 1rem;
  background: url("equalizer.svg") no-repeat left bottom / contain; opacity: .85; }
.text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg img, .msg video { display: block; max-width: 100%; max-height: 24rem; height: auto; border-radius: .4rem; }
audio { max-width: 100%; }
.downloads { font-size: .9rem; }
#antwort label { font-weight: 600; }
section[aria-labelledby="h-delete"] { margin-top: 2.5rem; border-top: 1px solid var(--line); }

/* Administration */
.scroll { overflow-x: auto; }
table { border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); }
th, td { padding: .55rem .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
thead th { background: var(--accent-soft); }
td.actions form { margin: .25rem 0; }
td.actions button { min-height: 2.5rem; padding: .35rem .8rem; font-weight: 500; }
.secret { margin: 1rem 0; padding: .75rem 1.25rem; background: var(--surface); border: 2px dashed var(--accent);
  border-radius: var(--radius); }
.code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 1.6rem; letter-spacing: .15em; }

@media (prefers-reduced-motion: no-preference) {
  #chats a, button { transition: background-color .15s, filter .15s; }
}
/* Windows high-contrast mode: keep shapes that otherwise only come from background colours. */
@media (forced-colors: active) {
  #chats a[aria-current="page"] { border-left-color: Highlight; }
  #chats .count, .new { border: 1px solid CanvasText; }
  .empty::before { display: none; }
}
