/* Farben und Typografie von koch-chemie.com: Anthrazit, Grau, Weiss */
:root {
  --ink: #1e1e1e;
  --ink-soft: #3a3a3a;
  --grey: #919396;
  --grey-dark: #77797d;
  --line: #e3e4e4;
  --light: #f4f5f5;
  --white: #fff;
  --red: #c8102e;
  --green: #1f9d55;
  --radius: 4px;
  --font: "HelveticaNowDisplay", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--light);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* --- Kopfzeile: Koch-Chemie-Schriftzug links, Verkaeufer und Gebiet rechts --- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px;
  background: var(--white); border-bottom: 1px solid var(--line);
}
.logo { display: block; height: 24px; width: auto; flex: none; }
.topnav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.nav-link {
  font: inherit; font-size: 14px; font-weight: 700; color: var(--ink);
  background: none; border: 0; padding: 8px 10px; border-radius: var(--radius); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.nav-link.active { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 2px; }
.nav-user {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 14px; font-weight: 700; color: var(--ink);
  background: var(--light); border: 1px solid var(--line); border-radius: 99px;
  padding: 6px 12px 6px 8px; min-height: 36px; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.nav-user svg { width: 18px; height: 18px; }
.nav-user:active { background: #e6e6e6; }
@media (max-width: 380px) { .logo { height: 21px; } .topbar { gap: 8px; } }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; background: none; border: 0; color: var(--ink); border-radius: var(--radius); cursor: pointer; }

.view { max-width: 720px; margin: 0 auto; padding-bottom: 32px; }

/* --- Kopfbereich der Seiten --- */
.hero { background: var(--white); padding: 28px 16px 22px; border-bottom: 1px solid var(--line); }
.hero h1, .done h1 { margin: 0 0 8px; font-size: 40px; line-height: 1.02; font-weight: 700; letter-spacing: -.025em; color: var(--grey); }
.eyebrow { margin: 0 0 6px; color: var(--ink); font-weight: 700; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.muted { color: var(--grey-dark); margin: 0; }
.pad { padding: 16px; }
.stack { display: grid; gap: 12px; }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 16px;
  font: inherit; font-weight: 700; font-size: 16px; text-decoration: none;
  border-radius: var(--radius); border: 1px solid transparent; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: background-color .15s, transform .05s;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .55; }
.btn-primary { background: var(--ink); color: var(--white); }
.btn-primary:active { background: var(--ink-soft); }
.btn-outline { background: var(--white); color: var(--ink); border-color: var(--ink); }
.btn-dark { background: var(--light); color: var(--ink); border-color: var(--grey); }
.btn-block { width: 100%; }
.btn-lg { min-height: 56px; font-size: 18px; }

/* Startseite: zwei Hauptaktionen nebeneinander, unten Download und Info */
.home-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-tile { flex-direction: column; gap: 6px; min-height: 88px; font-size: 16px; line-height: 1.2; padding: 12px 8px; }
.btn-tile svg { width: 26px; height: 26px; }
.home-footer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-top: 12px; border-top: 1px solid var(--line); padding-top: 20px; }
.home-footer .btn { font-size: 14.5px; padding: 12px 10px; white-space: nowrap; gap: 6px; }
.info-tile {
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 16px;
  font: inherit; font-size: 15px; font-weight: 700; color: var(--grey-dark);
  background: transparent; border: 1.5px dashed var(--grey); border-radius: 24px; cursor: pointer;
}
.info-i { width: 22px; height: 22px; border-radius: 50%; background: var(--grey); color: var(--white); display: grid; place-items: center; font-size: 13px; font-weight: 700; font-style: italic; font-family: Georgia, serif; }

/* Info-Dialog */
.info-dialog {
  width: min(640px, calc(100% - 24px)); max-height: calc(100dvh - 48px); padding: 0; border: 0; border-radius: 10px;
  color: var(--ink); background: var(--white); box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.info-dialog[open] { display: flex; flex-direction: column; }
.info-dialog::backdrop { background: rgba(30,30,30,.55); }
.info-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 8px 12px 20px; border-bottom: 1px solid var(--line); }
.info-head h2 { margin: 0; font-size: 19px; line-height: 1.25; }
.info-body { overflow-y: auto; padding: 8px 20px 24px; -webkit-overflow-scrolling: touch; }
.info-step { padding: 14px 0; border-bottom: 1px solid var(--line); }
.info-step:last-child { border-bottom: 0; }
.info-step h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font-size: 16px; }
.info-step .num { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--white); display: grid; place-items: center; font-size: 13px; }
.info-step p, .info-step li { font-size: 15px; line-height: 1.5; margin: 0 0 8px; }
.info-step ol { margin: 0 0 8px; padding-left: 22px; }
.info-first { background: var(--light); margin: 8px -12px 4px; padding: 14px 12px; border-radius: 8px; border-bottom: 0; }
.info-note { color: var(--grey-dark); font-size: 14px !important; }
.share-icon svg { width: 16px; height: 16px; vertical-align: -3px; }
.link-btn { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 8px 0; font: inherit; color: var(--ink); font-weight: 700; cursor: pointer; }
.link-btn.center { justify-content: center; width: 100%; }

