/* Falah Agency Mails – dunkel, Revolut x Apple */
:root {
  --bg: #000;
  --card: #111114;
  --card2: #1a1a1f;
  --card3: #24242b;
  --line: rgba(255, 255, 255, .08);
  --line2: rgba(255, 255, 255, .14);
  --text: #f5f5f7;
  --dim: #9b9ba6;
  --faint: #62626d;
  --accent: #5b8cff;
  --green: #30d158;
  --orange: #ff9f0a;
  --red: #ff453a;
  --purple: #bf5af2;
  --r-lg: 28px;
  --r-md: 20px;
  --r-sm: 14px;
  --spring: cubic-bezier(.32, 1.2, .4, 1);
  --ease: cubic-bezier(.22, 1, .36, 1);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; color: var(--text); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; letter-spacing: 0;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(91, 140, 255, .16), transparent 60%),
    radial-gradient(700px 420px at -5% 0%, rgba(191, 90, 242, .10), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
h1, h2, h3 { margin: 0; letter-spacing: -.02em; line-height: 1.1; font-weight: 700; }
h1 { font-size: clamp(2rem, 4vw, 2.75rem); letter-spacing: -.035em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1rem; letter-spacing: -.01em; }
p { margin: 0; }
.dim { color: var(--dim); }
.faint { color: var(--faint); }
.small { font-size: .82rem; }
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: rgba(91, 140, 255, .4); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--card3); border-radius: 10px; border: 2px solid var(--bg); }

