/* -------------------------------------------------------------------------- */

.rtg-board{
  --rtg-gap: 6px;
  --rtg-cell-min: 96px;
  --rtg-cell-max: 150px;

  --rtg-green: #c7e3bc;
  --rtg-yellow: #f2dfa0;
  --rtg-idle: #dde1e6;
  --rtg-alert-red: #efb1b1;

  --rtg-status-green-bg: #d7efd0;
  --rtg-status-green-fg: #1f5d28;
  --rtg-status-yellow-bg: #f5e7b2;
  --rtg-status-yellow-fg: #6a5302;
  --rtg-status-orange-bg: #efd2b0;
  --rtg-status-orange-fg: #7a4200;
  --rtg-status-red-bg: #efc0c0;
  --rtg-status-red-fg: #7c1616;

  --rtg-shadow-1: 0 4px 12px rgba(0,0,0,0.10);
  --rtg-shadow-2: 0 6px 18px rgba(0,0,0,0.15);
  --rtg-shadow-3: 0 8px 20px rgba(0,0,0,0.18);
  --rtg-shadow-4: 0 10px 24px rgba(0,0,0,0.20);

  width: 100%;
  padding: 12px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 14px;
  background: #f5f7fa;
  box-shadow: 0 10px 28px rgba(0,0,0,0.08);
}

.rtg-header{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.rtg-header-main{
  min-width: 0;
  flex: 1 1 auto;
}

.rtg-title-wrap{
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rtg-title{
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: .01em;
  color: #1d232a;
}

.rtg-subtitle{
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  color: #6b7280;
}

.rtg-statusbar{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.rtg-status-pill{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  padding: 5px 10px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35);
}

.rtg-status-pill.is-normal{
  background: var(--rtg-status-green-bg);
  color: var(--rtg-status-green-fg);
}

.rtg-status-pill.is-busy{
  background: var(--rtg-status-yellow-bg);
  color: var(--rtg-status-yellow-fg);
}

.rtg-status-pill.is-very-busy{
  background: var(--rtg-status-orange-bg);
  color: var(--rtg-status-orange-fg);
}

.rtg-status-pill.is-spike{
  background: var(--rtg-status-red-bg);
  color: var(--rtg-status-red-fg);
}

.rtg-status-pill.is-alert{
  background: var(--rtg-status-red-bg);
  color: var(--rtg-status-red-fg);
  border-color: rgba(124,22,22,0.22);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.28),
    0 0 0 1px rgba(124,22,22,0.06);
}

.rtg-status-pill.is-quiet{
  background: #eef2f6;
  color: #5f6b76;
  border-color: rgba(0,0,0,0.10);
}

.rtg-status-metric{
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid rgba(0,0,0,0.07);
  border-radius: 10px;
  background: rgba(255,255,255,0.68);
}

.rtg-status-label{
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #66707c;
}

.rtg-status-value{
  font-size: 13px;
  font-weight: 800;
  color: #1d232a;
}

.rtg-legend{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px 14px;
}

.rtg-legend-item{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  color: #4b5563;
}

.rtg-legend-box{
  display: inline-block;
  width: 14px;
  height: 14px;
  box-sizing: border-box;
  border: 1px solid rgba(0,0,0,0.16);
  border-radius: 4px;
}

.rtg-legend-green{ background: var(--rtg-green); }
.rtg-legend-yellow{ background: var(--rtg-yellow); }
.rtg-legend-idle{ background: var(--rtg-idle); }
.rtg-legend-stale{ background: rgba(255,255,255,0.88); }
.rtg-legend-alert{ background: var(--rtg-alert-red); }

.rtg-legend-hot{
  display: inline-block;
  width: 16px;
  height: 3px;
  box-sizing: border-box;
  border-radius: 2px;
  background: #c08a3c;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.12);
}

.rtg-spike-banner{
  display: none;
  align-items: center;
  gap: 9px;
  margin: -2px 0 12px;
  padding: 9px 11px;
  border: 1px solid rgba(172,36,36,0.18);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255,244,244,0.95), rgba(255,234,234,0.94));
  color: #7a1717;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
  box-shadow: 0 6px 18px rgba(122,23,23,0.08);
}

.rtg-spike-banner.is-on{
  display: inline-flex;
}

.rtg-spike-dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #cc2e2e;
  box-shadow: 0 0 0 4px rgba(204,46,46,0.14);
}

.rtg-body{
  display: block;
}