/* --- Listen --- */
.list-section { padding: 8px 16px 0; }
.list-section h2 { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--grey-dark); margin: 16px 0 8px; }
.list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.list li { background: var(--white); border-radius: var(--radius); border-left: 4px solid var(--ink); display: flex; align-items: stretch; }
.list li.sent { border-left-color: var(--grey); }
.list .item { flex: 1; min-width: 0; text-align: left; background: none; border: 0; font: inherit; color: inherit; padding: 12px 14px; cursor: pointer; }
.list .item strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .item span { display: block; color: var(--grey-dark); font-size: 14px; }
.list .item span.times { font-size: 12px; margin-top: 2px; }
.list .del { background: none; border: 0; color: var(--grey); padding: 0 16px; cursor: pointer; }
.empty { font-size: 15px; padding: 4px 0; }

/* --- Formular --- */
.formbar { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; background: var(--white); border-bottom: 1px solid var(--line); }
.status-pill { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 4px 10px; border-radius: 99px; background: var(--light); color: var(--grey-dark); }
.status-pill.draft { background: var(--ink); color: var(--white); }

form#form-entry { padding: 12px 16px calc(96px + var(--safe-b)); display: grid; gap: 12px; }
.card { background: var(--white); border: 0; border-radius: var(--radius); margin: 0; padding: 16px; display: grid; gap: 14px; min-width: 0; }
.card legend { float: left; width: 100%; padding: 0; font-weight: 700; font-size: 20px; }
.card legend + * { clear: both; }

.field { display: grid; gap: 6px; min-width: 0; }
.label { font-size: 14px; font-weight: 700; color: var(--ink); }
.label small { font-weight: 400; color: var(--grey-dark); }
em { font-style: normal; color: var(--grey-dark); }

