:root {
  --bg: #050507;
  --neon: #ff1a2e;
  --neon-soft: #ff4d5e;
  --text: #f5f5f7;
  --muted: #b8b8c0;
  --panel: rgba(10, 10, 14, 0.88);
  --line: rgba(255, 26, 46, 0.35);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-x: max(env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body.modal-open { overflow: hidden; }

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 420px at 50% -8%, rgba(255, 26, 46, 0.22), transparent 62%),
    radial-gradient(700px 420px at 85% 110%, rgba(255, 26, 46, 0.08), transparent 55%),
    #050507;
}

.grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 26, 46, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 26, 46, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 0%, black 25%, transparent 78%);
  animation: grid-drift 18s linear infinite;
}

.glow {
  position: absolute;
  width: 48vw;
  height: 48vw;
  max-width: 420px;
  max-height: 420px;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.28;
}

.glow-a {
  top: -6%;
  left: 4%;
  background: var(--neon);
  animation: float-a 9s ease-in-out infinite;
}

.glow-b {
  right: 0;
  top: 18%;
  background: #7a0010;
  opacity: 0.2;
  animation: float-b 11s ease-in-out infinite;
}

.scan {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(255, 26, 46, 0.04) 48%,
    rgba(255, 26, 46, 0.1) 50%,
    rgba(255, 26, 46, 0.04) 52%,
    transparent 100%
  );
  background-size: 100% 220%;
  animation: scan 7s linear infinite;
  mix-blend-mode: screen;
  opacity: 0.4;
}

.topbar {
  position: relative;
  z-index: 1;
  width: 100%;
  padding:
    calc(0.85rem + var(--safe-top))
    max(0.85rem, var(--safe-x))
    0.85rem;
  text-align: center;
  border-bottom: 1px solid rgba(255, 26, 46, 0.22);
  background: linear-gradient(180deg, rgba(8, 0, 2, 0.72), rgba(8, 0, 2, 0.28));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.pulse-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  letter-spacing: 0.18em;
  font-size: 0.58rem;
  color: var(--neon-soft);
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.dot {
  width: 0.45rem;
  height: 0.45rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--neon);
  box-shadow: 0 0 10px var(--neon), 0 0 20px var(--neon);
  animation: blink 1.4s ease-in-out infinite;
}


.next-update {
  margin: 0.15rem 0 0.55rem;
  text-align: center;
}

.next-label {
  font-size: 0.55rem;
  letter-spacing: 0.28em;
  color: var(--muted);
}

