/* ==========================================================================
   FoodDetect IoT — Komponen Aplikasi (Dashboard, Sidebar, Tabel, Auth)
   ========================================================================== */

/* ---------------------------------------------------------------- App shell */
.app-shell {
  display: grid;
  grid-template-columns: 268px 1fr;
  min-height: 100vh;
  padding-top: var(--header-h);
}

/* ---------------------------------------------------------------- Sidebar */
.sidebar {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  display: flex;
  flex-direction: column;
  padding: var(--sp-5) var(--sp-4);
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(10, 22, 32, 0.7), rgba(6, 13, 18, 0.9));
  backdrop-filter: blur(18px);
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 40;
}

.sidebar__section { margin-bottom: var(--sp-5); }

.sidebar__label {
  padding: 0 12px;
  margin-bottom: 9px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-lo);
}

.sidebar__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  margin-bottom: 3px;
  border-radius: var(--r-md);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-mid);
  transition: color var(--dur-fast) ease, background var(--dur-fast) ease, transform var(--dur-fast) ease;
}

.sidebar__link:hover {
  color: var(--text-hi);
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(3px);
}

.sidebar__link.is-active {
  color: var(--mint-300);
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.16), rgba(16, 185, 129, 0.03));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

.sidebar__link.is-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: var(--mint-400);
  box-shadow: 0 0 12px var(--mint-400);
}

.sidebar__icon { flex-shrink: 0; opacity: 0.9; }

.sidebar__foot { margin-top: auto; padding-top: var(--sp-4); padding-bottom: var(--sp-4); border-top: 1px solid var(--border); flex-shrink: 0; }

/* Kartu status perangkat di sidebar */
.sidebar-status {
  padding: 13px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: rgba(16, 185, 129, 0.06);
  margin-bottom: var(--sp-3);
}
.sidebar-status__row { display: flex; align-items: center; justify-content: space-between; font-size: 0.78rem; }
.sidebar-status__row + .sidebar-status__row { margin-top: 7px; }
.sidebar-status__key { color: var(--text-lo); }
.sidebar-status__val { font-weight: 700; font-family: var(--font-mono); font-size: 0.76rem; }

/* ---------------------------------------------------------------- App main */
.app-main { 
  min-width: 0; 
  padding: var(--sp-6) var(--sp-6) var(--sp-8); 
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

.page-head__title { font-size: clamp(1.5rem, 2.6vw, 2rem); }
.page-head__sub { margin-top: 6px; font-size: 0.9rem; color: var(--text-mid); }
.page-head__actions { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-3); }

/* ---------------------------------------------------------------- KPI card */
.kpi {
  position: relative;
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.055), rgba(0, 0, 0, 0.14));
  box-shadow: var(--shadow-3d);
  overflow: hidden;
  transition: transform var(--dur-mid) var(--ease-out), border-color var(--dur-mid) ease, box-shadow var(--dur-mid) ease;
}

.kpi:hover {
  transform: translateY(-5px);
  border-color: var(--border-hi);
  box-shadow: var(--shadow-lg), 0 0 40px -18px rgba(16, 185, 129, 0.6);
}

.kpi__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); }

.kpi__label {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-lo);
}

.kpi__icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(110, 231, 183, 0.2);
  color: var(--mint-300);
}

.kpi__icon--amber { background: rgba(245, 158, 11, 0.14); border-color: rgba(245, 158, 11, 0.24); color: var(--amber-400); }
.kpi__icon--sky   { background: rgba(56, 189, 248, 0.14); border-color: rgba(56, 189, 248, 0.24); color: var(--sky-400); }
.kpi__icon--rose  { background: rgba(244, 63, 94, 0.14);  border-color: rgba(244, 63, 94, 0.24);  color: var(--rose-400); }

.kpi__value {
  margin-top: var(--sp-3);
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.kpi__unit { font-size: 0.9rem; font-weight: 600; color: var(--text-lo); margin-left: 3px; }

.kpi__foot {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: var(--sp-3);
  font-size: 0.78rem;
  color: var(--text-lo);
}

.kpi__spark { position: absolute; right: 0; bottom: 0; width: 100%; height: 46px; opacity: 0.5; pointer-events: none; }

/* ---------------------------------------------------------------- Chart card */
.chart-card {
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.045), rgba(0, 0, 0, 0.12));
  box-shadow: var(--shadow-3d);
}

.chart-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.chart-card__title { font-size: 1rem; display: flex; align-items: center; gap: 9px; }
.chart-card__title svg { color: var(--mint-400); }

.chart-box { position: relative; width: 100%; height: 260px; }
.chart-box--sm { height: 200px; }
.chart-box--lg { height: 320px; }

