/* =====================================================================
   MailKopie – Oberfläche im Stil von Material Design
   Eine Hauptfarbe (Violett), Türkis als Akzent, sonst Schwarz und Grau.
   ===================================================================== */

@font-face { font-family: "Roboto"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/roboto-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Roboto"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/roboto-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Roboto"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/roboto-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Roboto"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/roboto-latin-ext-500-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Roboto"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/roboto-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Roboto"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/roboto-latin-ext-700-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
    --primary: #6200EE;
    --primary-dark: #3700B3;
    --primary-soft: #F1E9FE;
    --primary-line: #D9C7FB;
    --secondary: #03DAC5;
    --secondary-dark: #018786;
    --bg: #F5F4F7;
    --surface: #FFFFFF;
    --text: #1C1B1F;
    --text-2: #5C5B63;
    --text-3: #8B8993;
    --line: #E2E0E7;
    --error: #B00020;
    --error-soft: #FDECEE;
    --warn: #A15C00;
    --warn-soft: #FFF4E5;
    --radius: 12px;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .07), 0 1px 4px rgba(0, 0, 0, .05);
    --shadow-2: 0 2px 6px rgba(0, 0, 0, .10), 0 4px 14px rgba(0, 0, 0, .06);
    --shadow-3: 0 6px 14px rgba(0, 0, 0, .16), 0 2px 6px rgba(0, 0, 0, .10);

    /* Bereichs-Variablen (Standard = Mail Collector) */
    --bar-bg: #6200EE;
    --bar-fg: #FFFFFF;
    --btn-bg: #6200EE;
    --btn-fg: #FFFFFF;
    --btn-hover: #3700B3;
    --on-secondary: #000000;
    --secondary-hover: #05C4B1;
    --tab-indicator: #03DAC5;
    --switch-on: #03DAC5;
    --switch-track: rgba(3, 218, 197, .5);
    --chip-bg: rgba(255, 255, 255, .16);
}

/* Mail Forwarder: Farben umgekehrt – Türkis mit schwarzer Schrift, Violett als Akzent */
body.area-forwarder {
    --primary: #00796B;
    --primary-dark: #004D40;
    --primary-soft: #DFF7F4;
    --primary-line: #9EE7DF;
    --secondary: #6200EE;
    --secondary-dark: #3700B3;
    --bar-bg: #03DAC5;
    --bar-fg: #000000;
    --btn-bg: #03DAC5;
    --btn-fg: #000000;
    --btn-hover: #00C4B0;
    --on-secondary: #FFFFFF;
    --secondary-hover: #3700B3;
    --tab-indicator: #6200EE;
    --switch-on: #6200EE;
    --switch-track: rgba(98, 0, 238, .38);
    --chip-bg: rgba(0, 0, 0, .08);
}

/* Konto & Sicherheit sowie Startseite: neutral grau */
body.area-account, body.area-home {
    --primary: #455A64;
    --primary-dark: #263238;
    --primary-soft: #ECEFF1;
    --primary-line: #CFD8DC;
    --bar-bg: #37474F;
    --bar-fg: #FFFFFF;
    --btn-bg: #455A64;
    --btn-fg: #FFFFFF;
    --btn-hover: #263238;
    --tab-indicator: #03DAC5;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 500; line-height: 1.25; margin: 0; }
p { margin: 0 0 .75rem; }
code, .mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .9em; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }

.icon { width: 1.35em; height: 1.35em; flex: none; vertical-align: -.3em; }

