/* ============================================================
   Webmail niklas-bambor.de, Komponenten im Design "Terminal / Network-Ops".
   Tokens, .card, .btn, .eyebrow, .reveal, .list-dots usw. kommen aus global.css (unverändert).
   Diese Datei enthält:
   1) Header, Footer, Drawer   (exakt aus DESIGN.md Anhang B)
   2) Terminal-Fenster          (exakt aus DESIGN.md Anhang C)
   3) App-Komponenten, gebaut nur aus den Tokens (Kap. 2) und den Radien/Schatten aus Kap. 2.2
   ============================================================ */

/* ---------- 1) Header, Footer, Navigation (Anhang B) ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  backdrop-filter: blur(12px);
  background: rgba(11, 14, 20, 0.82);
  border-bottom: 1px solid var(--line);
}
.nav {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  font-size: 0.92rem;
  color: var(--text-bright);
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
}
.brand:hover { text-decoration: none; }
.brand__prompt { color: var(--green); }
.brand__sep, .brand__dollar { color: var(--muted); }
.brand__path { color: var(--cyan); }
.brand__cursor {
  width: 8px;
  height: 1.05em;
  margin-left: 5px;
  background: var(--amber);
  align-self: center;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.menu {
  display: flex;
  align-items: center;
  gap: 26px;
}
.menu a, .menu button.linklike {
  color: var(--text);
  font-size: 0.95rem;
  position: relative;
}
.menu a:hover, .menu button.linklike:hover { color: var(--text-bright); text-decoration: none; }
.menu a:not(.lang)::after, .menu button.linklike::after {
  content: "";
  position: absolute;
  left: 0; bottom: -6px;
  width: 100%;
  height: 2px;
  background: var(--amber);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.22s ease;
}
.menu a:not(.lang):hover::after, .menu button.linklike:hover::after,
.menu a[aria-current="page"]::after { transform: scaleX(1); }
.menu a[aria-current="page"] { color: var(--text-bright); }

.lang { color: var(--amber) !important; font-size: 0.85rem; }
.lang__bracket { color: var(--muted); }
.lang:hover .lang__bracket { color: var(--amber); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line-bright);
  border-radius: 8px;
  width: 42px; height: 38px;
  cursor: pointer;
  position: relative;
}
.nav-toggle__bar,
.nav-toggle__bar::before,
.nav-toggle__bar::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px;
  height: 2px;
  background: var(--text);
  transition: transform 0.2s;
}
.nav-toggle__bar { top: 50%; }
.nav-toggle__bar::before { top: -6px; left: 0; right: 0; }
.nav-toggle__bar::after { top: 6px; left: 0; right: 0; }

.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 40;
}
.nav-overlay[hidden] { display: none; }

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .menu {
    position: fixed;
    top: 0; right: 0;
    height: 100dvh;
    width: min(300px, 82vw);
    flex-direction: column;
    align-items: flex-start;
    padding: 90px 28px;
    gap: 22px;
    background: var(--surface);
    border-left: 1px solid var(--line);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 45;
  }
  .menu[data-open] { transform: none; }
}

.footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  margin-top: 40px;
}
.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.82rem;
}
.footer__copy { color: var(--muted); }
.footer__links { display: flex; gap: 22px; }
.footer__links a { color: var(--muted); }
.footer__links a:hover { color: var(--amber); text-decoration: none; }

/* ---------- 2) Terminal-Fenster (Anhang C, soweit statisch benötigt) ---------- */
.nbt {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  background: #0d1117;
  border: 1px solid var(--line-bright);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--text);
  overflow: hidden;
  transition: border-color 0.2s;
}
.nbt:focus-within { border-color: rgba(255, 180, 84, 0.55); }
.nbt__bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  cursor: default;
}
.nbt__dot { width: 11px; height: 11px; border-radius: 50%; }
.nbt__dot--r { background: #f26d78; }
.nbt__dot--y { background: var(--amber); }
.nbt__dot--g { background: var(--green); }
.nbt__title { margin-left: 10px; font-size: 0.72rem; color: var(--muted); flex: 1; }
.nbt__screen { padding: 14px 18px; }
.nbt__row { white-space: pre-wrap; word-break: break-word; }
.nbt__row--out { color: var(--muted); }
.nbt__row--cmd { color: var(--text-bright); }
.nbt__row--ok { color: var(--green); }
.nbt__row--err { color: var(--red); }
.nbt-g { color: var(--green); }
.nbt-m { color: var(--muted); }
.nbt-c { color: var(--cyan); }

/* ---------- 3) App-Bausteine ---------- */
.section-head { margin-bottom: 34px; }
.section-head h1, .section-head h2 { margin-bottom: 0; }
.section-head .lead { color: var(--muted); font-size: 1.18rem; max-width: 46ch; margin: 14px 0 0; }
.page { padding: 56px 0 24px; }
.page--narrow { max-width: 620px; margin-inline: auto; }
.page--wide .container { max-width: var(--container); }
.stack > * + * { margin-top: 18px; }
.muted { color: var(--muted); }
.bright { color: var(--text-bright); }
.green { color: var(--green); }
.red { color: var(--red); }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }
.label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Panel: Formularflächen ohne Orbit (Rezept 9.1, bewusst rgba(16,20,28,.7) mit 12px) */
.panel {
  background: rgba(16, 20, 28, 0.7);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 22px;
}
.panel + .panel { margin-top: 18px; }
.panel h2, .panel h3 { margin-bottom: 8px; }
.panel .meta, .panel p.muted { margin-top: 0; }