.chart-box canvas { width: 100% !important; height: 100% !important; }

/* Legend */
.legend { display: flex; flex-wrap: wrap; gap: var(--sp-4); }
.legend__item { display: flex; align-items: center; gap: 7px; font-size: 0.78rem; color: var(--text-mid); }
.legend__swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* ---------------------------------------------------------------- Live indicator */
.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: var(--r-full);
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #4ade80;
}

.live-dot__pulse {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #4ade80;
  animation: live-pulse 1.8s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6); }
  50%      { opacity: 0.6; transform: scale(0.85); box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
}

/* ---------------------------------------------------------------- Filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: var(--sp-5);
}

.filter-bar .field { flex: 1 1 160px; min-width: 140px; }
.filter-bar .field--wide { flex: 2 1 240px; }
.filter-bar__actions { display: flex; gap: var(--sp-2); flex-shrink: 0; }

/* ---------------------------------------------------------------- Bulk actions bar */
.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: var(--sp-5);
}
.bulk-bar__left { display: flex; align-items: center; gap: var(--sp-3); }
.bulk-bar__right { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.bulk-bar__count { font-size: 0.85rem; color: var(--text-mid); }

/* ---------------------------------------------------------------- Pagination */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
}

.pagination__info { font-size: 0.84rem; color: var(--text-lo); }
.pagination__pages { display: flex; gap: 5px; flex-wrap: wrap; }

.page-btn {
  min-width: 38px;
  height: 38px;
  padding: 0 11px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-mid);
  font-size: 0.85rem;
  font-weight: 600;
  display: grid;
  place-items: center;
  transition: all var(--dur-fast) ease;
}
.page-btn:hover { border-color: var(--border-hi); color: var(--mint-300); background: rgba(16, 185, 129, 0.08); }
.page-btn.is-active {
  background: linear-gradient(135deg, var(--mint-500), var(--mint-600));
  border-color: transparent;
  color: #04120c;
  box-shadow: 0 6px 18px -8px rgba(16, 185, 129, 0.8);
}
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ---------------------------------------------------------------- Empty state */
.empty {
  padding: var(--sp-8) var(--sp-5);
  text-align: center;
  color: var(--text-lo);
}
.empty__icon {
  width: 64px; height: 64px;
  margin: 0 auto var(--sp-4);
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-lo);
}
.empty__title { font-size: 1rem; font-weight: 700; color: var(--text-mid); margin-bottom: 6px; }
.empty__desc { font-size: 0.88rem; max-width: 380px; margin-inline: auto; }

/* ---------------------------------------------------------------- Auth layout */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding-top: var(--header-h);
}

.auth-visual {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: var(--sp-8);
}

.auth-visual img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.42;
  transform: scale(1.05);
  animation: hero-drift 30s ease-in-out infinite alternate;
}

.auth-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 30% 20%, rgba(16, 185, 129, 0.28), transparent 60%),
    linear-gradient(180deg, rgba(6, 13, 18, 0.4), rgba(6, 13, 18, 0.95));
}

.auth-visual__content { position: relative; z-index: 2; max-width: 440px; }

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-7) var(--sp-5);
}

.auth-card { width: 100%; max-width: 420px; }

.auth-card__head { margin-bottom: var(--sp-6); }
.auth-card__title { font-size: 1.7rem; }
.auth-card__sub { margin-top: 8px; font-size: 0.9rem; color: var(--text-mid); }

.auth-form { display: flex; flex-direction: column; gap: var(--sp-4); }

.auth-foot {
  margin-top: var(--sp-5);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-mid);
}
.auth-foot a { color: var(--mint-300); font-weight: 700; }
.auth-foot a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- Password strength */
.strength { display: flex; align-items: center; gap: 9px; margin-top: 7px; }
.strength__track { flex: 1; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.strength__bar { height: 100%; width: 0; border-radius: 4px; transition: width var(--dur-mid) ease, background var(--dur-mid) ease; }
.strength__text { font-size: 0.74rem; font-weight: 700; min-width: 46px; text-align: right; }

/* ---------------------------------------------------------------- Camera / detection */
.camera-stage {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
  aspect-ratio: 4 / 3;
  box-shadow: var(--shadow-lg);
}

.camera-stage video,
.camera-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-stage__overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: var(--sp-5);
  background: radial-gradient(ellipse at center, rgba(16, 185, 129, 0.08), rgba(0, 0, 0, 0.85));
  z-index: 3;
}

.camera-stage__overlay.is-hidden { display: none; }

.camera-stage__hint { max-width: 320px; color: var(--text-mid); font-size: 0.9rem; }

