:root {
  --sky-0: #f4fbff;
  --sky-1: #dff2ff;
  --sky-2: #b9e3ff;
  --sky-3: #7ec8f5;
  --ink: #0b3a55;
  --ink-soft: #3d6a86;
  --muted: #6b8fa8;
  --card: rgba(255, 255, 255, 0.72);
  --card-solid: #ffffff;
  --line: rgba(14, 116, 168, 0.16);
  --accent: #0284c7;
  --accent-deep: #0369a1;
  --yard: #0d9488;
  --danger-soft: #fecaca;
  --radius: 20px;
  --font-display: "Outfit", "Sarabun", sans-serif;
  --font-body: "Sarabun", "Outfit", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--ink);
  background: linear-gradient(180deg, #cfefff 0%, var(--sky-0) 42%, #f7fcff 100%);
  overflow-x: hidden;
}

.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.haze {
  position: absolute;
  inset: -20% -10% auto;
  height: 55vh;
  background:
    radial-gradient(ellipse 60% 50% at 20% 30%, rgba(255, 255, 255, 0.75), transparent 70%),
    radial-gradient(ellipse 50% 45% at 80% 20%, rgba(186, 230, 253, 0.65), transparent 70%);
}

.cloud {
  position: absolute;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  filter: blur(2px);
  animation: drift 48s linear infinite;
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: inherit;
}

.c1 {
  width: 180px;
  height: 48px;
  top: 12%;
  left: -10%;
  animation-duration: 55s;
}
.c1::before { width: 80px; height: 80px; top: -42px; left: 28px; }
.c1::after { width: 60px; height: 60px; top: -28px; left: 90px; }

.c2 {
  width: 240px;
  height: 56px;
  top: 22%;
  left: 40%;
  opacity: 0.7;
  animation-duration: 70s;
  animation-delay: -20s;
}
.c2::before { width: 100px; height: 100px; top: -52px; left: 40px; }
.c2::after { width: 70px; height: 70px; top: -34px; left: 120px; }

.c3 {
  width: 160px;
  height: 42px;
  top: 8%;
  left: 70%;
  opacity: 0.5;
  animation-duration: 62s;
  animation-delay: -35s;
}
.c3::before { width: 70px; height: 70px; top: -36px; left: 24px; }
.c3::after { width: 50px; height: 50px; top: -24px; left: 80px; }

@keyframes drift {
  from { transform: translateX(0); }
  to { transform: translateX(35vw); }
}

.hero,
.main {
  position: relative;
  z-index: 1;
}

.hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 4.5rem) 1.25rem 1.25rem;
  text-align: center;
  animation: rise 0.7s ease-out both;
}

.hero-kicker {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.6rem, 8vw, 4.4rem);
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.hero-sub {
  margin: 0.85rem auto 0;
  max-width: 28rem;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem 3.5rem;
}

.overview {
  margin-bottom: 2.25rem;
  animation: rise 0.75s 0.08s ease-out both;
}

.overview-loading {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
}

.overview-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  overflow: hidden;
  box-shadow:
    0 20px 50px rgba(2, 132, 199, 0.12),
    0 1px 0 rgba(255, 255, 255, 0.9) inset;
  backdrop-filter: blur(16px);
}

.ov-block {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(240, 249, 255, 0.92));
  padding: 1.35rem 1.25rem 1.5rem;
  min-height: 100%;
}

.ov-label {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.ov-value {
  margin: 0.45rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--accent-deep);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.ov-unit {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.ov-date {
  margin: 0.65rem 0 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(2, 132, 199, 0.1);
  color: var(--accent-deep);
  font-size: 0.82rem;
  font-weight: 600;
}

.ov-status {
  margin: 0.85rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ov-status li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.ov-status strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.zone {
  margin-top: 2rem;
}

.zone-head {
  margin-bottom: 1rem;
  animation: rise 0.6s ease-out both;
}

.zone-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.zone-head p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.zone-yard .zone-head h2 {
  color: #0f766e;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  align-items: start;
}

.loc-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  text-align: left;
  width: 100%;
  padding: 1.15rem 1.15rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.92), rgba(236, 248, 255, 0.88));
  box-shadow: 0 10px 28px rgba(2, 132, 199, 0.08);
  font: inherit;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  animation: rise 0.55s ease-out both;
  overflow: hidden;
}

.loc-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--accent), var(--sky-3));
}

.loc-card.yard::before {
  background: linear-gradient(180deg, var(--yard), #5eead4);
}

.loc-card:hover {
  transform: translateY(-3px);
  border-color: rgba(2, 132, 199, 0.35);
  box-shadow: 0 16px 36px rgba(2, 132, 199, 0.14);
}

.loc-card.is-open {
  border-color: rgba(2, 132, 199, 0.45);
}

.loc-name {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.loc-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.18);
  flex-shrink: 0;
}

.loc-card.yard .loc-dot {
  background: var(--yard);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.18);
}

.loc-count {
  margin: 0.7rem 0 0;
  font-family: var(--font-display);
  font-size: 2.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--accent-deep);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.loc-card.yard .loc-count {
  color: #0f766e;
}

.loc-unit {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.top-codes {
  margin: 0.9rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px dashed rgba(14, 116, 168, 0.2);
}

.top-codes-title {
  margin: 0 0 0.45rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.code-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 0.6rem;
  align-items: center;
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
}

.code-row .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 500;
}

.code-row .n {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--accent-deep);
}

.bar {
  grid-column: 1 / -1;
  height: 4px;
  border-radius: 999px;
  background: rgba(186, 230, 253, 0.65);
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #38bdf8);
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.loc-card.yard .bar > span {
  background: linear-gradient(90deg, var(--yard), #2dd4bf);
}

.foot-note {
  margin: 2rem 0 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ——— Yard combined panel ——— */
.yard-panel {
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.94), rgba(236, 253, 250, 0.9));
  box-shadow: 0 16px 40px rgba(13, 148, 136, 0.1);
  overflow: hidden;
  animation: rise 0.65s ease-out both;
}

.yard-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  padding: 1.25rem 1.35rem 1rem;
  border-bottom: 1px dashed rgba(13, 148, 136, 0.22);
}

.yard-panel-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f766e;
}

.yard-panel-sub {
  margin: 0.3rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.yard-panel-total {
  text-align: right;
}

.yard-panel-count {
  display: block;
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0f766e;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.yard-panel-unit {
  font-size: 0.85rem;
  color: var(--muted);
}

.yard-table-wrap {
  max-height: min(70vh, 720px);
  overflow: auto;
}

.yard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.yard-table th,
.yard-table td {
  padding: 0.65rem 1rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(13, 148, 136, 0.1);
}

.yard-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(240, 253, 250, 0.96);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.yard-table tbody tr:hover {
  background: rgba(13, 148, 136, 0.05);
}

.yard-loc {
  font-weight: 600;
  color: var(--ink);
  min-width: 9rem;
}

.yard-n {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #0f766e;
  white-space: nowrap;
  width: 5rem;
}

.yard-codes {
  min-width: 12rem;
}

.yard-code-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0.12rem 0.35rem 0.12rem 0;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: rgba(13, 148, 136, 0.1);
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.yard-code-chip strong {
  color: #0f766e;
  font-variant-numeric: tabular-nums;
}

.loading {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-content: center;
  gap: 0.75rem;
  background: rgba(207, 239, 255, 0.72);
  backdrop-filter: blur(8px);
  text-align: center;
  color: var(--ink-soft);
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.loading.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto;
  border-radius: 50%;
  border: 3px solid rgba(2, 132, 199, 0.2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .overview-card {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