/* Hinweise: Statusfarbe als Balken wie die eigene Zeile in den Standings */
.note {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 16px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 20, 28, 0.7);
  box-shadow: inset 2px 0 0 var(--cyan);
  font-size: 0.95rem;
}
.note--ok { box-shadow: inset 2px 0 0 var(--green); }
.note--err { box-shadow: inset 2px 0 0 var(--red); }
.note--warn { box-shadow: inset 2px 0 0 var(--amber); }
.note__text { flex: 1; min-width: 0; }
.flashes { padding-top: 18px; }
.flashes .note { margin-bottom: 10px; }

/* Formulare */
.field { display: grid; gap: 7px; margin-bottom: 18px; }
.field > label, .field > .label { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }
.field .hint { font-size: 0.82rem; color: var(--muted); }
.input, .select, .textarea {
  width: 100%;
  background: #0d1117;
  border: 1px solid var(--line-bright);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.5;
  transition: border-color 0.2s;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--muted); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--amber); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: 0.8; }
.textarea { min-height: 280px; resize: vertical; line-height: 1.65; }
.textarea--sm { min-height: 110px; }
.select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%237d8899' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.select--sm { padding: 6px 30px 6px 12px; font-size: 0.8rem; width: auto; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--amber); margin: 0; }
input[type="file"].input { padding: 8px 10px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 0.95rem; color: var(--text); }
.suffix { display: flex; align-items: stretch; }
.suffix .input { border-top-right-radius: 0; border-bottom-right-radius: 0; min-width: 0; }
.suffix__tail {
  display: grid; place-items: center; padding: 0 12px;
  border: 1px solid var(--line-bright); border-left: 0; border-radius: 0 8px 8px 0;
  background: var(--surface); color: var(--muted); font-family: var(--font-mono); font-size: 0.82rem; white-space: nowrap;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
button.btn { font-family: var(--font-mono); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }
button.linklike { background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit; }

/* Status: Interface-Zeile wie die Skill-Karte (Dot + Name + up/up) */
.iface { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--muted); }
.dot--ok { background: var(--green); box-shadow: 0 0 8px rgba(127, 217, 98, 0.7); animation: pulse 2.6s ease-in-out infinite; }
.dot--err { background: var(--red); box-shadow: 0 0 8px rgba(242, 109, 120, 0.7); }
.dot--warn { background: var(--amber); box-shadow: 0 0 8px rgba(255, 180, 84, 0.7); }
.up { color: var(--green); } .down { color: var(--red); } .warn { color: var(--amber); }
.tag {
  display: inline-block; font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted);
  border: 1px solid var(--line-bright); border-radius: 999px; padding: 1px 10px; margin: 0 6px 6px 0; white-space: nowrap;
}
.secret {
  display: flex; gap: 12px; align-items: center; padding: 14px 16px; margin-bottom: 18px;
  border: 1px solid rgba(255, 180, 84, 0.45); border-radius: 8px; background: var(--amber-dim);
  font-family: var(--font-mono); font-size: 1.05rem; color: var(--text-bright); overflow-wrap: anywhere;
}
.secret .btn { margin-left: auto; }

/* Kennzahlen (Karten) */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.stat .label { display: block; margin-bottom: 10px; }
.stat__num { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.6rem, 2.5vw, 2.15rem); line-height: 1; color: var(--text-bright); font-variant-numeric: tabular-nums; }
.stat:hover { transform: none; }

/* Tabellen */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: rgba(16, 20, 28, 0.7); }
.tbl { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.tbl th {
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line-bright); white-space: nowrap;
}
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface); }
.tbl .r { text-align: right; } .tbl .c { text-align: center; }
.tbl .mono { font-family: var(--font-mono); font-size: 0.85rem; }
.tbl td .meta { display: block; margin-top: 2px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 26px; margin: 0; }
.kv dt { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); padding-top: 3px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.drop { border: 1px dashed var(--line-bright); border-radius: 12px; padding: 20px 22px; margin-top: 34px; }
.drop h2 { font-size: 1.12rem; margin-bottom: 10px; }

