body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    background: #f4f7fb;
    color: #0f172a;
}

p, h2 {
    margin: 0;
}
.wrap {
    max-width: 100%;
    margin: 0 auto;
    padding: 16px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.topbar a {
    margin-left: 12px;
}

.panel {
    background: #fff;
    border: 1px solid #dbe1ea;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
}

.charts-header {
    padding: 6px 8px;
}

.charts-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.progress-wrap {
    flex: 1;
}

.dashboard-summary {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    line-height: 1.25;
}

.summary-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    min-width: 0;
}

.summary-row p,
.summary-row div {
    margin: 0;
}

.summary-row .muted,
.summary-row.muted {
    color: #475569;
}

#status {
    min-width: 220px;
    flex: 1;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
}

input[type="text"],
input[type="password"],
input[type="number"] {
    width: 100%;
    box-sizing: border-box;
    padding: 8px;
    margin-top: 4px;
    border: 1px solid #c8d2e1;
    border-radius: 6px;
}

button {
    margin-top: 10px;
    padding: 8px 12px;
    border: 1px solid #0f766e;
    background: #0f766e;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
}

.grid-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 8px;
    margin: 8px 0 12px;
}

.filters-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: #f8fafc;
    padding: 8px;
    border-radius: 6px;
}

.sensor-chip {
    margin: 0;
    padding: 4px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #fff;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    line-height: 1;
}

.sensor-chip input {
    margin: 0;
}

.alert {
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.alert.ok {
    background: #dcfce7;
    border: 1px solid #86efac;
}

.alert.err {
    background: #fee2e2;
    border: 1px solid #fca5a5;
}

.muted {
    color: #475569;
}

.icon-btn {
    margin: 0;
    width: 22px;
    height: 22px;
    padding: 0;
    border-radius: 4px;
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

.charts-grid + .panel {
    display: none;
}

.chart-card {
    background: #fff;
    border: 1px solid #dbe1ea;
    border-radius: 8px;
    padding: 8px;
    min-width: 0;
    cursor: zoom-in;
}

.chart-title {
    margin: 0 0 6px;
    font-size: 13px;
    line-height: 1.2;
}

.chart-box {
    position: relative;
    width: 100%;
    height: 180px;
}

.chart-box canvas {
    width: 100% !important;
    height: 100% !important;
}

.log {
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    font-size: 12px;
    line-height: 1.4;
}

.table-wrap {
    overflow-x: auto;
}

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

.status-table th,
.status-table td {
    border-bottom: 1px solid #e2e8f0;
    padding: 8px;
    text-align: left;
    vertical-align: top;
}

.status-table th {
    background: #f8fafc;
    font-weight: 600;
}

.status-table tr.is-problem {
    background: #fff7ed;
}

.cell-log {
    margin: 0;
    white-space: pre-wrap;
    font-family: inherit;
    font-size: 12px;
    line-height: 1.35;
}

.small-btn {
    margin-top: 0;
    padding: 6px 9px;
    font-size: 12px;
}

body.fs-mode .topbar,
body.fs-mode .panel:not(.charts-header),
body.fs-mode #globalFilters {
    display: none !important;
}

body.fs-mode .wrap {
    max-width: none;
    width: 100vw;
    height: 100vh;
    padding: 6px;
    box-sizing: border-box;
}

body.fs-mode .charts-header {
    margin-bottom: 6px;
}

body.fs-mode .charts-grid {
    height: calc(100vh - 70px);
    grid-template-columns: repeat(var(--fs-cols, 3), minmax(0, 1fr));
    grid-template-rows: repeat(var(--fs-rows, 2), minmax(0, 1fr));
    gap: 6px;
    align-items: stretch;
}

body.fs-mode .chart-box {
    height: calc(100% - 22px);
}

.chart-card:fullscreen {
    background: #fff;
    padding: 12px;
    cursor: zoom-out;
}

.chart-card:fullscreen .chart-box {
    height: calc(100vh - 70px);
}

.sensors-panel {
    padding: 8px 10px;
}

@media (max-width: 1800px) {
    .charts-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 1400px) {
    .charts-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1000px) {
    .charts-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .charts-topline {
        align-items: flex-start;
    }
    .summary-row {
        gap: 4px 10px;
    }
    .charts-grid {
        grid-template-columns: 1fr;
    }
    .chart-box {
        height: 220px;
    }
}
