body {
      font-family: "Sarabun", sans-serif;
      background: linear-gradient(135deg, #eef7ff, #f8fbff);
      min-height: 100vh;
      color: #16324f;
    }

    .app-shell {
      max-width: 980px;
      margin: auto;
      padding: 32px 16px;
    }

    .hero-card {
      background: rgba(255,255,255,0.9);
      border: 1px solid rgba(120,180,230,0.3);
      border-radius: 28px;
      box-shadow: 0 18px 45px rgba(30, 90, 150, 0.12);
      padding: 28px;
    }

    .upload-zone {
      border: 2px dashed #7bbcf2;
      border-radius: 24px;
      padding: 36px 20px;
      text-align: center;
      background: #f7fbff;
      cursor: pointer;
      transition: 0.2s;
    }

    .upload-zone:hover,
    .upload-zone.dragover {
      background: #eaf6ff;
      transform: translateY(-2px);
    }

    .btn-main {
      background: linear-gradient(135deg, #1887d9, #43b0f1);
      border: 0;
      border-radius: 16px;
      padding: 12px 22px;
      font-weight: 800;
      color: white;
    }

    .btn-main:disabled {
      opacity: 0.55;
    }

    .status-box {
      border-radius: 18px;
      padding: 14px 16px;
      background: #eef7ff;
      border: 1px solid #c8e6ff;
      margin-top: 16px;
      display: none;
    }

    .small-muted {
      color: #6b8298;
      font-size: 14px;
    }

    .modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 35, 60, 0.45);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 18px;
}

.nice-modal {
  width: 100%;
  max-width: 420px;
  background: white;
  border-radius: 28px;
  padding: 28px;
  text-align: center;
  box-shadow: 0 24px 70px rgba(0,0,0,0.22);
}