/* ---------- Anmeldung: Terminal-Fenster ---------- */
.login { max-width: 520px; margin: 0 auto; }
.nbt__screen--form { padding: 22px 22px 24px; }
.nbt__screen--form .field > label { color: var(--muted); }
.nbt__screen--form .field > label::before { content: "> "; color: var(--amber); }
.login__foot { display: flex; justify-content: space-between; gap: 16px; margin-top: 18px; font-family: var(--font-mono); font-size: 0.8rem; }
.login__foot a { color: var(--muted); }
.login__foot a:hover { color: var(--amber); text-decoration: none; }

/* ---------- Fehlerseite wie 404 ---------- */
.errwrap { min-height: calc(100dvh - var(--hdr) - 120px); display: grid; align-content: center; justify-items: center; gap: 28px; padding: 40px 0; text-align: center; }
.errwrap .nbt { max-width: 640px; text-align: left; }
.errwrap__msg { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; color: var(--text-bright); margin: 0; }
.errwrap .actions { justify-content: center; }

/* ---------- Postfach ---------- */
.app { padding: 18px 0 18px; }
.mailwin {
  display: grid;
  grid-template-columns: 224px 392px minmax(0, 1fr);
  height: calc(100dvh - var(--hdr) - 36px);
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(16, 20, 28, 0.7);
  overflow: hidden;
}
.pane { min-height: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line-bright) transparent; }

.folders { background: var(--surface); border-right: 1px solid var(--line); padding: 16px 0 12px; }
.folders__compose { padding: 0 14px 16px; }
.folders__compose .btn { width: 100%; justify-content: center; }
.folders__head { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; padding: 0 16px 8px; }
.folders__head span { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.folders__head span:nth-child(n + 2) { text-align: right; min-width: 3ch; }
.flist { list-style: none; margin: 0; padding: 0; }
.folder {
  display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: baseline;
  padding: 7px 16px; color: var(--text); font-size: 0.95rem;
}
.folder:hover { background: var(--surface-2); text-decoration: none; color: var(--text-bright); }
.folder[aria-current="page"] { background: rgba(255, 180, 84, 0.09); box-shadow: inset 2px 0 0 var(--amber); color: var(--text-bright); }
.folder__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder__new { font-family: var(--font-mono); font-size: 0.78rem; color: var(--amber); min-width: 3ch; text-align: right; }
.folder__all { font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted); min-width: 3ch; text-align: right; }
.folder--d1 { padding-left: 30px; } .folder--d2 { padding-left: 44px; } .folder--d3 { padding-left: 58px; }
.folder--sub .folder__name { color: var(--muted); }
.folder-label { padding: 7px 16px; font-size: 0.95rem; color: var(--muted); }
.folders__user { margin: 16px 16px 0; padding-top: 12px; border-top: 1px solid var(--line); font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); overflow-wrap: anywhere; }

.listpane { display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--bg); }
.listbar {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 12px; min-height: 48px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.listbar__all { display: grid; place-items: center; width: 24px; height: 24px; }
.filters { display: flex; gap: 2px; }
.filters a { font-family: var(--font-mono); font-size: 0.78rem; padding: 4px 9px; border-radius: 6px; color: var(--muted); }
.filters a:hover { color: var(--text-bright); text-decoration: none; }
.filters a[aria-current="true"] { color: var(--amber); background: var(--amber-dim); }
.listbar__count { margin-left: auto; font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted); white-space: nowrap; }
.bulk { display: none; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1; }
.listbar.has-sel .bulk { display: flex; }
.listbar.has-sel .filters { display: none; }
.folders-btn { display: none; }

.rows { list-style: none; margin: 0; padding: 0; flex: 1; }
.row { display: grid; grid-template-columns: 34px minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.row__chk { display: grid; place-items: center; cursor: pointer; position: relative; }
.row__main { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 10px; padding: 10px 14px 10px 0; color: var(--muted); }
.row__main:hover { text-decoration: none; }
.row:hover { background: var(--surface); }
.row.is-selected { background: rgba(255, 180, 84, 0.09); box-shadow: inset 2px 0 0 var(--amber); }
.row__who { font-weight: 600; font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.row__when { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); align-self: center; white-space: nowrap; }
.row__subj { grid-column: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; }
.row__marks { grid-column: 2; display: flex; gap: 6px; justify-content: flex-end; align-items: center; font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); }
.row__marks .star { color: var(--amber); }
.row.is-unread .row__who, .row.is-unread .row__subj { color: var(--text-bright); }
.row.is-unread .row__who { font-weight: 700; }
.row.is-unread .row__chk::after { content: ""; position: absolute; left: 4px; top: 50%; width: 7px; height: 7px; margin-top: -3px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 8px rgba(255, 180, 84, 0.6); }
.empty { padding: 36px 22px; }
.empty h3 { font-size: 1.02rem; margin-bottom: 6px; }
.empty p { color: var(--muted); font-size: 0.95rem; }
.empty pre { margin: 12px 0 0; font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); }
.pager { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; background: var(--surface); border-top: 1px solid var(--line); font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted); }
.pager .btn[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }

