/* mrvertrieb – Mahn & Rot Vertriebs-App */
:root {
    --red:        #c0261e;
    --red-dark:   #9c1e17;
    --red-light:  #fdecea;
    --ink:        #1b1f24;
    --muted:      #6b7280;
    --line:       #e5e7eb;
    --bg:         #f4f5f7;
    --card:       #ffffff;
    --green:      #1f9d55;
    --amber:      #b7791f;
    --radius:     12px;
    --shadow:     0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04);
    --shadow-lg:  0 10px 30px rgba(16,24,40,.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.5;
}
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Auth ---------- */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2a2d34 0%, #14161a 100%);
    padding: 24px;
}
.auth-card {
    background: var(--card);
    width: 100%;
    max-width: 400px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 36px 32px;
}
.auth-card .brand { text-align: center; margin-bottom: 28px; }
.auth-card .brand .logo {
    font-size: 22px; font-weight: 800; letter-spacing: -.4px;
}
.auth-card .brand .logo .dot { color: var(--red); }
.auth-card .brand .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.input {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 9px;
    font-size: 15px;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.input:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 3px var(--red-light);
}
.field { margin-bottom: 18px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 18px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 15px; font-weight: 600;
    cursor: pointer;
    transition: background .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); text-decoration: none; }
.btn-block { width: 100%; }
.btn-light { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-light:hover { background: #f9fafb; text-decoration: none; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* ---------- App layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: 236px; flex-shrink: 0;
    background: #1b1f24; color: #cbd2da;
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
.sidebar .logo {
    padding: 20px 22px; font-size: 18px; font-weight: 800; color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .logo .dot { color: var(--red); }
.sidebar nav { padding: 12px 10px; flex: 1; }
.sidebar nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; margin-bottom: 2px;
    color: #cbd2da; border-radius: 8px; font-weight: 500; font-size: 14px;
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: var(--red); color: #fff; }
.sidebar nav .group { font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
    color: #6b7280; padding: 14px 12px 6px; }
.sidebar .foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.sidebar .foot .name { color: #fff; font-weight: 600; }
.sidebar .foot .role { color: #8b93a1; font-size: 12px; }

.main { flex: 1; min-width: 0; }
.topbar {
    background: #fff; border-bottom: 1px solid var(--line);
    padding: 14px 28px; display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 700; }
.content { padding: 28px; max-width: 1200px; }

/* ---------- Cards / tiles ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); }
.card-pad { padding: 22px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.tile {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden; cursor: pointer;
    transition: transform .12s, box-shadow .12s; display: block; color: inherit;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); text-decoration: none; }
.tile .bar { height: 6px; }
.tile .body { padding: 18px; }
.tile .body h3 { margin: 0 0 6px; font-size: 16px; }
.tile .body .ind { display: inline-block; font-size: 12px; color: var(--muted);
    background: #f3f4f6; padding: 2px 8px; border-radius: 20px; margin-bottom: 8px; }
.tile .body p { margin: 0; color: var(--muted); font-size: 13px; }
.tile .meta { margin-top: 12px; font-size: 13px; color: var(--red); font-weight: 600; }

/* ---------- Stat cards ---------- */
.welcome { background: linear-gradient(135deg, #1b1f24 0%, #3a1113 100%); color: #fff;
    border-radius: var(--radius); padding: 24px 26px; margin-bottom: 24px; box-shadow: var(--shadow); }
.welcome h2 { margin: 0 0 4px; font-size: 22px; font-weight: 700; letter-spacing: -.3px; }
.welcome p { margin: 0; color: #cbd2da; font-size: 14px; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px 20px; box-shadow: var(--shadow); }
.stat .val { font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.stat .lbl { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---------- Flash ---------- */
.flash { padding: 12px 15px; border-radius: 9px; margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.flash.error   { background: var(--red-light); color: var(--red-dark); border: 1px solid #f3c9c5; }
.flash.success { background: #e9f7ef; color: #1a7f43; border: 1px solid #bfe6cd; }
.flash.info    { background: #eef2ff; color: #3b4ea8; border: 1px solid #cdd6f7; }

.section-title { font-size: 15px; font-weight: 700; margin: 26px 0 12px; color: var(--ink); }
.muted { color: var(--muted); }
.empty { text-align: center; padding: 40px; color: var(--muted); }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table thead th {
    text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px;
    color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fafbfc;
}
.table tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbfc; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions form { display: inline; }

/* ---------- Badges ---------- */
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px;
    background: #eef0f3; color: #4b5563; }
.badge-red   { background: var(--red-light); color: var(--red-dark); }
.badge-green { background: #e9f7ef; color: #1a7f43; }
.badge-gray  { background: #eef0f3; color: #6b7280; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
textarea.input { resize: vertical; font-family: inherit; }
small.muted { display: block; margin-top: 5px; font-size: 12px; }
code { background: #f3f4f6; padding: 1px 6px; border-radius: 5px; font-size: 13px; }
.topbar-actions { display: flex; gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; }

.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }

/* ---------- Radio cards ---------- */
.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 22px; }
.radio-card { border: 2px solid var(--line); border-radius: var(--radius); padding: 16px 18px; cursor: pointer;
    background: #fff; transition: border-color .15s, box-shadow .15s; }
.radio-card:hover { border-color: #cbd2da; }
.radio-card.selected { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-light); }
.radio-card input { position: absolute; opacity: 0; }
.rc-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.rc-desc { color: var(--muted); font-size: 13px; }

@media (max-width: 780px) {
    .form-grid, .cols-2, .radio-cards { grid-template-columns: 1fr; }
    .sidebar { display: none; }
}

/* ---------- Rich Text Editor ---------- */
.rte { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 3px; align-items: center;
    padding: 7px 8px; background: #f9fafb; border-bottom: 1px solid var(--line); }
.rte-btn { border: 1px solid transparent; background: transparent; border-radius: 6px;
    min-width: 30px; height: 30px; padding: 0 8px; cursor: pointer; font-size: 14px; color: var(--ink); }
.rte-btn:hover { background: #eceef1; }
.rte-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.rte-select { height: 30px; border: 1px solid var(--line); border-radius: 6px; background: #fff;
    font-size: 13px; padding: 0 6px; cursor: pointer; margin-left: auto; }
.rte-area { min-height: 260px; padding: 16px 18px; font-size: 15px; line-height: 1.6; outline: none;
    font-family: Montserrat, Arial, Helvetica, sans-serif; }
.rte-area:focus { background: #fff; }
.rte-area h2 { font-size: 20px; margin: .4em 0; }
.rte-area p { margin: .5em 0; }
.rte-area a { color: var(--red); }

.rte-modal-overlay { position: fixed; inset: 0; background: rgba(16,24,40,.5); z-index: 100;
    display: flex; align-items: center; justify-content: center; padding: 20px; }
.rte-modal { background: #fff; border-radius: 14px; padding: 24px; width: 100%; max-width: 440px;
    box-shadow: var(--shadow-lg); }
.rte-modal h3 { margin: 0 0 16px; font-size: 17px; }
.rte-modal label { margin-top: 12px; }
.rte-modal .input { margin-top: 4px; }
.rte-check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.rte-check input { width: 16px; height: 16px; }
.rte-colors { gap: 8px; margin-top: 10px; }
.rte-color { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.rte-color.active { border-color: #1b1f24; box-shadow: 0 0 0 2px #fff inset; }
.rte-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* Vorschau-Rahmen */
.preview-frame { width: 100%; min-height: 480px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.pill-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 8px; background: #f3f4f6; border: 1px solid var(--line);
    border-radius: 20px; padding: 6px 12px; font-size: 13px; }
.pill .rm { cursor: pointer; color: var(--muted); font-weight: 700; }
.att-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line);
    border-radius: 9px; margin-bottom: 8px; }
.att-item .ic { font-size: 20px; }
.att-item .grow { flex: 1; min-width: 0; }
.att-item .sz { color: var(--muted); font-size: 12px; }
.checklist label { display: flex; align-items: center; gap: 10px; padding: 9px 0; font-weight: 500; border-bottom: 1px solid var(--line); }
.checklist label:last-child { border-bottom: none; }
.pool-picker { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.pool-picker summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--red); list-style: none; }
.pool-picker summary::-webkit-details-marker { display: none; }
.pool-picker summary::before { content: '＋ '; }
.pool-picker[open] summary::before { content: '－ '; }
.bignum { font-size: 15px; }
.hint { background: #fffbeb; border: 1px solid #fde68a; color: #92610a; padding: 12px 15px; border-radius: 9px; font-size: 13px; margin-bottom: 16px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 10px 16px; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--red); border-bottom-color: var(--red); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