input, select, textarea {
  width: 100%; min-width: 0; font: inherit; font-size: 17px; color: var(--ink);
  background: var(--white); border: 1px solid #c9cbcc; border-radius: var(--radius);
  padding: 11px 12px; min-height: 48px; -webkit-appearance: none; appearance: none;
}
input[type="date"] { display: block; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231e1e1e' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; padding-right: 36px;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(30, 30, 30, .12); }
.field.invalid input, .field.invalid textarea, .field.invalid select, .field.invalid .seg { border-color: var(--red); box-shadow: 0 0 0 2px rgba(200, 16, 46, .15); }
.field.filled-by-voice input, .field.filled-by-voice select, .field.filled-by-voice textarea { animation: flash 1s ease-out; }
@keyframes flash { from { background: #e6e6e6; } to { background: var(--white); } }

.row2 { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .row2 { grid-template-columns: 1fr 1fr; } }
.row2.pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }

/* Pflichtfelder: Balken links, kraeftiger Rahmen, Sternchen */
.field.req { border-left: 3px solid var(--ink); padding-left: 10px; margin-left: -13px; }
.field.req input, .field.req textarea { border: 1.5px solid var(--ink); }
.field.req .label em { color: var(--ink); font-weight: 700; }

/* Schieber Umsatzpotenzial */
.label .slider-value { float: right; font-weight: 700; color: var(--ink); }
.slider { --thumb: 28px; --pct: 0%; position: relative; min-width: 0; padding-top: 4px; }
.slider input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: var(--thumb); min-height: 0; margin: 0; padding: 0;
  border: 0; background: transparent; position: relative; z-index: 2; box-shadow: none;
}
.slider input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right, var(--ink) 0, var(--ink) var(--pct), #d5d6d7 var(--pct));
}
.slider input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: #d5d6d7; }
.slider input[type="range"]::-moz-range-progress { height: 4px; background: var(--ink); }
.slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: var(--thumb); height: var(--thumb); margin-top: calc((4px - var(--thumb)) / 2);
  border-radius: 50%; background: var(--white); border: 3px solid var(--ink); box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.slider input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--white); border: 3px solid var(--ink); }
.slider input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(30,30,30,.2); }
.slider-ticks { position: relative; height: 34px; margin-top: -18px; }
.tick {
  position: absolute; top: 0; left: calc(var(--thumb) / 2 + (100% - var(--thumb)) * var(--i) / var(--n));
  transform: translateX(-50%); display: grid; justify-items: center; gap: 6px;
  background: none; border: 0; padding: 0; font: inherit; color: var(--grey-dark); cursor: pointer; z-index: 1;
}
.tick i { width: 10px; height: 10px; border-radius: 50%; background: #d5d6d7; }
.tick span { font-size: 11px; font-weight: 700; white-space: nowrap; letter-spacing: -.01em; }
.tick.on i { background: var(--ink); }
.tick.on span { color: var(--ink); }
.tick:first-child { transform: none; left: 0; justify-items: start; }
.tick:first-child i { margin-left: calc(var(--thumb) / 2 - 5px); }
.tick:last-child { transform: none; left: auto; right: 0; justify-items: end; }
.tick:last-child i { margin-right: calc(var(--thumb) / 2 - 5px); }

/* Kalender */
.card-flat { background: var(--white); margin: 12px 16px 0; padding: 12px; border-radius: var(--radius); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head h2 { margin: 0; font-size: 20px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-weekdays span { text-align: center; font-size: 12px; font-weight: 700; color: var(--grey-dark); padding: 4px 0; }
.cal-day {
  aspect-ratio: 1 / 1.2; display: grid; grid-template-rows: 1fr auto 1fr; justify-items: center; align-items: center;
  padding: 3px 0; border: 1px solid transparent; border-radius: var(--radius); background: var(--light);
  font: inherit; color: var(--ink); cursor: pointer; min-height: 44px;
}
.cal-day .num { font-size: 15px; font-weight: 700; }
.cal-day .sep { width: 70%; height: 1px; background: #c9cbcc; }
.cal-day .count { font-size: 11px; font-weight: 700; line-height: 1; min-height: 11px; }
.cal-day .count.draft-only { color: var(--grey-dark); font-weight: 400; }
.cal-day.has { background: var(--white); border-color: var(--line); }
.cal-day.today { border-color: var(--ink); }
.cal-day.selected { background: var(--ink); color: var(--white); border-color: var(--ink); }
.cal-day.selected .sep { background: rgba(255,255,255,.5); }
.cal-day.selected .count, .cal-day.selected .count.draft-only { color: var(--white); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }
.dot-draft { background: transparent; border: 1.5px solid var(--grey-dark); }
.cal-legend { margin: 10px 2px 0; font-size: 13px; }
.view#view-calendar { padding-top: 4px; }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick .btn { font-size: 15px; padding: 10px 8px; }
.hint { margin: -4px 0 0; font-size: 13px; color: var(--grey-dark); }

/* Aktivitaet als Segmentschalter */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--ink); border-radius: var(--radius); overflow: hidden; }
.seg button { font: inherit; font-size: 14px; font-weight: 700; min-height: 46px; padding: 6px 4px; border: 0; border-left: 1px solid var(--ink); background: var(--white); color: var(--ink); cursor: pointer; }
.seg button:first-child { border-left: 0; }
.seg button[aria-checked="true"] { background: var(--ink); color: var(--white); }

/* Mikrofon neben dem Feld */
.voice-row { display: flex; gap: 8px; align-items: flex-start; }
.mic {
  flex: none; width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; border: 0; cursor: pointer;
  background: var(--ink); color: var(--white); -webkit-tap-highlight-color: transparent;
}
.mic svg { width: 22px; height: 22px; }
.mic.on { background: var(--red); animation: ring 1.2s infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(200, 16, 46, .45); } 100% { box-shadow: 0 0 0 14px rgba(200, 16, 46, 0); } }
.mic-inline { display: inline-block; width: 16px; height: 16px; border-radius: 50%; background: var(--ink); vertical-align: -3px; }

/* Schalter Empfehlungen */
.switch { display: flex; align-items: center; gap: 12px; font-weight: 700; cursor: pointer; min-height: 44px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 51px; height: 31px; border-radius: 99px; background: #d5d6d7; position: relative; transition: background .2s; flex: none; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: var(--white); box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + .switch-track { background: var(--ink); }
.switch input:checked + .switch-track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px rgba(30, 30, 30, .25); }

.legend-note { font-size: 14px; padding: 0 4px; }

/* Leiste unten */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  display: grid; grid-template-columns: 1fr 1.25fr; gap: 8px;
  padding: 10px 16px calc(10px + var(--safe-b));
  background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.actionbar .btn { font-size: 15px; padding: 10px 8px; }
@media (min-width: 720px) { .actionbar { left: 50%; transform: translateX(-50%); max-width: 720px; } }

/* Hinweis beim Zuhoeren */
.listening {
  position: fixed; left: 16px; right: 16px; bottom: calc(84px + var(--safe-b)); z-index: 30;
  display: flex; align-items: center; gap: 12px; max-width: 688px; margin: 0 auto;
  background: var(--ink); color: var(--white); padding: 12px 12px 12px 16px; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
#listening-text { flex: 1; min-width: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.listening button { background: var(--white); color: var(--ink) !important; color: var(--white); border: 0; font: inherit; font-weight: 700; padding: 8px 14px; border-radius: var(--radius); }
.pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--red); animation: ring 1.2s infinite; flex: none; }