.reader { display: flex; flex-direction: column; background: var(--bg); }
.reader--blank { display: grid; place-items: center; padding: 24px; }
.reader--blank pre { margin: 0; font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.9; color: var(--muted); }
.kbd { font-family: var(--font-mono); font-size: 0.74rem; color: var(--text); border: 1px solid var(--line-bright); border-radius: 6px; padding: 0 7px; }
.rhead { padding: 22px 26px 16px; border-bottom: 1px solid var(--line); }
.rhead h1 { font-size: 1.45rem; letter-spacing: -0.01em; margin-bottom: 14px; overflow-wrap: anywhere; }
.meta-list { display: grid; grid-template-columns: max-content 1fr; gap: 3px 16px; margin: 0 0 16px; font-size: 0.92rem; }
.meta-list dt { font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted); padding-top: 3px; }
.meta-list dd { margin: 0; overflow-wrap: anywhere; }
.rtools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.rtools .sep { width: 1px; height: 22px; background: var(--line-bright); margin: 0 4px; }
.btn--on { border-color: var(--amber); color: var(--amber); }
.back-btn { display: none; }
.attach { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 26px; border-bottom: 1px solid var(--line); background: var(--surface); }
.attach .btn { max-width: 100%; }
.attach .btn span.nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.attach .btn .sz { color: var(--muted); }
.reader .note { margin: 16px 26px 0; }
.frame { padding: 16px 26px 28px; flex: 1; }
.frame iframe { display: block; width: 100%; min-height: 320px; border: 1px solid var(--line); border-radius: var(--radius); background: #0d1117; }

/* ---------- Schreiben ---------- */
.compose .frow { display: grid; grid-template-columns: 76px 1fr; gap: 12px; align-items: center; margin-bottom: 12px; }
.compose .frow > label { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }
.compose .toggles { margin: -4px 0 12px 88px; display: flex; gap: 14px; font-family: var(--font-mono); font-size: 0.8rem; }
.compose .toggles button { color: var(--cyan); font-size: inherit; }
.compose .toggles button:hover { text-decoration: underline; }
.fwdlist { list-style: none; margin: 8px 0 0; padding: 0; font-size: 0.88rem; color: var(--muted); }

/* ---------- schmale Bildschirme ---------- */
@media (max-width: 1180px) { .mailwin { grid-template-columns: 200px 340px minmax(0, 1fr); } }
@media (max-width: 920px) {
  .nbt__screen--form { padding: 18px; }
  .input, .select, .textarea { font-size: 16px; }
  .select--sm { font-size: 16px; }
}
@media (max-width: 900px) {
  .app { padding: 0; }
  .app .container { padding-inline: 0; }
  .mailwin { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - var(--hdr)); border-radius: 0; border-inline: 0; }
  .folders {
    position: fixed; inset: var(--hdr) auto 0 0; width: min(300px, 82vw); z-index: 45; padding-top: 18px;
    transform: translateX(-102%); transition: transform 0.25s ease; border-right: 1px solid var(--line-bright);
  }
  body.drawer-folders .folders { transform: none; }
  .listpane { border-right: 0; }
  .mailwin.reading .listpane { display: none; }
  .mailwin:not(.reading) .reader { display: none; }
  .folders-btn, .back-btn { display: inline-flex; }
  .rhead, .attach, .frame { padding-inline: 16px; }
  .reader .note { margin-inline: 16px; }
}
@media (max-width: 760px) {
  .row2 { grid-template-columns: 1fr; }
  .compose .frow { grid-template-columns: 1fr; gap: 4px; }
  .compose .toggles { margin-left: 0; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 10px; }
  .page { padding-top: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .brand__cursor, .dot--ok { animation: none !important; }
  .folders, .menu { transition: none; }
}

/* kleine Abstands-Helfer (statt Inline-Styles, wegen CSP) */
.stack--top, .kv--top { margin-top: 14px; }
.grid2--gap { margin-top: 22px; }

/* ---------- Korrekturen nach dem Screenshot-Check ---------- */
/* <button> bekommt sonst den Browser-Hintergrund; Primary bleibt Amber (global.css) */
.btn--ghost { background: transparent; }
/* Checkbox und Radio im Stil der Eingabefelder (nur Tokens) */
input[type="checkbox"], input[type="radio"] {
  appearance: none; -webkit-appearance: none; flex: none; cursor: pointer;
  width: 16px; height: 16px; margin: 0; background: #0d1117; border: 1px solid var(--line-bright); border-radius: 4px;
  display: inline-grid; place-content: center; transition: border-color 0.2s, background 0.2s;
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:hover, input[type="radio"]:hover { border-color: var(--muted); }
input[type="checkbox"]:checked, input[type="radio"]:checked { background: var(--amber); border-color: var(--amber); }
input[type="checkbox"]:checked::after {
  content: ""; width: 9px; height: 5px; margin-top: -2px; border-left: 2px solid #10141c; border-bottom: 2px solid #10141c; transform: rotate(-45deg);
}
input[type="radio"]:checked::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #10141c; }
input[type="checkbox"]:indeterminate { background: var(--amber); border-color: var(--amber); }
input[type="checkbox"]:indeterminate::after { content: ""; width: 8px; height: 2px; background: #10141c; }
input[type="checkbox"]:disabled { opacity: 0.55; cursor: not-allowed; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline-offset: 0; }
/* Suche in einer Zeile */
.listbar--search { gap: 10px; flex-wrap: nowrap; }
.listbar--search label { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.listbar--search .input { flex: 1; min-width: 0; padding: 6px 10px; font-size: 0.85rem; }
/* Zeilen: Platz für Ungelesen-Punkt links vom Kontrollkästchen */
.row { grid-template-columns: 42px minmax(0, 1fr); }
.row__chk { padding-left: 8px; }
.row.is-unread .row__chk::after { left: 7px; margin-top: -3px; }
.row .row__chk input { margin-left: 4px; }

/* ---------- Postfach über die volle Breite (nur Desktop; Mobil bleibt wie bisher) ---------- */
@media (min-width: 901px) {
  .app-wide .container { max-width: none; padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px)); }
  .app-wide .mailwin { grid-template-columns: clamp(220px, 13vw, 300px) clamp(380px, 25vw, 560px) minmax(0, 1fr); }
}

/* ---------- Korrekturen Einstellungen ---------- */
/* Zwei Spalten dürfen sich nicht gegenseitig strecken (Auswahlfeld wurde so hoch wie der Hinweistext der Nachbarspalte) */
.row2 { align-items: start; }
/* Panel-Titel eine Stufe unter dem Seitentitel */
.panel > h2, .drop > h2 { font-size: 1.3rem; letter-spacing: -0.01em; margin-bottom: 16px; }
.panel .field:last-child { margin-bottom: 0; }
.panel form .actions, .panel > .btn { margin-top: 4px; }
.panel .field--after { margin-top: 22px; }

/* Anmeldefeld: Domain-Zusatz verschwindet, sobald ein @ getippt (oder von einem Passwortmanager eingefügt) wird */
.suffix__tail[hidden] { display: none; }
.suffix--full .input { border-radius: 8px; }

/* ---------- Mehrere Konten in der Seitenleiste (wie bei Outlook) ---------- */
.acct { border-bottom: 1px solid var(--line); }
.acct:last-of-type { border-bottom: 0; }
.acct__head {
  display: flex; align-items: baseline; gap: 10px; padding: 10px 16px; cursor: pointer; list-style: none;
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-bright); background: var(--surface-2);
}
.acct__head::-webkit-details-marker { display: none; }
.acct__head::before { content: "▸"; color: var(--amber); font-size: 0.8rem; transition: transform 0.2s; }
.acct[open] > .acct__head::before { transform: rotate(90deg); }
.acct__head:hover { color: var(--amber); }
.acct__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct__tag { margin-left: 8px; font-size: 0.68rem; color: var(--muted); border: 1px solid var(--line-bright); border-radius: 999px; padding: 0 8px; }
.acct__err { margin: 0; padding: 8px 16px 12px; font-size: 0.85rem; color: var(--red); }
.acct .flist { padding: 4px 0 8px; }
@media (prefers-reduced-motion: reduce) { .acct__head::before { transition: none; } }

/* ============================================================
   Handy und Tablet
   ============================================================ */
:root {
  color-scheme: dark;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --hdr: calc(var(--header-h) + var(--safe-top));
}
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: rgba(255, 180, 84, 0.15); }
a, button, summary, label, select, input { touch-action: manipulation; }
/* Kopfzeile und Seitenrand: iPhone-Notch und Home-Indikator (in der installierten App) */
.topbar { height: var(--hdr); padding-top: var(--safe-top); }
.container { padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); }
.footer { padding-bottom: calc(28px + var(--safe-bottom)); }
.fab, .refresh-btn { display: none; }
.rtools__toggle { display: none; }

