.wd-map-widget {
    display: grid;
    grid-template-columns: 1.8fr 1fr;
    gap: 1rem;
}

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

.wd-map-header,
.wd-list-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(120deg, #ecfeff 0%, #f0fdf4 45%, #eff6ff 100%);
}

.wd-title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
}

.wd-subtitle {
    margin: 0.2rem 0 0;
    font-size: 0.78rem;
    color: #475569;
}

.wd-map-canvas {
    width: 100%;
    height: 460px;
    min-height: 460px;
    background: #e2e8f0;
}

.wd-map-empty,
.wd-list-empty {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #64748b;
    font-size: 0.85rem;
    padding: 1rem;
}

.wd-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    align-items: center;
    border-top: 1px solid #e2e8f0;
    padding: 0.6rem 1rem;
    font-size: 0.75rem;
    color: #475569;
    background: #f8fafc;
}

.wd-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.wd-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.wd-dot-good {
    background: #22c55e;
}

.wd-dot-online {
    background: #16a34a;
}

.wd-dot-offline {
    background: #64748b;
}

.wd-dot-medium {
    background: #f59e0b;
}

.wd-dot-low {
    background: #ef4444;
}

.wd-list-header {
    display: block;
    background: #f8fafc;
}

.wd-list-header h3 {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 700;
    color: #0f172a;
}

.wd-list-header p {
    margin: 0.18rem 0 0;
    font-size: 0.75rem;
    color: #64748b;
}

.wd-list-scroll {
    max-height: 520px;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.wd-device-card {
    display: block;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    padding: 0.75rem;
    text-decoration: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wd-device-card:hover {
    border-color: #38bdf8;
    box-shadow: 0 4px 16px rgba(2, 132, 199, 0.12);
}

.wd-device-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.wd-device-name {
    margin: 0;
    font-size: 0.84rem;
    font-weight: 700;
    color: #0f172a;
}

.wd-device-meta {
    margin: 0.15rem 0 0;
    font-size: 0.72rem;
    color: #64748b;
}

.wd-status-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-right: 0.45rem;
    font-weight: 600;
}

.wd-status-inline-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: currentColor;
    flex: none;
}

.wd-status-inline-success,
.wd-status-inline-online {
    color: #15803d;
}

.wd-status-inline-gray,
.wd-status-inline-offline {
    color: #475569;
}

.wd-status-inline-warning {
    color: #b45309;
}

.wd-status-inline-danger {
    color: #b91c1c;
}

.wd-device-body {
    margin-top: 0.65rem;
    display: flex;
    align-items: flex-end;
    gap: 0.65rem;
}

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

.wd-mini-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 16%) 0%,
        var(--water-color) 100%
    );
    transition: height 0.3s ease;
}

.wd-device-stats p {
    margin: 0;
    font-size: 0.72rem;
    color: #475569;
    line-height: 1.5;
}

.wd-device-stats span {
    color: #64748b;
}

.wd-device-stats b {
    color: #0f172a;
    font-weight: 600;
}

.wd-div-icon {
    background: transparent;
    border: 0;
}

.wd-map-marker {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    pointer-events: auto;
}

.wd-map-marker-tank {
    position: relative;
    width: 36px;
    height: 56px;
    border: 2px solid #334155;
    border-radius: 10px;
    overflow: hidden;
    background: linear-gradient(180deg, #f8fafc 0%, #dbeafe 100%);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
}

.wd-map-marker-status-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #64748b;
    border: 2px solid rgba(255, 255, 255, 0.92);
    z-index: 2;
}

.wd-map-marker-tank.is-online .wd-map-marker-status-dot {
    background: #16a34a;
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.18);
}

.wd-map-marker-tank.is-offline .wd-map-marker-status-dot {
    background: #64748b;
}

.wd-map-marker-tank.is-warning .wd-map-marker-status-dot {
    background: #f59e0b;
}

.wd-map-marker-tank.is-danger .wd-map-marker-status-dot {
    background: #ef4444;
}

.wd-map-marker-water {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    height: var(--water-percent);
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--water-color), white 10%) 0%,
        var(--water-color) 100%
    );
}

.wd-map-marker-caption {
    margin-top: 4px;
    max-width: 130px;
    min-width: 90px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.92);
    color: #ffffff;
    font-size: 10px;
    line-height: 1.15;
    padding: 4px 8px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.wd-map-marker-caption-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 100%;
}

.wd-map-marker-caption-serial {
    max-width: 100%;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wd-map-marker-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 54px;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

.wd-map-marker-status.is-online {
    background: rgba(34, 197, 94, 0.18);
    color: #bbf7d0;
}

.wd-map-marker-status.is-offline {
    background: rgba(148, 163, 184, 0.22);
    color: #e2e8f0;
}

.wd-map-marker-status.is-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fde68a;
}

.wd-map-marker-status.is-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #fecaca;
}

.wd-map-marker-caption-volume {
    font-size: 9px;
    opacity: 0.92;
    white-space: nowrap;
}

html.dark .wd-map-card,
html.dark .wd-list-card,
html.dark .wd-device-card {
    background: #0f172a;
    border-color: #334155;
    box-shadow: none;
}

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

html.dark .wd-title,
html.dark .wd-list-header h3,
html.dark .wd-device-name,
html.dark .wd-device-stats b {
    color: #f8fafc;
}

html.dark .wd-subtitle,
html.dark .wd-list-header p,
html.dark .wd-map-legend,
html.dark .wd-device-meta,
html.dark .wd-device-stats p,
html.dark .wd-device-stats span,
html.dark .wd-map-empty,
html.dark .wd-list-empty {
    color: #cbd5e1;
}

html.dark .wd-map-legend {
    background: #111827;
    border-color: #334155;
}

html.dark .wd-status-inline-success,
html.dark .wd-status-inline-online {
    color: #4ade80;
}

html.dark .wd-status-inline-gray,
html.dark .wd-status-inline-offline {
    color: #cbd5e1;
}

html.dark .wd-status-inline-warning {
    color: #fbbf24;
}

html.dark .wd-status-inline-danger {
    color: #f87171;
}

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

@media (max-width: 1280px) {
    .wd-map-widget {
        grid-template-columns: 1fr;
    }

    .wd-list-scroll {
        max-height: 380px;
    }
}
