@media screen and (max-width: 1199px) {
  /* 1. Hauptcontainer elastisch einmitten und Padding reduzieren */
  .container, 
  [class*="container-"], 
  main, 
  #dashboard-wrapper {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    box-sizing: border-box;
  }

  /* 2. Globaler Base-Font-Reset (skaliert rem-basierte Layouts automatisch) */
  html {
    font-size: 14px !important; /* Standard ist meist 16px */
  }

  /* 3. Aggressivere Verkleinerung für große Überschriften */
  h1, .h1 { font-size: 2rem !important; margin-bottom: 1rem !important; }
  h2, .h2 { font-size: 1.6rem !important; }
  h3, .h3 { font-size: 1.3rem !important; }

  /* 4. Flexbox- und Grid-Karten kompakter machen */
  .row, .grid {
    margin-left: -8px !important;
    margin-right: -8px !important;
  }
  
  .col, [class*="col-"], .card {
    padding-left: 8px !important;
    padding-right: 8px !important;
    margin-bottom: 12px !important;
  }

  /* 5. Padding in Dashboards/Karten reduzieren, um Viewport-Höhe zu sparen */
  .card-body, .panel, .widget {
    padding: 12px !important;
  }

  /* 6. Tabellen-Überlauf sichern (falls große Datenlisten vorhanden) */
  table {
    font-size: 0.9rem !important;
  }
  .table-responsive-tablet {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
}


/* --- BASIS-STYLING (Dark Mode) --- */
body {
    background-color: #0d1117;
    color: #e2e8f0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
}

.dashboard-container {
    padding: 1rem;
}

/* --- ÜBERSCHRIFT-STYLING --- */
.dashboard-header {
    padding: 1rem 0 1.5rem 0;
    border-bottom: 1px solid #2d3748;
    margin-bottom: 1.5rem;
}

.main-title {
    font-size: 1.75rem;
    font-weight: 400;
    color: #ffffff;
    margin: 0;
    letter-spacing: -0.025em;
}

