:root {
  --bg: #f4f2ee;
  --surface: #ffffff;
  --text: #2a2723;
  --muted: #7a736a;
  --line: #e2ddd5;
  --accent: #6b4f2e;
  --accent-text: #ffffff;
  --accent-soft: #efe6d9;
  --hover: #faf6ef;
  --danger: #b33a2b;
  --flag: #c0662a;
  --note: #fff6dd;
  --radius: 8px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1a17;
    --surface: #26231f;
    --text: #ece7df;
    --muted: #a39b90;
    --line: #3a3530;
    --accent: #c79a62;
    --accent-text: #1c1a17;
    --accent-soft: #3a3024;
    --hover: #2e2a25;
    --danger: #e0705f;
    --flag: #e39a5c;
    --note: #332c1c;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; color: inherit; }
/* Kein Doppeltipp-Zoom auf Bedienelementen (iPhone) */
button, a, .btn, .msg, .folder, .cd, .ag-item, .trow, label { touch-action: manipulation; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 13px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-decoration: none; color: var(--text); white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 3px 9px; font-size: 13px; }
.btn.icon { padding: 7px 10px; min-width: 38px; }
.btn.wide { width: 100%; padding: 10px; }
.btn:disabled { opacity: .5; cursor: default; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ic.filled { fill: currentColor; }
.btn .ic { color: var(--accent); }
.btn.primary .ic { color: var(--accent-text); }
.btn.danger .ic { color: var(--danger); }
.btn.tb.on .ic { color: var(--flag); }
.msg .ic { width: 13px; height: 13px; vertical-align: -2px; }
.msg .flag .ic { color: var(--flag); }
.swipe-bg .ic { width: 22px; height: 22px; margin: 0 6px; }
dialog.wide { width: min(620px, calc(100vw - 24px)); }
.k-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.k-head h2 { margin: 0; }
.k-head .ic { width: 16px; height: 16px; }
.klist { max-height: 55vh; overflow: auto; margin-top: 8px; border-top: 1px solid var(--line); }
.krow { display: flex; align-items: center; gap: 6px; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.kmain { flex: 1; min-width: 0; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kmain .small { overflow: hidden; text-overflow: ellipsis; }
.krow .btn.icon { min-width: 36px; }
.ksrc .ic { width: 14px; height: 14px; color: var(--muted); vertical-align: -2px; margin-left: 4px; }
.k-filter { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.k-filter .check { margin: 0; }
.crow { display: flex; gap: 10px; align-items: flex-start; padding: 7px 2px; margin: 0; border-bottom: 1px solid var(--line); color: var(--text); font-size: 14px; cursor: pointer; }
.crow input { margin-top: 3px; min-height: 0; flex: none; }
.crow span { min-width: 0; overflow-wrap: anywhere; }
.ibar { height: 10px; border-radius: 5px; background: var(--hover); overflow: hidden; margin: 6px 0; }
.ibar > div { height: 100%; background: var(--accent); transition: width .5s; }
.menu-list { display: grid; gap: 8px; }
/* Am PC stehen diese Aktionen schon oben als Knopf */
@media (min-width: 761px) {
  .menu-list .only-mobile-item { display: none; }
  /* Am PC alle Aktionen direkt in der Leiste – „Mehr“ nur auf dem Handy */
  .read-actions .mob { display: none; }
}
.menu-list .btn { justify-content: flex-start; }
input, select, textarea { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); min-height: 38px; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
label > input, label > textarea, label > select { display: block; width: 100%; margin-top: 3px; }
.check { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 14px; }
.check input { min-height: 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.login { max-width: 340px; margin: 10vh auto; }
.login .logo { display: block; width: 80%; margin: 0 auto 18px; }
.center { text-align: center; }
.focus-sink { position: absolute; width: 1px; height: 1px; overflow: hidden; outline: none; }
.login .center { margin: 14px 0 0; }

/* Grundaufbau: Kopfzeile + drei Spalten */
#shell { height: 100%; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.logo-img { height: 38px; width: auto; display: block; }
.brand-sub { font-weight: 650; color: var(--muted); margin-right: 8px; }
.search { flex: 1; max-width: 460px; }
.search { position: relative; }
.search input { width: 100%; padding-right: 36px; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
.search-clear { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 15px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.search-clear:hover { background: var(--hover); color: var(--text); }
#refreshBtn { margin-left: auto; }
.panes { flex: 1; display: grid; grid-template-columns: 230px minmax(300px, 400px) 1fr 280px; min-height: 0; }
body.no-agenda .panes { grid-template-columns: 230px minmax(300px, 400px) 1fr; }
body.no-agenda #agenda { display: none; }
#agenda { border-right: 0; border-left: 1px solid var(--line); padding: 0 0 12px; }
.ag-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.ag-head h2 { margin: 0; font-size: 17px; }
.ag-head .ic, .mini-head .ic { width: 16px; height: 16px; }
.ag-empty { padding: 24px 14px; text-align: center; color: var(--muted); font-size: 14px; }
.mini { padding: 8px 10px 4px; }
.mini-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; font-size: 14px; }
.mini-head .btn.icon { min-width: 30px; padding: 3px 6px; border: 0; }
.mini-head b { flex: 1; text-align: center; }
.mini-head .today-btn { padding: 2px 8px; font-size: 12px; margin-right: 2px; }
.mini-head .today-btn:disabled { opacity: .35; cursor: default; }
.ag-search { padding: 8px 10px 0; }
.ag-search input { width: 100%; box-sizing: border-box; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: inherit; font: inherit; font-size: 13.5px; }
.ag-shead { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 2px 0; font-weight: 600; font-size: 14px; }
.ag-shead span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-item[data-hit] { grid-template-columns: 1fr; }
.mini-head b[data-act] { cursor: pointer; user-select: none; }
.mini-caret { font-size: 11px; color: var(--muted); }
.mini.closed { padding-bottom: 0; }
.ag-more { text-align: center; padding: 14px 0 6px; }

/* Newsletter aufräumen / gesperrte Absender */
.ftool { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 26px; font-size: 13px; color: var(--muted); cursor: pointer; border-radius: 6px; }
.ftool:hover { background: var(--hover); color: inherit; }
.ftool .ic { width: 15px; height: 15px; }
.nllist { max-height: min(60vh, 520px); overflow-y: auto; margin: 6px 0 4px; }
.nlrow { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.nlrow.done { opacity: .5; }
.nlwho { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.nlwho > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nlsub { color: var(--muted); }
.nlrow .btn { flex: none; }

/* Monatsansicht in der App „Termine“ */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: 0 8px 0 auto; }
.seg button { border: 0; background: none; color: inherit; font: inherit; font-size: 13px; padding: 4px 12px; cursor: pointer; }
.seg button.on { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.month { padding: 8px 6px 4px; touch-action: pan-y; }
.mgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.mwd { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); padding: 2px 0 4px; }
.mc { display: flex; flex-direction: column; align-items: stretch; gap: 1px; min-height: 64px; min-width: 0; padding: 3px 2px; border: 0; border-top: 1px solid var(--line); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; overflow: hidden; border-radius: 0; }
.mc b { align-self: center; font-size: 13px; font-weight: 600; min-width: 22px; height: 22px; line-height: 22px; text-align: center; border-radius: 11px; font-variant-numeric: tabular-nums; }
.mc.we b { color: var(--muted); }
.mc.other { opacity: .4; }
.mc.today b { background: var(--accent); color: var(--accent-text); }
.mc.sel { background: var(--accent-soft); border-radius: 6px; }
.mev { display: block; font-size: 10.5px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: clip; padding: 0 2px; border-left: 2px solid var(--c); }
.mev.all { background: var(--c); color: #fff; border-radius: 3px; }
.mmore { font-size: 10px; color: var(--muted); text-align: center; }
.slide-next { animation: slideNext .22s ease-out; }
.slide-prev { animation: slidePrev .22s ease-out; }
@keyframes slideNext { from { transform: translateX(40px); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes slidePrev { from { transform: translateX(-40px); opacity: .3; } to { transform: none; opacity: 1; } }

/* Eigene App „Termine“ (/termine): nur die Terminspalte, bildschirmfüllend */
.cal-mode #folders, .cal-mode #listPane, .cal-mode #readPane,
.cal-mode #composeBtn, .cal-mode #agendaBtn, .cal-mode #contactsBtn, .cal-mode .ag-search { display: none !important; }
.cal-mode .panes { display: block; position: relative; }
.cal-mode #agenda { display: block !important; position: absolute; inset: 0; border-left: 0; padding-left: max(0px, calc(50% - 380px)); padding-right: max(0px, calc(50% - 380px)); }
.cal-mode .ag-item { font-size: 15px; padding: 9px 10px; }
.cal-mode .ag-head h2 { font-size: 20px; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 12px; }
.mini-grid span { color: var(--muted); padding: 2px 0; }
.cd { position: relative; border: 0; background: none; padding: 5px 0 7px; border-radius: 6px; cursor: pointer; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.cd:hover { background: var(--hover); }
.cd.other { color: var(--muted); opacity: .6; }
.cd.today { font-weight: 700; color: var(--accent); }
.cd.sel { background: var(--accent); color: var(--accent-text); }
.cd i { position: absolute; left: 50%; bottom: 2px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent); }
.cd.sel i { background: var(--accent-text); }
.ag-list { padding: 0 10px; }
.ag-day { font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 12px 2px 4px; }
.ag-day.is-today { color: var(--accent); }
.ag-item { display: grid; grid-template-columns: auto 1fr; gap: 0 8px; padding: 6px 8px; margin-bottom: 4px; border-radius: 6px; border-left: 3px solid var(--c); background: var(--hover); cursor: pointer; font-size: 13.5px; }
.ag-item:hover { background: var(--accent-soft); }
.ag-time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ag-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.ag-loc { grid-column: 2; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-none { color: var(--muted); font-size: 13px; padding: 2px 2px 4px; }
.ev-desc { white-space: pre-wrap; font-size: 14px; background: var(--hover); padding: 8px 10px; border-radius: 6px; max-height: 40vh; overflow: auto; word-break: break-word; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; flex: none; }
.set-sec { font-weight: 650; margin: 14px 0 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.cal-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.cal-row input { flex: 1; min-width: 0; }
.cal-row .colsel { width: auto; flex: none; padding: 6px 8px; }
.howto { padding-left: 18px; margin: 6px 0 10px; }
.fields2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 10px; }
.fields2 label { margin-bottom: 10px; min-width: 0; }
/* iPhone: Datums-/Zeitfelder haben sonst eine feste Mindestbreite und ragen über den Rand */
.fields2 input[type=date], .fields2 input[type=time], dialog input[type=date], dialog input[type=time] { width: 100%; min-width: 0; box-sizing: border-box; -webkit-appearance: none; appearance: none; }
.fields2 .check { justify-content: flex-start; }
.check input[type=checkbox] { width: auto; flex: none; }
.pane { min-height: 0; overflow: auto; border-right: 1px solid var(--line); }
#readPane { border-right: 0; overflow: auto; background: var(--surface); -webkit-overflow-scrolling: touch; }
#listPane { display: flex; flex-direction: column; overflow: hidden; background: var(--surface); }
#list { flex: 1; overflow: auto; outline: none; }
.only-mobile { display: none; }

/* Ordner */
#folders { padding: 10px 6px; }
.fsec { display: flex; align-items: center; justify-content: space-between; padding: 12px 8px 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; }
.fsec:first-child { padding-top: 2px; }
.fsec .btn { text-transform: none; letter-spacing: 0; }
.folder { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 6px; cursor: pointer; user-select: none; }
.folder:hover { background: var(--hover); }
.folder.active { background: var(--accent); color: var(--accent-text); }
.folder.active .count { color: var(--accent-text); }
.folder.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.folder .twisty { width: 14px; text-align: center; color: var(--muted); font-size: 11px; flex: none; }
.folder.active .twisty { color: var(--accent-text); }
.folder .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder .count { font-size: 13px; font-weight: 650; color: var(--accent); }
.folder .more { visibility: hidden; border: 0; background: none; padding: 0 4px; cursor: pointer; color: inherit; }
.folder:hover .more { visibility: visible; }
.folder.noselect { cursor: default; color: var(--muted); }
/* Griff zum Sortieren: blass, beim Überfahren etwas deutlicher */
.grip { display: flex; align-items: center; padding: 2px 2px 2px 4px; cursor: grab; touch-action: none; opacity: .25; flex: none; }
.grip .ic { width: 15px; height: 15px; }
.folder:hover .grip { opacity: .6; }
.folder.fdragging { opacity: .5; }
.folder.fdragging .grip { cursor: grabbing; }
.folder.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.folder.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.ferr { margin: 4px 8px; padding: 6px 8px; border-radius: 6px; background: var(--note); font-size: 13px; }

/* Liste */
.list-head { padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.list-head h2 { margin: 0; font-size: 17px; }
.msgwrap { position: relative; overflow: hidden; }
.swipe-bg { position: absolute; inset: 0; color: #fff; display: none; align-items: center; padding: 0 22px; font-weight: 650; opacity: .7; }
.swipe-bg.del { background: var(--danger); justify-content: flex-end; }
.swipe-bg.file { background: #6b4f2e; justify-content: flex-start; }
.msgwrap[data-dir=del] .swipe-bg.del, .msgwrap[data-dir=file] .swipe-bg.file { display: flex; }
.msgwrap.armed .swipe-bg { opacity: 1; }
.msg { position: relative; background: var(--surface); touch-action: pan-y; }
.msg.back { transition: transform .18s ease-out; }
.msg { display: grid; grid-template-columns: 10px 1fr auto; gap: 1px 8px; padding: 9px 14px 9px 8px; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; }
.msg:hover { background: var(--hover); }
.msg.sel { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.msg .dot { grid-row: 1; width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; }
.msg.unseen .dot { background: var(--accent); }
.msg .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg.unseen .who, .msg.unseen .subj { font-weight: 650; }
.msg .when { font-size: 13px; color: var(--muted); white-space: nowrap; }
.msg .subj { grid-column: 2 / 3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.msg .mdel { grid-column: 3; justify-self: end; border: 0; background: none; padding: 0 0 0 6px; cursor: pointer; color: var(--muted); opacity: .45; display: flex; align-items: center; }
.msg .mdel .ic { width: 15px; height: 15px; }
.msg:hover .mdel { opacity: .8; }
.msg .mdel:hover { opacity: 1; color: var(--danger); }
.msg .icons { color: var(--muted); font-size: 13px; margin-left: 4px; }
.msg .flag { color: var(--flag); }
/* Suche über alle Ordner */
.sgroup { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px 6px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: var(--bg); border-bottom: 1px solid var(--line); cursor: pointer; position: sticky; top: 0; z-index: 1; }
.sgroup .count { font-size: 12px; }
.srow { display: grid; grid-template-columns: 1fr auto; gap: 1px 8px; padding: 8px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.srow:hover { background: var(--hover); }
.srow .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow .when { font-size: 13px; color: var(--muted); white-space: nowrap; }
.srow .subj { grid-column: 1 / 3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.srow.unseen .who, .srow.unseen .subj { font-weight: 650; }
.smore { padding: 7px 14px 10px; font-size: 13px; color: var(--accent); cursor: pointer; border-bottom: 1px solid var(--line); }
.smore:hover { background: var(--hover); }
.empty { padding: 30px 16px; text-align: center; color: var(--muted); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.pager:empty { display: none; }

/* Lesebereich */
.read-actions { position: sticky; top: 0; z-index: 3; background: var(--surface); padding: 8px 18px; margin: 0; border-bottom: 1px solid var(--line); }
.read-head { padding: 12px 18px 10px; border-bottom: 1px solid var(--line); }
.meta .more-hint { display: none; }
.read-head h1 { font-size: 20px; margin: 0 0 8px; line-height: 1.3; word-break: break-word; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.meta { font-size: 14px; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; }
.meta .k { color: var(--muted); }
.meta .v { word-break: break-word; }
.meta .date { color: var(--muted); }
.atts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.att { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 14px; font-size: 13px; text-decoration: none; color: var(--text); max-width: 100%; }
.att:hover { border-color: var(--accent); }
.att span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.atts .att { padding: 0; gap: 0; overflow: hidden; }
.atts .att > a { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px 4px 10px; color: var(--text); text-decoration: none; min-width: 0; }
.atts .att > a.att-dl { border-left: 1px solid var(--line); padding: 4px 9px; }
.atts .att > a:hover { background: var(--hover); }
.atts .att .ic { width: 15px; height: 15px; color: var(--accent); }
.thread { margin-top: 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.thread summary { padding: 5px 10px; cursor: pointer; color: var(--muted); font-weight: 600; }
.thread[open] { max-height: 30vh; overflow: auto; }
.trow { display: grid; grid-template-columns: 70px 1fr auto; gap: 8px; padding: 5px 10px; border-top: 1px solid var(--line); cursor: pointer; }
.trow:hover { background: var(--hover); }
.trow.current { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); cursor: default; }
.trow.unseen .twho { font-weight: 650; }
.trow .tdate, .trow .tfolder { color: var(--muted); white-space: nowrap; }
.trow .twho { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.banner { margin: 10px 0 0; padding: 7px 10px; border-radius: 6px; background: var(--note); font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mailframe { display: block; width: 100%; border: 0; background: #fff; height: 300px; }
.placeholder { color: var(--muted); text-align: center; padding: 40px 20px; }

/* Dialoge */
dialog { border: 1px solid var(--line); border-radius: 10px; padding: 0; width: min(480px, calc(100vw - 24px)); background: var(--surface); color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog form { padding: 18px; margin: 0; }
dialog h2 { margin: 0 0 14px; font-size: 18px; }
dialog .buttons { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 12px; }
dialog .buttons .left { margin-right: auto; }
.pick { max-height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px; margin-top: 8px; }
.pick div { padding: 7px 10px; cursor: pointer; border-bottom: 1px solid var(--line); }
.pick div:last-child { border-bottom: 0; }
.pick div:hover, .pick div.hl { background: var(--accent-soft); }
.pick .sub { color: var(--muted); font-size: 13px; }
.pick .new { color: var(--accent); }

/* Schreiben */
dialog.compose { width: min(860px, calc(100vw - 24px)); height: min(820px, calc(100vh - 24px)); }
dialog.compose[open] { display: flex; }
dialog.compose form { flex: 1; display: flex; flex-direction: column; gap: 0; min-height: 0; padding-top: 10px; }
.c-head { display: flex; align-items: center; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.c-head h2 { flex: 1; margin: 0; font-size: 17px; text-align: center; }
.c-clip { cursor: pointer; margin: 0; }
.cfield-tools { display: flex; align-items: center; gap: 2px; }
.c-pick { border-color: transparent; background: none; min-width: 32px; padding: 4px 6px; }
.c-pick .ic { width: 18px; height: 18px; }
.krow[data-i] { cursor: pointer; }
.krow[data-i]:hover { background: var(--hover); }
.btn.link { border-color: transparent; background: none; color: var(--accent); padding-left: 4px; padding-right: 4px; }
.cfield { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); min-height: 44px; }
.cfield > span:first-child { color: var(--muted); font-size: 15px; }
.cfield input { width: 100%; border: 0; background: none; padding: 10px 0; outline: none; min-height: 0; }
.cfield input:focus { outline: none; }
.compose .from { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compose textarea { flex: 1; resize: none; width: 100%; min-height: 120px; font: 15px/1.5 system-ui, sans-serif; border: 0; background: none; padding: 12px 0; }
.compose textarea:focus { outline: none; }
.compose .files { padding: 6px 0; }
.compose .files:empty { display: none; }
.compose .check { padding: 6px 0 4px; }
.compose .files { display: flex; flex-wrap: wrap; gap: 6px; }
.compose .files .att button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 0 0 2px; }
.compose.dragover form { outline: 3px dashed var(--accent); outline-offset: -8px; }
.suggest { position: fixed; z-index: 100; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.15); max-height: 260px; overflow: auto; }
.suggest div { padding: 6px 10px; cursor: pointer; white-space: nowrap; }
.suggest div.hl, .suggest div:hover { background: var(--accent-soft); }
.suggest .sub { color: var(--muted); font-size: 13px; margin-left: 6px; }

/* Postkutsche nach dem Senden */
:root { --coach-dark: #5f4126; --coach-body: #8a6a45; }
@media (prefers-color-scheme: dark) { :root { --coach-dark: #c79a62; --coach-body: #8a6a45; } }
.coach-veil { position: fixed; inset: 0; z-index: 250; background: rgba(0,0,0,.28); display: flex; align-items: center; justify-content: center; padding: 16px; }
.coach-panel { position: relative; width: min(800px, 100%); height: min(340px, 60vh); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.coach-road { position: absolute; left: 0; right: 0; bottom: 52px; border-top: 3px dashed var(--line); }
.coach-panel .coach { position: absolute; left: 0; bottom: 47px; width: min(340px, 62%); }
.coach-msg { position: absolute; left: 0; right: 0; top: 40px; text-align: center; font-weight: 650; font-size: clamp(22px, 5vw, 34px); color: var(--accent); }
.coach .cb { fill: var(--coach-body); stroke: var(--coach-dark); stroke-width: 2; }
.coach .cw { fill: #faeeda; }
.coach .cd { fill: var(--coach-dark); }
.coach .cl { fill: #ef9f27; }
.coach .cs, .coach .tail { stroke: var(--coach-dark); fill: none; }
.coach .cs { stroke-width: 2; } .coach .tail { stroke-width: 4; }
.coach .wheel { fill: none; stroke: var(--coach-dark); stroke-width: 3; transform-box: fill-box; transform-origin: center; animation: coach-spin .45s linear infinite; }
.coach .wheel path { stroke-width: 1.5; }
.coach .leg { transform-box: fill-box; transform-origin: top; animation: coach-legs .3s ease-in-out infinite; }
.coach .leg.b { animation-delay: .15s; }
@keyframes coach-spin { to { transform: rotate(360deg); } }
@keyframes coach-legs { 0%, 100% { transform: rotate(14deg); } 50% { transform: rotate(-14deg); } }
.coach-puff { position: absolute; bottom: 50px; width: 22px; height: 22px; border-radius: 50%; background: var(--line); }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 200; max-width: calc(100vw - 32px); display: flex; gap: 12px; align-items: center; }
#toast.show { opacity: 1; pointer-events: auto; }
#toast.err { background: var(--danger); color: #fff; }
#toast button { background: none; border: 1px solid currentColor; color: inherit; border-radius: 5px; padding: 2px 8px; cursor: pointer; }

/* Mittelgroß: Ordnerspalte schmaler */
@media (max-width: 1100px) {
  .panes { grid-template-columns: 190px minmax(260px, 340px) 1fr 250px; }
  body.no-agenda .panes { grid-template-columns: 190px minmax(260px, 340px) 1fr; }
  .brand-sub { display: none; }
}
/* Handy: immer nur eine Spalte */
@media (max-width: 760px) {
  .only-mobile { display: inline-flex; }
  /* iPhone zoomt bei Feldern unter 16 px automatisch hinein */
  input, select, textarea, .compose textarea { font-size: 16px; }
  html, body { overflow-x: hidden; }
  .hide-narrow, .brand { display: none; }
  /* Neue Mails kommen von selbst – „Aktualisieren“ braucht auf dem Handy keinen Platz */
  #refreshBtn { display: none; }
  #agendaBtn { margin-left: auto; }
  /* Termine: gesucht wird über das große Suchfeld oben */
  .ag-search { display: none; }
  .topbar .btn.icon { min-width: 40px; padding: 7px 8px; }
  .topbar { padding: calc(env(safe-area-inset-top) + 6px) 8px 6px; gap: 6px; }
  #shell { padding-bottom: env(safe-area-inset-bottom); }
  .panes { display: block; position: relative; }
  .pane { position: absolute; inset: 0; border: 0; display: none !important; }
  .panes[data-view=folders] #folders { display: block !important; }
  .panes[data-view=list] #listPane { display: flex !important; }
  .panes[data-view=read] #readPane, .panes[data-view=agenda] #agenda { display: block !important; }
  .cd { padding: 9px 0 11px; font-size: 14px; }
  .ag-item { font-size: 15px; padding: 9px 10px; }
  .folder { padding: 9px 10px; }
  .folder .more { visibility: visible; }
  .read-head { padding: 8px 12px; }
  .read-head h1 { font-size: 17px; margin-bottom: 4px; }
  /* Handy: Symbol mit kurzem Wort darunter, alle Knöpfe in einer Zeile */
  .read-actions { padding: 4px 2px; flex-wrap: nowrap; gap: 0; }
  .read-actions .btn.tb { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 2px; padding: 5px 0 4px; border: 0; background: none; font-size: 11px; color: var(--text); }
  .read-actions .btn.tb .ic { width: 24px; height: 24px; }
  .read-actions .btn.tb .lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: 10.5px; letter-spacing: -.1px; }
  .read-actions .btn.tb.danger { color: var(--danger); }
  .read-actions .btn.tb:active { background: var(--accent-soft); }
  .read-actions .desk { display: none; }
  .topbar .btn .ic { width: 22px; height: 22px; }
  .meta { font-size: 13px; cursor: pointer; }
  .meta .extra { display: none; }
  .meta.show-extra .extra { display: block; }
  .meta .more-hint { display: block; grid-column: 1 / 3; color: var(--accent); font-size: 12px; }
  .meta.show-extra .more-hint { visibility: hidden; height: 0; }
  .atts { margin-top: 6px; }
  /* Schreiben füllt den ganzen Bildschirm, Statusleiste und Home-Balken bleiben frei */
  dialog.compose { position: fixed; inset: 0 auto auto 0; margin: 0; width: 100vw; height: 100dvh; max-width: 100vw; max-height: none; border: 0; border-radius: 0; }
  dialog.compose form { padding: calc(env(safe-area-inset-top) + 6px) 14px calc(env(safe-area-inset-bottom) + 6px); }
  .c-head .btn.primary { padding: 7px 14px; }
}
