/* Melde-Manni Web-Frontend — Apple-inspiriertes Design, optimiert fuer 1280x1024 */

/* === Reset & Basis === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f5f5f7;
    color: #1d1d1f;
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: #0071e3;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* === Header === */
.header {
    background: #fff;
    border-bottom: 1px solid #d2d2d7;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inhalt {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 16px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #1d1d1f;
}

.logo-link:hover {
    text-decoration: none;
}

.logo {
    height: 32px;
    width: auto;
    border-radius: 6px;
}

.app-name {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.header-rechts {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-link {
    font-size: 13px;
    font-weight: 500;
    color: #0071e3;
}

.benutzer-badge {
    background: #e8e8ed;
    color: #1d1d1f;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
}

.abmelden-link {
    font-size: 13px;
    color: #86868b;
}

/* === Schweregrad-Navigation === */
.schweregrad-nav {
    background: #fff;
    border-bottom: 1px solid #d2d2d7;
    position: sticky;
    top: 48px;
    z-index: 99;
}

.nav-inhalt {
    max-width: 1240px;
    margin: 0 auto;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.nav-buttons {
    display: flex;
    gap: 4px;
}

.nav-btn {
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 16px;
    text-decoration: none;
    color: #1d1d1f;
    background: #f5f5f7;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-btn:hover {
    background: #e8e8ed;
    text-decoration: none;
}

.nav-btn.aktiv {
    background: #1d1d1f;
    color: #fff;
}

.nav-btn.aktiv .nav-count {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.nav-count {
    background: #e8e8ed;
    color: #86868b;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
}

.nav-kritisch.aktiv { background: #e74c3c; }
.nav-hoch.aktiv { background: #e67e22; }
.nav-mittel.aktiv { background: #f39c12; }
.nav-info.aktiv { background: #3498db; }

.nav-rechts {
    display: flex;
    align-items: center;
    gap: 8px;
}

.limit-dropdown select {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #d2d2d7;
    border-radius: 6px;
    background: #f5f5f7;
    font-family: inherit;
    cursor: pointer;
}

/* === Inhalt === */
.inhalt {
    max-width: 1240px;
    margin: 0 auto;
    padding: 16px;
    width: 100%;
    flex: 1;
}

/* === Footer === */
.footer {
    text-align: center;
    padding: 16px;
    color: #86868b;
    font-size: 12px;
    border-top: 1px solid #d2d2d7;
    background: #fff;
    margin-top: auto;
}

/* === Flash-Nachrichten === */
.flash {
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 500;
}

.flash-erfolg {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash-fehler {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.flash-warnung {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* === Seiten-Header === */
.seiten-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.seiten-header h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.header-links {
    display: flex;
    align-items: center;
    gap: 12px;
}

.zurueck-link {
    font-size: 14px;
    color: #0071e3;
    font-weight: 500;
}

.anzahl-badge {
    font-weight: 400;
    color: #86868b;
    font-size: 18px;
}

/* === Zeitraum-Buttons === */
.zeitraum-buttons {
    display: flex;
    gap: 4px;
}

.btn-zeit {
    padding: 5px 14px;
    font-size: 13px;
    border-radius: 16px;
    background: #e8e8ed;
    color: #1d1d1f;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.15s;
    display: inline-block;
    text-decoration: none;
}

.btn-zeit:hover {
    background: #d2d2d7;
    text-decoration: none;
}

.btn-zeit.aktiv {
    background: #0071e3;
    color: #fff;
}

/* === Karten === */
.karte {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 16px;
    margin-bottom: 16px;
}

.karte-titel {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: -0.2px;
}

/* === Zaehler-Karten (Dashboard) === */
.karten-reihe {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.zaehler-karte {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 20px 16px;
    text-align: center;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    border-bottom: 3px solid transparent;
}

.zaehler-karte:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    text-decoration: none;
}

.zaehler-wert {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1;
}

.zaehler-label {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.karte-kritisch {
    border-bottom-color: #e74c3c;
}
.karte-kritisch .zaehler-wert { color: #e74c3c; }
.karte-kritisch .zaehler-label { color: #c0392b; }

.karte-hoch {
    border-bottom-color: #e67e22;
}
.karte-hoch .zaehler-wert { color: #e67e22; }
.karte-hoch .zaehler-label { color: #d35400; }

.karte-mittel {
    border-bottom-color: #f39c12;
}
.karte-mittel .zaehler-wert { color: #f39c12; }
.karte-mittel .zaehler-label { color: #e67e22; }

.karte-info {
    border-bottom-color: #3498db;
}
.karte-info .zaehler-wert { color: #3498db; }
.karte-info .zaehler-label { color: #2980b9; }

/* === Tabellen === */
.tabelle-wrapper {
    overflow-x: auto;
}

.datentabelle {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.datentabelle thead th {
    background: #f5f5f7;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #86868b;
    border-bottom: 1px solid #d2d2d7;
    white-space: nowrap;
    user-select: none;
}

.datentabelle.sortierbar thead th {
    cursor: pointer;
}

.datentabelle.sortierbar thead th:hover {
    color: #1d1d1f;
}

.datentabelle.sortierbar thead th.sortiert-auf::after {
    content: " \25B2";
}

.datentabelle.sortierbar thead th.sortiert-ab::after {
    content: " \25BC";
}

.datentabelle tbody tr {
    border-bottom: 1px solid #f0f0f2;
    height: 36px;
}

.datentabelle tbody tr:nth-child(even) {
    background: #fafafa;
}

.datentabelle tbody tr:hover {
    background: #f0f0f5;
}

.datentabelle td {
    padding: 6px 12px;
    vertical-align: middle;
}

.datum-zelle {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: #86868b;
    font-size: 12px;
}

.betreff-zelle {
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zeile-inaktiv {
    opacity: 0.5;
}

.aktionen-zelle {
    white-space: nowrap;
    display: flex;
    gap: 4px;
}

.leer-text {
    color: #86868b;
    font-size: 14px;
    padding: 20px 0;
    text-align: center;
}

/* === Badges === */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-kritisch {
    background: #fde8e8;
    color: #e74c3c;
}

.badge-hoch {
    background: #fef0e0;
    color: #e67e22;
}

.badge-mittel {
    background: #fef7e0;
    color: #d68910;
}

.badge-info {
    background: #e8f4fd;
    color: #2980b9;
}

/* === Servername (klickbar fuer Schweregrad-Aenderung) === */
.server-name {
    font-weight: 600;
    color: #0071e3;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.1s;
}

.server-name:hover {
    background: #e8f4fd;
}

/* === Schweregrad-Dropdown === */
.dropdown-menu {
    position: fixed;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px;
    z-index: 200;
    min-width: 160px;
}

.dropdown-titel {
    font-size: 11px;
    font-weight: 600;
    color: #86868b;
    padding: 4px 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.dropdown-option {
    display: block;
    width: 100%;
    padding: 6px 12px;
    border: none;
    background: none;
    text-align: left;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.1s;
}

.dropdown-option:hover {
    background: #f5f5f7;
}

.option-kritisch { color: #e74c3c; }
.option-hoch { color: #e67e22; }
.option-mittel { color: #d68910; }
.option-info { color: #2980b9; }

.versteckt {
    display: none !important;
}

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    background: #fff;
    color: #1d1d1f;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover {
    background: #f5f5f7;
    text-decoration: none;
}

.btn-primaer {
    background: #0071e3;
    color: #fff;
    border-color: #0071e3;
}

.btn-primaer:hover {
    background: #0062cc;
}

.btn-warnung {
    color: #e74c3c;
    border-color: #e74c3c;
}

.btn-warnung:hover {
    background: #fde8e8;
}

.btn-erfolg {
    color: #27ae60;
    border-color: #27ae60;
}

.btn-erfolg:hover {
    background: #d4edda;
}

.btn-klein {
    padding: 3px 10px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-voll {
    width: 100%;
    text-align: center;
}

/* === Login === */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 120px);
}

.login-karte {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 32px;
    width: 340px;
    text-align: center;
}

.login-logo {
    height: 56px;
    width: auto;
    border-radius: 12px;
    margin-bottom: 12px;
}

.login-titel {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 24px;
    letter-spacing: -0.3px;
}

/* === Formulare === */
.formular-gruppe {
    margin-bottom: 14px;
    text-align: left;
}

.formular-gruppe label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #86868b;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.formular-gruppe input[type="text"],
.formular-gruppe input[type="email"],
.formular-gruppe input[type="password"] {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    background: #f5f5f7;
    transition: border-color 0.15s, background 0.15s;
    font-family: inherit;
}

.formular-gruppe input:focus {
    outline: none;
    border-color: #0071e3;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.formular-checkbox {
    display: flex;
    align-items: center;
}

.formular-checkbox label {
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: none;
    font-size: 13px;
    color: #1d1d1f;
    cursor: pointer;
}

.formular-reihe {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.formular-reihe .formular-gruppe {
    flex: 1;
    min-width: 140px;
    margin-bottom: 0;
}

.formular-reihe .formular-checkbox {
    min-width: auto;
    flex: 0;
}

/* === Betreff-Link (klickbar fuer Detail) === */
.betreff-link {
    color: #1d1d1f;
    text-decoration: none;
}

.betreff-link:hover {
    color: #0071e3;
    text-decoration: underline;
}

/* === Kunde-Trigger (klickbar fuer Zuordnung) === */
.kunde-trigger {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.1s;
    color: #0071e3;
    font-weight: 500;
}

.kunde-trigger:hover {
    background: #e8f4fd;
}

/* === Kunden-Dropdown Suchfeld === */
.dropdown-search {
    padding: 4px;
}

.dropdown-input {
    width: 100%;
    padding: 5px 8px;
    font-size: 13px;
    border: 1px solid #d2d2d7;
    border-radius: 6px;
    font-family: inherit;
    background: #f5f5f7;
}

.dropdown-input:focus {
    outline: none;
    border-color: #0071e3;
    background: #fff;
}

.dropdown-neu {
    border-bottom: 1px solid #f0f0f2;
    padding-bottom: 4px;
    margin-bottom: 4px;
}

#kunden-liste {
    max-height: 200px;
    overflow-y: auto;
}

/* Dropdown absolute statt fixed fuer Scroll-Kompatibilitaet */
.dropdown-menu {
    position: absolute;
}

/* === Nachricht-Detail === */
.nachricht-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.meta-reihe {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 4px 0;
}

.meta-label {
    font-size: 12px;
    font-weight: 600;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    min-width: 120px;
}

.nachricht-betreff {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.6;
    word-break: break-word;
}

.nachricht-body {
    font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    background: #f5f5f7;
    padding: 12px;
    border-radius: 8px;
    max-height: 600px;
    overflow-y: auto;
}

/* === Schweregrad-Badge als Trigger === */
.badge.schweregrad-trigger {
    cursor: pointer;
    transition: transform 0.1s;
}

.badge.schweregrad-trigger:hover {
    transform: scale(1.1);
}

/* === Seiten-Header mit Aktion rechts === */
.seiten-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.header-rechts-aktion {
    flex-shrink: 0;
}

/* === Formulare (breit) === */
.formular-breit {
    width: 100%;
}

.formular-breit textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d2d2d7;
    border-radius: 6px;
    font-family: "SF Mono", "Consolas", "Monaco", monospace;
    font-size: 13px;
    resize: vertical;
}

.formular-breit textarea:focus {
    outline: none;
    border-color: #0071e3;
    box-shadow: 0 0 0 3px rgba(0,113,227,0.15);
}

.hilfe-text {
    font-size: 12px;
    color: #86868b;
    margin-bottom: 8px;
}

.hilfe-text code {
    background: #f0f0f2;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 12px;
}

.import-status {
    margin-left: 12px;
    font-size: 13px;
    color: #86868b;
}

/* === Alarm-Karte === */
.karte-alarm {
    border-left: 4px solid #e74c3c;
}

.alarm-text {
    color: #e74c3c;
    font-weight: 600;
    margin-bottom: 12px;
}

.zeile-alarm {
    background: #fdf0f0 !important;
}

.zeile-alarm:hover {
    background: #fbe3e3 !important;
}