.rtg-system{
  margin: 14px 0 18px;
  padding-left: 10px;
  border-left: 4px solid transparent;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease;
}

.rtg-system:last-child{
  margin-bottom: 0;
}

.rtg-system-title{
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 4px;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #4b5563;
}

.rtg-system-title-text{
  min-width: 0;
  line-height: 1.15;
}

.rtg-system-badge{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  padding: 2px 7px;
  border: 1px solid rgba(0,0,0,0.09);
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  color: #6b7280;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.rtg-system.is-active{
  border-left-color: #83bb76;
}

.rtg-system.is-active .rtg-system-badge{
  background: #dbeed5;
  color: #2d6628;
}

.rtg-system.is-recent{
  border-left-color: #ddc36a;
}

.rtg-system.is-recent .rtg-system-badge{
  background: #f7ecbf;
  color: #785f09;
}

.rtg-system.is-alert{
  border-left-color: #d87979;
  box-shadow: inset 0 0 0 999px rgba(255,0,0,0.02);
}

.rtg-system.is-alert .rtg-system-badge{
  background: #f6d5d5;
  color: #842222;
}

.rtg-grid{
  display: grid;
  gap: var(--rtg-gap);
  grid-template-columns: repeat(auto-fill, minmax(var(--rtg-cell-min), 1fr));
}

.rtg-cell{
  position: relative;
  overflow: hidden;
  min-height: 38px;
  padding: 3px 5px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0,0,0,0.13);
  border-radius: 8px;
  color: #1a1a1a;
  user-select: none;
  cursor: pointer;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    border-color 140ms ease,
    background-color 140ms ease,
    color 140ms ease,
    filter 140ms ease;
}