/* Corner brackets */
.camera-stage__frame {
  position: absolute;
  inset: 18px;
  z-index: 2;
  pointer-events: none;
}
.camera-stage__frame span {
  position: absolute;
  width: 26px; height: 26px;
  border: 2px solid rgba(110, 231, 183, 0.7);
}
.camera-stage__frame span:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 6px 0 0 0; }
.camera-stage__frame span:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 6px 0 0; }
.camera-stage__frame span:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 6px; }
.camera-stage__frame span:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 6px 0; }

.detect-list { display: flex; flex-direction: column; gap: 9px; max-height: 320px; overflow-y: auto; }

.detect-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  animation: alert-in var(--dur-mid) var(--ease-out);
}

.detect-item__bar { flex: 1; height: 5px; border-radius: 5px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.detect-item__fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--mint-500), var(--lime-400)); transition: width var(--dur-mid) ease; }

/* ---------------------------------------------------------------- Device card */
.device-card {
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.12));
  box-shadow: var(--shadow-3d);
  transition: transform var(--dur-mid) var(--ease-out), border-color var(--dur-mid) ease;
}
.device-card:hover { transform: translateY(-4px); border-color: var(--border-hi); }
.device-card.is-offline { opacity: 0.72; }

.device-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.device-card__id { font-family: var(--font-mono); font-size: 0.78rem; color: var(--mint-300); letter-spacing: 0.04em; }
.device-card__label { font-size: 1rem; font-weight: 700; margin-top: 4px; }
.device-card__meta { display: grid; gap: 8px; margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--border); }
.device-card__row { display: flex; align-items: center; justify-content: space-between; font-size: 0.82rem; }
.device-card__key { color: var(--text-lo); }
.device-card__val { font-weight: 600; }

/* ---------------------------------------------------------------- Tabs */
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: var(--r-full); border: 1px solid var(--border); background: rgba(0, 0, 0, 0.25); width: fit-content; max-width: 100%; overflow-x: auto; }
.tab {
  padding: 9px 18px;
  border-radius: var(--r-full);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-mid);
  white-space: nowrap;
  transition: all var(--dur-fast) ease;
}
.tab:hover { color: var(--text-hi); }
.tab.is-active { background: linear-gradient(135deg, var(--mint-500), var(--mint-600)); color: #04120c; box-shadow: 0 4px 14px -6px rgba(16, 185, 129, 0.8); }

/* ---------------------------------------------------------------- Code block */
.code-block {
  position: relative;
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.45);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.7;
  color: #a5d6c4;
  overflow-x: auto;
  white-space: pre;
}

.code-block__copy {
  position: absolute;
  top: 9px;
  right: 9px;
  padding: 6px 11px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-mid);
  transition: all var(--dur-fast) ease;
}
.code-block__copy:hover { color: var(--mint-300); border-color: var(--border-hi); }

/* ---------------------------------------------------------------- Toast */
.toast-stack {
  position: fixed;
  top: calc(var(--header-h) + 14px);
  right: 18px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: min(360px, calc(100vw - 36px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: rgba(10, 22, 32, 0.97);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-lg);
  font-size: 0.86rem;
  animation: toast-in var(--dur-mid) var(--ease-spring);
}
.toast.is-out { animation: toast-out 260ms var(--ease-out) forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(40px) scale(0.96); }
}

.toast--success { border-color: rgba(34, 197, 94, 0.4); }
.toast--danger  { border-color: rgba(239, 68, 68, 0.4); }
.toast--warning { border-color: rgba(245, 158, 11, 0.4); }
.toast--info    { border-color: rgba(56, 189, 248, 0.4); }

/* ---------------------------------------------------------------- Responsif app */
@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform var(--dur-mid) var(--ease-out);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: translateX(0); }
  .app-main { padding: var(--sp-5) var(--sp-4) var(--sp-7); }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
}

@media (max-width: 640px) {
  .app-main { padding: var(--sp-4) var(--sp-3) var(--sp-6); }
  .kpi { padding: var(--sp-4); }
  .chart-card { padding: var(--sp-4); }
  .chart-box { height: 220px; }
  .filter-bar { padding: var(--sp-3); }
  .filter-bar .field { flex: 1 1 100%; }
  .filter-bar__actions { width: 100%; }
  .filter-bar__actions .btn { flex: 1; }
  .page-head__actions { width: 100%; }
  .page-head__actions .btn { flex: 1; }
  .pagination { flex-direction: column; align-items: stretch; }
  .pagination__pages { justify-content: center; }
  .camera-stage { aspect-ratio: 3 / 4; }
  .toast-stack { left: 12px; right: 12px; max-width: none; }
}

