/* ==========================================================================
   FABULOUS EMAIL – Stylesheet
   ========================================================================== */

:root {
  --brand: #0a0a0a;
  --brand-2: #262626;
  --accent: #0a0a0a;
  --grad: #0a0a0a;
  --on-brand: #ffffff;
  --ring: rgba(0, 0, 0, .08);
  --ok: #16a34a;
  --warn: #0a0a0a;
  --danger: #dc2626;

  --bg: #fafafa;
  --bg-2: #f4f4f5;
  --panel: #ffffff;
  --panel-2: #fafafa;
  --line: #e7e7e7;
  --line-2: #d4d4d4;
  --text: #0a0a0a;
  --text-2: #404040;
  --muted: #737373;
  --hover: #f4f4f4;
  --sel: #efefef;
  --sel-line: #d4d4d4;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow: 0 8px 24px -10px rgba(0, 0, 0, .14), 0 2px 6px rgba(0, 0, 0, .04);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .25), 0 8px 20px rgba(0, 0, 0, .06);
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}

[data-theme="dark"] {
  --brand: #fafafa;
  --brand-2: #e5e5e5;
  --accent: #fafafa;
  --grad: #fafafa;
  --on-brand: #0a0a0a;
  --ring: rgba(255, 255, 255, .12);
  --warn: #fafafa;
  --bg: #0a0a0a;
  --bg-2: #0f0f0f;
  --panel: #111111;
  --panel-2: #161616;
  --line: #242424;
  --line-2: #333333;
  --text: #fafafa;
  --text-2: #d4d4d4;
  --muted: #8a8a8a;
  --hover: #1a1a1a;
  --sel: #1f1f1f;
  --sel-line: #3d3d3d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow: 0 8px 24px -10px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .4);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .9), 0 8px 20px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.02em; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
kbd {
  font-family: inherit; font-size: 11px; font-weight: 700;
  padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line-2);
  background: var(--panel); box-shadow: 0 1px 0 var(--line-2);
}
[hidden] { display: none !important; }