/* ---- Kopfleiste (Material) ---- */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(0, 0, 0, .55); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.02em; font-size: 1.1rem; }
.logo-mark { width: 30px; height: 30px; object-fit: contain; display: block; }
nav.seg { display: flex; overflow-x: auto; scrollbar-width: none; max-width: 100%; min-width: 0; gap: 4px; padding: 4px; margin: 0 auto; background: var(--card); border: 1px solid var(--line); border-radius: 999px; }
nav.seg button {
  border: 0; background: transparent; color: var(--dim); padding: 8px 18px; border-radius: 999px; cursor: pointer;
  font-weight: 600; font-size: .9rem; transition: background .25s var(--ease), color .25s var(--ease), transform .12s;
}
nav.seg button:hover { color: var(--text); }
nav.seg button:active { transform: scale(.96); }
nav.seg button.on { background: var(--text); color: #000; }
.top form { margin: 0; }

main { max-width: 1180px; margin: 0 auto; padding: clamp(20px, 4vw, 44px) clamp(16px, 4vw, 40px) 120px; }
.view { animation: rise .45s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.head p { margin-top: 8px; }

/* ---- Karten ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 26px; }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.cols2 { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); align-items: start; }
@media (max-width: 900px) { .cols2 { grid-template-columns: 1fr; } nav.seg button { padding: 8px 12px; } .brand span { display: none; } }
.sticky { position: sticky; top: 86px; }

/* ---- Kennzahlen ---- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px 22px; }
.stat .n { font-size: 2.4rem; font-weight: 700; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--dim); font-size: .85rem; margin-top: 8px; }

/* ---- Formulare ---- */
label.f { display: block; margin-bottom: 16px; }
label.f > span { display: block; font-size: .8rem; color: var(--dim); font-weight: 600; margin: 0 0 7px 4px; }
input[type=text], input[type=email], input[type=password], input[type=datetime-local], input[type=search], textarea, select {
  width: 100%; background: var(--card2); border: 1px solid transparent; border-radius: var(--r-sm); padding: 13px 15px; outline: none;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus, select:focus { border-color: var(--accent); background: #15151b; box-shadow: 0 0 0 4px rgba(91, 140, 255, .16); }
input[type=text], input[type=email], input[type=password], input[type=datetime-local], input[type=search], select { height: 48px; line-height: 1.2; }
select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 44px; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239b9ba6' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 18px center; background-size: 14px;
}
select option { background: #1a1a1f; color: var(--text); }
textarea { min-height: 280px; resize: vertical; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .86rem; line-height: 1.55; }
.row { display: flex; gap: 12px; } .row > * { flex: 1; min-width: 0; }
@media (max-width: 560px) { .row { flex-direction: column; gap: 0; } }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; font-weight: 650;
  padding: 12px 22px; border-radius: 999px; background: var(--card3); color: var(--text); font-size: .92rem;
  transition: transform .14s var(--spring), background .2s, opacity .2s; user-select: none;
}
.btn:hover { background: #2e2e36; }
.btn:active { transform: scale(.95); transition-duration: .08s; }
.btn.primary { background: var(--text); color: #000; }
.btn.primary:hover { background: #fff; }
.btn.accent { background: var(--accent); color: #fff; }
.btn.danger { color: var(--red); background: rgba(255, 69, 58, .12); }
.btn.ghost { background: transparent; border: 1px solid var(--line2); }
.btn.sm { padding: 7px 14px; font-size: .82rem; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.block { width: 100%; padding: 15px; font-size: 1rem; }

/* ---- Umschalter (Jetzt / Planen) ---- */
.pills { display: inline-flex; padding: 4px; gap: 4px; background: var(--card2); border-radius: 999px; margin-bottom: 14px; }
.pills button { border: 0; background: transparent; color: var(--dim); padding: 8px 18px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: .88rem; transition: all .25s var(--ease); }
.pills button.on { background: var(--card3); color: var(--text); }

/* ---- Status-Pillen ---- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: .76rem; font-weight: 650; background: var(--card3); color: var(--dim); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.scheduled, .pill.queued, .pill.sending { color: var(--orange); background: rgba(255, 159, 10, .13); }
.pill.sent { color: var(--accent); background: rgba(91, 140, 255, .13); }
.pill.delivered { color: var(--green); background: rgba(48, 209, 88, .13); }
.pill.opened { color: var(--purple); background: rgba(191, 90, 242, .15); }
.pill.failed { color: var(--red); background: rgba(255, 69, 58, .13); }

/* ---- Listen ---- */
.list { display: flex; flex-direction: column; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; padding: 16px 14px; margin: 0 -14px; border-top: 1px solid var(--line); cursor: pointer; transition: background .2s, transform .15s; border-radius: 14px; }
.item:first-child { border-top: 0; }
.item:hover { background: rgba(255, 255, 255, .03); }
.item .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .s { color: var(--dim); font-size: .85rem; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .meta { display: flex; align-items: center; gap: 12px; }
.empty { text-align: center; padding: 56px 20px; color: var(--dim); }
.empty b { display: block; color: var(--text); font-size: 1.05rem; margin-bottom: 6px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.chip { border: 1px solid var(--line2); background: transparent; color: var(--dim); padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: .82rem; font-weight: 600; transition: all .2s; }
.chip.on { background: var(--text); color: #000; border-color: var(--text); }

/* ---- Dateien ---- */
.drop { display: block; border: 1.5px dashed var(--line2); border-radius: var(--r-lg); padding: 38px 20px; text-align: center; color: var(--dim); cursor: pointer; transition: all .25s var(--ease); margin-bottom: 22px; background: rgba(255, 255, 255, .015); }
.drop:hover, .drop.over { border-color: var(--accent); color: var(--text); background: rgba(91, 140, 255, .07); transform: scale(1.005); }
.drop b { display: block; color: var(--text); font-size: 1.05rem; margin-bottom: 4px; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.file { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; display: flex; flex-direction: column; transition: transform .25s var(--spring), border-color .2s; }
.file:hover { transform: translateY(-3px); border-color: var(--line2); }
.thumb { aspect-ratio: 4 / 3; background: var(--card2); display: grid; place-items: center; overflow: hidden; color: var(--dim); font-weight: 700; font-size: 1.1rem; letter-spacing: .04em; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.file .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.file .name { font-weight: 600; font-size: .9rem; word-break: break-all; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.file .acts { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }

.attach { display: flex; flex-wrap: wrap; gap: 8px; }
.attach label { display: inline-flex; align-items: center; gap: 8px; background: var(--card2); border: 1px solid transparent; padding: 8px 14px; border-radius: 999px; cursor: pointer; font-size: .84rem; transition: all .2s; max-width: 100%; }
.attach label:has(input:checked) { border-color: var(--accent); background: rgba(91, 140, 255, .12); }
.attach input { accent-color: var(--accent); }

/* ---- Vorschau ---- */
.preview { background: #fff; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); }
.preview iframe { width: 100%; height: 520px; border: 0; display: block; background: #fff; color-scheme: light; }

/* ---- Sheet (Modal) ---- */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: grid; place-items: end center; opacity: 0; transition: opacity .3s var(--ease); }
.scrim.in { opacity: 1; }
.sheet {
  width: min(720px, 100%); max-height: 88vh; overflow: auto; background: rgba(22, 22, 27, .92); backdrop-filter: blur(30px) saturate(160%);
  border: 1px solid var(--line2); border-bottom: 0; border-radius: 32px 32px 0 0; padding: 28px; transform: translateY(40px) scale(.98);
  transition: transform .45s var(--spring); box-shadow: 0 -30px 80px rgba(0, 0, 0, .6);
}
.scrim.in .sheet { transform: none; }
@media (min-width: 760px) { .scrim { place-items: center; } .sheet { border-radius: 32px; border-bottom: 1px solid var(--line2); } }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--card3); margin: -10px auto 18px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 14px; margin: 18px 0; font-size: .92rem; }
.kv dt { color: var(--dim); } .kv dd { margin: 0; word-break: break-word; }

/* ---- Toast ---- */
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 80; transform: translate(-50%, 30px); opacity: 0; background: rgba(36, 36, 43, .9); backdrop-filter: blur(20px); border: 1px solid var(--line2); padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: .9rem; transition: all .45s var(--spring); max-width: 92vw; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.err { color: var(--red); }

.err { color: var(--red); font-size: .9rem; margin: 8px 0; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* ---- Login ---- */
/* Feste Position statt Zentrierung per Grid: Fremd-Elemente im <body> (Passwort-Manager-Dropdowns,
   Extensions) dürfen die Karte niemals verschieben. */
body.login { display: block; padding: 0 20px; overflow-x: hidden; }
.login-card { width: min(380px, 100%); margin: clamp(24px, 22vh, 240px) auto 40px; position: relative; display: flex; flex-direction: column; gap: 14px; text-align: center; background: rgba(17, 17, 20, .8); backdrop-filter: blur(24px); border: 1px solid var(--line); border-radius: 32px; padding: 38px 30px 30px; box-shadow: 0 40px 100px rgba(0, 0, 0, .6); animation: rise .6s var(--spring) both; }
.login-card .logo-mark { width: 64px; height: 64px; margin: 0 auto 8px; }
.login-card .btn { margin-top: 6px; padding: 15px; }

/* ---- Eingeschränkte Bewegung / Transparenz / Kontrast ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .sheet { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .top, .sheet, .toast, .login-card, .scrim { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .top { background: #000; } .sheet { background: var(--card); } .scrim { background: rgba(0, 0, 0, .85); }
}
@media (prefers-contrast: more) { :root { --line: rgba(255, 255, 255, .3); --dim: #c4c4cc; } }

/* ---- Account-Karten ---- */
.accts { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.acct { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; display: flex; flex-direction: column; gap: 16px; transition: border-color .2s, transform .25s var(--spring); }
.acct:hover { border-color: var(--line2); transform: translateY(-2px); }
.acct-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.acct .tags { margin-top: 0; }
.acct .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.sheet .row .btn { width: 100%; }

/* ---- Anbieter-Logos (echtes Mailgun-Logo, per Maske in der Markenfarbe) ---- */
.brand-tile { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 14px; display: grid; place-items: center; background: rgba(240, 107, 102, .12); border: 1px solid rgba(240, 107, 102, .22); }
.brand-tile i { width: 26px; height: 26px; display: block; background: #f06b66; -webkit-mask: url(/assets/logos/mailgun.svg) center / contain no-repeat; mask: url(/assets/logos/mailgun.svg) center / contain no-repeat; }
.acct-id { display: flex; gap: 14px; align-items: center; min-width: 0; }
.sheet .brand-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }

/* Von Extensions eingefügte Elemente nie in den Seitenfluss einreihen. */
body.login > *:not(.login-card):not(script):not(style) { position: fixed; }
