:root {
  --ink: #0f172a;
  --ink-soft: #475569;
  --muted: #64748b;
  --bg: #f8fafc;
  --card: #ffffff;
  --line: #e2e8f0;
  --accent: #059669;
  --accent-deep: #047857;
  --primary: #334155;
  --red: #dc2626;
  --orange: #ea580c;
  --amber: #d97706;
  --radius: 16px;
  --font-display: "Plus Jakarta Sans", "Sarabun", sans-serif;
  --font-body: "Sarabun", "Plus Jakarta Sans", sans-serif;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 32px rgba(15, 23, 42, 0.06);
}

*,
*::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:
    radial-gradient(1000px 520px at 8% -8%, rgba(5, 150, 105, 0.12), transparent 55%),
    radial-gradient(800px 480px at 100% 0%, rgba(51, 65, 85, 0.1), transparent 50%),
    linear-gradient(180deg, #eef2f7 0%, var(--bg) 40%, #f8fafc 100%);
}

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.atmosphere-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(51, 65, 85, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(51, 65, 85, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.5), transparent 72%);
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(64px);
  opacity: 0.5;
}
.glow.a { width: 380px; height: 380px; top: -100px; left: -60px; background: rgba(5,150,105,.18); }
.glow.b { width: 340px; height: 340px; top: 10%; right: -80px; background: rgba(51,65,85,.14); }

.mock-banner {
  position: relative;
  z-index: 2;
  background: #0f172a;
  color: #e2e8f0;
  text-align: center;
  padding: 0.55rem 1rem;
  font-size: 0.88rem;
}
.mock-banner strong { color: #6ee7b7; }

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

.topbar {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 0.5rem;
  animation: rise 0.5s ease-out both;
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  gap: 1.25rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.kicker {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.topbar-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.55rem;
}

.pill {
  display: inline-flex;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 600;
}

.app-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

.app-links a {
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
  cursor: pointer;
}

.app-links a:hover {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: var(--accent-deep);
}

.main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1rem 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  animation: rise 0.55s 0.05s ease-out both;
}

.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.15rem 1.2rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.kpi::before {
  content: "";
  position: absolute;
  left: 1.15rem;
  top: 0;
  width: 2rem;
  height: 3px;
  background: var(--accent);
  border-radius: 0 0 3px 3px;
}

.kpi-ok::before { background: var(--accent); }
.kpi-warn::before { background: var(--amber); }

.kpi-label {
  margin: 0.55rem 0 0;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.kpi-value {
  margin: 0.45rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 3.5vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.kpi-suffix {
  font-size: 0.55em;
  margin-left: 0.05em;
}

.kpi-unit {
  margin: 0.45rem 0 0;
  font-size: 0.86rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

.layout-2 {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 1.1rem;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.2rem 1.25rem;
  animation: rise 0.55s 0.1s ease-out both;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.95rem;
}

.eyebrow {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.panel-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.text-link {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-deep);
  text-decoration: none;
  white-space: nowrap;
}
.text-link:hover { text-decoration: underline; }

.alert-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.alert {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: start;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.alert strong {
  font-family: var(--font-display);
  font-size: 0.95rem;
}

.alert p {
  margin: 0.2rem 0 0;
  font-size: 0.86rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

.alert-tag {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.28rem 0.45rem;
  border-radius: 6px;
  white-space: nowrap;
}

.alert-amber { border-color: #fde68a; background: #fffbeb; }
.alert-amber .alert-tag { background: #fef3c7; color: #92400e; }

.alert-red { border-color: #fecaca; background: #fef2f2; }
.alert-red .alert-tag { background: #fee2e2; color: #991b1b; }

.alert-orange { border-color: #fed7aa; background: #fff7ed; }
.alert-orange .alert-tag { background: #ffedd5; color: #9a3412; }

.alert-slate { border-color: #cbd5e1; background: #f8fafc; }
.alert-slate .alert-tag { background: #e2e8f0; color: #334155; }

.table-wrap { overflow: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.65rem 0.4rem;
  border-bottom: 1px solid var(--line);
}

.data-table th {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.data-table td:first-child {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-weight: 600;
  font-size: 0.82rem;
}

.pct {
  font-family: var(--font-display);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.pct.ok { color: var(--accent-deep); }
.pct.low { color: var(--red); }

.wh-bars {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.wh-row {
  display: grid;
  grid-template-columns: 5.5rem 1fr 4.2rem;
  gap: 0.75rem;
  align-items: center;
}

.wh-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.wh-track {
  height: 10px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.wh-track > span {
  display: block;
  height: 100%;
  width: var(--w);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #34d399);
  animation: grow 0.7s ease-out both;
}

.wh-track.yard > span {
  background: linear-gradient(90deg, #0f766e, #2dd4bf);
}

.wh-n {
  text-align: right;
  font-family: var(--font-display);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
}

.lot-grid {
  display: grid;
  gap: 0.75rem;
}

.lot {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  background: #f8fafc;
}

.lot h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
}

.lot-meta {
  margin: 0.25rem 0 0.55rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.lot-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: var(--primary);
}

.tag-red { background: #fee2e2; color: #991b1b; }
.tag-orange { background: #ffedd5; color: #9a3412; }

.panel-note {
  background:
    linear-gradient(135deg, rgba(5, 150, 105, 0.06), transparent 45%),
    var(--card);
}

.scope-list {
  margin: 0;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

.scope-list strong { color: var(--ink); }

.scope-foot {
  margin: 1.1rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--line);
  font-size: 0.85rem;
  color: var(--muted);
}

.foot {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.25rem 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
}

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

@keyframes grow {
  from { width: 0; }
}

@media (max-width: 960px) {
  .kpi-grid,
  .layout-2 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .kpi-grid,
  .layout-2 {
    grid-template-columns: 1fr;
  }
  .topbar-meta { align-items: flex-start; }
  .app-links { justify-content: flex-start; }
  .wh-row {
    grid-template-columns: 4.5rem 1fr 3.6rem;
    gap: 0.45rem;
  }
}

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