/* O'lchamlarni px da beramiz — server va localda bir xil ko'rinsin (root font-size dan qat'iy nazar) */
.wd-device-view {
    display: grid;
    gap: 16px;
    font-size: 14px;
}

.wd-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.wd-main-grid {
    display: grid;
    grid-template-columns: 1.7fr 1fr;
    gap: 16px;
}

.wd-main-left,
.wd-main-right {
    display: grid;
    gap: 16px;
}

.wd-table-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.wd-card {
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    padding: 15px;
}

.wd-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.wd-kpi-label {
    margin: 0;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.wd-kpi-title {
    margin: 5px 0 0;
    font-size: 18px;
    line-height: 1.2;
    font-weight: 700;
    color: #0f172a;
}

.wd-kpi-title-sm {
    font-size: 15px;
}

.wd-kpi-sub {
    margin: 5px 0 0;
    font-size: 12px;
    color: #64748b;
}

.wd-kpi-icon {
    width: 23px;
    height: 23px;
    color: #64748b;
}

.wd-kpi-icon-blue {
    color: #0284c7;
}

.wd-kpi-icon-green {
    color: #059669;
}

.wd-kpi-icon-violet {
    color: #4f46e5;
}

.wd-kpi-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 13px;
    font-size: 12px;
    color: #64748b;
}

.wd-revenue-detail {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 11px;
    color: #64748b;
}

.wd-revenue-detail span,
.wd-revenue-detail-line {
    font-variant-numeric: tabular-nums;
}

.wd-revenue-detail .wd-revenue-detail-line {
    margin: 0 0 2px 0;
}

.wd-revenue-detail .wd-revenue-detail-line:last-child {
    margin-bottom: 0;
}

.wd-water-row {
    margin-top: 12px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    font-size: 13px;
    color: #475569;
}

.wd-device-tank {
    position: relative;
    width: 30px;
    height: 72px;
    border: 2px solid #64748b;
    border-radius: 10px;
    overflow: hidden;
    background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    flex: none;
}

.wd-device-tank-water {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    height: var(--water-percent);
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--water-color), white 15%) 0%,
        var(--water-color) 100%
    );
    transition: height 0.3s ease;
}

.wd-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 10px;
    margin-bottom: 13px;
}

.wd-card-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}

.wd-card-compact {
    padding: 11px 15px;
}

.wd-card-header-sm {
    padding-bottom: 7px;
    margin-bottom: 8px;
}

.wd-card-header-sm h3 {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
}

.wd-revenue-breakdown {
    display: grid;
    gap: 6px;
    font-size: 12px;
}

.wd-revenue-breakdown-head,
.wd-revenue-breakdown-row {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 12px;
    align-items: center;
}

.wd-revenue-breakdown-head {
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: 11px;
}

.wd-revenue-breakdown-label {
    font-weight: 500;
    color: #334155;
}

.wd-revenue-breakdown-row span:not(.wd-revenue-breakdown-label) {
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}

.wd-card-header p {
    margin: 0;
    font-size: 12px;
    color: #64748b;
}

.wd-header-icon {
    width: 16px;
    height: 16px;
    color: #64748b;
}

.wd-sensor-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.wd-sensor-item {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px;
    background: #ffffff;
}

.wd-sensor-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 999px;
    padding: 3px 8px;
    border: 1px solid transparent;
    font-size: 11px;
    font-weight: 600;
}

.wd-sensor-icon {
    width: 13px;
    height: 13px;
}

.wd-sensor-value {
    margin: 9px 0 0;
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}

.wd-tone-success {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}

.wd-tone-warning {
    background: #fffbeb;
    color: #92400e;
    border-color: #fde68a;
}

.wd-tone-danger {
    background: #fff1f2;
    color: #9f1239;
    border-color: #fecdd3;
}

.wd-tone-primary {
    background: #eff6ff;
    color: #1e3a8a;
    border-color: #bfdbfe;
}

.wd-tone-info {
    background: #eef2ff;
    color: #3730a3;
    border-color: #c7d2fe;
}