@media (max-width: 920px) {
  /* iOS zoomt in Felder unter 16 px hinein */
  .listbar--search .input { font-size: 16px; }
}

@media (max-width: 900px) {
  /* Menü: nur sichtbar = erreichbar. Unsichtbar geparkt erzeugte es 300 px seitlichen Überlauf und war per Tab anspringbar. */
  .menu { padding-top: calc(90px + var(--safe-top)); padding-bottom: calc(24px + var(--safe-bottom)); overflow-y: auto; }
  /* Geschlossen: display:none. Ein nur seitlich verschobenes festes Element macht Chrome auf dem Handy 300 px breiter
     (die Seite wird kleiner dargestellt); overflow-x auf body würde die klebende Kopfzeile zerstören. Getestet. */
  .menu:not([data-open]) { display: none; }
  .menu[data-open] { animation: drawer-in-right 0.25s ease; }
  .menu a, .menu button.linklike { padding: 8px 0; font-size: 1.02rem; }
  .menu a:not(.lang)::after, .menu button.linklike::after { bottom: 2px; }
  .nav-toggle { width: 44px; height: 44px; flex: none; }
  /* Marke einzeilig: der Pfad wird gekürzt, Prompt und Cursor bleiben */
  .brand { display: flex; min-width: 0; max-width: calc(100vw - 96px); align-items: baseline; }
  .brand__prompt, .brand__sep, .brand__dollar, .brand__cursor { flex: none; }
  .brand__path { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Ordnerleiste */
  .folders { padding-bottom: calc(24px + var(--safe-bottom)); }
  body:not(.drawer-folders) .folders { display: none; }
  body.drawer-folders .folders { animation: drawer-in-left 0.25s ease; }
  .folders__compose .btn { min-height: 46px; }

  /* Liste */
  .refresh-btn { display: inline-flex; min-width: 40px; justify-content: center; }
  .listbar__count { margin-left: auto; }
  .row { grid-template-columns: 46px minmax(0, 1fr); }
  .row__main { padding-block: 12px; }
  .pager { padding-bottom: calc(8px + var(--safe-bottom)); }
  .mailwin:not(.reading) + .fab {
    display: grid; place-items: center; position: fixed; z-index: 30; width: 56px; height: 56px; border-radius: 50%;
    right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(76px + var(--safe-bottom));
    background: var(--amber); color: #10141c; font: 600 30px/1 var(--font-mono); box-shadow: 0 6px 22px rgba(255, 180, 84, 0.35);
  }
  .fab:hover { text-decoration: none; }

  /* Mehrfachauswahl: Aktionsleiste unten statt vier Zeilen oben */
  .listbar.has-sel .bulk {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; overflow-x: auto;
    padding: 10px 12px calc(10px + var(--safe-bottom)); background: var(--surface); border-top: 1px solid var(--line-bright);
  }
  .bulk > * { flex: none; }
  .bulk .btn, .bulk .select { min-height: 44px; }
  body.has-sel .fab { display: none; }

  /* Lesen: Zurück-Knopf oben, Aktionen als Leiste unten, der Rest klappt auf */
  .back-btn { margin-bottom: 12px; min-height: 40px; }
  .rhead { padding-top: 16px; }
  .rhead h1 { font-size: 1.3rem; }
  .reader { padding-bottom: calc(84px + var(--safe-bottom)); }
  .rtools {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; margin: 0; display: flex; flex-wrap: wrap-reverse; gap: 8px;
    padding: 10px 12px calc(10px + var(--safe-bottom)); background: var(--surface); border-top: 1px solid var(--line-bright);
  }
  .rtools .btn, .rtools .select { min-height: 44px; }
  .rtools .m-bar { order: 0; flex: 1 1 0; min-width: 0; justify-content: center; padding-inline: 4px; font-size: 0.76rem; }
  .rtools .rtools__toggle { order: 1; display: inline-flex; flex: 0 0 52px; justify-content: center; padding-inline: 0; font-size: 1.1rem; }
  .rtools .sep { order: 2; flex-basis: 100%; height: 0; margin: 0; width: auto; display: none; }
  .rtools .m-more { order: 3; display: none; }
  .rtools--open .sep { display: block; }
  .rtools--open .m-more { display: inline-flex; flex: 1 1 calc(50% - 4px); justify-content: center; }
  .rtools--open .select.m-more { display: block; flex-basis: 100%; }
}

/* Berührung: großzügige Tippflächen (mindestens 40 bis 44 px) */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn--sm { min-height: 40px; padding: 8px 14px; }
  .select--sm { min-height: 40px; }
  .folder { padding-block: 11px; }
  .acct__head { padding-block: 13px; }
  .filters a { padding: 10px 12px; }
  .row__chk { min-width: 46px; }
  input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; }
  .check { min-height: 40px; }
  .tbl td, .tbl th { padding-block: 14px; }
  .footer__links a { padding: 8px 0; }
}

