/* Web app (konto/*): landing colours plus soft pastel accents. Loaded after styles.css. */
:root {
  --mint: #e0f2e9; --mint-ink: #2e6a4d;
  --peach: #fde9db; --peach-ink: #8a4f27;
  --sky: #e1eefb; --sky-ink: #2f5b88;
  --rose: #f9e4ec; --rose-ink: #8a3d58;
  --sand: #f4efe6;
  --shadow: 0 1px 2px rgba(60, 45, 95, .05), 0 8px 24px rgba(60, 45, 95, .05);
}
body.app { background: var(--paper); }
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 8px; padding: 22px 16px; border-right: 1px solid var(--line); background: linear-gradient(180deg, #fbf9f5, #f6f2fa); }
.side .brand { padding: 4px 12px 18px; font-size: 26px; }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-top .brand { padding-bottom: 18px; }
.side-toggle { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; margin-bottom: 14px; border: 0; border-radius: 12px; background: none; color: var(--muted); cursor: pointer; flex: none; }
.side-toggle:hover { background: #fff8; color: var(--ink); }
.shell { transition: grid-template-columns .2s ease; }
@media (min-width: 861px) {
  .shell.collapsed { grid-template-columns: 76px minmax(0, 1fr); }
  .shell.collapsed .side { padding-inline: 12px; align-items: center; }
  .shell.collapsed .side-top { flex-direction: column; gap: 4px; }
  .shell.collapsed .side .brand { padding: 4px 0 0; }
  .shell.collapsed .lbl { display: none; }
  /* Collapsed: a 40px usage bar without its labels read as a stray line, so the box is hidden (usage stays on Konto). */
  .shell.collapsed .plan-box { display: none; }
  .shell.collapsed .nav a, .shell.collapsed .linkish { justify-content: center; padding: 11px; }
  .shell.collapsed .side-foot { width: 100%; justify-items: center; }
}
.linkish { display: inline-flex; align-items: center; gap: 12px; }
.nav { display: grid; gap: 4px; }
.nav a { display: flex; gap: 12px; align-items: center; padding: 11px 14px; border-radius: 14px; color: var(--muted); font-weight: 500; text-decoration: none; }
.nav a:hover { background: #fff8; color: var(--ink); }
.nav a[aria-current="page"] { background: var(--lavender); color: var(--accent-deep); font-weight: 600; }
.nav .ico { width: 20px; text-align: center; font-size: 17px; }
.side-foot { margin-top: auto; display: grid; gap: 12px; }
.plan-box { padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #fffdf9; display: grid; gap: 8px; box-shadow: var(--shadow); }
.plan-box strong { font-size: 15px; }
.plan-box .bar { position: relative; height: 8px; border-radius: 99px; background: var(--lavender); }
.plan-box .bar .pace { top: -3px; bottom: -3px; border-right-width: 3px; border-radius: 99px 0 0 99px; }
.plan-box .bar span { position: relative; z-index: 1; display: block; height: 100%; background: linear-gradient(90deg, #8c7fb8, var(--accent)); border-radius: 99px; }
.plan-box small { color: var(--muted); display: flex; justify-content: space-between; }
.linkish { background: none; border: 0; color: var(--muted); cursor: pointer; text-align: left; padding: 8px 14px; border-radius: 12px; }
.linkish:hover { background: #fff8; color: var(--ink); }
.main { min-width: 0; padding: clamp(20px, 4vw, 44px); display: grid; gap: 24px; align-content: start; position: relative; }
.main::before { content: ""; position: absolute; top: 0; right: 0; width: min(520px, 50%); height: 300px; background: url("assets/olive-study.webp") right top / cover no-repeat; opacity: .5; mask-image: linear-gradient(to left, #000 30%, transparent); -webkit-mask-image: linear-gradient(to left, #000 30%, transparent); pointer-events: none; }
.main > * { position: relative; }
.topbar-m { display: none; }
.hello { color: var(--muted); font-size: 15px; }
.title { font-size: clamp(30px, 5vw, 48px); letter-spacing: -.035em; line-height: 1.1; }
.lead { color: var(--muted); max-width: 560px; font-size: 17px; }
.btn { display: inline-flex; gap: 8px; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent; font-size: 15px; font-weight: 600; line-height: 1.2; white-space: nowrap; cursor: pointer; text-decoration: none; transition: background .15s, transform .15s, box-shadow .15s; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(93, 85, 125, .25); }
.btn-primary:hover { background: var(--accent-deep); transform: translateY(-1px); }
.btn-ghost { background: #fffdf9; border-color: #cfc7dc; color: var(--accent-deep); }
.btn-ghost:hover { background: var(--lavender); }
.btn-danger { background: #c94a33; color: #fff; border-color: transparent; }
.btn-danger:hover { background: #a93a27; }
.btn-danger:disabled { opacity: .5; }
.btn-small { min-height: 38px; padding: 0 16px; font-size: 14px; }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.chips-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 18px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 0; background: var(--sand); color: var(--muted); padding: 9px 16px; border-radius: 999px; cursor: pointer; font-weight: 500; }
.chip b { font-weight: 500; opacity: .6; margin-left: 4px; }
.chip[aria-pressed="true"] { background: var(--accent); color: #fff; }
.search { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid #d6cfe2; background: #fffdf9; font: inherit; min-width: 220px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
.card { border: 1px solid var(--line); border-radius: 22px; background: #fffdf9; box-shadow: var(--shadow); padding: 22px; display: grid; gap: 14px; }
a.card { text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s, border-color .15s; }
a.card:hover { transform: translateY(-3px); border-color: #cbbfe3; box-shadow: 0 14px 34px rgba(60, 45, 95, .1); }
.who { display: flex; gap: 14px; align-items: center; }
.who h3 { font-size: 20px; margin: 0; letter-spacing: -.02em; }
.who .sub { color: var(--muted); font-size: 15px; }
.who .grow { flex: 1; min-width: 0; }
.face { border-radius: 50%; object-fit: cover; flex: none; box-shadow: 0 0 0 4px var(--tint, var(--lavender)); background: var(--tint, var(--lavender)); }
.tone-0 { --tint: var(--lavender); } .tone-1 { --tint: var(--sky); } .tone-2 { --tint: var(--mint); } .tone-3 { --tint: var(--rose); } .tone-4 { --tint: var(--peach); }
.status { display: inline-flex; gap: 6px; align-items: center; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--mint); color: var(--mint-ink); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.off { background: var(--peach); color: var(--peach-ink); }
.desc { color: var(--muted); }
.meta { display: flex; gap: 20px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 14px; color: var(--muted); font-size: 14px; }
.meta span { display: inline-flex; gap: 8px; align-items: center; }
.new-card { border: 2px dashed #cfc7dc; background: transparent; box-shadow: none; place-content: center; text-align: center; color: var(--accent-deep); min-height: 180px; cursor: pointer; font: inherit; }
.new-card:hover { background: var(--lavender); }
.crumbs { color: var(--muted); font-size: 14px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.head-row { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.tabs2 { display: flex; gap: 8px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs2 button { display: inline-flex; gap: 8px; align-items: center; padding: 12px 18px; border: 0; background: none; color: var(--muted); font-weight: 500; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs2 button[aria-selected="true"] { color: var(--accent-deep); border-color: var(--accent); font-weight: 600; }
.tabs2 button:hover { color: var(--ink); }
@media (max-width: 860px) {
  .side-toggle { display: none; }
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }   /* top bar only as tall as its content */
  .side { position: static; height: auto; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px 12px; padding: 10px 14px 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side .brand { padding: 0; }
  /* Navigation: its own full-width row that scrolls sideways, so every item stays reachable and nothing is cut off. */
  .nav { grid-column: 1 / -1; grid-row: 2; display: flex; flex: none; gap: 4px; min-width: 0; margin: 0 -14px; padding: 0 14px; overflow-x: auto; scrollbar-width: none; }
  .nav a { flex: none; padding: 7px 12px; font-size: 14px; white-space: nowrap; }
  /* Top bar: the version and provider lines would take the navigation's room; logout stays as an icon. */
  .side-foot { margin: 0; display: flex; align-items: center; justify-self: end; }
  .side-foot .build { display: none; }
  .side-foot .linkish .lbl { display: none; }
  .plan-box { display: none; }
  .main::before { display: none; }
  .grid2 { grid-template-columns: 1fr; }
}

/* Chat */
.chat-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; }
.people { display: grid; gap: 6px; }
.person { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 16px; text-decoration: none; color: inherit; }
.person div { display: grid; min-width: 0; }
.person:hover { background: #fffdf9; }
.person.on { background: var(--lavender); }
.convo { border: 1px solid var(--line); border-radius: 24px; background: #fffdf9; box-shadow: var(--shadow); padding: 18px; display: grid; gap: 14px; min-height: 480px; grid-template-rows: 1fr auto auto; }
.chat-log { display: grid; gap: 14px; align-content: start; overflow: auto; max-height: 56vh; padding: 4px; }
.msg { display: flex; gap: 10px; align-items: flex-end; max-width: 100%; }
.msg.user { justify-content: flex-end; }
.msg-body { display: grid; gap: 3px; max-width: min(640px, 88%); }
.msg.user .msg-body { justify-items: end; }
.bubble { padding: 12px 16px; border-radius: 20px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.bubble.user { background: #e6def5; color: var(--ink); border-bottom-right-radius: 6px; }
.bubble.agent { background: var(--sand); color: var(--ink); border-bottom-left-radius: 6px; }
.bubble.pending { opacity: .65; }
.chat-empty { text-align: center; color: var(--muted); padding: 60px 12px; }
.composer { display: flex; gap: 10px; align-items: center; padding: 8px 8px 8px 20px; border: 1px solid #d6cfe2; border-radius: 999px; background: #fff; }
.composer textarea { flex: 1; border: 0; outline: 0; resize: none; font: inherit; background: none; max-height: 120px; padding: 10px 0; }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px #e6def5; }
.round { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.round:hover { background: var(--accent-deep); }
.round:disabled { opacity: .5; }
.stop { display: inline-flex; gap: 6px; align-items: center; border: 0; background: none; color: var(--peach-ink); font-weight: 600; cursor: pointer; }
.approval { border: 1px solid #d9cfee; background: var(--lavender); border-radius: 18px; padding: 16px; display: grid; gap: 8px; }
.approval p { white-space: pre-line; overflow-wrap: anywhere; }
/* A long draft scrolls inside the box; the buttons below it never leave the screen. */
.approval { flex: none; max-height: 70vh; grid-template-rows: auto auto minmax(0, 1fr) auto; }
.approval-body { overflow-y: auto; max-height: min(42vh, 420px); min-height: 0; padding-right: 6px; overscroll-behavior: contain; }
@media (max-width: 860px) { .chat-layout { grid-template-columns: 1fr; } .people { grid-auto-flow: column; overflow-x: auto; } .person { flex: none; } }

/* Knowledge */
.pane { display: grid; gap: 18px; padding-top: 6px; }
.know-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 18px; align-items: start; }
.know { border: 1px solid var(--line); border-radius: 22px; background: #fffdf9; box-shadow: var(--shadow); overflow: hidden; display: grid; gap: 14px; padding: 0 20px 20px; }
.know-head { display: flex; gap: 12px; align-items: center; margin: 0 -20px; padding: 16px 20px; background: var(--tint-bg, var(--lavender)); }
.know-head h3 { margin: 0; font-size: 17px; letter-spacing: -.01em; }
.know-head p { margin: 2px 0 0; font-size: 13px; }
.know-icon { width: 40px; height: 40px; border-radius: 12px; background: #fffdf9; display: grid; place-items: center; color: var(--tint-ink, var(--accent-deep)); flex: none; }
.tint-sky { --tint-bg: var(--sky); --tint-ink: var(--sky-ink); } .tint-mint { --tint-bg: var(--mint); --tint-ink: var(--mint-ink); }
.tint-rose { --tint-bg: var(--rose); --tint-ink: var(--rose-ink); } .tint-lavender { --tint-bg: var(--lavender); --tint-ink: var(--accent-deep); }
.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fact { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 14px; background: var(--sand); }
.fact p { margin: 0; overflow-wrap: anywhere; }
.fact .muted, .muted { font-size: 13px; color: var(--muted); }
.fact .row-actions { display: flex; gap: 14px; flex: none; }
.text-action { border: 0; background: none; color: var(--accent-deep); font-weight: 600; cursor: pointer; padding: 4px 0; font-size: 14px; }
.text-action:hover { text-decoration: underline; }
.quote { margin: 0; padding: 12px 14px; border-left: 3px solid #b9aedb; background: var(--sand); border-radius: 0 12px 12px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.empty { margin: 0; color: var(--muted); font-size: 14px; }
.add-fact { display: flex; gap: 8px; flex-wrap: wrap; }
.add-fact input { flex: 1 1 200px; font: inherit; padding: 10px 14px; border: 1px solid #d6cfe2; border-radius: 999px; min-height: 44px; background: #fff; }
.add-fact select { font: inherit; padding: 10px 14px; border: 1px solid #d6cfe2; border-radius: 999px; background: #fff; }
.add-fact .btn { min-height: 44px; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.chips li { padding: 6px 12px; border-radius: 999px; background: var(--mint); color: var(--mint-ink); font-size: 14px; font-weight: 500; }
.know .text-link { justify-self: start; }
.panel { border: 1px solid var(--line); border-radius: 22px; background: #fffdf9; box-shadow: var(--shadow); padding: 22px; }

/* Settings */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.settings-grid > div, .settings-grid > form { display: contents; }
.settings-group { border: 1px solid var(--line); border-radius: 22px; background: #fffdf9; box-shadow: var(--shadow); padding: 20px; display: grid; gap: 6px; align-content: start; }
.settings-group h3, .settings-group summary { display: flex; gap: 10px; align-items: center; margin: 0 0 8px; font-size: 17px; font-weight: 700; cursor: default; }
.settings-group summary { cursor: pointer; }
.settings-group h3 svg, .settings-group summary svg { color: var(--accent); }
.settings-grid .form-error, .settings-grid .row-actions:last-child { grid-column: 1 / -1; }
.field input, .field textarea, .field select { border-radius: 14px; border-color: #d6cfe2; }
.switch-row { display: flex; gap: 14px; align-items: center; justify-content: space-between; padding: 10px 0; cursor: pointer; }
.switch-row input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 46px; height: 26px; border-radius: 99px; background: #d9d4e2; position: relative; cursor: pointer; flex: none; transition: background .15s; margin: 0; }
.switch-row input[type="checkbox"]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s; }
.switch-row input[type="checkbox"]:checked { background: var(--accent); }
.switch-row input[type="checkbox"]:checked::after { transform: translateX(20px); }
.settings-grid .row-actions { display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 860px) { .settings-grid { grid-template-columns: 1fr; } }

/* Fixes */
textarea, input, select { font-family: inherit; }
.main { overflow-x: clip; }
.grid2 > *, .know-grid > *, .settings-grid > * { min-width: 0; }
.grid2 > .shared { grid-column: 1 / -1; }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { max-width: 100vw; }
  .who { flex-wrap: wrap; }
  .who .status { margin-left: 0; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .main { padding: 18px 16px 40px; }
  .composer { padding-left: 14px; }
  .head-row { align-items: flex-start; }
}
.meter span { background: linear-gradient(90deg, #8c7fb8, var(--accent)); }
.meter span.mid { background: #d9a441; }
.meter span.high { background: #c8574b; }
.main .plan { border-radius: 20px; }

/* Wissen & Erinnerungen (following the supplied design) */
.know-title { font-size: clamp(26px, 3.4vw, 36px); letter-spacing: -.03em; line-height: 1.15; }
.k4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.kcard { border: 1px solid var(--line); border-radius: 20px; background: #fffdf9; box-shadow: var(--shadow); overflow: hidden; display: grid; grid-template-rows: auto 1fr; }
.kcard header { display: flex; gap: 12px; align-items: center; padding: 16px 18px; background: var(--tint-bg, var(--lavender)); }
.kcard header h3 { margin: 0; font-size: 16px; line-height: 1.25; letter-spacing: -.01em; }
.k-ico { width: 38px; height: 38px; border-radius: 12px; background: #fffdf9; display: grid; place-items: center; color: var(--tint-ink, var(--accent-deep)); flex: none; }
.kbody { padding: 16px 18px 18px; display: grid; gap: 12px; align-content: start; color: #3d3a4d; font-size: 15px; line-height: 1.55; }
.kbody p { margin: 0; }
.bul { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.bul li::marker { color: var(--tint-ink, var(--accent)); }
.tick { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tick li { display: flex; gap: 10px; align-items: flex-start; }
.tick svg { flex: none; margin-top: 3px; color: var(--mint-ink); }
.mem-head { display: flex; gap: 16px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 26px; margin-top: 4px; }
.mem-head h2 { font-size: 26px; letter-spacing: -.02em; margin-bottom: 2px; }
.mems { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.mem { display: flex; gap: 16px; align-items: center; padding: 16px 20px; border: 1px solid var(--line); border-radius: 18px; background: #fffdf9; box-shadow: var(--shadow); }
.mem-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--lavender); color: var(--accent-deep); display: grid; place-items: center; flex: none; }
.mem:nth-child(5n+2) .mem-icon { background: var(--sky); color: var(--sky-ink); }
.mem:nth-child(5n+3) .mem-icon { background: var(--mint); color: var(--mint-ink); }
.mem:nth-child(5n+4) .mem-icon { background: var(--rose); color: var(--rose-ink); }
.mem:nth-child(5n+5) .mem-icon { background: var(--peach); color: var(--peach-ink); }
.mem-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.mem-text p { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.mem-text small { color: var(--muted); }
.mem-text textarea { width: 100%; font: inherit; padding: 10px 14px; border: 1px solid #d6cfe2; border-radius: 14px; background: #fff; resize: vertical; min-height: 44px; }
.mem-actions { display: flex; gap: 8px; flex: none; }
.row-btn { display: inline-flex; gap: 6px; align-items: center; border: 0; background: none; color: var(--muted); font-weight: 500; cursor: pointer; padding: 8px 12px; border-radius: 10px; }
.row-btn:hover { background: var(--lavender); color: var(--accent-deep); }
.mem-empty { padding: 28px; text-align: center; border: 2px dashed #d6cfe2; border-radius: 18px; color: var(--muted); }
.mem-empty strong { display: block; color: var(--ink); margin-bottom: 4px; }
.add-fact { padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--lavender); }
@media (max-width: 1180px) { .k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .k4 { grid-template-columns: 1fr; } .mem { flex-wrap: wrap; } .mem-actions { width: 100%; justify-content: flex-end; } }
.kcard header > div, .kcard header h3 { min-width: 0; overflow-wrap: anywhere; }
.kbody .row-actions { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.kbody .text-action { padding: 0; }

/* Avatar portrait (saved design) and studio */
.face-wrap { position: relative; display: inline-block; overflow: hidden; }
.face-wrap img { display: block; width: 100%; height: 100%; object-fit: contain; }
.face-wrap .face-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.studio { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 22px; align-items: start; padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: #fffdf9; }
.studio-preview { display: grid; place-items: center; padding: 6px; }
.studio-options { display: grid; gap: 14px; }
.studio-row { display: grid; gap: 6px; }
.studio-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.studio-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 14px; border: 1px solid #d6cfe2; border-radius: 999px; background: #fff; color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--lavender); border-color: var(--accent); color: var(--accent-deep); font-weight: 600; }
.chip .swatch { width: 14px; height: 14px; border-radius: 50%; border: 1px solid #0003; display: inline-block; }
@media (max-width: 640px) { .studio { grid-template-columns: 1fr; } }

/* Chat: markdown in agent bubbles, copy / replay actions */
.bubble.agent { white-space: normal; }
.bubble.agent .md > :first-child { margin-top: 0; } .bubble.agent .md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .7em; } .md h3, .md h4, .md h5, .md h6 { margin: .9em 0 .4em; line-height: 1.25; letter-spacing: -.01em; }
.md h3 { font-size: 1.15em; } .md h4 { font-size: 1.05em; } .md h5 { font-size: 1em; } .md h6 { font-size: .95em; }
.md hr { border: 0; border-top: 1px solid #0000001f; margin: .9em 0; }
.md ul, .md ol { margin: 0 0 .7em; padding-left: 1.4em; } .md li { margin: .2em 0; }
.md blockquote { margin: 0 0 .7em; padding: 2px 0 2px 12px; border-left: 3px solid #cfc5e0; color: var(--muted); }
.md code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; padding: 1px 5px; border-radius: 6px; background: #0000000d; }
.md pre { margin: 0 0 .7em; padding: 10px 12px; border-radius: 12px; background: #2a2838; color: #f3f0fa; overflow-x: auto; white-space: pre; font-size: 13px; }
.md-table { margin: 0 0 .7em; overflow-x: auto; }
.md table { border-collapse: collapse; font-size: .92em; min-width: 100%; }
.md th, .md td { padding: 6px 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.md th { background: var(--sand); font-weight: 600; }
.md a { color: var(--accent-deep); text-decoration: underline; overflow-wrap: anywhere; }
.msg-meta { display: flex; align-items: center; gap: 4px; min-height: 28px; }
.msg-actions { display: inline-flex; gap: 2px; opacity: 0; transition: opacity .15s; vertical-align: middle; }
.msg:hover .msg-actions, .msg-actions:focus-within { opacity: 1; }
@media (hover: none) { .msg-actions { opacity: .8; } }
.msg-action { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.msg-action:hover { background: #fff8; color: var(--ink); }
.msg-action.done { color: #2f7d4f; }
.msg-action:disabled { opacity: .4; cursor: default; }

/* Research report card in chat */
.report-card { display: grid; gap: 4px; margin-top: 6px; }
.report-row { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 14px; background: #fffdf9; overflow: hidden; }
.report-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; background: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.report-main:hover { background: var(--lavender); }
.report-main svg { color: var(--accent); flex: none; }
.report-main span { display: grid; min-width: 0; }
.report-main strong { font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.report-row .msg-action { width: 40px; height: 40px; border-radius: 0; flex: none; }
.report-row button:disabled { opacity: .5; cursor: default; }

/* Messenger layout for the agent page: chat list left, compact header, full-height conversation */
.main.messenger { padding: 0; gap: 0; height: 100vh; overflow: hidden; display: block; }
.main.messenger::before { display: none; }
.messenger-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); height: 100vh; }
.chat-list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: #fbf9f5; }
.list-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 8px 18px; }
.list-head h2 { font-size: 20px; letter-spacing: -.02em; }
.chat-list .people { display: grid; gap: 2px; padding: 4px 8px 12px; overflow-y: auto; align-content: start; }
.chat-list .person { padding: 9px 10px; border-radius: 14px; }
.person-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.person-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-top time { flex: none; font-size: 11.5px; }
.person-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.messenger-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100vh; background: var(--paper); }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 8px 14px; min-height: 58px; border-bottom: 1px solid var(--line); background: #fffdf9; flex: none; }
.chat-head .back { display: none; }
.chat-head .head-name { flex: 1; min-width: 0; display: grid; }
.chat-head h1 { font-size: 16px; line-height: 1.25; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-sub { font-size: 12.5px; color: var(--mint-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-sub.off { color: var(--peach-ink); }
.chat-head .face { box-shadow: none; }
.head-tabs { display: flex; gap: 2px; }
.head-tabs button { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 0; border-radius: 12px; background: none; color: var(--muted); cursor: pointer; }
.head-tabs button:hover { background: var(--lavender); color: var(--ink); }
.head-tabs button[aria-selected="true"] { background: var(--lavender); color: var(--accent-deep); }
.messenger-main > .notice { margin: 8px 14px 0; flex: none; }
.messenger-main .pane { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0; gap: 0; }
.messenger-main .pane:not(.pane-chat) { display: grid; align-content: start; gap: 18px; padding: 22px clamp(16px, 3vw, 36px); overflow-y: auto; }
.messenger-main .convo { flex: 1; min-height: 0; border: 0; border-radius: 0; box-shadow: none; background: none; padding: 0; gap: 0; display: flex; flex-direction: column; }
.messenger-main .chat-log { flex: 1; min-height: 0; max-height: none; padding: 18px clamp(14px, 4vw, 48px); gap: 10px; }
.messenger-main .chat-log .msg-body { max-width: min(680px, 86%); }
.messenger-main .approval { margin: 0 clamp(14px, 4vw, 48px) 8px; }
.messenger-main .composer { margin: 8px clamp(12px, 3vw, 40px) 14px; flex: none; }
@media (max-width: 1100px) { .messenger-grid { grid-template-columns: 240px minmax(0, 1fr); } }
@media (max-width: 860px) {
  /* The top bar (brand + navigation row) has no fixed height: the chat fills exactly what is left, so the input never slips below the screen. */
  .shell:has(.main.messenger) { height: 100vh; height: 100dvh; min-height: 0; }
  .main.messenger { height: 100%; min-height: 0; overflow: hidden; }
  .messenger-grid { display: block; height: 100%; }
  .chat-list { display: none; }
  .messenger-main { height: 100%; }
  .chat-head .back { display: inline-flex; }
}
@media (max-width: 480px) {
  /* Narrow phones: smaller header icons so the agent's name stays readable. */
  .chat-head { gap: 8px; padding-inline: 10px; }
  .chat-head .face { width: 34px; height: 34px; }
  .head-tabs button { width: 34px; height: 34px; }
  .chat-head .kebab summary { width: 30px; }
}

/* Workspace tab and live tool calls */
.ws { display: grid; gap: 14px; }
.ws-tabs { display: flex; flex-wrap: wrap; gap: 0 6px; border-bottom: 1px solid var(--line); }
.ws-tabs button { flex: none; white-space: nowrap; padding: 10px 16px; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px; background: none; font: inherit; color: var(--muted); cursor: pointer; }
.ws-tabs button[aria-selected="true"] { color: var(--accent-deep); border-color: var(--accent); font-weight: 600; }
.ws-path { display: flex; align-items: center; gap: 8px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; color: var(--muted); }
.ws-path span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-list { display: grid; border: 1px solid var(--line); border-radius: 16px; background: #fffdf9; overflow: hidden; }
.ws-list > p { padding: 18px; }
.ws-row { display: flex; align-items: center; border-top: 1px solid var(--line); }
.ws-row:first-child { border-top: 0; }
.ws-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 0; background: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.ws-main:hover:not(:disabled) { background: var(--lavender); }
.ws-main:disabled { opacity: .55; cursor: default; }
.ws-main svg { color: var(--accent); flex: none; }
.ws-main span { display: grid; min-width: 0; }
.ws-main strong { overflow-wrap: anywhere; font-weight: 600; font-size: 14.5px; }
.ws-row .msg-action { margin-right: 6px; flex: none; }
.ws-exec { border: 1px solid var(--line); border-radius: 14px; background: #fffdf9; padding: 0 14px; }
.ws-exec summary { display: flex; align-items: center; gap: 12px; padding: 12px 0; cursor: pointer; list-style: none; }
.ws-exec summary span { display: grid; min-width: 0; }
.ws-exec summary strong { font-size: 14px; overflow-wrap: anywhere; font-weight: 600; }
.ws-code { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: #2a2838; color: #f3f0fa; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; }
.bad { color: #a23a3a; }
.run-steps { margin: 6px 0 0; border: 1px solid var(--line); border-radius: 14px; background: #fffdf9; font-size: 13px; padding: 0 12px; max-width: 100%; }
.run-steps summary { padding: 8px 0; cursor: pointer; color: var(--muted); font-weight: 500; }
.run-steps ul { list-style: none; margin: 0; padding: 0 0 8px; display: grid; gap: 6px; }
.run-steps li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.run-steps li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--mint-ink); align-self: center; flex: none; }
.run-steps li.live::before { animation: pulse 1s ease-in-out infinite; background: var(--accent); }
.run-steps li.bad::before { background: #a23a3a; }
.run-steps .step-title { font-weight: 600; }
.run-steps code { font-size: 12px; background: #0000000d; padding: 1px 6px; border-radius: 6px; overflow-wrap: anywhere; max-width: 100%; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .run-steps li.live::before { animation: none; } }

/* Dashboard task board */
.tasks { display: grid; gap: 14px; }
.tasks-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tasks-head h2 { font-size: 22px; letter-spacing: -.02em; }
.task-form { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.task-form-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.task-group h3, .task-group summary { font-size: 14px; color: var(--muted); font-weight: 600; margin: 4px 0 8px; cursor: default; }
.task-group summary { cursor: pointer; }
.task-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.task-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: #fffdf9; flex-wrap: wrap; }
.task-row.live { border-color: var(--accent); background: #f6f2fa; }
.task-main { flex: 1; min-width: 160px; display: grid; }
.task-title { font-weight: 600; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
a.task-title:hover { text-decoration: underline; }
.task-start { min-height: 38px; padding: 0 14px; }
.task-status { border: 1px solid #d6cfe2; border-radius: 10px; background: #fff; font: inherit; font-size: 13px; padding: 7px 8px; }
@media (max-width: 640px) { .task-form-row { grid-template-columns: 1fr; } }
.side .brand { gap: 0; }

/* Chat wallpaper: the olive watercolor sits behind the conversation, bubbles stay solid */
.messenger-main .convo { position: relative; isolation: isolate; background: var(--paper); }
.messenger-main .convo::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: min(72%, 600px); z-index: -1; pointer-events: none;
  background: url("assets/olive-study.webp") right bottom / cover no-repeat;
  -webkit-mask-image: linear-gradient(to top, #000 62%, transparent); mask-image: linear-gradient(to top, #000 62%, transparent); }
.messenger-main .bubble.agent { box-shadow: 0 1px 2px #3b294d14; }
.messenger-main .bubble.user { box-shadow: 0 1px 2px #3b294d14; }
.messenger-main .composer { box-shadow: 0 6px 22px #3b294d14; }

/* Hover: time, copy and replay sit on a soft pill so they read well over the wallpaper */
.msg-meta { width: fit-content; padding: 0 8px; border-radius: 999px; transition: background .15s, box-shadow .15s; }
.msg:hover .msg-meta, .msg-meta:focus-within { background: #fffdf9f2; box-shadow: 0 1px 6px #3b294d1f; }
.msg:hover .msg-meta small, .msg-meta:focus-within small { color: var(--ink); }

/* Dashboard: stats, sections, compact agent cards, task list */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; max-width: 720px; }
.stat { display: grid; gap: 2px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 18px; background: #fffdf9ee; }
.stat b { font-size: 32px; line-height: 1.1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13.5px; }
.block { display: grid; gap: 14px; align-content: start; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.block-head h2, .tasks-head h2 { font-size: 22px; letter-spacing: -.02em; }
.grid2 .card { padding: 16px 18px; gap: 10px; }
.card .meta { font-size: 13px; }
.card-open { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-deep); font-weight: 600; font-size: 14px; }
.tasks .task-list { gap: 6px; }
.tasks .task-row { padding: 8px 12px; }
.task-state { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--lavender); color: var(--accent-deep); white-space: nowrap; }
.task-state.s-done { background: var(--mint); color: var(--mint-ink); }
.task-state.s-planned { background: var(--peach); color: var(--peach-ink); }
.kebab { position: relative; }
.kebab summary { list-style: none; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 10px; cursor: pointer; color: var(--muted); }
.kebab summary::-webkit-details-marker { display: none; }
.kebab summary:hover, .kebab[open] summary { background: var(--lavender); color: var(--ink); }
.kebab-menu { position: absolute; right: 0; top: 38px; z-index: 5; min-width: 210px; display: grid; padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 10px 30px #3b294d26; }
.kebab-item { text-align: left; padding: 9px 12px; border: 0; border-radius: 9px; background: none; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; }
.kebab-item:hover { background: var(--lavender); }
.kebab-item.bad { color: #a23a3a; }
@media (max-width: 640px) { .stats { grid-template-columns: 1fr 1fr 1fr; gap: 8px; } .stat { padding: 10px 12px; } .stat b { font-size: 24px; } }

/* Agent settings: one column, jump chips, danger zone last, sticky save bar */
.settings-page { display: grid; gap: 16px; max-width: 780px; align-content: start; }
.settings-nav { display: flex; gap: 8px; flex-wrap: wrap; position: sticky; top: -22px; z-index: 4; padding: 10px 0; margin-top: -4px; background: linear-gradient(var(--paper) 78%, transparent); }
.anchor { scroll-margin-top: 64px; }
.danger-zone { border-color: #e6bcbc; background: #fffafa; }
.danger-zone h3 svg { color: #a23a3a; }
.savebar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px -8px 0; padding: 12px 16px; border: 1px solid var(--line); border-radius: 18px; background: #fffdf9f5; box-shadow: 0 -6px 24px #3b294d1a; }
.savebar-actions { display: inline-flex; gap: 8px; }
.savebar-state { font-size: 14px; }
.savebar-state.dirty { color: var(--peach-ink); font-weight: 600; }
.savebar .btn:disabled { opacity: .5; cursor: default; box-shadow: none; }
@media (max-width: 640px) { .savebar { flex-direction: column; align-items: stretch; } .savebar-actions { justify-content: flex-end; } }
.stack { display: grid; gap: 16px; }
.settings-page > div:empty { display: none; }
.pane-settings > .ws-tabs { max-width: 780px; margin-bottom: 4px; }

/* Agent management as a side panel next to the chat */
.messenger-main { position: relative; }
.drawer { position: absolute; top: 58px; right: 0; bottom: 0; z-index: 20; width: min(660px, 100%); display: flex; flex-direction: column; background: var(--paper); border-left: 1px solid var(--line); box-shadow: -14px 0 44px #3b294d26; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px 10px 22px; border-bottom: 1px solid var(--line); background: #fffdf9; flex: none; }
.drawer-head h2 { font-size: 17px; letter-spacing: -.01em; }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 22px 28px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }
.drawer-body > h2 { display: none; }
.drawer .settings-page, .drawer .pane-tabs { max-width: none; }
.drawer .ws-tabs { margin-bottom: 4px; }
@media (max-width: 860px) { .drawer { top: 0; bottom: 0; position: fixed; width: 100%; } }

/* Abilities with plain explanations and clear approval limits */
.ability { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.ability:first-of-type { border-top: 0; }
.ability-text { display: grid; gap: 3px; min-width: 0; }
.ability-text strong { font-size: 15px; }
.ability-text small { color: var(--muted); font-size: 13px; line-height: 1.45; }
.badge { display: inline-flex; align-items: center; width: fit-content; margin-top: 3px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--mint); color: var(--mint-ink); }
.badge.approve { background: var(--peach); color: var(--peach-ink); }
.badge.sandbox { background: var(--lavender); color: var(--accent-deep); }
.ability input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 46px; height: 26px; border-radius: 99px; background: #d9d4e2; position: relative; cursor: pointer; flex: none; transition: background .15s; margin: 4px 0 0; }
.ability input[type="checkbox"]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s; }
.ability input[type="checkbox"]:checked { background: var(--accent); }
.ability input[type="checkbox"]:checked::after { transform: translateX(20px); }
.ability-group { font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 14px 0 0; }

.learned-review { margin: 4px 0 10px; padding: 12px 14px; border-radius: 14px; background: var(--lavender); display: grid; gap: 4px; }
.learned-review strong { font-size: 13px; color: var(--accent-deep); text-transform: uppercase; letter-spacing: .04em; }
.learned-review p { margin: 0; font-size: 14.5px; line-height: 1.5; }

/* Gedächtnis panel */
.mem-top { display: flex; align-items: center; gap: 14px; }
.mem-top .know-title { font-size: 22px; margin: 0; letter-spacing: -.02em; }
.mem-switch { padding: 14px 16px; border: 1px solid var(--line); border-radius: 18px; background: #fffdf9; }
.mem-body { display: grid; gap: 16px; align-content: start; }
.mem-block { display: grid; gap: 10px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 20px; background: #fffdf9; align-content: start; }
.mem-block h3 { font-size: 17px; }
.mem-block h4 { margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.mem-block textarea { width: 100%; border-radius: 14px; }
.mem-block .summary { margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--lavender); line-height: 1.5; }

/* Chat: context bar and attach button */
.ctx-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 6px clamp(14px, 4vw, 48px); border-bottom: 1px solid var(--line); background: #fffdf9e6; font-size: 13px; flex: none; }
.ctx-actions { display: inline-flex; gap: 14px; }
.ctx-bar .text-action { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--accent-deep); cursor: pointer; padding: 4px 0; }
.ctx-bar .text-action:hover { text-decoration: underline; }
.composer .attach { flex: none; margin-left: -6px; }

/* Pictures waiting to be sent with the next message */
.attach-chips { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 clamp(12px, 3vw, 40px); margin-top: 6px; flex: none; }
.attach-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fffdf9; font-size: 13px; color: var(--ink); }
.attach-chip button { border: 0; background: none; font-size: 16px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.attach-chip button:hover { color: #a23a3a; }

/* Context: header menu and a quiet divider in the history */
.chat-head .context-menu { margin-left: 2px; }
.chat-head .kebab-menu { z-index: 40; min-width: 280px; right: 0; top: 40px; }
.kebab-status { margin: 0; padding: 8px 12px 6px; font-size: 13px; line-height: 1.4; }
.kebab-item.two-line { display: grid; gap: 2px; }
.kebab-item.two-line small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.ctx-divider { display: flex; align-items: center; gap: 12px; margin: 8px 0; color: var(--muted); font-size: 12.5px; }
.ctx-divider::before, .ctx-divider::after { content: ""; flex: 1; height: 1px; background: #cfc7da; }
.ctx-dream { margin: 14px auto; max-width: 560px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--lavender); }
.ctx-dream-head { display: flex; align-items: center; gap: 8px; color: var(--accent-deep); }
.ctx-dream-body { margin-top: 6px; line-height: 1.5; overflow-wrap: anywhere; }
.ctx-dream-body h4 { margin: 12px 0 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.dream-item { margin: 0 0 4px; padding-left: 14px; position: relative; }
.dream-item::before { content: "•"; position: absolute; left: 0; color: var(--accent-deep); }
.ctx-dream-undone { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.ctx-dream.is-undone .ctx-dream-body { opacity: .55; text-decoration: line-through; }
.ctx-divider span { padding: 3px 12px; border-radius: 999px; background: #fffdf9e6; border: 1px solid var(--line); }

/* Gesprächsverlauf actions: two clear cards instead of text links */
.mem-stack { display: grid; gap: 14px; }
.mem-text p.mem-long { font-weight: 500; white-space: pre-line; }
.know-sub { margin: 10px 0 0; font-size: 15px; color: var(--muted); }
.night-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0; font-size: 14px; }
.night-line:empty { display: none; }
.diary { display: grid; gap: 8px; }
.diary-entry { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 14px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.diary-when { color: var(--muted); font-size: 13px; font-weight: 600; padding-top: 2px; }
.diary-text { margin: 0; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
@media (max-width: 640px) { .diary-entry { grid-template-columns: 1fr; gap: 4px; } }
.hist-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.hist-action { display: grid; gap: 3px; text-align: left; padding: 12px 14px; border: 1px solid #d6cfe2; border-radius: 14px; background: #fff; font: inherit; color: var(--ink); cursor: pointer; transition: border-color .15s, background .15s; }
.hist-action:hover:not(:disabled) { border-color: var(--accent); background: var(--lavender); }
.hist-action:disabled { opacity: .55; cursor: default; }
.hist-action strong { font-size: 14.5px; }
.hist-action small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
@media (max-width: 520px) { .hist-actions { grid-template-columns: 1fr; } }

/* Task board */
.tboard { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.tcol { display: grid; gap: 10px; align-content: start; padding: 12px; border: 1px solid var(--line); border-radius: 20px; background: #fffdf9cc; min-height: 220px; transition: background .15s, border-color .15s; }
.tcol.over { background: var(--lavender); border-color: var(--accent); }
.tcol > header { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px; }
.tcol > header h3 { font-size: 15px; }
.tcol > header b { font-size: 12.5px; padding: 1px 9px; border-radius: 999px; background: var(--lavender); color: var(--accent-deep); }
.tcol-body { display: grid; gap: 10px; align-content: start; }
.tcol-empty { text-align: center; padding: 18px 0; font-size: 13px; }
.tcard { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; cursor: grab; box-shadow: 0 1px 2px #3b294d10; }
.tcard:active { cursor: grabbing; }
.tcard.dragging { opacity: .45; }
.tcard.unassigned { border-style: dashed; background: #fffdf9; }
.tcard.live { border-color: var(--accent); background: #f6f2fa; }
.tcard-title { margin: 0; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.tcard-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.tcard-agent { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); }
.tcard-agent.none { color: var(--muted); font-weight: 500; }
.tcard-agent .face { box-shadow: none; }
@media (max-width: 900px) { .tboard { grid-template-columns: 1fr; } }
.tcard-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.tcard-top .kebab summary { width: 28px; height: 28px; margin: -4px -6px 0 0; }
.tcard .kebab-menu { min-width: 200px; z-index: 30; }

/* Dropdowns that match the text fields */
.field select, .task-form select {
  appearance: none; -webkit-appearance: none; width: 100%; min-height: 46px; padding: 8px 40px 8px 14px;
  font: inherit; font-weight: 400; color: var(--ink); border: 1px solid #d6cfe2; border-radius: 14px; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235c5866' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center / 18px;
}
.field select:hover, .task-form select:hover { border-color: var(--accent); }
.field select:focus-visible, .task-form select:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 2px; }
.field input[type="datetime-local"] { width: 100%; }
.task-form-row { align-items: start; }
.task-form .stack { gap: 8px; }

/* Switches inside a .field (e.g. "Wangen" in the avatar studio) must not inherit the text-input size */
.field .switch-row input[type="checkbox"], .studio .switch-row input[type="checkbox"] { width: 46px; height: 26px; min-height: 0; padding: 0; border: 0; border-radius: 99px; flex: none; }
.studio .switch-row { padding: 6px 0; }

/* Wissen: one shared-knowledge card, agents only as assignees */
.assignees { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.assignee { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--sand); color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 500; }
.assignee:hover { background: var(--lavender); }

/* Konto: compact usage and equal-height plan cards with the same USPs as the landing page */
.main .panel { padding: 16px 20px; gap: 10px; }
.main .panel h2 { font-size: 17px; }
.main .usage-line { display: inline; }
.main .usage-line strong { font-size: 20px; }
.main .meter { height: 8px; }
.main .plans { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
.main .plan { padding: 14px 16px; border-radius: 18px; }
.main .plan h3 { font-size: 18px; }
.main .plan-for { min-height: 0; margin-top: 2px; font-size: 13px; }
.main .plan-price { margin-top: 4px; }
.main .plan-price strong { font-size: 26px; }
.main .plan-limit { padding-block: 8px; font-size: 13.5px; }
.main .plan ul { margin: 8px 0 12px; gap: 6px; font-size: 13px; }
.main .plan li { padding-left: 22px; background-size: 13px 13px; }
.main .plan-link { min-height: 38px; font-size: 14px; }
@media (max-width: 860px) { .main .plans { grid-template-columns: 1fr; } }

/* Konto: password change lives in a modal */
.account-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.account-row h2 { margin: 0; }
.account-row p { margin: 2px 0 0; }
.modal { width: min(460px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 24px; background: #fffdf9; color: var(--ink); box-shadow: 0 24px 60px #3b294d40; }
.modal::backdrop { background: #1f1b2e66; }
.modal-form { display: grid; gap: 14px; padding: 26px 28px 22px; }
.modal-form h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.modal-form > p { margin: -6px 0 4px; }
.modal-form .field { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.modal-form .field input { padding: 12px 14px; border: 1px solid #d6cfe2; border-radius: 14px; background: #fff; font: inherit; font-weight: 400; }
.modal-form .field input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px #e6def5; }
.modal-form .field small { font-weight: 400; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* Konto: account rows like in the desktop app */
.account-list { padding: 8px 0 !important; gap: 0 !important; }
.account-list h2 { padding: 12px 20px 4px; }
.account-list > p { padding: 0 20px; }
.account-list ul { list-style: none; margin: 0; padding: 0; display: grid; }
.account-list li { display: flex; align-items: center; gap: 14px; padding: 10px 20px; border-top: 1px solid var(--line); }
.account-list li:first-child { border-top: 0; }
.acc-label { font-weight: 600; min-width: 120px; }
.acc-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.account-list li.danger .acc-label { color: #9b2c2c; }
/* Phone: label and value stacked on the left, the button stays on the right of the row. */
@media (max-width: 640px) {
  .account-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 2px; }
  .acc-label { min-width: 0; grid-column: 1; }
  .acc-value { grid-column: 1; white-space: normal; overflow-wrap: anywhere; }
  .acc-value:empty { display: none; }
  .account-list li > :not(.acc-label):not(.acc-value) { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
}

/* Calendar */
.cal-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 18px 0 14px; }
.cal-title { margin: 0 8px; font-size: 20px; }
.cal-spacer { flex: 1; }
.cal-bar select { min-height: 38px; border-radius: 999px; border: 1px solid #d6cfe2; padding: 0 12px; background: #fff; font: inherit; }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.cal-board { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.cal-board.month { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-board.week { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-board.day { grid-template-columns: minmax(0, 1fr); }
.cal-col { display: grid; grid-template-rows: auto 1fr; background: #fffdf9; }
.cal-head { padding: 8px 10px; background: #f6f2fa; font-size: 13px; font-weight: 600; color: var(--muted); text-align: center; }
.cal-cell { display: flex; flex-direction: column; gap: 4px; min-height: 104px; padding: 6px; background: #fffdf9; cursor: pointer; text-align: left; font-size: 13px; }
.cal-board.week .cal-cell, .cal-board.day .cal-cell { min-height: 260px; }
.cal-cell:hover, .cal-cell:focus-visible { background: #fbf8ff; outline: none; }
.cal-cell.other { background: #faf7f2; color: var(--muted); }
.cal-cell.today .cal-num { background: var(--accent); color: #fff; }
.cal-num { align-self: flex-start; min-width: 24px; height: 24px; display: inline-grid; place-items: center; border-radius: 12px; font-weight: 600; font-size: 12px; }
.cal-event { width: 100%; border: 0; border-radius: 8px; padding: 3px 6px; background: var(--lavender); color: var(--accent-deep); font: inherit; font-size: 12px; text-align: left; cursor: pointer; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.cal-event:hover { background: #e3d9f5; }
.cal-rep { font-style: normal; opacity: .7; }
.alarm-card h3 { margin: 0; }
.alarm-list { display: grid; gap: 10px; }
.alarm-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.alarm-form { display: grid; gap: 10px; }
.alarm-form input, .alarm-form select { width: 100%; min-width: 0; box-sizing: border-box; }
@media (max-width: 900px) {
  .cal-layout { grid-template-columns: minmax(0, 1fr); }
  .cal-board.week { grid-template-columns: minmax(0, 1fr); }
  .cal-cell { min-height: 64px; }
  .cal-board.week .cal-cell { min-height: 80px; }
}

/* Calendar: one colour per agent, picked by class because the page allows no inline styles */
.cal-filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.cal-filter:empty { display: none; }
.agc-0 { --agc-bg: #e9e2f7; --agc-ink: #4a3f78; --agc-dot: #7a68b8; }
.agc-1 { --agc-bg: var(--mint); --agc-ink: var(--mint-ink); --agc-dot: #4f9a76; }
.agc-2 { --agc-bg: var(--peach); --agc-ink: var(--peach-ink); --agc-dot: #d98a4e; }
.agc-3 { --agc-bg: var(--sky); --agc-ink: var(--sky-ink); --agc-dot: #4f86c0; }
.agc-4 { --agc-bg: var(--rose); --agc-ink: var(--rose-ink); --agc-dot: #c4627f; }
.agc-5 { --agc-bg: #fbf0c9; --agc-ink: #7a5d12; --agc-dot: #c9a227; }
.agc-6 { --agc-bg: #d9f0ee; --agc-ink: #1f6a64; --agc-dot: #2f9c93; }
.agc-7 { --agc-bg: #e4e3fb; --agc-ink: #3b3a8a; --agc-dot: #6866c9; }
.cal-event[class*="agc-"] { background: var(--agc-bg); color: var(--agc-ink); }
.cal-event[class*="agc-"]:hover { filter: brightness(.96); }
.chip .swatch.agc-0, .chip .swatch.agc-1, .chip .swatch.agc-2, .chip .swatch.agc-3, .chip .swatch.agc-4, .chip .swatch.agc-5, .chip .swatch.agc-6, .chip .swatch.agc-7 { background: var(--agc-dot); border: 0; }
.alarm-row[class*="agc-"] { border-left: 4px solid var(--agc-dot); padding-left: 10px; }

/* Phone call with an agent (konto/voice.js) */
.call-overlay { position: fixed; inset: 0; z-index: 50; display: grid; justify-items: center; align-content: center; gap: 14px; padding: 24px; background: #fff; text-align: center; }
.call-overlay h2 { margin: 0; }
.call-state { margin: 0; color: var(--muted, #6b6480); }
.call-circle { width: 140px; height: 140px; border-radius: 50%; border: 0; background: var(--lavender, #ece6f7); cursor: pointer; transition: width .25s, height .25s; }
.call-circle:disabled { cursor: default; }
.call-overlay[data-phase="speaking"] .call-circle { width: 168px; height: 168px; background: #d9cfee; }
.call-overlay[data-phase="thinking"] .call-circle { background: #e6def5; }
.call-overlay[data-phase="denied"] .call-circle, .call-overlay[data-phase="failed"] .call-circle { background: #f8dcd4; }
.call-hint, .call-problem { margin: 0; color: var(--muted, #6b6480); }
.call-problem { color: #b3402a; }
.call-line { margin: 0; max-width: 520px; max-height: 140px; overflow-y: auto; font-size: 1.1rem; overflow-wrap: anywhere; }
.call-actions { display: flex; gap: 16px; margin-top: 12px; }
.call-btn { border: 0; border-radius: 999px; padding: 14px 26px; background: var(--lavender, #ece6f7); font: inherit; font-weight: 600; cursor: pointer; }
.call-btn.hang { background: #c94a33; color: #fff; }
@media (prefers-color-scheme: dark) { .call-overlay { background: #1c1824; color: #f1edf8; } .call-btn { color: #1c1824; } }

/* Appointment card with delete button (konto/kalender.js) */
.cal-detail { margin: 12px 0; padding: 16px 18px; display: grid; gap: 6px; }
.cal-detail h3 { margin: 0; }
.cal-detail .actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; }

.build { display: block; padding: 4px 12px 0; color: var(--muted, #6b6475); font-size: 11px; overflow-wrap: anywhere; }
.shell.collapsed .build { display: none; }

/* Wissen: full-width panel, rows like the Konto account list, add field on top */
.know-wide { width: 100%; }
.main .know-panel { padding: 8px 0; gap: 0; }
.know-intro { display: grid; gap: 12px; padding: 12px 20px 16px; }
.know-intro h2 { margin: 0; }
.know-intro p { margin: 0; max-width: 760px; }
.know-intro .add-fact { padding: 12px; }
.know-sub2 { margin: 0; padding: 12px 20px 6px; font-size: 14px; color: var(--muted); border-top: 1px solid var(--line); }
.know-list { list-style: none; margin: 0; padding: 0; display: grid; }
.know-row { display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-top: 1px solid var(--line); }
.know-row:first-child { border-top: 0; }
.know-row:nth-child(5n+2) .mem-icon { background: var(--sky); color: var(--sky-ink); }
.know-row:nth-child(5n+3) .mem-icon { background: var(--mint); color: var(--mint-ink); }
.know-row:nth-child(5n+4) .mem-icon { background: var(--rose); color: var(--rose-ink); }
.know-row:nth-child(5n+5) .mem-icon { background: var(--peach); color: var(--peach-ink); }
.know-actions { display: flex; gap: 8px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.know-panel .mem-empty { margin: 4px 20px 16px; }
@media (max-width: 640px) { .know-row { flex-wrap: wrap; } .know-actions { width: 100%; } }

/* Aufgaben: filter pills and a list like the app */
.task-panel { padding: 6px 0 !important; gap: 0 !important; }
.task-list2 { list-style: none; margin: 0; padding: 0; display: grid; }
.task-row2 { display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-top: 1px solid var(--line); }
.task-row2:first-child { border-top: 0; }
.task-row2.live { background: #f6f2fa; }
.task-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.task-title { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.task-row2.is-done .task-title { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.task-check { appearance: none; -webkit-appearance: none; width: 24px; height: 24px; flex: none; margin: 0; border: 2px solid #cfc7dc; border-radius: 8px; background: #fff; cursor: pointer; display: grid; place-content: center; }
.task-check:checked { background: var(--accent); border-color: var(--accent); }
.task-check:checked::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
.task-check:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 2px; }
.task-panel .mem-empty { margin: 14px 20px; }
.task-panel .routine-hint { padding: 12px 20px 8px; margin: 0; }
.main > .filters { margin-top: -8px; }

/* Übersicht: compact agent card, name plus one line of role */
.grid2:has(.agent-card) { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.agent-card { align-content: center; min-height: 92px; grid-template-columns: minmax(0, 1fr); min-width: 0; overflow: hidden; }
.agent-card .who { flex-wrap: nowrap; min-width: 0; }
.agent-card .status { flex: none; }
.agent-card .who > .grow { overflow: hidden; }
.agent-card .who > .grow h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.one-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.build.awa { padding-top: 2px; line-height: 1.4; }
.build.awa a { color: inherit; text-decoration: underline; }

/* Text inside fields: same inner spacing for textareas and inputs */
.field textarea { font: inherit; font-weight: 400; line-height: 1.5; padding: 12px 16px; border: 1px solid #d6cfe2; background: #fff; color: var(--ink); width: 100%; box-sizing: border-box; resize: vertical; }
.field input:not([type="checkbox"]):not([type="radio"]) { padding: 10px 16px; }
.field textarea:focus-visible, .field input:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 2px; }

/* Agent settings: spacing between text and buttons, bar aligned with the cards */
.settings-group .row-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.settings-group > p { margin: 0 0 4px; }
.settings-group > p + .row-actions { margin-top: 14px; }
.settings-group .row-actions:empty { display: none; }
.savebar { margin: 4px 0 0; padding: 12px 20px; }
.danger-zone { padding: 22px 24px; }
.order-summary { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.order-summary dt { color: var(--muted); font-size: 14px; }
.order-summary dd { margin: 0; font-weight: 600; }
.modal-form .check-field { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; color: var(--muted); }
.modal-form .check-field input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.modal-form .check-field a { color: inherit; text-decoration: underline; }
/* Read by screen readers only (finished chat replies). */
.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; }
/* Older chat messages on request, centred above the first loaded message. */
.chat-log > .chat-older { justify-self: center; margin: 2px 0 6px; }
/* A page whose first load failed. */
.load-failed { display: grid; gap: 10px; justify-items: start; }
.load-failed h2 { margin: 0; }

/* Quick start: ready-made agents on the overview when there is none yet. */
.grid2 > .quick-start { grid-column: 1 / -1; }
.quick-start { display: grid; gap: 16px; }
.quick-lead { margin: 0; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.quick-card { align-content: space-between; }
.quick-card .btn { justify-self: start; }
.quick-try { margin: 0; font-size: 14px; }
.link-button { border: 0; background: none; padding: 0; font: inherit; color: var(--accent-deep, var(--accent)); text-decoration: underline; cursor: pointer; }

/* Suggested replies above the chat input: one click sends (or prepares) the message. */
.quick-replies { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 4px 10px; }
.messenger-main .quick-replies { padding: 0 clamp(12px, 3vw, 40px) 2px; }   /* same left edge as the input below */
.quick-reply { min-height: 36px; padding: 7px 14px; line-height: 1.35; border: 1px solid #d6cfe2; border-radius: 999px; background: #fff; color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; text-align: left; }
.quick-reply:hover, .quick-reply:focus-visible { border-color: var(--accent); background: var(--lavender, #f1ecfa); }
.quick-reply.subtle { border-style: dashed; color: var(--muted); }

/* Tools in the chat input: suggestions while typing, the tools menu and the picked tools above the input. */
.tool-hints { padding-top: 2px; }
.messenger-main .tool-hints { padding: 0 clamp(12px, 3vw, 40px) 4px; }
.tool-pill { display: inline-flex; align-items: center; gap: 7px; }
.tool-pill svg { flex: none; color: var(--accent); }
.tool-pill.subtle svg { color: var(--muted); }
.tool-badge { padding: 1px 7px; border-radius: 999px; background: var(--lavender, #f1ecfa); color: var(--accent); font-size: 11.5px; font-weight: 600; }
.tool-badge.off { background: none; color: var(--muted); font-weight: 400; }
.tool-chip svg { color: var(--accent); }
.msg .tool-used { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-bottom: 4px; }
.msg .tool-used .attach-chip { padding: 3px 10px; font-size: 12.5px; }
.msg-files { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.msg-files.user { justify-content: flex-end; }
.msg-files .file-chip { padding: 3px 10px; font-size: 12.5px; cursor: pointer; max-width: 100%; }
.msg-files .file-chip:hover { border-color: var(--accent, #7a5fb0); }
.composer .msg-action[aria-expanded="true"] { color: var(--accent); }

/* Chat navigation: previous / next own prompt and back to the newest message, over the lower right of the log. */
.chat-pane { position: relative; display: flex; flex-direction: column; min-height: 0; }
.messenger-main .chat-pane { flex: 1; }
.chat-pane > .chat-log { position: relative; flex: 1; }
.chat-nav { position: absolute; right: clamp(10px, 2.5vw, 28px); bottom: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 2; }
.chat-nav[hidden] { display: none; }
.chat-nav-btn { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid #d6cfe2; border-radius: 999px; background: #fff; color: var(--ink); box-shadow: 0 4px 14px #3b294d1f; cursor: pointer; }
.chat-nav-btn:hover:not(:disabled), .chat-nav-btn:focus-visible { border-color: var(--accent); color: var(--accent); }
.chat-nav-btn:disabled { opacity: .35; cursor: default; box-shadow: none; }
.chat-nav-btn[hidden] { display: none; }
.chat-nav-btn.up svg { transform: rotate(90deg); }
.chat-nav-btn.down svg, .chat-nav-btn.bottom svg { transform: rotate(-90deg); }
.chat-nav-btn.bottom { background: var(--accent); border-color: var(--accent); color: #fff; }
.chat-nav-btn.bottom:hover { color: #fff; filter: brightness(1.08); }
.chat-nav-btn.fresh::after { content: ""; position: absolute; top: 1px; right: 1px; width: 10px; height: 10px; border-radius: 50%; background: #e0574f; border: 2px solid #fff; }

/* Slash commands: the command pills and the local answer cards (not stored, not sent to the agent). */
.command-pill code, .command-list code { font: 600 13px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--accent); }
.command-pill .muted { font-size: 13px; }
.msg.system { justify-content: center; }
.system-card { max-width: min(560px, 100%); padding: 12px 16px; border: 1px dashed #d6cfe2; border-radius: 16px; background: #fff; display: grid; gap: 8px; font-size: 14px; }
.system-card p { margin: 0; }
.command-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; }

/* A switch the user was sent to from the chat ("Fähigkeit einschalten"): briefly highlighted. */
.ability.ability-focus { animation: ability-focus 2.4s ease-out; border-radius: 14px; }
@keyframes ability-focus { 0%, 40% { background: var(--lavender, #f1ecfa); box-shadow: 0 0 0 2px var(--accent); } 100% { background: transparent; box-shadow: 0 0 0 2px transparent; } }

/* Language switcher (i18n.js) */
.lang-switch { font: inherit; font-size: 13px; color: inherit; background: transparent; border: 1px solid currentColor; border-radius: 8px; padding: 2px 6px; opacity: .75; }
.legal-lang { display: flex; gap: 12px; align-items: center; margin: 24px auto; }

/* Chat font size (Konto → Einstellungen), set by ui.js as --chat-font-size. */
.bubble, .composer textarea, .chat-log .ctx-dream { font-size: var(--chat-font-size, 16px); }
/* Below 16px iOS zooms into the field on focus: touch devices keep the input at 16px or more. */
@media (pointer: coarse) { .composer textarea { font-size: max(16px, var(--chat-font-size, 16px)); } }

/* Preview of a text file in the workspace. */
.ws-preview-dialog { width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 48px); display: none; }
.ws-preview-dialog[open] { display: flex; flex-direction: column; }
.ws-preview-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 12px 22px; border-bottom: 1px solid var(--line); }
.ws-preview-head strong { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 15px; }
.ws-preview-body { min-height: 0; overflow: auto; padding: 16px 22px 20px; }
.ws-preview-body .ws-preview { margin: 0; max-height: none; font-size: 12.5px; line-height: 1.5; }
.ws-preview-md { font-size: 15px; line-height: 1.55; }
.ws-preview-pdf { height: calc(100vh - 48px); }
.ws-preview-pdf .ws-preview-body { flex: 1; padding: 0; overflow: hidden; }
.ws-pdf { display: block; width: 100%; height: 100%; border: 0; }
.ws-pdf p { padding: 16px 22px; }
.ws-image { display: block; max-width: 100%; max-height: calc(100vh - 140px); margin: 0 auto; object-fit: contain; border-radius: 8px; }

/* Chat list (desktop): always starts slim with avatars only and opens over the chat while hovered or focused. */
@media (min-width: 861px) {
  .messenger-grid { grid-template-columns: 76px minmax(0, 1fr); }
  .chat-list { position: relative; z-index: 6; width: 76px; overflow: hidden; transition: width .16s ease, box-shadow .16s ease; }
  .chat-list:hover, .chat-list:focus-within { width: 300px; box-shadow: 12px 0 32px #3b294d1f; transition-delay: .12s; }
  .chat-list .list-head { padding: 14px 10px 8px; justify-content: center; }
  .chat-list .people { padding: 4px 8px 12px; overflow-x: hidden; }
  .chat-list .person { padding: 9px 8px; }
  .chat-list:not(:hover):not(:focus-within) .list-head h2,
  .chat-list:not(:hover):not(:focus-within) .person > div { display: none; }
  .chat-list:hover .list-head, .chat-list:focus-within .list-head { justify-content: space-between; padding: 14px 14px 8px 18px; }
  .chat-list .person > div { min-width: 0; flex: 1; }
}
/* Usage at the foot of the chat list. */
.shell.collapsed .list-usage, .list-usage { display: grid; }   /* not hidden with the folded main sidebar */
.list-usage { margin: auto 10px 12px; padding: 10px; gap: 6px; text-decoration: none; color: inherit; box-shadow: none; flex: none; }
.list-usage strong { font-size: 13.5px; }
.list-usage small { font-size: 12px; }
.list-usage strong, .list-usage small { white-space: nowrap; overflow: hidden; }
.list-usage .usage-short { display: none; }
@media (min-width: 861px) {
  .chat-list:not(:hover):not(:focus-within) .list-usage { margin: auto 8px 12px; padding: 8px 6px; }
  .chat-list:not(:hover):not(:focus-within) .list-usage .usage-long { display: none; }
  .chat-list:not(:hover):not(:focus-within) .list-usage .usage-short { display: block; margin: 0 auto; }
}

/* Composer like ChatGPT: text on top with the full width, actions in a row below; grows upwards. */
.composer.composer-stack { display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 8px 8px 6px; border-radius: 26px; }
.composer-stack .composer-text { position: relative; display: flex; }
.composer-stack textarea { width: 100%; max-height: none; padding: 8px 40px 6px 12px; line-height: 1.4; overflow-y: hidden; }
.composer-stack .composer-expand { position: absolute; top: 2px; right: 0; }
.composer-stack .composer-actions { display: flex; align-items: center; gap: 4px; }
.composer-stack .composer-actions .attach { margin-left: 0; }
.composer-stack .composer-gap { flex: 1; }
.full-input-dialog { width: min(960px, calc(100vw - 24px)); height: calc(100vh - 48px); max-height: none; display: none; padding: 0; }
.full-input-dialog[open] { display: flex; flex-direction: column; }
.full-input-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.full-input-head strong { flex: 1; font-size: 15px; }
.full-input { flex: 1; width: 100%; border: 0; outline: 0; resize: none; font: inherit; font-size: var(--chat-font-size, 16px); line-height: 1.5; padding: 18px 22px; background: none; }
@media (max-width: 640px) { .full-input-dialog { width: 100vw; height: 100dvh; border-radius: 0; } }