.toast {
  position: fixed; left: 16px; right: 16px; top: calc(env(safe-area-inset-top, 0px) + 64px); z-index: 40;
  max-width: 560px; margin: 0 auto; padding: 12px 16px; border-radius: 8px;
  background: var(--ink); color: var(--white); font-size: 15px; box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.toast.is-error { background: var(--red); }
.toast.is-ok { background: var(--ink); }

.error { color: var(--red); margin: 0; font-size: 15px; }
#view-login .card { margin: 16px; padding: 20px 16px; }

/* Bestaetigung */
.done { padding: 48px 16px; text-align: center; display: grid; gap: 12px; justify-items: center; }
.done .stack { width: 100%; max-width: 420px; margin-top: 16px; }
.done-icon { width: 72px; height: 72px; border-radius: 50%; background: var(--ink); color: var(--white); display: grid; place-items: center; }
.done-icon svg { width: 38px; height: 38px; stroke-width: 2.5; }

/* Nur-Lesen-Ansicht gesendeter Berichte */
.readonly .mic, .readonly .quick, .readonly .actionbar { display: none !important; }
.readonly input, .readonly select, .readonly textarea { background: var(--light); color: var(--ink); opacity: 1; -webkit-text-fill-color: var(--ink); }
.readonly form#form-entry { padding-bottom: 32px; }