.wd-tone-gray {
    background: #f8fafc;
    color: #334155;
    border-color: #cbd5e1;
}

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

.wd-trend-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.wd-trend-track {
    width: 100%;
    height: 110px;
    border-radius: 8px;
    background: #f1f5f9;
    padding: 3px;
    display: flex;
    align-items: flex-end;
}

.wd-trend-fill {
    width: 100%;
    border-radius: 5px;
    background: linear-gradient(180deg, #22d3ee 0%, #0284c7 100%);
}

.wd-trend-time {
    margin: 0;
    font-size: 10px;
    color: #64748b;
}

.wd-quick-list {
    display: grid;
    gap: 8px;
}

.wd-quick-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    padding: 9px 10px;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.wd-quick-link:hover {
    border-color: #7dd3fc;
    background: #f0f9ff;
}

.wd-quick-main {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.wd-quick-icon {
    width: 16px;
    height: 16px;
    color: #64748b;
}

.wd-quick-label {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
}

.wd-quick-desc {
    font-size: 11px;
    color: #64748b;
    text-align: right;
}

.wd-location-grid {
    display: grid;
    gap: 7px;
}

.wd-location-grid p {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 12px;
}

.wd-location-grid span {
    color: #64748b;
}

.wd-location-grid b {
    color: #0f172a;
    font-weight: 600;
}

.wd-card-table {
    padding: 0;
}

.wd-card-table .wd-card-header {
    margin: 0;
    padding: 14px 15px;
    background: #f8fafc;
}

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

.wd-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 620px;
}

.wd-table thead th {
    padding: 10px 14px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    text-align: left;
    white-space: nowrap;
}

.wd-table tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 12px;
    color: #334155;
    vertical-align: middle;
}

.wd-empty-cell {
    text-align: center;
    color: #64748b;
    padding: 16px;
}

.wd-empty {
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #64748b;
    font-size: 13px;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
}

html.dark .wd-card,
html.dark .wd-sensor-item,
html.dark .wd-quick-link {
    background: #0f172a;
    border-color: #334155;
    box-shadow: none;
}

html.dark .wd-kpi-title,
html.dark .wd-card-header h3,
html.dark .wd-sensor-value,
html.dark .wd-quick-label,
html.dark .wd-location-grid b {
    color: #f8fafc;
}

html.dark .wd-kpi-label,
html.dark .wd-kpi-sub,
html.dark .wd-kpi-footer,
html.dark .wd-card-header p,
html.dark .wd-header-icon,
html.dark .wd-trend-time,
html.dark .wd-quick-desc,
html.dark .wd-location-grid span,
html.dark .wd-table thead th,
html.dark .wd-table tbody td,
html.dark .wd-empty,
html.dark .wd-empty-cell {
    color: #cbd5e1;
}

html.dark .wd-card-header,
html.dark .wd-card-table .wd-card-header {
    border-color: #334155;
    background: #111827;
}

html.dark .wd-card-header-sm h3 {
    color: #94a3b8;
}

html.dark .wd-revenue-breakdown-label,
html.dark .wd-revenue-breakdown-row span:not(.wd-revenue-breakdown-label) {
    color: #e2e8f0;
}

html.dark .wd-revenue-breakdown-head {
    color: #94a3b8;
}

html.dark .wd-revenue-detail {
    color: #94a3b8;
}

html.dark .wd-trend-track {
    background: #111827;
}

html.dark .wd-table tbody td {
    border-color: #1f2937;
}

html.dark .wd-device-tank {
    border-color: #64748b;
    background: linear-gradient(180deg, #1f2937 0%, #0f172a 100%);
}

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

    .wd-main-grid,
    .wd-table-grid {
        grid-template-columns: 1fr;
    }
}

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

@media (max-width: 640px) {
    .wd-kpi-grid {
        grid-template-columns: 1fr;
    }

    .wd-sensor-grid {
        grid-template-columns: 1fr;
    }
}