@media (max-width: 760px) {
  /* Schreiben: das Formular zuerst, Senden-Leiste bleibt am unteren Rand */
  .page { padding-top: 20px; }
  .section-head--compact { margin-bottom: 14px; }
  .section-head--compact h1 { font-size: 1.6rem; }
  .section-head--compact .lead, .section-head--compact .eyebrow { display: none; }
  .compose .textarea { min-height: 36dvh; }
  .compose .actions {
    position: sticky; bottom: 0; z-index: 10; margin: 18px -22px -20px; padding: 12px 22px calc(12px + var(--safe-bottom));
    background: var(--surface); border-top: 1px solid var(--line-bright); border-radius: 0 0 12px 12px;
  }
  .compose .actions .btn { flex: 1 1 auto; justify-content: center; min-height: 46px; }
  .compose .actions .btn--primary { flex: 2 1 auto; }

  /* Tabellen als Karten stapeln statt seitlich aus dem Bild zu laufen */
  .tbl--stack thead { display: none; }
  .tbl--stack, .tbl--stack tbody { display: block; }
  .tbl--stack tr { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .tbl--stack tr:last-child { border-bottom: 0; }
  .tbl--stack td { display: block; padding: 0; border: 0; text-align: left !important; }
  .tbl--stack td:first-child { grid-column: 1 / -1; overflow-wrap: anywhere; }
  .tbl--stack td[data-label]::before { content: attr(data-label); display: block; font: 0.68rem var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
  .tbl--stack tbody tr:hover td { background: transparent; }
  /* Matrizen bleiben breit und scrollen, die erste Spalte bleibt stehen */
  .tbl--matrix td:first-child, .tbl--matrix th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
  .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .secret { flex-wrap: wrap; }
  .actions .btn { min-height: 46px; }
}

/* Querformat am Handy: wenig Höhe */
@media (max-height: 480px) and (orientation: landscape) {
  .page { padding-top: 16px; }
  .section-head { margin-bottom: 18px; }
  .rtools .btn, .rtools .select, .bulk .btn, .bulk .select { min-height: 40px; }
  .reader { padding-bottom: calc(70px + var(--safe-bottom)); }
}
@keyframes drawer-in-right { from { transform: translateX(100%); } to { transform: none; } }
@keyframes drawer-in-left { from { transform: translateX(-100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .menu, .folders { transition: none !important; animation: none !important; } }

/* ---------- Handy: Feinschliff nach dem Test ---------- */
@media (max-width: 900px) {
  /* Die Ordnerleiste lag im Stapelkontext von .container (z-index 1) und wurde vom Overlay abgedunkelt */
  .app .container { z-index: auto; }
  /* Schreiben-Knopf verschwindet, sobald die Auswahlleiste erscheint (höhere Spezifität nötig) */
  body.has-sel .mailwin:not(.reading) + .fab { display: none; }
  /* Auswahlleiste: wichtigste Aktion zuerst, kurze Beschriftung */
  .bulk__word { display: none; }
  .bulk [data-act="trash"], .bulk [data-act="delete"] { order: -2; }
  .bulk [data-act="seen"] { order: -1; }
  /* Mehr-Menü beim Lesen: von oben nach unten in der Reihenfolge der Vorlage */
  .rtools a.m-more[href*="/message/source"] { order: 3; }
  .rtools .select.m-more { order: 4; }
  .rtools .m-more[data-act="unseen"] { order: 5; }
  .rtools .m-more[data-act="flag"], .rtools .m-more[data-act="unflag"] { order: 6; }
  .rtools .m-more[data-key="a"] { order: 7; }
  .rtools .m-more[data-act="spam"], .rtools .m-more[data-act="notspam"] { order: 8; }
}
@media (max-width: 760px) {
  /* Schreiben: Senden, Entwurf und Verwerfen in einer Zeile */
  .compose .actions { flex-wrap: nowrap; gap: 8px; }
  .compose .actions .btn { font-size: 0.8rem; padding-inline: 8px; white-space: nowrap; min-width: 0; }
  .compose .actions .btn--primary { flex: 1.2 1 0; }
  .compose .actions .btn--ghost { flex: 1 1 0; }
}
@media (max-width: 370px) { .compose .actions { flex-wrap: wrap; } }

@media (max-width: 900px) { .frame iframe { min-height: 160px; } }

.t-short { display: none; }
@media (max-width: 760px) { .t-long { display: none; } .t-short { display: inline; } }

/* Kontoname wird gekürzt, das Etikett "freigegeben" bleibt vollständig */
.acct__name { display: flex; align-items: baseline; min-width: 0; }
.acct__addr { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct__tag { flex: none; }


/* ============================================================
   Suche, Unterhaltungen, Filterregeln, Ordner, Adressvorschläge
   ============================================================ */
.search { padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.search__row { display: flex; align-items: center; gap: 10px; }
.search__row label { font-family: var(--font-mono); font-size: 0.8rem; white-space: nowrap; }
.search__row .input { flex: 1; min-width: 0; padding: 6px 10px; font-size: 0.85rem; }
.adv__sum { cursor: pointer; list-style: none; padding: 8px 0 2px; font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted); }
.adv__sum::-webkit-details-marker { display: none; }
.adv__sum::before { content: "▸ "; color: var(--amber); }
.adv[open] > .adv__sum::before { content: "▾ "; }
.adv__sum:hover { color: var(--amber); }
.adv__on { color: var(--amber); }
.adv__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin: 10px 0 12px; }
.adv .field { margin-bottom: 0; }
.adv .field > label { font-size: 0.7rem; }
.adv .check { margin-bottom: 6px; font-size: 0.88rem; }
.adv__actions { display: flex; gap: 8px; margin-top: 10px; }
@media (max-width: 920px) { .search__row .input { font-size: 16px; } .adv .input { font-size: 16px; } }

.row__count { display: inline-block; margin-left: 6px; padding: 0 7px; font-family: var(--font-mono); font-size: 0.68rem; font-weight: 400; color: var(--muted); border: 1px solid var(--line-bright); border-radius: 999px; vertical-align: 1px; }
.row__folder { font-family: var(--font-mono); font-size: 0.68rem; color: var(--muted); margin-right: auto; padding-right: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 12em; }
.row__marks { min-width: 0; }

.thread-count { margin: 0 0 14px; font-size: 0.78rem; }
.tmsgs { display: grid; gap: 12px; padding: 16px 26px 28px; }
.tmsg { border: 1px solid var(--line); border-radius: 12px; background: rgba(16, 20, 28, 0.7); overflow: hidden; }
.tmsg.is-new { box-shadow: inset 2px 0 0 var(--amber); }
.tmsg__head { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: baseline; padding: 14px 18px 8px; }
.tmsg__meta { grid-column: 1 / -1; margin: 0; font-size: 0.86rem; }
.tmsg__acts { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.tmsg .attach { padding: 8px 18px; background: transparent; border-top: 1px solid var(--line); border-bottom: 0; }
.tmsg .note { margin: 8px 18px 0; }
.tmsg .frame { padding: 10px 18px 18px; }
.tmsg__collapsed { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: baseline; padding: 12px 18px; color: var(--text); font-size: 0.95rem; }
.tmsg__collapsed:hover { background: var(--surface); text-decoration: none; }
.tmsg__who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tag--new { color: var(--amber); border-color: rgba(255, 180, 84, 0.45); }
@media (max-width: 900px) { .tmsgs { padding: 12px 14px 24px; } .tmsg__head { padding: 12px 14px 6px; } .tmsg .frame { padding: 8px 12px 14px; } }

.rules { display: grid; gap: 14px; margin-bottom: 22px; }
.rules .panel + .panel { margin-top: 0; }
.rule__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.rule__head h3 { margin: 0; font-size: 1.1rem; }
.rule__text { margin: 8px 0 12px; line-height: 1.7; overflow-wrap: anywhere; }
.rule__warn { margin: 0 0 10px; font-size: 0.9rem; }
.rule__acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rule__acts form { margin: 0; }
.rule--off { opacity: 0.7; }
.cond { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 8px; margin-bottom: 8px; }
@media (max-width: 760px) { .cond { grid-template-columns: 1fr; } }
.field .check + .check { margin-top: 2px; }

.flist-manage { list-style: none; margin: 0; padding: 0; }
.fm { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.fm:last-child { border-bottom: 0; }
.fm--d1 { padding-left: 18px; } .fm--d2 { padding-left: 36px; } .fm--d3 { padding-left: 54px; } .fm--d4 { padding-left: 72px; }
.fm__name { overflow-wrap: anywhere; }
.fm__rename { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; margin: 0; }
.fm__rename .input { padding: 6px 10px; font-size: 0.85rem; }

.compose .frow { position: relative; }
.suggest { position: absolute; z-index: 60; top: 100%; left: 88px; right: 0; margin-top: 4px; max-height: 260px; overflow: auto; background: var(--surface); border: 1px solid var(--line-bright); border-radius: 8px; }
.suggest__item { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; cursor: pointer; font-size: 0.92rem; }
.suggest__item span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest__item[aria-selected="true"], .suggest__item:hover { background: rgba(255, 180, 84, 0.09); box-shadow: inset 2px 0 0 var(--amber); }
@media (max-width: 760px) { .suggest { left: 0; } }

.row__who { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.row__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__count { flex: none; margin-left: 0; }
.fm { grid-template-columns: 1fr auto auto; }
.fm .tag { justify-self: end; }

/* Im Listenpanel (Flex-Spalte) darf nichts auf seine Mindesthöhe schrumpfen: sonst überlappt ein umbrechender Listenkopf die Suchzeile */
.pane > .listbar, .pane > .search, .pane > .pager, .pane > .rows, .pane > .note, .pane > .empty { flex-shrink: 0; }