/* ---------- App-Leiste ---------- */
.appbar {
    background: var(--bar-bg);
    color: var(--bar-fg);
    box-shadow: var(--shadow-2);
    position: sticky;
    top: 0;
    z-index: 10;
}
.appbar-inner {
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 60px;
    flex-wrap: wrap;
}
.appbar-spacer { flex: 1; }
.area-chip {
    display: inline-flex; align-items: center; gap: 6px;
    height: 30px; padding: 0 12px; border-radius: 15px;
    background: var(--chip-bg); color: var(--bar-fg);
    font-size: 13px; font-weight: 500; letter-spacing: .3px; white-space: nowrap;
}
.area-chip .icon { width: 18px; height: 18px; }
.brand {
    color: var(--bar-fg);
    font-size: 19px;
    font-weight: 500;
    letter-spacing: .2px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.brand:hover { text-decoration: none; }
.brand .icon { width: 26px; height: 26px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; order: 10; width: 100%; margin-top: -4px; }
.tab {
    color: var(--bar-fg);
    opacity: .78;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 1.1px;
    text-transform: uppercase;
    padding: 20px 14px 17px;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tab:hover { opacity: 1; text-decoration: none; background: rgba(127, 127, 127, .12); }
.tab.active { opacity: 1; border-bottom-color: var(--tab-indicator); }
.appbar .icon-btn { color: var(--bar-fg); }
.appbar form { margin: 0; }

@media (max-width: 640px) {
    .appbar-inner { padding: 0 8px 0 14px; }
    .tabs { margin: 0 -8px 0 -14px; padding: 0 6px; width: calc(100% + 22px); }
    .brand-name { display: none; }
    .tab { padding: 12px 12px 10px; }
    .tab .icon { display: none; }
}

/* ---------- Grundlayout ---------- */
.container { max-width: 1040px; margin: 0 auto; padding: 24px 16px 96px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: 24px; }

.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-1);
    padding: 20px 22px;
    margin-bottom: 16px;
}
.card-title { font-size: 17px; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.card-title .icon { color: var(--primary); }
.card-sub { color: var(--text-2); font-size: 14px; margin-bottom: 16px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; align-items: center; }
.card-actions form { margin: 0; }
.divider { height: 1px; background: var(--line); margin: 16px -22px; border: 0; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

/* ---------- Schaltflächen ---------- */
.btn {
    --c: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 18px;
    border-radius: 6px;
    border: 0;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    background: var(--btn-bg);
    color: var(--btn-fg);
    box-shadow: var(--shadow-1);
    transition: background .15s, box-shadow .15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { background: var(--btn-hover); box-shadow: var(--shadow-2); text-decoration: none; }
.btn:focus-visible, .btn-text:focus-visible, .btn-outline:focus-visible, .icon-btn:focus-visible { outline: 3px solid var(--secondary); outline-offset: 2px; }
.btn .icon { width: 20px; height: 20px; }
.btn-outline {
    display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px;
    border-radius: 6px; border: 1px solid var(--line); background: transparent; color: var(--primary);
    font: inherit; font-size: 14px; font-weight: 500; letter-spacing: 1px; text-transform: uppercase; cursor: pointer;
}
.btn-outline:hover { background: var(--primary-soft); border-color: var(--primary-line); text-decoration: none; }
.btn-text {
    display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 10px;
    border-radius: 6px; border: 0; background: transparent; color: var(--primary);
    font: inherit; font-size: 14px; font-weight: 500; letter-spacing: 1px; text-transform: uppercase; cursor: pointer;
}
.btn-text:hover { background: var(--primary-soft); text-decoration: none; }
.btn-text .icon, .btn-outline .icon { width: 20px; height: 20px; }
.btn-danger { color: var(--error); }
.btn-danger:hover { background: var(--error-soft); }
.btn-block { width: 100%; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent;
    color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: rgba(0, 0, 0, .06); }
.appbar .icon-btn:hover { background: rgba(255, 255, 255, .12); }

/* Schwebende Aktionsschaltfläche in Türkis */
.fab {
    position: fixed; right: 24px; bottom: 24px; z-index: 20;
    display: inline-flex; align-items: center; gap: 10px;
    height: 56px; padding: 0 22px 0 18px; border-radius: 28px;
    background: var(--secondary); color: var(--on-secondary); box-shadow: var(--shadow-3);
    font-weight: 500; letter-spacing: 1px; text-transform: uppercase; font-size: 14px;
}
.fab:hover { background: var(--secondary-hover); text-decoration: none; }
.fab .icon { width: 24px; height: 24px; }

/* ---------- Formulare ---------- */
.form-section { margin-bottom: 8px; }
.form-section + .form-section { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 10px; }
.form-section h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-2); margin-bottom: 14px; }
.field { margin-bottom: 16px; }
.field label, .label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.field .hint { font-size: 12.5px; color: var(--text-3); margin-top: 5px; }
.row { display: grid; gap: 0 16px; grid-template-columns: 1fr 1fr; }
.row-3 { display: grid; gap: 0 16px; grid-template-columns: 2fr 1fr 1fr; }
@media (max-width: 640px) { .row, .row-3 { grid-template-columns: 1fr; } }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid #C9C6D0;
    border-radius: 6px;
    transition: border-color .15s, box-shadow .15s;
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 40px; }
input:hover, select:hover { border-color: var(--text-2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
input.code-input { font-size: 26px; letter-spacing: 8px; text-align: center; font-weight: 500; }
.input-group { display: flex; gap: 6px; align-items: stretch; }
.input-group input { flex: 1; }
.input-group .icon-btn { height: 46px; width: 46px; border-radius: 6px; border: 1px solid #C9C6D0; }

/* Schalter (Material-Switch) */
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; margin-bottom: 14px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { position: relative; width: 36px; height: 14px; border-radius: 7px; background: #BDBBC4; transition: background .15s; flex: none; margin: 0 4px; }
.switch .track::after { content: ""; position: absolute; left: -4px; top: -3px; width: 20px; height: 20px; border-radius: 50%; background: #FAFAFA; box-shadow: var(--shadow-2); transition: transform .15s, background .15s; }
.switch input:checked + .track { background: var(--switch-track); }
.switch input:checked + .track::after { transform: translateX(20px); background: var(--switch-on); }
.switch input:focus-visible + .track { outline: 3px solid var(--primary-line); outline-offset: 4px; }
.switch .switch-text { font-size: 14.5px; }

/* ---------- Meldungen ---------- */
.flash {
    display: flex; gap: 12px; align-items: flex-start;
    background: var(--surface); border-radius: 8px; box-shadow: var(--shadow-1);
    padding: 12px 16px; margin-bottom: 12px; border-left: 4px solid var(--primary);
}
.flash .icon { color: var(--primary); margin-top: 1px; }
.flash.success { border-left-color: var(--secondary-dark); }
.flash.success .icon { color: var(--secondary-dark); }
.flash.error { border-left-color: var(--error); background: var(--error-soft); }
.flash.error .icon { color: var(--error); }
.flash.warning { border-left-color: #F57C00; background: var(--warn-soft); }
.flash.warning .icon { color: var(--warn); }
.errors { margin: 0; padding-left: 18px; }

/* ---------- Konto-Karten ---------- */
.source-head { display: flex; align-items: flex-start; gap: 12px; }
.source-head .titles { flex: 1; min-width: 0; }
.source-name { font-size: 17px; font-weight: 500; }
.source-addr { color: var(--text-2); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip {
    display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 12px;
    background: var(--primary-soft); color: var(--primary-dark);
    font-size: 11.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; white-space: nowrap;
}
.chip.grey { background: #ECEBEF; color: var(--text-2); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 14px 0 0; font-size: 14px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.status { display: flex; align-items: flex-start; gap: 8px; margin-top: 14px; padding: 10px 12px; border-radius: 8px; background: #F4F3F6; font-size: 14px; }
.status .icon { margin-top: 1px; }
.status.ok .icon { color: var(--secondary-dark); }
.status.error { background: var(--error-soft); }
.status.error .icon { color: var(--error); }
.status.paused .icon { color: var(--text-3); }
.status.init .icon { color: var(--primary); }
.status .msg { overflow-wrap: anywhere; }
.counter { font-size: 13px; color: var(--text-3); }

/* ---------- Leere Zustände / Einstieg ---------- */
.empty { text-align: center; padding: 40px 20px; }
.empty .icon { width: 56px; height: 56px; color: var(--primary-line); }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: step; display: flex; gap: 14px; align-items: flex-start; padding: 10px 0; }
.steps li::before {
    content: counter(step); flex: none; width: 28px; height: 28px; border-radius: 50%;
    background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 500; font-size: 14px;
}
.steps li.done::before { background: var(--secondary); color: var(--on-secondary); content: "✓"; }

/* ---------- Einfache Seiten (Login, Installation) ---------- */
.plain { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 48px 16px; }
.plain-brand { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 500; color: var(--primary); margin-bottom: 24px; }
.plain-brand .icon { width: 32px; height: 32px; }
.plain-card { width: 100%; max-width: 420px; }
.plain-card.wide { max-width: 720px; }
.checklist { list-style: none; padding: 0; margin: 0 0 8px; }
.checklist li { display: flex; gap: 10px; padding: 6px 0; font-size: 14px; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist .ok { color: var(--secondary-dark); }
.checklist .bad { color: var(--error); }
.checklist .warn { color: var(--warn); }
.checklist .hint { display: block; color: var(--text-3); font-size: 12.5px; }

.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0; }
.codes code { background: #F4F3F6; border-radius: 6px; padding: 8px 10px; text-align: center; font-size: 15px; letter-spacing: 1px; }

details summary { cursor: pointer; color: var(--primary); font-weight: 500; font-size: 14px; margin: 8px 0; }
.footer-note { text-align: center; color: var(--text-3); font-size: 12px; margin-top: 24px; }

/* Hilfsklassen (statt Inline-Styles, wegen Content-Security-Policy) */
.mt-0 { margin-top: 0 !important; }
.mt-6 { margin-top: 6px; }
.mt-12 { margin-top: 12px; }
.w-100 { width: 100%; }

/* ---------- Startseite: Bereichs-Kacheln ---------- */
.tiles { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.tile {
    display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius);
    box-shadow: var(--shadow-1); overflow: hidden; color: var(--text); transition: box-shadow .15s, transform .15s;
}
.tile:hover { box-shadow: var(--shadow-3); transform: translateY(-2px); text-decoration: none; }
.tile-head { display: flex; align-items: center; gap: 12px; padding: 22px 22px 18px; }
.tile-head .icon { width: 34px; height: 34px; }
.tile-name { font-size: 20px; font-weight: 500; }
.tile-sub { font-size: 13px; opacity: .85; }
.tile-body { padding: 16px 22px 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; flex: 1; }
.tile-stat { display: flex; justify-content: space-between; gap: 12px; color: var(--text-2); }
.tile-stat strong { color: var(--text); font-weight: 500; }
.tile-collector .tile-head { background: #6200EE; color: #fff; }
.tile-forwarder .tile-head { background: #03DAC5; color: #000; }
.tile-account .tile-head { background: #37474F; color: #fff; }
.tile .status { margin-top: 6px; }

/* Hinweisband Probemodus */
.banner {
    display: flex; gap: 12px; align-items: flex-start; border-radius: 10px; padding: 14px 16px; margin-bottom: 16px;
    background: #F1E9FE; border: 1px solid #D9C7FB; color: #2B0A6B;
}
.banner .icon { color: #6200EE; margin-top: 1px; }
.banner strong { font-weight: 500; }

/* Listen in Karten */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.list li:last-child { border-bottom: 0; }
.list li .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.list li form { margin: 0; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { flex: 1; min-width: 200px; margin-bottom: 0; }

/* Prüfbericht */
.report { width: 100%; border-collapse: collapse; font-size: 14px; }
.report th, .report td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.report th { width: 34%; color: var(--text-2); font-weight: 500; }
.report td { overflow-wrap: anywhere; }
.ok-text { color: var(--secondary-dark); font-weight: 500; }
.bad-text { color: var(--error); font-weight: 500; }
.preview-frame { width: 100%; min-height: 420px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
pre.code { background: #F4F3F6; border-radius: 8px; padding: 12px 14px; overflow-x: auto; font-size: 13px; line-height: 1.5; white-space: pre-wrap; margin: 8px 0 12px; }
