  :root {
    --card-bg: linear-gradient(180deg, rgba(18, 29, 52, .84), rgba(11, 18, 32, .80));
    --card-border: rgba(255, 255, 255, .08);
    --muted: rgba(255, 255, 255, .66);
    --muted-2: rgba(255, 255, 255, .52);
    --white: #fff;
    --blue: #9dd7ff;
    --green: #86efac;
    --yellow: #fde68a;
    --red: #fca5a5;
    --violet: #c4b5fd;
    --cyan: #67e8f9;
  }

  #groups {
    display: none !important;
  }

  .loss-page {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(420px, .95fr);
    gap: 15px;
    align-items: start;
  }

  .panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .24);
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    margin-top: 10px;
  }

  .panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
  }

  .panel-title {
    color: var(--white);
    font-size: 18px;
    font-weight: 800;
    line-height: 1.2;
  }

  .panel-sub {
    color: var(--muted);
    font-size: 13px;
    margin-top: 4px;
  }

  .panel-right-note {
    color: var(--muted);
    font-size: 12px;
    text-align: right;
    white-space: nowrap;
  }

  .summary-wrap {
    padding: 18px;
  }

  .summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
  }

  .dma-card {
    position: relative;
    border-radius: 18px;
    padding: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .065), rgba(255, 255, 255, .03));
    border: 1px solid rgba(255, 255, 255, .08);
    cursor: pointer;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  }

  .dma-card:hover {
    transform: translateY(-2px);
    border-color: rgba(77, 124, 255, .44);
    box-shadow: 0 12px 28px rgba(0, 0, 0, .20);
  }

  .dma-card.active {
    border-color: rgba(41, 214, 125, .42);
    box-shadow: 0 0 0 1px rgba(41, 214, 125, .14), 0 14px 28px rgba(0, 0, 0, .22);
  }

  .dma-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
  }

  .dma-name {
    color: var(--white);
    font-weight: 800;
    font-size: 15px;
    line-height: 1.2;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .dma-value {
    color: var(--blue);
    font-size: 30px;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 6px;
  }

  .dma-unit,
  .dma-meta {
    color: var(--muted);
    font-size: 12px;
  }

  .dma-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
  }

  .status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    border: 1px solid rgba(255, 255, 255, .08);
    flex: 0 0 auto;
  }

  .status-pill.ok {
    color: var(--green);
    background: rgba(34, 197, 94, .10);
  }

  .status-pill.warn {
    color: var(--yellow);
    background: rgba(234, 179, 8, .10);
  }

  .status-pill.bad {
    color: var(--red);
    background: rgba(239, 68, 68, .10);
  }

  .status-pill.none {
    color: #cbd5e1;
    background: rgba(148, 163, 184, .12);
  }

  .summary-note {
    padding: 14px 18px 18px;
    color: var(--muted-2);
    font-size: 12px;
  }

  .detail-body {
    padding: 18px;
  }

  .detail-empty {
    color: var(--muted);
    font-size: 14px;
  }

  .detail-block {
    margin-bottom: 18px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .07);
  }

  .detail-block:last-child {
    margin-bottom: 0;
  }

  .detail-block-title {
    color: var(--white);
    font-size: 14px;
    font-weight: 800;
    margin-bottom: 12px;
  }

  .time-chip {
    display: inline-flex;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .07);
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 12px;
  }

  .metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .metric-card {
    border-radius: 14px;
    padding: 12px 13px;
    background: rgba(255, 255, 255, .035);
    border: 1px solid rgba(255, 255, 255, .06);
  }

  .metric-label {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 6px;
  }

  .metric-value {
    color: var(--white);
    font-size: 18px;
    font-weight: 800;
    line-height: 1.2;
  }

  .history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .history-row {
    display: grid;
    grid-template-columns: 96px 1fr 84px;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .035);
    border: 1px solid rgba(255, 255, 255, .055);
  }

  .history-date {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

  .history-bar {
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    overflow: hidden;
    position: relative;
  }

  .history-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    border-radius: 999px;
  }

  .history-bar-fill.day {
    background: linear-gradient(90deg, #4d7cff 0%, #29d67d 100%);
  }

  .history-bar-fill.night {
    background: linear-gradient(90deg, #8b5cf6 0%, #22c55e 100%);
  }

  .history-val {
    color: var(--white);
    font-size: 12px;
    font-weight: 800;
    text-align: right;
  }

  .history-empty {
    color: var(--muted);
    font-size: 13px;
  }

  .detail-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
  }

  .detail-dma {
    color: var(--white);
    font-size: 20px;
    font-weight: 900;
    text-transform: uppercase;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .today-badge {
    padding: 7px 11px;
    border-radius: 999px;
    background: rgba(77, 124, 255, .14);
    border: 1px solid rgba(77, 124, 255, .22);
    color: #b8d4ff;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
  }

  .detail-status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
  }

  .reason-box {
    margin-top: 12px;
    border-radius: 14px;
    padding: 12px;
    background: rgba(255, 255, 255, .035);
    border: 1px solid rgba(255, 255, 255, .06);
  }

  .reason-title {
    color: var(--white);
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 8px;
  }

  .reason-list {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
  }

  .delta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
  }

  .delta-card {
    border-radius: 14px;
    padding: 12px 13px;
    background: rgba(255, 255, 255, .035);
    border: 1px solid rgba(255, 255, 255, .06);
  }

  .delta-label {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 6px;
  }

  .delta-value {
    font-size: 18px;
    font-weight: 800;
    line-height: 1.2;
  }

  .delta-value.up-strong,
  .delta-value.up {
    color: var(--red);
  }

  .delta-value.down-strong,
  .delta-value.down {
    color: var(--green);
  }

  .delta-value.neutral {
    color: var(--white);
  }

  .baseline-note {
    margin-top: 10px;
    color: var(--muted-2);
    font-size: 12px;
  }

  .chart-wrap {
    position: relative;
    height: 300px;
    border-radius: 18px;
    background: rgba(255, 255, 255, .03);
    border: 1px solid rgba(255, 255, 255, .06);
    padding: 10px;
  }

  .chart-note {
    margin-top: 10px;
    color: var(--muted-2);
    font-size: 12px;
  }

  @media (max-width: 1180px) {
    .loss-page {
      grid-template-columns: 1fr;
    }
  }

  @media (max-width: 800px) {
    .delta-grid {
      grid-template-columns: 1fr;
    }
  }

  @media (max-width: 640px) {
    .metric-grid {
      grid-template-columns: 1fr;
    }

    .history-row {
      grid-template-columns: 82px 1fr 74px;
      gap: 8px;
      padding: 9px 10px;
    }

    .dma-value {
      font-size: 26px;
    }

    .chart-wrap {
      height: 260px;
    }
  }

  .mini-map-wrap {
    width: 100%;
    height: 260px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .08);
    background: #0b1220;
  }

  
  .leaflet-container {
    background: #0b1220;
    font-family: inherit;
  }

  .mini-map-wrap {
    width: 100%;
    height: 320px;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .08);
    background: #dfe7ef;
    margin-top: 8px;
    position: relative;
  }

  .mini-map-top {
    margin-top: 0;
  }

  #dmaMiniMap {
    width: 100%;
    height: 100%;
    background: #dfe7ef;
  }

  #dmaMiniMap .leaflet-container {
    width: 100%;
    height: 100%;
    background: #dfe7ef;
    font-family: inherit;
  }

  #dmaMiniMap .leaflet-tile-pane {
    filter: saturate(1.02) contrast(1.01);
  }

  #dmaMiniMap .leaflet-control-zoom a {
    background: rgba(15, 23, 42, .92);
    color: #fff;
    border: none;
  }

  #dmaMiniMap .leaflet-control-zoom a:hover {
    background: rgba(30, 41, 59, .96);
  }

  #dmaMiniMap .leaflet-popup-content-wrapper,
  #dmaMiniMap .leaflet-popup-tip {
    background: #0f172a;
    color: #e5eefc;
  }