/* ---------------------------------------------------------------- Grid layout responsif */
.grid--split   { grid-template-columns: 1.6fr 1fr; gap: 20px; }
.grid--split-2 { grid-template-columns: 1.5fr 1fr; gap: 20px; }
.grid--profile { grid-template-columns: 1fr 1.4fr; gap: 20px; }
.grid--docs    { grid-template-columns: 240px 1fr; gap: 32px; align-items: start; }

@media (max-width: 1080px) {
  .grid--split,
  .grid--split-2,
  .grid--profile,
  .grid--docs { grid-template-columns: 1fr; gap: 18px; }
  .grid--docs > nav { position: static !important; }
}

/* ---------------------------------------------------------------- Guard overflow */
.grid > * { min-width: 0; }
.app-main { overflow-x: hidden; overflow-y: auto; }
.chart-card, .kpi, .device-card, .card { min-width: 0; }

/* ---------------------------------------------------------------- Fixed height untuk list di dashboard */
.chart-card__list-scroll {
  max-height: 480px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.chart-card__list-scroll .table-wrap,
.chart-card__list-scroll .stack {
  max-height: none;
}
.code-block { max-width: 100%; }
.table-wrap { max-width: 100%; }

/* ==========================================================================
   Perbaikan overflow tabel & grid di layar sempit.
   .table punya min-width 720px; tanpa pembungkus ini, tabel mendorong
   seluruh halaman melebar. .table-wrap harus benar-benar mengklip.
   ========================================================================== */
.table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  min-width: 0;
  display: block;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

/* Tanpa JavaScript, animasi reveal tidak akan pernah berjalan. Paksa semua
   konten terlihat agar halaman tidak tampil kosong sama sekali. */
.no-js [data-reveal],
.no-js [data-reveal-pending] {
  opacity: 1 !important;
  transform: none !important;
}

/* Setiap anak grid/flex boleh mengecil di bawah ukuran kontennya */
.docs-layout,
.docs-body,
.chart-card__body,
.page-head,
.page-head > * {
  min-width: 0;
}

/* Kartu & panel tidak boleh mendorong lebar induk */
.chart-card,
.panel,
.card,
.quote,
.feature,
.step,
.device-card,
.kpi {
  max-width: 100%;
  min-width: 0;
}

/* Tabel di dalam kartu: beri ruang gulir horizontal sendiri */
.chart-card .table-wrap,
.panel .table-wrap {
  border-radius: var(--r-md);
}

@media (max-width: 900px) {
  .table { min-width: 640px; }
}

/* Tabel ringkas untuk kolom sempit (mis. kartu "Pembacaan Terbaru" di
   dashboard). Tanpa min-width, tabel mengalir di dalam kartu sehingga
   tidak ada kolom yang terpotong atau perlu digulir. */
.table--compact { min-width: 0 !important; font-size: 0.8rem; }
.table--compact thead th,
.table--compact tbody td { padding: 9px 8px; white-space: nowrap; }
.table--compact thead th:first-child,
.table--compact tbody td:first-child { padding-left: 0; }
.table--compact thead th:last-child,
.table--compact tbody td:last-child { padding-right: 0; }

/* Badge status di tabel ringkas: jangan pernah terpotong. */
.table--compact .badge {
  white-space: nowrap;
  max-width: none;
  overflow: visible;
  text-overflow: clip;
}

/* Di layar sangat sempit, tabel ringkas boleh digulir di dalam kartunya
   sendiri (bukan mendorong seluruh halaman). */
@media (max-width: 480px) {
  .table--compact { font-size: 0.74rem; }
  .table--compact thead th,
  .table--compact tbody td { padding: 8px 6px; }
  .table--compact .badge { font-size: 0.66rem; padding: 3px 7px; }

  /* Kolom Suhu disembunyikan agar kolom Status punya ruang cukup dan
     badge tidak pernah terpotong. Data suhu tetap ada di halaman Riwayat. */
  .table--compact thead th:nth-child(4),
  .table--compact tbody td:nth-child(4) { display: none; }
}

@media (max-width: 640px) {
  .table { min-width: 560px; font-size: 0.82rem; }
  .table thead th,
  .table tbody td { padding: 10px 12px; }
}

/* ---------------------------------------------------------------- Tombol aksi riwayat */
.btn.is-muted { opacity: .55; }
.btn.is-muted:hover { opacity: .8; }
.btn.is-loading { pointer-events: none; opacity: .6; position: relative; }
.btn.is-loading::after {
  content: '';
  width: 12px; height: 12px;
  margin-left: 6px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  vertical-align: -2px;
  animation: fd-spin .7s linear infinite;
}
@keyframes fd-spin { to { transform: rotate(360deg); } }
