:root {
  --bg: #eceef1; --card: #fff; --line: #e6e8ec; --text: #14161a; --muted: #6b7280; --soft: #f4f5f7;
  --sel: #f1f2f5; --dark: #1d1e22; --yellow: #f6c90e; --yellow-bg: #fff8d6;
  --radius: 14px; font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif; color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body { background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
button, input, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }

.app { height: 100vh; display: flex; flex-direction: column; margin: 0 auto; background: var(--card); }
@media (min-width: 1100px) { .app { height: calc(100vh - 24px); margin: 12px; border-radius: 18px; border: 1px solid var(--line); overflow: hidden; } }

.topbar { display: flex; align-items: center; gap: 24px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.title { font-size: 17px; font-weight: 600; display: flex; gap: 10px; align-items: baseline; min-width: 140px; }
.count { color: var(--muted); font-weight: 400; font-size: 14px; }
.search { flex: 1; max-width: 640px; display: flex; align-items: center; gap: 10px; background: var(--soft); border: 1px solid transparent; border-radius: 10px; padding: 0 14px; color: var(--muted); }
.search:focus-within { background: #fff; border-color: #c9ccd3; }
.search input { flex: 1; border: 0; background: transparent; outline: 0; padding: 10px 0; color: var(--text); }

.panes { flex: 1; display: grid; grid-template-columns: 380px 1fr; min-height: 0; }
.listwrap { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.list { flex: 1; overflow-y: auto; }
.tabs { display: flex; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.tab { flex: 1; border: 0; background: transparent; border-radius: 9px; padding: 8px 10px; cursor: pointer; font-weight: 500; color: var(--muted); }
.tab:hover { background: var(--soft); }
.tab.on { background: var(--sel); color: var(--text); font-weight: 600; }
.tab .n { font-weight: 400; color: var(--muted); margin-left: 4px; }
.d-actions { display: flex; gap: 8px; flex: none; }
.row { display: grid; grid-template-columns: 40px 1fr; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); cursor: pointer; }
.row:hover { background: #f8f9fa; }
.row.sel { background: var(--sel); }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 15px; flex: none; }
.row .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.row .name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .date { font-size: 13px; color: var(--muted); white-space: nowrap; }
.row .mail { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .subj { margin-top: 4px; font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row.read .name, .row.read .subj { font-weight: 500; color: #8a909b; }
.row.read .name { font-weight: 600; }
.row .badge { display: inline-block; width: 8px; height: 8px; background: #2563eb; border-radius: 50%; margin-right: 6px; }
.row .tag { font-size: 12px; color: var(--muted); margin-left: 6px; }
.none { padding: 40px 20px; text-align: center; color: var(--muted); }

.detail { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.empty { margin: auto; color: var(--muted); }
.d-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 28px 14px; border-bottom: 1px solid var(--line); }
.d-head h1 { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.3; }
.d-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.scroll { flex: 1; overflow-y: auto; padding: 8px 28px 24px; }
.msg { padding: 20px 0; border-bottom: 1px solid var(--line); }
.msg:last-child { border-bottom: 0; }
.msg-head { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.msg-head .who-wrap { min-width: 0; flex: 1; }
.msg-head .from { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-body { display: none; margin-top: 14px; }
.msg.open .msg-body { display: block; }
.msg:not(.open) { padding: 12px 0; }
.msg:not(.open) .msg-head:hover { background: #f8f9fa; }
.msg:not(.open) .avatar { width: 32px; height: 32px; font-size: 13px; }
.clip { display: inline-flex; vertical-align: middle; margin-left: 8px; color: var(--muted); }
.msg-head .who { font-weight: 600; font-size: 15px; }
.msg-head .from { color: var(--muted); font-size: 13px; }
.msg-head .when { margin-left: auto; color: var(--muted); font-size: 13px; white-space: nowrap; }
.msg.out .avatar { background: var(--dark) !important; color: #fff !important; }
.body { white-space: pre-wrap; word-wrap: anywhere; color: #2b2f36; }
.trans { margin-top: 12px; }
.trans summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.trans .body { margin-top: 8px; padding: 10px 14px; background: var(--soft); border-radius: 10px; }
.atts { margin-top: 16px; }
.atts .label { font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.chips-row { display: flex; flex-wrap: wrap; gap: 10px; }
.file { cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: inherit; max-width: 260px; }
.file:hover { border-color: #c9ccd3; }
.file .ext { width: 28px; height: 28px; border-radius: 7px; color: #fff; font-size: 9.5px; font-weight: 700; display: grid; place-items: center; text-transform: uppercase; flex: none; }
.file .fn { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file .fs { font-size: 12px; color: var(--muted); }
.file .x { margin-left: 4px; border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 14px; }

.btn { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 16px; cursor: pointer; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.btn:hover { background: var(--soft); }
.btn.dark { background: var(--dark); border-color: var(--dark); color: #fff; }
.btn.dark:hover { background: #33353b; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ki { background: var(--yellow); border-color: var(--yellow); color: #231d00; font-weight: 700; }
.btn.ki:hover { background: #e9bc00; }
.icon { border: 0; background: transparent; cursor: pointer; font-size: 16px; color: var(--muted); padding: 4px 8px; }

.detail.composing .scroll { flex: 0 0 auto; max-height: 24vh; }
.composer { flex: 1; min-height: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line); padding: 14px 28px 16px; background: #fff; box-shadow: 0 -6px 18px rgba(20, 22, 26, .04); }
.composer .meta { display: grid; grid-template-columns: 56px 1fr; gap: 4px 8px; align-items: center; margin-bottom: 8px; font-size: 13px; }
.composer .meta input { border: 0; border-bottom: 1px solid var(--line); padding: 5px 0; outline: 0; background: transparent; }
.composer .meta input:focus { border-color: #9aa0ab; }
.composer textarea#body { flex: 1; min-height: 120px; resize: none; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; outline: 0; line-height: 1.6; font-size: 14.5px; }
.composer textarea#body:focus { border-color: #9aa0ab; }
.composer textarea#body.flash { animation: flash 1.4s ease-out; }
@keyframes flash { 0% { background: var(--yellow-bg); } 100% { background: #fff; } }
.composer .trans { flex: none; }
.composer .trans .body { max-height: 18vh; overflow-y: auto; }
.composer .chips-row { margin-top: 10px; flex: none; }
.composer .bar { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex: none; }
.composer .bar .sp { flex: 1; }
.composer .busy { opacity: .55; pointer-events: none; }
.saved { font-size: 12px; color: var(--muted); margin-right: 6px; }
.ibtn { width: 36px; height: 36px; padding: 0; justify-content: center; }
.ibtn:disabled { opacity: .35; }

.ai-panel { flex: none; margin-top: 10px; border: 1px solid #ecd870; background: #fffdf2; border-radius: 14px; padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.ai-log { max-height: 150px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.ai-log:empty { display: none; }
.bub-user { align-self: flex-end; max-width: 80%; background: #eceef1; border-radius: 16px; padding: 6px 14px; white-space: pre-wrap; }
.bub-ai { max-width: 94%; font-size: 13.5px; }
.bub-ai summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
.bub-ai .thought { margin: 4px 0; padding-top: 4px; border-top: 1px solid var(--line); color: #3a3f47; }
.bub-ai.err { color: #b91c1c; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 11px; font-size: 12.5px; cursor: pointer; }
.chips button:hover { background: var(--soft); }
.chat-input { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 8px 8px 8px 12px; display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.chat-input:focus-within { border-color: #9aa0ab; }
.chat-input textarea { flex: 1; min-width: 180px; border: 0; outline: 0; resize: none; max-height: 120px; padding: 6px 0; background: transparent; }
.sel-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--yellow-bg); border: 1px solid #ecd870; border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 12.5px; white-space: nowrap; align-self: center; }
.sel-pill.all { background: var(--soft); border-color: var(--line); padding-right: 10px; color: var(--muted); }
.sel-pill button { border: 0; background: rgba(0, 0, 0, .08); width: 18px; height: 18px; border-radius: 50%; cursor: pointer; font-size: 11px; line-height: 1; }
.send { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--dark); color: #fff; cursor: pointer; display: grid; place-items: center; flex: none; }
.send:disabled { opacity: .4; cursor: default; }

.statusbar { display: flex; align-items: center; gap: 10px; padding: 9px 20px; border-top: 1px solid var(--line); background: #fafafb; font-size: 13px; color: #3a3f47; }
.statusbar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); flex: none; }
.statusbar.err .dot { background: #dc2626; }
.statusbar.ok .dot { background: #16a34a; }

.modal-bg { position: fixed; inset: 0; background: rgba(20, 22, 26, .35); display: grid; place-items: center; z-index: 10; padding: 16px; }
.modal-bg[hidden], .viewer-bg[hidden] { display: none; }
.modal { width: min(520px, 100%); background: #fff; border-radius: 18px; display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0, 0, 0, .25); max-height: 90vh; }
.modal header, .modal footer { display: flex; align-items: center; gap: 10px; padding: 14px 18px; }
.modal header { border-bottom: 1px solid var(--line); }
.modal header .icon { margin-left: auto; }
.modal footer { justify-content: flex-end; border-top: 1px solid var(--line); }
.modal-body { padding: 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.modal-body input:not([type]), .modal-body input[type="text"], .modal-body input:not([type="checkbox"]) { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; outline: 0; }
.modal-body input:focus { border-color: #9aa0ab; }
.modal-body input:disabled { background: var(--soft); color: #9aa0ab; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; margin-top: 4px; }
.rules { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.rules .r { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }
.rules .r span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rules .h { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }

.viewer-bg { position: fixed; inset: 0; background: rgba(12, 13, 16, .92); z-index: 20; display: flex; flex-direction: column; color: #fff; }
.viewer-top { display: flex; align-items: center; gap: 14px; padding: 12px 18px; }
.viewer-top .sp { flex: 1; }
.viewer-top .muted { color: #a9aeb8; }
.viewer-top .btn { background: rgba(255, 255, 255, .1); border-color: transparent; color: #fff; }
.icon.light { color: #fff; font-size: 18px; }
.viewer-stage { flex: 1; display: grid; place-items: center; min-height: 0; padding: 0 70px 24px; touch-action: pan-y; }
.viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; user-select: none; -webkit-user-drag: none; }
.viewer-stage iframe { width: min(1000px, 100%); height: 100%; border: 0; background: #fff; border-radius: 8px; }
.viewer-stage .nopreview { text-align: center; color: #cfd3da; }
.viewer-stage .nopreview .ext { width: 64px; height: 64px; font-size: 16px; margin: 0 auto 14px; border-radius: 14px; color: #fff; display: grid; place-items: center; text-transform: uppercase; font-weight: 700; }
.nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .14); color: #fff; font-size: 30px; line-height: 1; cursor: pointer; z-index: 2; }
.nav:hover { background: rgba(255, 255, 255, .26); }
.nav.prev { left: 14px; } .nav.next { right: 14px; }
.nav[hidden] { display: none; }

body.plain { background: #fff; }
.plain-main { max-width: 820px; margin: 0 auto; padding: 32px 20px; }
.settings-form { display: flex; flex-direction: column; gap: 8px; }
.settings-form textarea { width: 100%; font-family: ui-monospace, monospace; font-size: 13px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.form-error { color: #b91c1c; }
.back { color: var(--muted); text-decoration: none; }

}

.topbar #ignore-btn { margin-left: auto; }
.btn.ki.on { box-shadow: 0 0 0 3px rgba(246, 201, 14, .35); }

.body.html { white-space: normal; }
.body.html p { margin: 0 0 .8em; }
.body.html img { max-width: min(100%, 560px); height: auto; border-radius: 8px; margin: 6px 0; cursor: zoom-in; display: block; }
.body.html a { color: #2563eb; }
.body.html blockquote { margin: .6em 0; padding-left: 12px; border-left: 3px solid var(--line); color: var(--muted); }
.body.html table { border-collapse: collapse; max-width: 100%; }
.body.html td, .body.html th { padding: 2px 8px; vertical-align: top; }

.modal.wide { width: min(760px, 100%); max-height: 90vh; }
.modal footer .sp { flex: 1; }
.cx-list { display: flex; flex-direction: column; gap: 8px; }
.cx-item { display: grid; grid-template-columns: 22px 26px 1fr 28px; gap: 8px; align-items: start; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 8px 10px 10px; }
.cx-item.drag { opacity: .45; border-style: dashed; }
.cx-handle { cursor: grab; color: #9aa0ab; letter-spacing: -2px; user-select: none; padding-top: 4px; font-weight: 700; }
.cx-no { font-weight: 600; color: var(--muted); padding-top: 4px; text-align: right; }
.cx-main textarea { width: 100%; resize: none; border: 1px solid transparent; border-radius: 8px; padding: 4px 8px; outline: 0; line-height: 1.5; background: var(--soft); overflow: hidden; }
.cx-main textarea:focus { border-color: #9aa0ab; background: #fff; }
.cx-ctr { display: block; font-size: 11.5px; color: var(--muted); text-align: right; margin-top: 2px; }
.cx-ctr.full { color: #b91c1c; }
.cx-actions { display: flex; gap: 8px; margin-top: 8px; }

#menu-btn { display: none; }
.btn .ico { display: inline-flex; }
.detail.composing .scroll { display: none; }
.detail.composing.peek-open .scroll { display: block; flex: 0 0 auto; max-height: 42vh; }
.detail.composing #reply-btn { display: none; }
.peek { border: 0; border-bottom: 1px solid var(--line); background: #fafafb; text-align: left; padding: 10px 28px; cursor: pointer; color: #3a3f47; font-weight: 500; }
.peek:hover { background: var(--soft); }

/* KI-Verlauf kompakt */
.ai-log { max-height: 96px; gap: 4px; }
.bub-user { padding: 3px 12px; font-size: 13px; }
.bub-ai.compact { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 12.5px; max-width: 100%; }
.bub-ai.compact .ok { color: #15803d; font-weight: 700; }
.bub-ai.compact .think { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0; font-size: 12.5px; }
.bub-ai.compact .think:hover { color: var(--text); }
.bub-ai.compact .thought { display: none; flex-basis: 100%; margin: 0; padding: 4px 0 0; border-top: 0; color: #3a3f47; }
.bub-ai.compact.open .thought { display: block; }

/* ---------- Mobile: Vollansicht je Zustand ---------- */
@media (max-width: 800px) {
  body { font-size: 15px; }
  input, textarea { font-size: 16px !important; }
  .app { height: 100%; margin: 0; border-radius: 0; border: 0; }
  .topbar { gap: 8px; padding: 8px 10px; }
  .topbar .title { min-width: 0; flex: 1; font-size: 16px; overflow: hidden; }
  .topbar .title #top-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .search { max-width: none; }
  .topbar .search { flex: 3; }
  .topbar .title { flex: 0 0 auto; max-width: 38vw; }
  .btn .lbl { display: none; }
  .topbar .btn { padding: 0; width: 40px; height: 40px; justify-content: center; }
  #menu-btn { display: inline-flex; }
  .app:not(.m-detail) #menu-btn { display: none; }
  .app.m-detail .search { display: none; }
  .app.m-detail .topbar .title { flex: 1; max-width: none; }
  .topbar #ignore-btn, .topbar #cortex-btn { margin-left: 0; }
  .topbar #cortex-btn { margin-left: auto; }
  .panes { display: block; position: relative; }
  .listwrap, .detail { height: 100%; width: 100%; border: 0; }
  .app:not(.m-detail) .detail { display: none; }
  .app.m-detail .listwrap { display: none; }
  .row { padding: 12px 14px; gap: 10px; grid-template-columns: 36px 1fr; }
  .avatar { width: 36px; height: 36px; }
  .d-head { padding: 10px 14px; }
  .d-head h1 { font-size: 16px; }
  .d-head .btn { padding: 8px 12px; }
  .scroll { padding: 4px 14px 20px; }
  .msg-head .when { display: none; }
  .msg-head .from { font-size: 12px; }
  .file { max-width: 100%; }
  .peek { padding: 10px 14px; }
  .composer { padding: 8px 12px 10px; }
  .composer .meta { grid-template-columns: 52px 1fr; }
  .composer textarea#body { min-height: 90px; padding: 10px 12px; }
  .composer .bar { flex-wrap: wrap; gap: 6px; }
  .composer .bar .sp { flex: 1 1 0; min-width: 0; }
  .composer .bar .btn { padding: 8px 12px; }
  .saved { display: none; }
  .ai-panel { padding: 8px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -8px; padding: 0 8px 2px; }
  .chips button { white-space: nowrap; flex: none; }
  .chat-input { padding: 6px 6px 6px 10px; }
  .chat-input textarea { min-width: 120px; }
  .modal-bg { padding: 0; }
  .modal, .modal.wide, .modal.small { width: 100%; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; }
  .modal-body { flex: 1; }
  .cx-item { grid-template-columns: 18px 22px 1fr 28px; gap: 6px; }
  .viewer-stage { padding: 0 8px 16px; }
  .nav { width: 40px; height: 40px; }
  .statusbar { padding: 8px 12px; font-size: 12.5px; }
}

.x-only { display: none; }
@media (max-width: 800px) {
  .topbar .title { flex: 0 0 auto; max-width: none; }
  .app:not(.m-detail) .topbar .title #top-title { display: none; }
  .topbar .search { flex: 1; min-width: 0; }
  .search input { min-width: 0; width: 100%; }
  .composer .bar .x-only { display: inline; }
  .composer .bar .ibtn { width: 34px; height: 36px; }
  .composer .bar .btn { padding: 8px 10px; }
  .composer .bar .btn.ki { padding: 8px 12px; }
}

/* KI-Panel: Verlauf fährt nach oben aus, Pills umbrechen */
.ai-panel { position: relative; }
.ai-log { display: none; }
.ai-hist { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); max-height: min(46vh, 380px); overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px rgba(20, 22, 26, .16); opacity: 0; transform: translateY(14px); pointer-events: none; transition: opacity .18s ease, transform .18s ease; z-index: 5; }
.ai-panel.hist-open .ai-hist { opacity: 1; transform: translateY(0); pointer-events: auto; }
.ai-hist .bub-ai { font-size: 13px; }
.ai-hist .bub-ai .ok { color: #15803d; font-weight: 700; }
.ai-hist .bub-ai .thought { margin-top: 3px; color: var(--muted); font-size: 12.5px; }
.ai-done { align-self: flex-start; border: 0; background: transparent; padding: 0 2px; font-size: 12.5px; font-weight: 600; color: #15803d; cursor: pointer; }
.ai-done[hidden] { display: none; }
.ai-done.busy { color: var(--muted); font-weight: 500; cursor: default; }
.ai-done.err { color: #b91c1c; }
.chips { flex-wrap: wrap !important; overflow: visible !important; }
.kb { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.kb summary { cursor: pointer; font-weight: 600; }
.kb-item { display: grid; grid-template-columns: 1fr 28px; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kb-text { display: flex; flex-direction: column; }
.kb-text span { color: #3a3f47; }
@media (max-width: 800px) {
  .chips { flex-wrap: wrap !important; margin: 0; padding: 0; }
}

.chips .pill-new { background: var(--dark); border-color: var(--dark); color: #fff; font-weight: 600; }
.chips .pill-new:hover { background: #33353b; }

.btn .ico { align-items: center; }

.kb-btns { display: flex; align-items: flex-start; }
.kb-item.editing { grid-template-columns: 1fr; }
.kb-edit { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
.kb-edit input, .kb-edit textarea { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; outline: 0; resize: none; background: #fff; }
.kb-edit input:focus, .kb-edit textarea:focus { border-color: #9aa0ab; }
.kb-edit-bar { display: flex; align-items: center; gap: 8px; }
.kb-edit-bar .sp { flex: 1; }
.kb-edit-bar .btn { padding: 5px 12px; }
.kb-pin { color: var(--muted); font-weight: 400; }
.kb-item { grid-template-columns: 1fr auto; min-width: 0; }
.kb-item.editing { grid-template-columns: 1fr; }
.kb-text { min-width: 0; }
.kb-edit textarea { overflow: hidden; }
.kb-btns .icon { padding: 4px 6px; }

/* ---------- PWA: Safe-Areas (Notch/Home-Indicator), Touch, Login ---------- */
html { -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
body { -webkit-tap-highlight-color: transparent; padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
button, .row, .tab, .file, .msg-head, .peek { touch-action: manipulation; }
.statusbar { padding-bottom: calc(9px + env(safe-area-inset-bottom)); }
@media (display-mode: standalone) { .app { margin: 0; border-radius: 0; border: 0; height: 100%; } }
.center-card { max-width: 360px; margin: 0 auto; padding: 14vh 24px 24px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.center-card .logo { border-radius: 18px; }
.center-card h1 { margin: 0; font-size: 22px; }
.login-form { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.login-form input { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; outline: 0; font-size: 16px; background: #fff; }
.login-form input:focus { border-color: #9aa0ab; }
.login-form .btn { justify-content: center; padding: 12px; font-size: 15px; }

.statusbar .sp { flex: 1; }
.statusbar .polled { color: var(--muted); font-size: 12px; white-space: nowrap; }
@media (max-width: 800px) { .statusbar .polled { display: none; } }