.next-clock {
  margin-top: 0.12rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(0.95rem, 3.8vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #fff;
  text-shadow:
    0 0 8px rgba(255, 26, 46, 0.85),
    0 0 18px rgba(255, 26, 46, 0.4);
  font-variant-numeric: tabular-nums;
}

.title {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-weight: 800;
  font-size: clamp(1.05rem, 5vw, 2.1rem);
  letter-spacing: 0.1em;
  line-height: 1.15;
  color: #fff;
  text-shadow:
    0 0 8px rgba(255, 26, 46, 0.9),
    0 0 24px rgba(255, 26, 46, 0.5);
}

.subtitle {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-weight: 600;
  font-size: clamp(0.68rem, 2.6vw, 0.95rem);
  letter-spacing: 0.22em;
  color: var(--neon-soft);
  margin-top: 0.28rem;
  text-shadow: 0 0 12px rgba(255, 26, 46, 0.5);
}

.rule {
  width: min(240px, 58vw);
  height: 1px;
  margin: 0.6rem auto 0;
  background: linear-gradient(90deg, transparent, var(--neon), transparent);
  box-shadow: 0 0 12px rgba(255, 26, 46, 0.7);
}

.content {
  position: relative;
  z-index: 1;
  padding:
    0.75rem
    max(0.5rem, var(--safe-x))
    calc(1.1rem + var(--safe-bottom));
  max-width: 1180px;
  margin: 0 auto;
}

.panel {
  border: 1px solid var(--line);
  background: #0b0b0f;
  box-shadow: 0 0 24px rgba(255, 26, 46, 0.12);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.panel-head {
  padding: 0.7rem 0.75rem;
  background: linear-gradient(90deg, #b0101c, #d71920 40%, #7a0a12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  text-align: center;
}

.panel-title {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(0.78rem, 3.2vw, 1.15rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.3;
  color: #fff;
  text-align: center;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.35);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #0b0b0f;
  cursor: pointer;
}

.kpi-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.kpi-table th,
.kpi-table td {
  border: 1px solid #2a2a32;
  padding: 0.45rem 0.25rem;
  text-align: center;
  vertical-align: middle;
}

.kpi-table thead th {
  background: #12131a;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  padding: 0.55rem 0.2rem;
}

.col-no {
  width: 6%;
  color: #ddd;
  background: #101118;
}

.col-dp {
  width: 22%;
  text-align: left !important;
  font-style: italic;
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  padding-left: 0.45rem !important;
  padding-right: 0.25rem !important;
  white-space: normal;
  word-break: break-word;
  color: #f3f3f5;
  background: #101118;
}

.heat {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #111;
  border: 1px solid #0b0b0f !important;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.28);
}

.heat.avg { font-weight: 800; }
.heat.g100 { background: #1f9d55; }
.heat.g85  { background: #6fbf73; }
.heat.y75  { background: #f2d14b; }
.heat.o65  { background: #f0a35a; }
.heat.r50  { background: #ef7a6a; }
.heat.r0   { background: #e85d5d; }


.section-rule {
  width: min(280px, 62vw);
  height: 1px;
  margin: 1.15rem auto;
  background: linear-gradient(90deg, transparent, var(--neon), transparent);
  box-shadow: 0 0 12px rgba(255, 26, 46, 0.7);
}

.kpi-table-qr .col-dp {
  width: 28%;
}

.kpi-table-vip .col-dp {
  width: 26%;
}

.num {
  color: #f3f3f5;
  background: #101118;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.kpi-table-mdp .col-dp {
  width: 30%;
}


.th-stack {
  line-height: 1.15;
  white-space: normal;
}

.th-stack span {
  display: inline-block;
  margin-top: 0.15rem;
  font-weight: 600;
  opacity: 0.92;
  letter-spacing: 0.03em;
}

.th-sub {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
}

.th-live {
  color: var(--neon-soft);
  text-shadow: 0 0 8px rgba(255, 26, 46, 0.55);
}


.kpi-table-awb .col-dp {
  width: 28%;
}


.row-blank .col-dp {
  opacity: 0.75;
  font-style: italic;
}

.empty {
  color: #8b8b93;
  background: #101118;
  border: 1px solid #2a2a32;
  text-align: center;
  font-weight: 700;
}

.hint {
  margin-top: 0.55rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
}

.modal[hidden] { display: none !important; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(300px, 100%);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: #121218;
  border: 1px solid rgba(255, 26, 46, 0.45);
  box-shadow:
    0 0 0 1px rgba(255, 26, 46, 0.2),
    0 0 28px rgba(255, 26, 46, 0.28);
}

.modal-card h3 {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  margin-bottom: 0.15rem;
}

.btn {
  width: 100%;
  border: 0;
  padding: 0.7rem 0.8rem;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.btn:disabled { opacity: 0.55; cursor: wait; }

.btn-primary {
  color: #fff;
  background: #d71920;
  box-shadow: 0 0 16px rgba(215, 25, 32, 0.35);
}

.btn-primary:hover { background: #ff2a35; }

.btn-ghost {
  color: var(--muted);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.toast {
  position: fixed;
  top: calc(0.85rem + var(--safe-top));
  right: 0.85rem;
  z-index: 60;
  padding: 0.55rem 0.8rem;
  background: #1a1d26;
  border: 1px solid rgba(255, 26, 46, 0.35);
  color: #f1f5f9;
  font-size: 0.72rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.toast[hidden] { display: none !important; }

@keyframes blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.85); }
}

@keyframes scan {
  0% { background-position: 0% 120%; }
  100% { background-position: 0% -120%; }
}

@keyframes grid-drift {
  0% { transform: translateY(0); }
  100% { transform: translateY(48px); }
}

@keyframes float-a {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(3%, 5%); }
}

@keyframes float-b {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-4%, -3%); }
}

@media (max-width: 767px) {
  .content {
    padding-left: max(0.3rem, var(--safe-x));
    padding-right: max(0.3rem, var(--safe-x));
  }
  .panel-head { padding: 0.55rem 0.45rem; }
  .table-wrap { overflow-x: visible; }
  .kpi-table {
    width: 100%;
    min-width: 0;
    font-size: clamp(0.52rem, 2.7vw, 0.72rem);
  }
  .kpi-table th,
  .kpi-table td {
    padding: 0.28rem 0.08rem;
  }
  .kpi-table thead th {
    font-size: clamp(0.42rem, 2.2vw, 0.55rem);
    letter-spacing: 0.02em;
    padding: 0.32rem 0.06rem;
    white-space: normal;
    hyphens: auto;
  }
  .col-no { width: 5%; }
  .col-dp {
    width: 20%;
    font-size: clamp(0.48rem, 2.5vw, 0.62rem);
    padding-left: 0.22rem !important;
    padding-right: 0.1rem !important;
  }
  .kpi-table-qr .col-dp,
  .kpi-table-mdp .col-dp,
  .kpi-table-awb .col-dp { width: 22%; }
  .kpi-table-vip .col-dp { width: 18%; }
  .th-sub {
    font-size: clamp(0.4rem, 2vw, 0.5rem);
    letter-spacing: 0.04em;
  }
  .th-stack span {
    margin-top: 0.08rem;
    letter-spacing: 0.02em;
  }
}

@media (min-width: 768px) {
  .content { padding-left: 1rem; padding-right: 1rem; }
  .kpi-table { font-size: 0.94rem; }
  .kpi-table thead th {
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    padding: 0.65rem 0.3rem;
  }
  .col-dp {
    font-size: 0.88rem;
    padding-left: 0.7rem !important;
  }
  .kpi-table th,
  .kpi-table td { padding: 0.55rem 0.35rem; }
}
