* {
    box-sizing: border-box;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    margin: 0;
}

/* =========================================
   1. EKRAN LOGOWANIA (CIEMNY / CZARNY)
   ========================================= */
.login-body {
    background: #0a0a0c;
    color: #e5e7eb;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-box {
    background: #141418;
    border: 1px solid #26262e;
    padding: 36px 32px;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7);
    width: 100%;
    max-width: 360px;
}

.login-box h2 {
    margin: 0 0 24px;
    text-align: center;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #ffffff;
}

.login-box label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: #9ca3af;
}

.login-box input {
    width: 100%;
    padding: 11px 12px;
    margin-bottom: 18px;
    background: #0d0d10;
    border: 1px solid #2e2e38;
    border-radius: 6px;
    color: #ffffff;
    font-size: 14px;
}

.login-box input:focus {
    outline: none;
    border-color: #40916c;
}

.login-box button {
    width: 100%;
    padding: 11px;
    background: #2d6a4f;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.login-box button:hover {
    background: #40916c;
}

/* =========================================
   2. PANEL ADMINISTRACYJNY (MOTYW ROŚLINNY)
   ========================================= */
.admin-body {
    background: #f0f5f1;
    color: #1b2e22;
}

.topbar {
    background: #1b4332;
    color: #e9f5ec;
    padding: 14px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(27, 67, 50, 0.2);
}

.brand {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.logout-btn {
    margin-left: 16px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.12);
    color: #d8f3dc;
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

.layout {
    display: flex;
    min-height: calc(100vh - 54px);
}

.sidebar {
    width: 230px;
    background: #ffffff;
    border-right: 1px solid #d8e6dc;
    padding: 20px 0;
}

.sidebar a {
    display: block;
    padding: 13px 24px;
    color: #344e41;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.15s;
}

.sidebar a:hover, .sidebar a.active {
    background: #e9f5ec;
    color: #1b4332;
    border-right: 4px solid #2d6a4f;
    font-weight: 600;
}

.content {
    flex: 1;
    padding: 28px 32px;
}

.content h1 {
    margin-top: 0;
    margin-bottom: 24px;
    color: #1b4332;
    font-size: 26px;
}

.sub-heading {
    margin-top: 32px;
    margin-bottom: 14px;
    font-size: 18px;
    color: #2d6a4f;
}

/* Zakładka: Ogólne */
.overview-grid {
    display: grid;
    grid-template-columns: minmax(280px, 1.1fr) 1.4fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 900px) {
    .overview-grid {
        grid-template-columns: 1fr;
    }
}

.latest-photo-card {
    background: #ffffff;
    border: 1px solid #d8e6dc;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 4px 12px rgba(27, 67, 50, 0.05);
}

.latest-photo-card h3 {
    margin: 0 0 12px;
    font-size: 15px;
    color: #2d6a4f;
}

.latest-photo-card img {
    width: 100%;
    height: auto;
    max-height: 320px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.photo-date {
    margin-top: 12px;
    font-size: 13px;
    color: #52796f;
}

.params-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.param-card {
    background: #ffffff;
    border: 1px solid #d8e6dc;
    border-radius: 12px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(27, 67, 50, 0.05);
}

.param-card.highlight {
    background: #d8f3dc;
    border-color: #95d5b2;
}

.param-label {
    font-size: 14px;
    color: #52796f;
    font-weight: 500;
}

.param-value {
    font-size: 28px;
    font-weight: 700;
    color: #1b4332;
}

/* Zakładka: Galeria */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
}

.gallery-item {
    background: #ffffff;
    border: 1px solid #d8e6dc;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(27, 67, 50, 0.05);
}

.gallery-item img {
    width: 100%;
    height: 170px;
    object-fit: cover;
    display: block;
}

.gallery-item .caption {
    padding: 10px 14px;
    color: #52796f;
    font-size: 13px;
}

/* Zakładka: Dziennik zdarzeń & Tabele */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border: 1px solid #d8e6dc;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(27, 67, 50, 0.05);
}

.data-table th, .data-table td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid #e6f0e9;
}

.data-table th {
    background: #e9f5ec;
    color: #1b4332;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    display: inline-block;
}

