/* W5 – Meldungen & Benachrichtigungen. Nutzt Design-Tokens aus theme.css (mit Fallbacks). */

.mld-fab {
    position: fixed;
    left: 12px;   /* rechts sitzt der „+ Pin“-Knopf (fab-add), Mitte die Orts-Anzahl */
    bottom: calc(var(--bottomnav-height, 58px) + 14px + env(safe-area-inset-bottom, 0px));
    z-index: 1200;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: var(--touch, 48px);
    padding: 0 18px 0 14px;
    border: 0;
    border-radius: var(--r-pill, 999px);
    background: var(--c-accent, #E65100);
    color: #fff;
    font: 600 var(--fs-md, 15px)/1 var(--font, system-ui, sans-serif);
    box-shadow: var(--sh-2, 0 4px 14px rgba(0, 0, 0, .25));
    cursor: pointer;
}
.mld-fab[hidden] { display: none; }
.mld-fab-plus { font-size: 20px; line-height: 1; }
.mld-fab-badge {
    position: absolute; top: -6px; right: -4px;
    min-width: 22px; height: 22px; padding: 0 6px;
    border-radius: 11px; background: var(--c-danger, #C62828); color: #fff;
    font-size: 12px; line-height: 22px; text-align: center; box-shadow: 0 0 0 2px #fff;
}
.mld-fab-badge[hidden] { display: none; }
body.mld-open .mld-fab { display: none; }
/* Platz unter dem letzten Listeneintrag, damit der Melden-Knopf nichts verdeckt */
body:not(.mld-open) .panel-body { padding-bottom: 84px; }

.mld-overlay {
    position: fixed; inset: 0; z-index: 2800;
    background: rgba(0, 0, 0, .35);
    display: flex; justify-content: center; align-items: stretch;
}
.mld-overlay[hidden] { display: none; }
.mld-sheet {
    width: 100%; max-width: 640px; min-width: 0;
    background: var(--c-bg, #F5F7F8);
    display: flex; flex-direction: column;
    height: 100%; height: 100dvh;
    box-sizing: border-box;
    padding-top: env(safe-area-inset-top, 0px);
}
.mld-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: var(--sp-3, 12px) var(--sp-4, 16px);
    background: var(--bg-header, var(--c-primary, #1B5E20)); color: #fff;
}
.mld-head h2 { margin: 0; font-size: var(--fs-lg, 18px); }
.mld-close {
    width: var(--touch, 44px); height: var(--touch, 44px); flex: 0 0 auto;
    border: 0; border-radius: var(--r-md, 10px); background: rgba(255, 255, 255, .15);
    color: #fff; font-size: 20px; cursor: pointer;
}
.mld-tabs {
    display: flex; gap: 4px; padding: 6px 8px 0;
    background: var(--c-surface, #fff); border-bottom: 1px solid var(--c-line, #E0E0E0);
    overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
.mld-tab {
    flex: 1 1 auto; min-width: 0; white-space: nowrap;
    min-height: 44px; padding: 0 12px; border: 0; background: none;
    border-bottom: 3px solid transparent; color: var(--c-text-2, #555);
    font: 600 var(--fs-sm, 14px) var(--font, system-ui, sans-serif); cursor: pointer;
}
.mld-tab[data-tab="push"] { flex: 0 0 auto; }
.mld-tab.active { color: var(--c-primary, #1B5E20); border-bottom-color: var(--c-primary, #1B5E20); }
.mld-count {
    display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px;
    background: var(--c-danger, #C62828); color: #fff; font-size: 12px; line-height: 20px;
}
.mld-body {
    flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: var(--sp-4, 16px); padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
}

/* Formular */
.mld-form { display: flex; flex-direction: column; gap: 6px; }
.mld-label { margin-top: 10px; font-weight: 600; font-size: var(--fs-sm, 14px); color: var(--c-text, #222); }
.mld-input {
    width: 100%; max-width: 100%; box-sizing: border-box; min-height: 44px;
    padding: 10px 12px; border: 1px solid var(--c-line, #CFD8DC); border-radius: var(--r-md, 10px);
    background: var(--c-surface, #fff); color: var(--c-text, #222);
    font: var(--fs-md, 15px) var(--font, system-ui, sans-serif);
}
textarea.mld-input { resize: vertical; min-height: 80px; }
.mld-input:focus { outline: 2px solid var(--c-primary, #1B5E20); outline-offset: 1px; }
.mld-hint { margin: 4px 0; color: var(--c-text-2, #555); font-size: var(--fs-sm, 14px); overflow-wrap: anywhere; }
.mld-note {
    margin: 8px 0; padding: 10px 12px; border-radius: var(--r-md, 10px);
    background: var(--c-warn-soft, #FFF8E1); color: var(--c-text, #222); font-size: var(--fs-sm, 14px);
}
.mld-error {
    margin: 6px 0; padding: 10px 12px; border-radius: var(--r-md, 10px);
    background: var(--c-danger-soft, #FFEBEE); color: var(--c-danger, #C62828); font-size: var(--fs-sm, 14px);
}
.mld-error[hidden] { display: none; }
.mld-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.mld-seg button {
    min-width: 0; min-height: 44px; border: 2px solid var(--c-line, #CFD8DC);
    border-radius: var(--r-md, 10px); background: var(--c-surface, #fff); color: var(--c-text, #222);
    font: 600 var(--fs-sm, 14px) var(--font, system-ui, sans-serif); cursor: pointer;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mld-seg button.active {
    border-color: var(--c-primary, #1B5E20); background: var(--c-primary-soft, #E8F5E9);
    color: var(--c-primary-dark, #1B5E20);
}
.mld-target-box { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.mld-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.mld-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.mld-posinfo { font-size: var(--fs-sm, 14px); color: var(--c-ok, #2E7D32); }
.mld-posinfo[hidden], .mld-minimap[hidden] { display: none; }
.mld-minimap { height: 220px; border-radius: var(--r-md, 10px); overflow: hidden; border: 1px solid var(--c-line, #CFD8DC); }
.mld-file {
    display: flex; align-items: center; min-height: 44px; padding: 0 12px;
    border: 1px dashed var(--c-line, #B0BEC5); border-radius: var(--r-md, 10px);
    background: var(--c-surface, #fff); cursor: pointer; overflow: hidden;
}
.mld-file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.mld-file span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mld-submit { margin-top: 16px; }

/* Knöpfe */
.mld-btn {
    min-width: 0; min-height: 44px; padding: 0 14px;
    border: 1px solid transparent; border-radius: var(--r-md, 10px);
    font: 600 var(--fs-sm, 14px) var(--font, system-ui, sans-serif); cursor: pointer;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mld-btn.primary { background: var(--c-primary, #1B5E20); color: #fff; }
.mld-btn.ok { background: var(--c-ok, #2E7D32); color: #fff; }
.mld-btn.ghost { background: var(--c-surface, #fff); border-color: var(--c-line, #CFD8DC); color: var(--c-text, #222); }
.mld-btn.small { min-height: 36px; padding: 0 10px; }
.mld-btn:disabled { opacity: .6; cursor: default; }
.mld-link {
    border: 0; background: none; padding: 0; color: var(--c-link, #1565C0);
    text-decoration: underline; font: inherit; cursor: pointer;
}

/* Listen */
.mld-listbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 10px; }
.mld-listbar .mld-btn { margin-left: auto; }
.mld-check { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm, 14px); min-height: 36px; }
.mld-list { display: flex; flex-direction: column; gap: 10px; }
.mld-empty { text-align: center; color: var(--c-text-3, #777); padding: 24px 0; }
.mld-card {
    min-width: 0; padding: 12px; border-radius: var(--r-lg, 14px);
    background: var(--c-surface, #fff); box-shadow: var(--sh-1, 0 1px 3px rgba(0, 0, 0, .12));
    border-left: 4px solid var(--c-warn, #F9A825);
}
.mld-card.st-in_arbeit { border-left-color: var(--c-link, #1565C0); }
.mld-card.st-erledigt { border-left-color: var(--c-ok, #2E7D32); opacity: .8; }
.mld-card.focus { outline: 3px solid var(--c-accent, #E65100); }
.mld-card-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.mld-card-title { margin: 0; font-size: var(--fs-md, 15px); overflow-wrap: anywhere; }
.mld-status {
    padding: 3px 10px; border-radius: var(--r-pill, 999px); font-size: var(--fs-xs, 12px); font-weight: 700;
    white-space: nowrap; background: var(--c-warn-soft, #FFF8E1); color: #8D6E00;
}
.mld-status.st-in_arbeit { background: var(--c-link-soft, #E3F2FD); color: var(--c-link, #1565C0); }
.mld-status.st-erledigt { background: var(--c-ok-soft, #E8F5E9); color: var(--c-ok, #2E7D32); }
.mld-sender { margin-top: 4px; font-size: var(--fs-sm, 14px); color: var(--c-text, #222); overflow-wrap: anywhere; }
.mld-desc { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-sm, 14px); }
.mld-meta { margin-top: 6px; color: var(--c-text-3, #666); font-size: var(--fs-xs, 12px); overflow-wrap: anywhere; }
.mld-thumb { display: block; margin-top: 8px; max-width: 100%; max-height: 180px; border-radius: var(--r-md, 10px); object-fit: cover; }
.mld-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mld-actions .mld-btn { flex: 1 1 auto; }
.mld-assign { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; margin-top: 8px; }
.mld-assign[hidden] { display: none; }

/* Push-Einstellungen */
.mld-push h3 { margin: 0 0 6px; font-size: var(--fs-md, 15px); }
.mld-switch {
    display: flex; align-items: center; gap: 10px; min-height: 48px; margin: 10px 0;
    padding: 0 12px; border-radius: var(--r-md, 10px); background: var(--c-surface, #fff);
    border: 1px solid var(--c-line, #CFD8DC); font-weight: 600;
}
.mld-switch input { width: 22px; height: 22px; flex: 0 0 auto; }