.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.grad { color: var(--text); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; letter-spacing: .12em; font-size: 13.5px; text-decoration: none !important; }
.brand b { font-weight: 800; color: inherit; }
.brand img { border-radius: 9px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 11px; border: 1px solid transparent;
  font-weight: 650; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease, border-color .2s, opacity .2s;
  text-decoration: none !important; user-select: none;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { color: var(--on-brand) !important; background: var(--brand); }
.btn-primary:hover { opacity: .86; }
.btn-ghost { background: var(--panel); border-color: var(--line); color: var(--text) !important; }
.btn-ghost:hover { background: var(--hover); border-color: var(--line-2); }
.btn-danger { background: var(--danger); color: #fff !important; }
.btn-danger:hover { filter: brightness(1.05); }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 13px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--on-brand); animation: spin .7s linear infinite; }
.btn-ghost.loading::after { border-color: var(--line-2); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border-radius: 10px; border: 0; background: transparent; color: var(--text-2); cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.active { color: var(--brand); background: var(--sel); }
.icon-btn.danger:hover { color: var(--danger); }
.icon-btn:disabled { opacity: .4; cursor: default; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; color: var(--text-2); }
.field-row { display: flex; justify-content: space-between; align-items: center; }
.link-sm { font-size: 12.5px; font-weight: 600; }
.field input, .field select, .field textarea, .input {
  height: 44px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-weight: 500; font-size: 14.5px; outline: none;
  transition: border-color .15s, box-shadow .15s; width: 100%;
}
.field textarea { height: auto; min-height: 90px; padding: 10px 14px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }
.field .hint { font-weight: 500; color: var(--muted); font-size: 12px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; }
.pw-toggle { position: absolute; right: 4px; top: 4px; width: 36px; height: 36px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 9px; display: grid; place-items: center; }
.pw-toggle:hover { color: var(--text); background: var(--hover); }
.strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 2px; }
.strength i { height: 4px; border-radius: 4px; background: var(--line); transition: background .25s; }
.strength[data-level="1"] i:nth-child(-n+1) { background: var(--danger); }
.strength[data-level="2"] i:nth-child(-n+2) { background: var(--warn); }
.strength[data-level="3"] i:nth-child(-n+3) { background: #84cc16; }
.strength[data-level="4"] i { background: var(--ok); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; color: var(--text-2); cursor: pointer; font-weight: 500; }
.check input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237d7b96' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px !important; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-weight: 550; font-size: 13.5px; margin-bottom: 16px; border: 1px solid; }
.alert .ic { margin-top: 1px; }
.alert-error { background: rgba(229, 72, 77, .08); border-color: rgba(229, 72, 77, .25); color: #c2292e; }
.alert-success { background: rgba(22, 169, 116, .08); border-color: rgba(22, 169, 116, .25); color: #0f8a5e; }
[data-theme="dark"] .alert-error { color: #ff8b8f; }
[data-theme="dark"] .alert-success { color: #4fe0a9; }

/* ---------- Orbs (Hintergrund-Deko) ---------- */
.orb { display: none; position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; pointer-events: none; z-index: 0; }
.orb-a { width: 420px; height: 420px; background: #7b6bff; top: -120px; left: -80px; animation: float 16s ease-in-out infinite; }
.orb-b { width: 360px; height: 360px; background: #ff6b8b; bottom: -100px; right: -60px; animation: float 19s ease-in-out infinite reverse; }
.orb-c { width: 260px; height: 260px; background: #3fd5ff; top: 40%; left: 55%; opacity: .3; animation: float 22s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(30px, -25px) scale(1.08); } }

/* ==========================================================================
   Auth-Seiten
   ========================================================================== */
.auth-page { min-height: 100vh; }
.auth-shell { display: grid; grid-template-columns: minmax(380px, 1fr) minmax(420px, 1.05fr); min-height: 100vh; }
.auth-brand {
  position: relative; overflow: hidden; color: #fff; padding: 40px 48px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: #0a0a0a; border-right: 1px solid var(--line);
}
.auth-brand .brand { color: #fff; position: relative; z-index: 1; }
.auth-brand-copy { position: relative; z-index: 1; max-width: 460px; }
.auth-brand h2 { font-size: 42px; line-height: 1.08; font-weight: 800; margin-bottom: 18px; }
.auth-brand p { color: rgba(255,255,255,.75); font-size: 15.5px; line-height: 1.65; }
.auth-points { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 12px; }
.auth-points li { display: flex; gap: 12px; align-items: center; color: rgba(255,255,255,.88); font-weight: 550; }
.auth-points .ic { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.12); }
.auth-brand-foot { position: relative; z-index: 1; color: rgba(255,255,255,.45); font-size: 12.5px; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 30px; font-weight: 800; margin-bottom: 6px; }
.auth-card > .muted { margin: 0 0 24px; font-size: 15px; }
.auth-switch { text-align: center; margin-top: 22px; color: var(--muted); font-weight: 500; }
.auth-switch a { font-weight: 700; }
.auth-icon { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; background: var(--brand); color: var(--on-brand); margin-bottom: 20px; }
.auth-icon .ic { width: 28px; height: 28px; }
.auth-icon-warn { background: var(--danger); color: #fff; }
.brand-mobile { display: none; margin-bottom: 28px; }

/* ---------- Fehlerseite ---------- */
.error-page { position: relative; overflow: hidden; min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.error-card { position: relative; z-index: 1; text-align: center; max-width: 520px; background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 48px 36px; box-shadow: var(--shadow-lg); }
.error-code { font-size: 84px; font-weight: 800; line-height: 1; margin-bottom: 8px; }
.error-card h1 { font-size: 24px; margin-bottom: 8px; }
.error-card .btn { margin-top: 18px; }
.error-debug { text-align: left; font-size: 11px; max-height: 240px; overflow: auto; background: var(--bg-2); padding: 12px; border-radius: 10px; }

/* ==========================================================================
   Einstellungen
   ========================================================================== */
.settings-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.settings-wrap { max-width: 780px; margin: 0 auto; padding: 32px 20px 60px; display: flex; flex-direction: column; gap: 18px; }
.settings-wrap > h1 { font-size: 30px; font-weight: 800; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: var(--shadow-sm); }
.card-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.card-head > .ic { width: 40px; height: 40px; padding: 10px; border-radius: 12px; background: var(--sel); color: var(--brand); }
.card-head h2 { font-size: 17px; }
.card-head p { margin: 2px 0 0; }
.card-danger .card-head > .ic { background: rgba(229, 72, 77, .1); color: var(--danger); }
.acc-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.acc-list li { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.acc-list i { width: 10px; height: 10px; border-radius: 50%; }
.acc-list b { display: block; } .acc-list small { color: var(--muted); }

/* ==========================================================================
   Mail-App
   ========================================================================== */
.app-page { overflow: hidden; height: 100vh; height: 100dvh; }
.app { display: grid; grid-template-columns: 264px minmax(330px, 420px) 1fr; height: 100vh; height: 100dvh; }

/* ---------- Sidebar ---------- */
.sidebar { display: flex; flex-direction: column; background: var(--panel-2); border-right: 1px solid var(--line); min-height: 0; padding: 16px 12px 12px; gap: 12px; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 4px; }
.btn-compose { height: 46px; border-radius: 13px; font-size: 14.5px; justify-content: flex-start; padding: 0 18px; }
.acc-switch { display: flex; flex-direction: column; gap: 4px; }
.acc-current { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; text-align: left; transition: border-color .15s; }
.acc-current:hover { border-color: var(--line-2); }
.acc-dot { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: var(--on-brand); background: var(--brand) !important; font-weight: 800; font-size: 12px; flex: none; }
.acc-meta { flex: 1; min-width: 0; }
.acc-meta b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-meta small { display: block; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-badge { font-size: 11px; font-weight: 800; background: var(--accent); color: var(--on-brand); border-radius: 10px; padding: 1px 7px; }
.folders { flex: 1; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 2px; margin: 0 -4px; padding: 0 4px; }
.folder { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 10px; color: var(--text-2); font-weight: 600; font-size: 13.5px; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; transition: background .12s, color .12s; position: relative; }
.folder:hover { background: var(--hover); color: var(--text); }
.folder.active { background: var(--sel); color: var(--text); }
.folder.active::before { content: ''; position: absolute; left: -4px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--grad); }
.folder.active .ic { color: var(--brand); }
.folder span.name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder .count { font-size: 11.5px; font-weight: 800; color: var(--brand); }
.folder.drop-target { background: var(--sel); outline: 2px dashed var(--brand); outline-offset: -2px; }
.folder-sep { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 14px 12px 6px; display: flex; justify-content: space-between; align-items: center; }
.folder-sep button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; border-radius: 6px; display: grid; }
.folder-sep button:hover { color: var(--brand); background: var(--hover); }
.side-foot { border-top: 1px solid var(--line); padding-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.me { display: flex; gap: 10px; align-items: center; min-width: 0; padding-left: 4px; }
.me-info { min-width: 0; }
.me-info b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-info small { display: block; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-actions { display: flex; gap: 0; }
.side-actions form { display: contents; }
.side-actions .icon-btn { width: 32px; height: 32px; }
.sidebar-scrim { display: none; }

.av { width: 38px; height: 38px; border-radius: 12px; display: inline-grid; place-items: center; color: var(--text); font-weight: 700; font-size: 13px; flex: none; background: var(--sel); box-shadow: inset 0 0 0 1px var(--line); letter-spacing: .02em; }
.av-sm { width: 32px; height: 32px; border-radius: 10px; font-size: 12px; }
.av-lg { width: 46px; height: 46px; border-radius: 14px; font-size: 15px; }

/* ---------- Liste ---------- */
.list-pane { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--panel); }
.list-head { display: flex; gap: 6px; align-items: center; padding: 14px 14px 8px; }
.search { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; height: 40px; transition: border-color .15s, box-shadow .15s; }
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); background: var(--panel); }
.search .ic { color: var(--muted); width: 16px; height: 16px; }
.search input { flex: 1; border: 0; outline: none; background: none; height: 100%; font-weight: 500; min-width: 0; }
.list-sub { padding: 6px 16px 10px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.list-title { display: flex; align-items: baseline; gap: 10px; }
.list-title h1 { font-size: 21px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filters { display: flex; gap: 6px; }
.chip { height: 28px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-weight: 650; font-size: 12.5px; color: var(--text-2); cursor: pointer; transition: all .15s; }
.chip:hover { border-color: var(--line-2); color: var(--text); }
.chip.active { background: var(--text); border-color: var(--text); color: var(--panel); }
.bulk { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px 6px 16px; background: var(--sel); border-bottom: 1px solid var(--sel-line); }
.bulk .check { font-weight: 700; color: var(--text); align-items: center; }
.bulk .check input { margin: 0; }
.bulk-actions { display: flex; }
.bulk-actions .icon-btn { width: 32px; height: 32px; }
.msg-list { flex: 1; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.msg {
  display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 12px 14px 12px 12px;
  border-bottom: 1px solid var(--line); cursor: pointer; position: relative; transition: background .1s;
}
.msg:hover { background: var(--hover); }
.msg.active { background: var(--sel); }
.msg.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--grad); }
.msg.checked { background: var(--sel); }
.msg-left { position: relative; width: 38px; }
.msg-left .av { transition: opacity .15s; }
.msg-check { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transition: opacity .15s; }
.msg-check input { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; margin: 0; }
.msg:hover .msg-check, .msg.checked .msg-check, .selecting .msg-check { opacity: 1; }
.msg:hover .msg-left .av, .msg.checked .msg-left .av, .selecting .msg-left .av { opacity: 0; }
.msg-main { min-width: 0; }
.msg-top { display: flex; align-items: baseline; gap: 8px; }
.msg-from { flex: 1; min-width: 0; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.msg-date { font-size: 11.5px; color: var(--muted); white-space: nowrap; font-weight: 500; }
.msg-subj { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); margin-top: 1px; display: flex; gap: 6px; align-items: center; }
.msg-subj span { overflow: hidden; text-overflow: ellipsis; }
.msg-icons { display: flex; gap: 4px; align-items: center; margin-left: auto; flex: none; color: var(--muted); }
.msg-icons .ic { width: 14px; height: 14px; }
.msg.unread .msg-from, .msg.unread .msg-subj { color: var(--text); font-weight: 800; }
.msg.unread .msg-date { color: var(--brand); font-weight: 700; }
.msg.unread::after { content: ''; position: absolute; right: 14px; bottom: 16px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.star-btn { border: 0; background: none; padding: 2px; cursor: pointer; color: var(--muted); display: grid; border-radius: 6px; }
.star-btn:hover { color: var(--warn); }
.star-btn.on { color: var(--warn); }
.star-btn.on .ic { fill: var(--warn); }
.msg .star-btn { opacity: 0; }
.msg:hover .star-btn, .msg .star-btn.on { opacity: 1; }
.list-empty { padding: 60px 24px; text-align: center; color: var(--muted); }
.list-empty .ic { width: 40px; height: 40px; color: var(--line-2); margin-bottom: 10px; }
.list-empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); font-weight: 600; }
.pager:empty { display: none; }
.pager .btns { display: flex; gap: 2px; }

.skeleton { padding: 14px; display: flex; gap: 12px; border-bottom: 1px solid var(--line); }
.skeleton .sk-av { width: 38px; height: 38px; border-radius: 12px; }
.skeleton .sk-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; padding-top: 3px; }
.sk { background: linear-gradient(90deg, var(--bg-2) 0%, var(--hover) 50%, var(--bg-2) 100%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 6px; }
.sk-l1 { height: 12px; width: 55%; } .sk-l2 { height: 11px; width: 85%; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- Lesebereich ---------- */
.read-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.empty-read { margin: auto; text-align: center; padding: 40px; }
.empty-art { width: 92px; height: 92px; border-radius: 28px; margin: 0 auto 20px; display: grid; place-items: center; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--brand); }
.empty-art .ic { width: 40px; height: 40px; stroke-width: 1.6; }
.empty-read h3 { font-size: 18px; margin-bottom: 6px; }
.read-tools { display: flex; align-items: center; gap: 2px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel); }
.read-tools .sep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; }
.read-tools .spacer { flex: 1; }
.read-scroll { flex: 1; overflow-y: auto; min-height: 0; background: var(--panel); }
.read-card { min-height: 100%; display: flex; flex-direction: column; }
.read-head { padding: 20px 24px 16px; }
.read-subject { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.read-subject h2 { flex: 1; min-width: 0; font-size: 22px; font-weight: 800; line-height: 1.3; overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; }
.read-quick { display: flex; gap: 2px; flex: none; margin-top: -2px; }
.read-quick .star-btn { padding: 0; display: grid; place-items: center; }
.read-from { display: flex; gap: 12px; align-items: flex-start; }
.read-from-info { flex: 1; min-width: 0; }
.read-from-name { font-weight: 750; font-size: 14.5px; }
.read-from-name small { font-weight: 500; color: var(--muted); font-size: 13px; margin-left: 4px; word-break: break-all; }
.read-to { color: var(--muted); font-size: 12.5px; margin-top: 2px; cursor: pointer; }
.read-to:hover { color: var(--text-2); }
.read-details { margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: var(--bg); font-size: 12.5px; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; color: var(--text-2); }
.read-details dt { color: var(--muted); font-weight: 600; }
.read-details dd { margin: 0; word-break: break-word; }
.read-date { color: var(--muted); font-size: 12.5px; white-space: nowrap; font-weight: 500; }
.notice { display: flex; align-items: center; gap: 10px; margin: 0 24px 14px; padding: 10px 14px; border-radius: 12px; background: var(--sel); border: 1px solid var(--line); font-size: 13px; font-weight: 550; color: var(--text-2); }
.notice .ic { color: var(--text); }
.notice button { margin-left: auto; }
.read-body { flex: 1; padding: 0 0 8px; background: #fff; }
.read-frame { width: 100%; border: 0; display: block; min-height: 120px; background: #fff; color-scheme: light; }
.attachments { padding: 16px 24px 22px; border-top: 1px solid var(--line); }
.attachments h4 { font-size: 13px; color: var(--muted); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.att { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text) !important; text-decoration: none !important; transition: border-color .15s, transform .15s; min-width: 0; }
.att:hover { border-color: var(--brand); transform: translateY(-1px); }
.att-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 10px; font-weight: 800; color: var(--text); flex: none; background: var(--sel); box-shadow: inset 0 0 0 1px var(--line); text-transform: uppercase; }
.att-meta { min-width: 0; flex: 1; }
.att-meta b { display: block; font-size: 13px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-meta small { color: var(--muted); font-size: 11.5px; }
.att .ic { color: var(--muted); }

/* ---------- Composer ---------- */
.composer-dock { position: fixed; right: 24px; bottom: 0; z-index: 40; display: flex; gap: 14px; align-items: flex-end; pointer-events: none; }
.composer {
  pointer-events: auto; width: 620px; max-width: calc(100vw - 32px); height: min(680px, calc(100vh - 40px));
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px 18px 0 0; box-shadow: var(--shadow-lg); overflow: hidden; animation: rise .22s ease;
}
@keyframes rise { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.composer.minimized { height: 50px; width: 320px; }
.composer.minimized > :not(.comp-head) { display: none; }
.composer.maximized { position: fixed; inset: 24px 24px 0; width: auto; height: auto; max-width: none; z-index: 60; }
.comp-head { display: flex; align-items: center; gap: 4px; padding: 0 8px 0 18px; height: 50px; flex: none; background: #0a0a0a; color: #fff; cursor: pointer; border-bottom: 1px solid var(--line); }
.comp-head b { flex: 1; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comp-head .icon-btn { color: rgba(255,255,255,.75); width: 32px; height: 32px; }
.comp-head .icon-btn:hover { color: #fff; background: rgba(255,255,255,.12); }
.comp-status { font-size: 11.5px; opacity: .7; margin-right: 6px; font-weight: 500; }
.comp-fields { border-bottom: 1px solid var(--line); flex: none; }
.comp-row { display: flex; align-items: center; gap: 10px; padding: 0 16px; min-height: 44px; border-bottom: 1px solid var(--line); }
.comp-row:last-child { border-bottom: 0; }
.comp-row > label { color: var(--muted); font-weight: 600; font-size: 13px; width: 44px; flex: none; }
.comp-row select, .comp-row > input { flex: 1; border: 0; outline: none; background: none; height: 42px; font-weight: 550; font-size: 14px; min-width: 0; }
.comp-row select { padding-right: 30px; background-position: right 4px center; cursor: pointer; }
.comp-row select option { background: var(--panel); color: var(--text); }
.comp-toggle { border: 0; background: none; color: var(--muted); font-weight: 650; font-size: 12.5px; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.comp-toggle:hover { color: var(--brand); background: var(--hover); }
.rcpt { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 0; min-width: 0; position: relative; cursor: text; }
.rcpt input { flex: 1; min-width: 140px; border: 0; outline: none; background: none; height: 30px; font-size: 14px; font-weight: 500; }
.tag { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 4px 0 10px; border-radius: 8px; background: var(--sel); color: var(--text); font-weight: 600; font-size: 13px; max-width: 100%; }
.tag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag.invalid { background: rgba(229, 72, 77, .14); color: var(--danger); }
.tag button { border: 0; background: none; color: inherit; cursor: pointer; opacity: .6; display: grid; padding: 2px; border-radius: 5px; }
.tag button:hover { opacity: 1; background: rgba(0,0,0,.06); }
.tag .ic { width: 13px; height: 13px; }
.suggest { position: absolute; top: 100%; left: 0; z-index: 10; min-width: 280px; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 4px; }
.suggest div { padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.suggest div.on, .suggest div:hover { background: var(--sel); }
.suggest b { display: block; font-size: 13px; } .suggest small { color: var(--muted); font-size: 12px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 1px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line); background: var(--panel-2); flex: none; }
.toolbar .icon-btn { width: 32px; height: 32px; border-radius: 8px; }
.toolbar .icon-btn .ic { width: 16px; height: 16px; }
.toolbar .sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.toolbar select { height: 30px; border: 1px solid var(--line); border-radius: 8px; background-color: var(--panel); font-size: 12.5px; font-weight: 600; padding: 0 28px 0 8px; background-position: right 8px center; cursor: pointer; }
.color-pop { position: relative; }
.color-grid { position: absolute; top: 36px; left: 0; z-index: 20; display: grid; grid-template-columns: repeat(6, 22px); gap: 6px; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.color-grid button { width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(0,0,0,.1); cursor: pointer; }
.editor { flex: 1; overflow-y: auto; padding: 16px 18px; outline: none; font-size: 14px; line-height: 1.5; color: #1f2330; background: #fff; min-height: 120px; word-wrap: break-word; }
.editor:empty::before { content: attr(data-placeholder); color: #9a98b2; }
.editor p, .editor div { margin: 0; }
.editor blockquote { margin: 0 0 0 .8ex; border-left: 2px solid #ccc; padding-left: 1ex; color: #555; }
.editor img { max-width: 100%; height: auto; }
.editor a { color: #0b57d0; }
.editor ul, .editor ol { margin: 0; padding-left: 28px; }
.editor table { max-width: 100%; }
.comp-atts { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 16px; border-top: 1px solid var(--line); flex: none; }
.comp-atts:empty { display: none; }
.comp-att { display: inline-flex; align-items: center; gap: 8px; padding: 6px 6px 6px 10px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; max-width: 260px; }
.comp-att span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comp-att small { color: var(--muted); font-weight: 500; white-space: nowrap; }
.comp-att button { border: 0; background: none; cursor: pointer; color: var(--muted); display: grid; padding: 2px; border-radius: 6px; }
.comp-att button:hover { color: var(--danger); }
.comp-att .ic { width: 14px; height: 14px; }
.comp-foot { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line); flex: none; background: var(--panel); }
.comp-foot .spacer { flex: 1; }
.comp-foot .btn-primary { padding: 0 20px 0 18px; }
.drop-hint { position: absolute; inset: 50px 0 0; z-index: 5; display: none; place-items: center; background: var(--ring); border: 2px dashed var(--brand); border-radius: 0 0 18px 18px; font-weight: 700; color: var(--brand); font-size: 15px; }
.composer.dragging .drop-hint { display: grid; }
.composer { position: relative; }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; z-index: 80; background: rgba(12, 10, 30, .5); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg); animation: pop .2s ease; }
.modal.wide { max-width: 760px; }
@keyframes pop { from { transform: scale(.96) translateY(8px); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px 0; }
.modal-head h3 { font-size: 19px; font-weight: 800; flex: 1; }
.modal-body { padding: 18px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 22px 20px; flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
.providers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.provider { border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 12px; background: var(--panel); cursor: pointer; text-align: left; font-weight: 700; font-size: 13.5px; transition: all .15s; display: flex; flex-direction: column; gap: 4px; }
.provider small { font-weight: 500; color: var(--muted); font-size: 11.5px; }
.provider:hover { border-color: var(--line-2); transform: translateY(-1px); }
.provider.active { border-color: var(--brand); background: var(--sel); box-shadow: 0 0 0 3px var(--ring); }
.provider-hint { font-size: 12.5px; color: var(--text-2); background: var(--bg); border-radius: 10px; padding: 10px 12px; margin-top: 2px; }
details.adv { border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; }
details.adv summary { cursor: pointer; padding: 12px 0; font-weight: 700; font-size: 13.5px; list-style: none; display: flex; align-items: center; gap: 8px; }
details.adv summary::-webkit-details-marker { display: none; }
details.adv summary .ic { transition: transform .2s; width: 16px; height: 16px; }
details.adv[open] summary .ic { transform: rotate(180deg); }
details.adv .grid-srv { display: grid; grid-template-columns: 1fr 90px 120px; gap: 10px; margin-bottom: 14px; }
.srv-title { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 6px 0 8px; }
.test-result { display: grid; gap: 6px; margin-top: 4px; }
.test-line { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 10px; }
.test-line.ok { background: rgba(22,169,116,.1); color: var(--ok); }
.test-line.err { background: rgba(229,72,77,.1); color: var(--danger); }
.test-line .ic { width: 16px; height: 16px; margin-top: 1px; }
.acc-manage { display: grid; gap: 10px; }
.acc-item { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; }
.acc-item .acc-meta b { font-size: 14px; }
.menu { position: fixed; z-index: 90; min-width: 220px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; animation: pop .12s ease; max-height: 60vh; overflow-y: auto; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; background: none; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--text-2); text-align: left; }
.menu button:hover { background: var(--hover); color: var(--text); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.menu .ic { width: 16px; height: 16px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 13px; background: #0a0a0a; color: #fff; font-weight: 600; font-size: 13.5px; box-shadow: var(--shadow-lg); animation: rise .2s ease; max-width: min(560px, calc(100vw - 32px)); }
[data-theme="dark"] .toast { background: #262626; }
.toast .ic { width: 17px; height: 17px; flex: none; }
.toast.ok .ic { color: #fff; }
.toast.err .ic { color: #fff; }
.toast button { border: 0; background: rgba(255,255,255,.12); color: #fff; font-weight: 700; padding: 4px 10px; border-radius: 8px; cursor: pointer; margin-left: 6px; }
.toast.out { opacity: 0; transform: translateY(10px); transition: all .25s; }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line-2); border-top-color: var(--brand); animation: spin .7s linear infinite; margin: 40px auto; }
.welcome { margin: auto; max-width: 520px; text-align: center; padding: 40px 24px; }
.welcome h2 { font-size: 26px; font-weight: 800; margin: 18px 0 10px; }
.welcome p { color: var(--text-2); margin-bottom: 22px; }
.welcome .empty-art { background: var(--brand); color: var(--on-brand); border: 0; }

.only-mobile { display: none !important; }
.fab { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 25; width: 58px; height: 58px; border-radius: 18px; border: 0; color: var(--on-brand); background: var(--brand); box-shadow: var(--shadow-lg); cursor: pointer; }
.fab .ic { width: 22px; height: 22px; }
.app-page .read-pane ~ .fab { display: none; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1180px) {
  .app { grid-template-columns: 236px minmax(300px, 360px) 1fr; }
}
@media (max-width: 980px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .brand-mobile { display: inline-flex; }

  .app { grid-template-columns: minmax(300px, 380px) 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 50; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  .app.side-open .sidebar { transform: none; }
  .app.side-open .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(12,10,30,.45); }
  .only-mobile { display: inline-grid !important; }
}
@media (max-width: 720px) {
  .grid-2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .providers { grid-template-columns: 1fr 1fr; }
  details.adv .grid-srv { grid-template-columns: 1fr 1fr; }
  details.adv .grid-srv > :first-child { grid-column: span 2; }

  .app { grid-template-columns: 1fr; }
  .read-pane { position: fixed; inset: 0; z-index: 30; transform: translateX(100%); transition: transform .25s ease; }
  .app.reading .read-pane { transform: none; }
  .read-head { padding: 18px 16px 12px; }
  .read-subject { flex-direction: column; gap: 8px; margin-bottom: 14px; }
  .read-subject h2 { font-size: 19px; line-height: 1.3; }
  .read-quick { margin: 0 0 0 -8px; }
  .read-from { flex-wrap: wrap; gap: 10px; }
  .read-from .av-lg { width: 38px; height: 38px; border-radius: 12px; font-size: 13px; }
  .read-from-name small { display: block; margin-left: 0; }
  .read-date { order: 3; flex-basis: 100%; padding-left: 48px; margin-top: -4px; white-space: normal; }
  .attachments { padding: 14px 16px 18px; }
  .notice { margin: 0 16px 12px; }
  .composer-dock { right: 0; left: 0; }
  .composer, .composer.maximized { position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; border-radius: 0; }
  .composer.minimized { inset: auto 0 0 0; height: 50px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Monochrom: Konto-Farben neutralisieren ---------- */
.acc-list i { background: var(--text) !important; }

/* ==========================================================================
   Zwei-Faktor-Authentifizierung
   ========================================================================== */
.switch { position: relative; display: inline-block; width: 44px; height: 26px; flex: none; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 26px; background: var(--line-2); transition: background .2s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + span { background: var(--brand); }
[data-theme="dark"] .switch input:checked + span::after { background: #0a0a0a; }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 4px var(--ring); }
.switch input:disabled + span { opacity: .6; cursor: default; }
.tfa-status { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; color: var(--text-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.dot.on { background: var(--text); }
.tfa-setup { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.tfa-qr { padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 14px; flex: none; }
.tfa-qr img { display: block; width: 184px; height: 184px; }
.tfa-steps { flex: 1; min-width: 240px; }
.tfa-steps ol { margin: 0 0 16px; padding-left: 18px; display: grid; gap: 8px; color: var(--text-2); }
.tfa-secret { display: inline-block; margin-top: 6px; padding: 6px 10px; border-radius: 8px; background: var(--sel); font-size: 13px; letter-spacing: .06em; user-select: all; word-break: break-all; }
.form.tfa-enable { display: flex; flex-direction: row; align-items: center; gap: 10px; margin-bottom: 8px; }
.tfa-enable .btn { flex: none; height: 40px; }
.otp-input { width: 100%; height: 48px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel); font-size: 22px; font-weight: 700; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; outline: none; }
.otp-input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }
.tfa-enable .otp-input { max-width: 200px; height: 40px; font-size: 18px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--muted); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link-btn:hover { color: var(--text); }
.recovery { border: 1px solid var(--line-2); border-radius: 12px; padding: 16px; margin-bottom: 16px; background: var(--panel-2); }
.recovery p { margin: 0 0 12px; color: var(--text-2); }
.recovery-codes { list-style: none; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.recovery-codes code { display: block; padding: 8px 10px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); font-size: 14px; text-align: center; letter-spacing: .04em; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.tfa-confirm { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.tfa-confirm p { margin: 0; }
.tfa-more { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.tfa-more summary { cursor: pointer; font-weight: 600; color: var(--text-2); }
.tfa-more form { margin-top: 14px; }
[data-theme="dark"] .brand img { box-shadow: 0 0 0 1px var(--line-2); }
.acc-chev { position: relative; display: grid; place-items: center; color: var(--muted); }
.acc-other { position: absolute; top: -3px; right: -3px; width: 7px; height: 7px; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 2px var(--panel); }
.count-spin { margin-left: auto; width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--text); animation: spin .7s linear infinite; flex: none; }
.model-row { display: flex; gap: 10px; }
.model-row select { flex: 1; min-width: 0; }
.model-row .btn { flex: none; height: auto; }
.ai-form textarea { width: 100%; resize: vertical; min-height: 96px; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-form .small .ic { width: 14px; height: 14px; vertical-align: -2px; }
.provider-hint a { color: var(--text); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