.badge.motion  { background: #fee2e2; color: #b91c1c; }
.badge.water   { background: #dbeafe; color: #1d4ed8; }
.badge.photo   { background: #d8f3dc; color: #1b4332; }
.badge.pending { background: #fef3c7; color: #b45309; }
.badge.done    { background: #d8f3dc; color: #1b4332; }

/* Zakładka: Zarządzanie */
.control-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.control-card {
    background: #ffffff;
    border: 1px solid #d8e6dc;
    border-radius: 12px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 4px 12px rgba(27, 67, 50, 0.05);
}

.control-card h3 {
    margin: 0 0 8px;
    color: #1b4332;
}

.control-card p {
    margin: 0 0 18px;
    font-size: 14px;
    color: #52796f;
    line-height: 1.4;
}

.btn-action {
    width: 100%;
    padding: 11px;
    background: #2d6a4f;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-action:hover {
    background: #1b4332;
}

.btn-water {
    background: #0284c7;
}

.btn-water:hover {
    background: #0369a1;
}

/* Alerty i puste stany */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

/* =========================================
   SEKCJE DOLNE: PODLEWANIE + ZASILANIE
   ========================================= */
.bottom-sections-grid {
    margin-top: 32px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    align-items: stretch;
}

@media (max-width: 1050px) {
    .bottom-sections-grid {
        grid-template-columns: 1fr;
    }
}

.sub-section {
    display: flex;
    flex-direction: column;
}

.sub-section h2 {
    margin: 0 0 14px;
    font-size: 20px;
    color: #1b4332;
}

.status-card {
    background: #ffffff;
    border: 1px solid #d8e6dc;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex: 1;
    box-shadow: 0 4px 12px rgba(27, 67, 50, 0.05);
}

.status-info {
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
}

.stat-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-max {
    font-size: 15px;
    font-weight: 500;
    color: #748c7e;
}

.text-danger {
    color: #b91c1c !important;
}

.compact-alert {
    margin: 4px 0 0;
    padding: 8px 12px;
    font-size: 13px;
}

.badge.charging {
    background: #fef3c7;
    color: #b45309;
}

/* Graficzny zbiornik */
.visual-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.water-tank {
    position: relative;
    width: 105px;
    height: 165px;
    border: 3px solid #2d6a4f;
    border-top: 3px dashed #748c7e;
    border-radius: 6px 6px 14px 14px;
    background: #f0f5f1;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.06);
}

.water-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
    transition: height 0.5s ease;
}

.water-fill.low {
    background: linear-gradient(180deg, #f87171 0%, #dc2626 100%);
}

.tank-scale {
    position: absolute;
    inset: 6px 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 2;
    pointer-events: none;
}

.tank-scale span {
    font-size: 10px;
    font-weight: 700;
    color: #1b2e22;
    text-shadow: 0 0 4px rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(27, 46, 34, 0.18);
    width: 32px;
}

/* Graficzna bateria (akumulator 12V) */
.battery-wrapper {
    gap: 14px;
    min-width: 155px;
}

.battery-graphic {
    display: flex;
    align-items: center;
}

.battery-body {
    position: relative;
    width: 132px;
    height: 70px;
    border: 4px solid #1b2e22;
    border-radius: 10px;
    background: #f0f5f1;
    padding: 4px;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.battery-terminal {
    width: 10px;
    height: 28px;
    background: #1b2e22;
    border-radius: 0 5px 5px 0;
    margin-left: 2px;
}

.battery-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s ease;
}

/* Kolory poziomu naładowania */
.battery-fill.level-high {
    background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
}

.battery-fill.level-medium {
    background: linear-gradient(90deg, #facc15 0%, #eab308 100%);
}

.battery-fill.level-low {
    background: linear-gradient(90deg, #f87171 0%, #dc2626 100%);
}

/* Ikona błyskawicy na baterii podczas ładowania */
.charging-bolt-overlay {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    fill: #ffffff;
    stroke: #1b2e22;
    stroke-width: 1.8;
    stroke-linejoin: round;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
    z-index: 2;
}

.charging-info {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
}

.charging-icon {
    font-size: 15px;
}

@media (max-width: 550px) {
    .status-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .visual-wrapper {
        width: 100%;
        padding-top: 8px;
    }
}

/* =========================================
   SEKCJA: PROGNOZA POGODY (7 DNI)
   ========================================= */
.weather-section {
    margin-top: 32px;
}

.weather-section h2 {
    margin: 0 0 14px;
    font-size: 20px;
    color: #1b4332;
}

.weather-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 14px;
}

@media (max-width: 1200px) {
    .weather-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}

.weather-card {
    background: #ffffff;
    border: 1px solid #d8e6dc;
    border-radius: 12px;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(27, 67, 50, 0.05);
}

.weather-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.weather-day {
    font-weight: 700;
    font-size: 15px;
    color: #1b4332;
}

.weather-date {
    font-size: 12px;
    color: #748c7e;
}

.weather-icon {
    font-size: 36px;
    line-height: 1.1;
    margin: 4px 0;
}

.weather-desc {
    font-size: 12px;
    color: #52796f;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.weather-temps {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
    padding-top: 6px;
    border-top: 1px solid #e6f0e9;
    font-size: 13px;
}

.temp-day {
    font-weight: 700;
    color: #1b2e22;
}

.temp-night {
    color: #52796f;
}

.weather-rain {
    margin-top: 2px;
    font-size: 12px;
    font-weight: 600;
    color: #0284c7;
    background: #e0f2fe;
    padding: 3px 10px;
    border-radius: 12px;
}

.alert.error { background: #3b1219; color: #fca5a5; border: 1px solid #7f1d1d; }
.alert.success { background: #d8f3dc; color: #1b4332; border: 1px solid #95d5b2; }
.empty-state { color: #748c7e; font-style: italic; }

/* =========================================
   ZAKŁADKA: GROWLOG (DZIENNIK WZROSTU)
   ========================================= */
.hidden {
    display: none !important;
}

.growlog-timeline {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding-left: 24px;
    border-left: 3px solid #95d5b2;
}

.growlog-card {
    position: relative;
    background: #ffffff;
    border: 1px solid #d8e6dc;
    border-radius: 14px;
    padding: 20px 22px;
    box-shadow: 0 4px 12px rgba(27, 67, 50, 0.05);
}

/* Zielony punkt na osi czasu */
.growlog-card::before {
    content: "";
    position: absolute;
    left: -34px;
    top: 24px;
    width: 14px;
    height: 14px;
    background: #2d6a4f;
    border: 3px solid #d8f3dc;
    border-radius: 50%;
}

.growlog-day-badge {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e6f0e9;
}

.day-number {
    font-size: 19px;
    font-weight: 700;
    color: #1b4332;
}

.day-date {
    font-size: 13px;
    font-weight: 600;
    color: #52796f;
    background: #e9f5ec;
    padding: 3px 10px;
    border-radius: 20px;
}

.growlog-body {
    display: flex;
    gap: 22px;
    align-items: flex-start;
}

@media (max-width: 780px) {
    .growlog-body {
        flex-direction: column;
    }
}

/* Miniaturka zdjęcia */
.growlog-thumb {
    position: relative;
    width: 170px;
    height: 170px;
    flex-shrink: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #d8e6dc;
    background: #f0f5f1;
}

.growlog-thumb .zoomable-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: zoom-in;
    transition: transform 0.25s ease;
    display: block;
}

.growlog-thumb:hover .zoomable-img {
    transform: scale(1.05);
}

.zoom-hint {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(27, 67, 50, 0.8);
    color: #ffffff;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
    pointer-events: none;
}

.no-photo {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #748c7e;
    font-size: 13px;
    font-style: italic;
}

/* Parametry i notatka */
.growlog-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
}

.growlog-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.metric-pill {
    background: #f0f5f1;
    border: 1px solid #d8e6dc;
    border-radius: 10px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 135px;
}

.metric-pill span {
    font-size: 12px;
    color: #52796f;
}

.metric-pill strong {
    font-size: 16px;
    color: #1b4332;
}

/* Notatka */
.growlog-note-box {
    background: #f8fbf9;
    border: 1px solid #d8e6dc;
    border-radius: 10px;
    padding: 14px 16px;
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.note-title {
    font-size: 13px;
    font-weight: 700;
    color: #2d6a4f;
}

.btn-note-toggle {
    background: #e9f5ec;
    color: #1b4332;
    border: 1px solid #95d5b2;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-note-toggle:hover {
    background: #d8f3dc;
}

.note-content {
    margin: 0 0 6px;
    font-size: 14px;
    color: #1b2e22;
    line-height: 1.5;
}

.note-author {
    font-size: 11px;
    color: #748c7e;
}

.note-empty {
    margin: 0;
    font-size: 13px;
    color: #748c7e;
    font-style: italic;
}

.note-form {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.note-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #95d5b2;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

.note-form textarea:focus {
    outline: none;
    border-color: #2d6a4f;
}

.note-form-actions {
    display: flex;
    gap: 8px;
}

.btn-save-note {
    background: #2d6a4f;
    color: #ffffff;
    border: none;
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.btn-save-note:hover {
    background: #1b4332;
}

.btn-cancel-note {
    background: #e5e7eb;
    color: #374151;
    border: none;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

/* Lightbox (powiększenie zdjęcia) */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(10, 15, 12, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    text-align: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 10px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
}

#lightbox-caption {
    margin-top: 10px;
    color: #d8f3dc;
    font-size: 14px;
    font-weight: 500;
}

.lightbox-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #ffffff;
    color: #1b4332;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}