.rtg-big{
  font-size: clamp(9px, 0.86vw, 12px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: .01em;
  text-align: center;
  word-break: break-word;
}

.rtg-ids{
  margin-top: 3px;
  font-size: 10px;
  font-weight: 650;
  opacity: 0.5;
}

.rtg-cell > *{
  position: relative;
  z-index: 4;
}

.rtg-cell::after{
  z-index: 2;
}

.rtg-cell.is-green{ background-color: var(--rtg-green); }
.rtg-cell.is-yellow{ background-color: var(--rtg-yellow); }
.rtg-cell.is-idle{ background-color: var(--rtg-idle); }

.rtg-cell.is-stale{
  color: #5b6168;
  border-color: rgba(0,0,0,0.06);
  box-shadow: inset 0 0 0 999px rgba(255,255,255,0.60);
  filter: saturate(0.78) brightness(1.03);
}

.rtg-cell.is-stale .rtg-ids{
  opacity: 0.28;
}

.rtg-cell.is-green:not(.is-stale):not(.is-alert):not(.is-blink),
.rtg-cell.is-yellow:not(.is-stale):not(.is-alert):not(.is-blink){
  transform: translateY(-2px) scale(1.015);
  border-color: rgba(0,0,0,0.22);
  box-shadow:
    var(--rtg-shadow-2),
    inset 0 1px 0 rgba(255,255,255,0.45);
}

.rtg-cell.is-blink:not(.is-stale),
.rtg-cell.is-alert{
  transform: translateY(-3px) scale(1.02);
  border-color: rgba(0,0,0,0.24);
  box-shadow:
    var(--rtg-shadow-3),
    inset 0 1px 0 rgba(255,255,255,0.4);
}

/* subtle "alive" polish: only active cells get a faint saturation/brightness lift */
.rtg-cell.is-green:not(.is-stale):not(.is-alert):not(.is-blink),
.rtg-cell.is-yellow:not(.is-stale):not(.is-alert):not(.is-blink),
.rtg-cell.is-blink:not(.is-stale),
.rtg-cell.is-alert{
  filter: saturate(1.04) brightness(1.01);
}

/* hover */
.rtg-cell.is-idle:hover,
.rtg-cell.is-stale:hover{
  transform: translateY(-1px);
  box-shadow: var(--rtg-shadow-1);
}

.rtg-cell.is-green:not(.is-stale):not(.is-alert):not(.is-blink):hover,
.rtg-cell.is-yellow:not(.is-stale):not(.is-alert):not(.is-blink):hover{
  transform: translateY(-3px) scale(1.02);
  box-shadow:
    var(--rtg-shadow-3),
    inset 0 1px 0 rgba(255,255,255,0.45);
}

.rtg-cell.is-blink:not(.is-stale):hover,
.rtg-cell.is-alert:hover{
  transform: translateY(-4px) scale(1.025);
  box-shadow:
    var(--rtg-shadow-4),
    inset 0 1px 0 rgba(255,255,255,0.4);
}

/* live pulse */
@keyframes rtg-livepulse{
  0%{
    box-shadow:
      0 0 0 0 rgba(72,128,72,0),
      var(--rtg-shadow-2);
  }
  50%{
    box-shadow:
      0 0 0 4px rgba(72,128,72,0.10),
      0 7px 18px rgba(0,0,0,0.16);
  }
  100%{
    box-shadow:
      0 0 0 0 rgba(72,128,72,0),
      var(--rtg-shadow-2);
  }
}

.rtg-board[data-pulse="1"] .rtg-cell.is-green:not(.is-stale):not(.is-alert):not(.is-blink){
  animation: rtg-livepulse 2.4s ease-in-out infinite;
}

.rtg-cell.rtg-hot{
  border-top-color: rgba(0,0,0,0.25);
}

.rtg-cell.rtg-hot::before{
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: #c08a3c;
  pointer-events: none;
  z-index: 3;
}

.rtg-cell.rtg-hot-1:not(.is-stale){
  filter:
    drop-shadow(0 0 1px rgba(192,138,60,0.9))
    drop-shadow(0 0 6px rgba(192,138,60,0.35));
}

@keyframes rtg-blink3{
  0%    { opacity: 0; }
  12.5% { opacity: 1; }
  25%   { opacity: 0; }
  37.5% { opacity: 1; }
  50%   { opacity: 0; }
  62.5% { opacity: 1; }
  75%   { opacity: 0; }
  100%  { opacity: 1; }
}

.rtg-cell.is-blink::after{
  content: "";
  position: absolute;
  inset: 0;
  background: var(--rtg-idle);
  animation: rtg-blink3 2s steps(1,end) 1;
  pointer-events: none;
}

@keyframes rtg-alert{
  0%   { opacity: 0; }
  50%  { opacity: 1; }
  100% { opacity: 0; }
}

.rtg-cell.is-alert::after{
  content: "";
  position: absolute;
  inset: 0;
  background: var(--rtg-alert-red);
  animation: rtg-alert 1s steps(1,end) infinite;
  pointer-events: none;
}

.rtg-tip{
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2147483647;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(-9999px,-9999px,0);
  transition: opacity 80ms linear;
}

.rtg-tip.is-on{
  opacity: 1;
}

.rtg-tip-box{
  max-width: 340px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(15,15,15,0.92);
  color: #fff;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  line-height: 1.15;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.rtg-tip-title{
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 800;
}

.rtg-tip-sub{
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  opacity: .92;
}

.rtg-tip-last{
  margin-top: 6px;
  font-size: 11px;
  font-weight: 700;
  opacity: .82;
}

.rtg-tip-meta{
  margin-top: 5px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  white-space: normal;
  opacity: .75;
}

.rtg-tip-meta > span{
  display: block;
}

.rtg-tip-meta.is-loading{
  opacity: .55;
}

.rtg-tip-hot{
  color: #ffd08a;
  font-weight: 800;
  letter-spacing: .01em;
}

.rtg-tip-row{
  display: block;
  margin-top: 4px;
  line-height: 1.25;
}

.rtg-tip-key{
  opacity: 0.8;
  font-size: 11px;
}

.rtg-traffic-very-high { color: #b00020; font-weight: 700; }
.rtg-traffic-high { color: #c85a00; font-weight: 700; }
.rtg-traffic-moderate { color: #8a6d00; font-weight: 700; }
.rtg-traffic-low { color: #2f6f3e; font-weight: 700; }
.rtg-traffic-very-low { color: #5f6b76; font-weight: 700; }

@media (max-width:700px){
  .rtg-header{
    flex-direction: column;
    align-items: stretch;
  }

  .rtg-legend{
    justify-content: flex-start;
  }

  .rtg-statusbar{
    gap: 8px;
  }
}

@media (max-width:420px){
  .rtg-cell{
    min-height: 36px;
    padding: 3px 5px;
    border-radius: 8px;
  }

  .rtg-tip-box{
    max-width: 260px;
  }

  .rtg-status-metric{
    width: 100%;
    justify-content: space-between;
  }
}

/* -------------------------------------------------------------------------- */