/* --- CARD STRUCTURE --- */
.dashboard-card {
    background: #1a202c;
    border: 1px solid #2d3748 !important;
    border-radius: 0.5rem;
    box-shadow: 0 0.4rem 1.5rem rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.card-header {
    background-color: #2d3748 !important;
    border-bottom: 1px solid #4a5568 !important;
    padding: 0.85rem 1.25rem;
    font-weight: 700;
    font-size: 0.95rem;
    color: #e2e8f0;
}

/* Header Akzentfarben */
.weather-accent { color: #63b3ed; }
.cleaning-accent { color: #48bb78; }
.bus-accent { color: #ecc94b; }

.card-body {
    padding: 1.25rem;
}
.card-body.no-padding {
    padding: 0.25rem 0;
}

/* --- WIDGET ZEILEN & FLEX-BOXEN (iPhone Optimiert) --- */
.card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid #2d3748;
    gap: 0.5rem; /* Verhindert Zusammenstoßen auf schmalen Displays */
}

.card-row:last-child {
    border-bottom: none;
}

.row-left-block {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0; /* Erlaubt Text-Truncation falls nötig */
}

/* --- WETTER SPECIFIC --- */
.weather-main-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.weather-temp {
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
}
.weather-desc {
    font-size: 0.9rem;
    color: #63b3ed;
    margin-top: 0.35rem;
    font-weight: 600;
}
.weather-icon-container {
    font-size: 2.75rem;
    color: #cbd5e0;
}
.weather-details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    border-top: 1px solid #2d3748;
    padding-top: 1rem;
}
.weather-detail-item {
    background: #232d3f;
    padding: 0.5rem 0.6rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    display: flex;
    justify-content: space-between;
    border: 1px solid #2d3748;
}
.weather-detail-label { color: #a0aec0; }
.weather-detail-value { color: #f7fafc; font-weight: 600; }

/* --- MÜLL SPECIFIC --- */
.garbage-badge {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.bin-rest { background-color: #718096; border: 1px solid #a0aec0; }
.bin-bio { background-color: #975a16; border: 1px solid #b7791f; }
.bin-papier { background-color: #2b6cb0; border: 1px solid #4299e1; }
.bin-yellow { background-color: #d69e2e; border: 1px solid #ecc94b; }
.bin-gelb { background-color: #d69e2e; border: 1px solid #ecc94b; }
.bin-default { background-color: #4a5568; border: 1px solid #718096; }

/* --- BADGES / LABELS --- */
.badge-value-text {
    color: #cbd5e0;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    white-space: nowrap; /* Verhindert unschöne Zeilenumbrüche im Badge */
}
.date-tomorrow { color: #fc8181; background-color: rgba(229, 62, 62, 0.15); }
.date-day-after { color: #fbd38d; background-color: rgba(221, 107, 32, 0.15); }

/* --- REINIGUNG SPECIFIC --- */
.cleaning-icon {
    width: 28px;
    height: 28px;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.icon-flur { background-color: rgba(66, 153, 225, 0.15); color: #4299e1; }
.icon-treppe { background-color: rgba(159, 122, 234, 0.15); color: #9f7aea; }
.icon-keller { background-color: rgba(237, 137, 54, 0.15); color: #ed8936; }

.cleaning-task-meta {
    font-weight: 600;
    color: #a0aec0;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.cleaning-tenant {
    color: #ffffff;
    font-size: 0.95rem;
    margin-top: 0.1rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cleaning-urgent { color: #fc8181; background-color: rgba(229, 62, 62, 0.15); border: 1px solid rgba(229, 62, 62, 0.2); }

/* --- BUS SPECIFIC --- */
.bus-table {
    width: 100%;
    border-collapse: collapse;
}
.bus-table td {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid #2d3748;
    font-size: 0.85rem;
    vertical-align: middle;
}
.bus-table tr:last-child td { border-bottom: none; }

.bus-badge-line {
    background-color: #4a5568;
    color: #fff;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-weight: 700;
    font-size: 0.8rem;
    white-space: nowrap;
}

.widget-loading {
    text-align: center;
    padding: 2rem 0;
    color: #a0aec0;
    font-style: italic;
    font-size: 0.85rem;
}




#gas-prices-table th {
    font-size: 0.85rem; /* Standard ist meist 1rem */
    font-weight: 600;    /* Macht den Text trotz geringerer Größe gut lesbar */
}

 /* Container beansprucht im Querformat/Desktop die doppelte Breite */
    .gas-widget-container {
        background: #ffffff;
        border: 1px solid #e3e6f0;
        border-radius: 0.35rem;
        box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
        margin-bottom: 1.5rem;
        font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
        box-sizing: border-box;
        /* Flex/Grid Integration für dein Dashboard: */
        width: 100%;
        grid-column: span 2; /* Falls du CSS Grid nutzt */
        flex: 0 0 100%;       /* Fallback für Flexbox */
    }

    /* Auf Tablets (Querformat) und Desktops wird es doppelt so breit */
  .gas-widget-container {
        background: #1a202c; /* Dunkler Hintergrund */
        border: 1px solid #2d3748; /* Dezenter, dunkler Rahmen */
        border-radius: 0.35rem;
        box-shadow: 0 0.15rem 1.75rem 0 rgba(0, 0, 0, 0.5);
        margin-bottom: 1.5rem;
        font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
        box-sizing: border-box;
        width: 100%;
        grid-column: span 2; /* Für CSS Grid Layouts */
        flex: 0 0 100%;       /* Fallback für Flexbox */
    }

    /* Auf Tablets (Querformat) und Desktops wird es doppelt so breit */
    @media (min-width: 768px) {
        .gas-widget-container {
            flex: 0 0 calc(66.666% - 1.5rem);
        }
    }

    .gas-widget-header {
        background-color: #2d3748; /* Etwas helleres Grau für den Header */
        border-bottom: 1px solid #4a5568;
        padding: 0.75rem 1.25rem;
        border-top-left-radius: 0.35rem;
        border-top-right-radius: 0.35rem;
    }

    .gas-widget-title {
        margin: 0;
        font-weight: 700;
        color: #63b3ed; /* Angenehmes Hellblau für dunkle Hintergründe */
        font-size: 1rem;
    }

    .gas-widget-body {
        padding: 1.25rem;
        overflow-x: auto;
    }

    .gas-prices-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.9rem;
    }

    .gas-prices-table th {
        font-size: 0.75rem;
        text-transform: uppercase;
        color: #a0aec0; /* Hellerer Text für die Spaltenköpfe */
        background-color: #2d3748;
        padding: 8px;
        border-bottom: 2px solid #4a5568;
        text-align: left;
        letter-spacing: 0.05em;
    }

    .gas-prices-table td {
        padding: 10px 8px;
        border-bottom: 1px solid #2d3748;
        color: #e2e8f0; /* Sehr helles Grau/Weiß für gute Lesbarkeit des Textes */
        vertical-align: middle;
    }

    /* Zeilen-Zebra-Streifen im Dark Mode */
    .gas-prices-table tr:nth-child(even) {
        background-color: #232d3f;
    }

    /* Hilfsklassen für Preise */
    .gas-price-val {
        font-size: 0.85rem;
        font-weight: 700;
        white-space: nowrap;
        color: #f7fafc;
    }
    
    .gas-dist-val {
        font-size: 0.8rem;
        color: #a0aec0;
    }

    /* Status Badges im Dark Mode (etwas gedecktere Farben) */
    .gas-badge {
        display: inline-block;
        padding: 0.25em 0.5em;
        font-size: 75%;
        font-weight: 700;
        line-height: 1;
        text-align: center;
        white-space: nowrap;
        vertical-align: baseline;
        border-radius: 0.25rem;
        color: #fff;
    }
    .gas-badge-open { background-color: #38a169; }   /* Dunkleres Grün */
    .gas-badge-closed { background-color: #e53e3e; } /* Dunkleres Rot */


/* Dark Mode Anpassungen für die Download-Liste */
.dark-mode-list .list-group-item {
    border-color: rgba(255, 255, 255, 0.1) !important; /* Dezente Trennlinie */
}

/* Entfernt unschöne äußere Ränder der Liste */
.dark-mode-list .list-group-item:first-child {
    border-top: 0;
}
.dark-mode-list .list-group-item:last-child {
    border-bottom: 0;
}

/* Text-Styling für exakte Lesbarkeit */
.download-text {
    color: #f7fafc !important;
    font-size: 0.95rem;
}

/* Button-Styling passend zum Dashboard */
.download-btn {
    background-color: #4e73df;
    border-color: #4e73df;
    transition: all 0.2s ease;
}

.download-btn:hover {
    background-color: #2e59d9;
    border-color: #2653d4;
}


/* --- RESPONSIVE MEDIA QUERIES (iPhone-Feinschliff) --- */
@media (max-width: 576px) {
    body { padding: 0.5rem; }
    .main-title { font-size: 1.5rem; }
    .card-header { padding: 0.75rem 1rem; }
    .card-row { padding: 0.75rem 1rem; }
    .bus-table td { padding: 0.75rem 1rem; }
}