.modal-icon {
  font-size: 44px;
  margin-bottom: 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.summary-card {
  background: white;
  border-radius: 22px;
  padding: 18px;
  border: 1px solid #d8ecff;
  box-shadow: 0 12px 30px rgba(30, 90, 150, 0.08);
}

.result-table {
  background: white;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid #d8ecff;
}

.badge-type {
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 800;
  font-size: 13px;
}

.type-prc { background:#ffe7e7; color:#b42323; }
.type-ffp { background:#e6f4ff; color:#0969a8; }
.type-ldppc { background:#fff4d6; color:#9a6700; }
.type-cryo { background:#f1e8ff; color:#6b2bbf; }
.type-sdp { background:#e8fff3; color:#087443; }

@media (max-width: 768px) {
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

    .priority-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.priority-card {
  background: white;
  border-radius: 22px;
  padding: 18px;
  border: 1px solid #d8ecff;
}

.priority-card.critical {
  border-color: #ffc9c9;
  background: #fff6f6;
}

.priority-card.overstock {
  border-color: #e3d2ff;
  background: #fbf8ff;
}

.tab-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 14px;
}

.tab-btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 800;
  background: white;
  color: #31506f;
  box-shadow: 0 8px 20px rgba(30, 90, 150, 0.08);
  white-space: nowrap;
}

.tab-btn.active {
  background: linear-gradient(135deg, #1887d9, #43b0f1);
  color: white;
}

.action-pill {
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 800;
  font-size: 13px;
  display: inline-block;
  white-space: nowrap;
  text-align: center;
  min-width: 86px;
}

.alert-critical { background:#ffe1e1; color:#b42323; }
.alert-warning { background:#fff4d6; color:#9a6700; }
.alert-watch { background:#eaf6ff; color:#0969a8; }
.alert-normal { background:#e8fff3; color:#087443; }
.alert-overstock { background:#f1e8ff; color:#6b2bbf; }

@media (max-width: 768px) {
  .priority-grid {
    grid-template-columns: 1fr;
  }
}

    .app-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 22px;
  max-width: 1320px;
  margin: auto;
  padding: 28px 18px;
}

.side-menu {
  position: sticky;
  top: 18px;
  align-self: start;
  background: rgba(255,255,255,0.92);
  border: 1px solid #d8ecff;
  border-radius: 28px;
  padding: 16px;
  box-shadow: 0 18px 45px rgba(30, 90, 150, 0.10);
}

.side-title {
  font-weight: 900;
  color: #16324f;
  margin-bottom: 12px;
}

.side-btn {
  width: 100%;
  border: 0;
  background: transparent;
  color: #31506f;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-radius: 18px;
  font-weight: 800;
  text-align: left;
  margin-bottom: 8px;
}

.side-btn.active {
  background: linear-gradient(135deg, #1887d9, #43b0f1);
  color: white;
}

.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 10001;
  border: 0;
  border-radius: 16px;
  padding: 10px 14px;
  background: #1887d9;
  color: white;
  font-weight: 900;
  box-shadow: 0 10px 28px rgba(0,0,0,0.18);
}

.side-overlay {
  display: none;
}

.dashboard-page {
  display: none;
}

.dashboard-page.active {
  display: block;
}

.mobile-filter-card {
  background: rgba(255,255,255,0.94);
  border: 1px solid #d8ecff;
  border-radius: 28px;
  padding: 24px;
  box-shadow: 0 18px 45px rgba(30, 90, 150, 0.10);
  margin-bottom: 18px;
}

.mobile-date-input {
  border: 1px solid #c8e6ff;
  border-radius: 16px;
  padding: 12px 14px;
  font-weight: 800;
  color: #16324f;
  background: #f8fcff;
}

.mobile-decision-card {
  border-radius: 24px;
  padding: 20px;
  margin-top: 16px;
  border: 1px solid #d8ecff;
}

.mobile-decision-card.critical {
  background: #fff1f1;
  border-color: #ffc9c9;
}

.mobile-decision-card.warning {
  background: #fff8e8;
  border-color: #ffe0a3;
}

.mobile-decision-card.watch {
  background: #eef7ff;
  border-color: #bfe3ff;
}

.mobile-decision-card.normal {
  background: #effff6;
  border-color: #bff0d4;
}

.mobile-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.mobile-chart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.mobile-chart-card {
  background: white;
  border: 1px solid #d8ecff;
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 12px 30px rgba(30, 90, 150, 0.08);
}

.mobile-bar-row {
  margin-bottom: 14px;
}

.mobile-bar-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 800;
  margin-bottom: 6px;
}

.mobile-bar-track {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: #edf4fb;
  overflow: hidden;
}

.mobile-bar-fill {
  height: 100%;
  border-radius: 999px;
}

.fill-cnmi { background: #1887d9; }
.fill-trc { background: #f59f00; }
.fill-other { background: #8c9aaa; }

.fill-expired { background: #7a271a; }
.fill-high { background: #d92d20; }
.fill-medium { background: #f59f00; }
.fill-watch { background: #1887d9; }
.fill-safe { background: #12b76a; }
.fill-unknown { background: #8c9aaa; }

.mobile-table-card {
  background: white;
  border: 1px solid #d8ecff;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(30, 90, 150, 0.08);
}

.mobile-table-card table {
  min-width: 980px;
}

.mobile-product-badge {
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 900;
  font-size: 13px;
  display: inline-block;
}

.mobile-note-box {
  background: #f7fbff;
  border: 1px solid #d8ecff;
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 18px;
}

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

  .mobile-chart-grid {
    grid-template-columns: 1fr;
  }

  .mobile-filter-card {
    padding: 20px;
  }
}

    .plan-button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.plan-btn {
  border: 1px solid #c8e6ff;
  background: white;
  color: #31506f;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(30, 90, 150, 0.08);
}

.plan-btn.active {
  background: linear-gradient(135deg, #1887d9, #43b0f1);
  color: white;
  border-color: transparent;
}

.forecast-hero {
  background: linear-gradient(135deg, #ffffff, #f4faff);
  border: 1px solid #d8ecff;
  border-radius: 28px;
  padding: 24px;
  box-shadow: 0 18px 45px rgba(30, 90, 150, 0.10);
  margin-bottom: 18px;
}

.forecast-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 900;
  font-size: 13px;
  background: #eef7ff;
  color: #0969a8;
}

.mobile-table-card table {
  min-width: 1100px;
}

.row-advice {
  min-width: 220px;
  display: inline-block;
}

    .group-forecast-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.group-forecast-card {
  background: white;
  border: 1px solid #d8ecff;
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 12px 30px rgba(30, 90, 150, 0.08);
}

.group-forecast-kpi {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.group-forecast-item {
  background: #f7fbff;
  border: 1px solid #e5f1ff;
  border-radius: 16px;
  padding: 10px 12px;
  text-align: center;
}

.group-forecast-item .value {
  font-size: 24px;
  font-weight: 900;
  line-height: 1.1;
  color: #16324f;
}

.group-forecast-note {
  color: #6b8298;
  font-size: 13px;
  margin-top: 4px;
}

.mobile-table-card th {
  white-space: nowrap;
  font-size: 14px;
}
    
.mobile-table-card table {
  min-width: 1100px;
}

@media (max-width: 768px) {
  .group-forecast-grid {
    grid-template-columns: 1fr;
  }
}
    
    @media (max-width: 900px) {
  .app-layout {
    display: block;
    padding: 72px 14px 22px;
  }

  .mobile-menu-btn {
    display: block;
  }

  .side-menu {
    position: fixed;
    top: 0;
    left: -290px;
    width: 270px;
    height: 100vh;
    z-index: 10000;
    border-radius: 0 28px 28px 0;
    transition: 0.22s ease;
    overflow-y: auto;
  }

  .side-menu.open {
    left: 0;
  }

  .side-overlay {
    position: fixed;
    inset: 0;
    background: rgba(12, 35, 60, 0.35);
    z-index: 9999;
  }

  .side-overlay.show {
    display: block;
  }
}

  .mobile-stock-cards {
  display: none;
}

.stock-mobile-card {
  background: white;
  border: 1px solid #d8ecff;
  border-radius: 22px;
  padding: 16px;
  margin-bottom: 12px;
}

.stock-mobile-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.stock-mobile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stock-mobile-item {
  background: #f7fbff;
  border-radius: 16px;
  padding: 10px;
}

.stock-mobile-label {
  color: #6b8298;
  font-size: 13px;
}

.stock-mobile-value {
  font-weight: 900;
  font-size: 20px;
}

@media (max-width: 768px) {
  .result-table {
    display: none;
  }

  .mobile-stock-cards {
    display: block;
  }

  .tab-scroll {
    padding-bottom: 10px;
  }

  .tab-btn {
    padding: 10px 14px;
    font-size: 15px;
  }
}

    .mobile-table-card th,
.mobile-table-card td {
  padding: 14px 12px;
}

.mobile-table-card thead th {
  background: #f7fbff;
  color: #31506f;
  font-weight: 900;
}

.mobile-table-card tbody td {
  font-size: 15px;
}

/* Supabase/GitHub optimized split files */
.engine-note {
  font-size: 12px;
  color: #6b8298;
}
