/* =========================================================
   DESIGN.MD COMPLIANT SYSTEM: WARM TACTILE BENTO NEUMORPHISM
   ========================================================= */

* {
  box-sizing: border-box;
}

:root {
  /* Mode Utama: Warm Oat / Latte (Terang & Organik) */
  --bg: #E6DDD3;
  --surface: #E6DDD3;
  --surface-highlight: #F7F1EA;
  --surface-shadow: #CFC4B8;

  /* CSS Box-Shadow Timbul (Extruded) - HANYA wadah kartu bento & tombol CTA */
  --bento-shadow: -7px -7px 16px #F7F1EA, 7px 7px 16px #CFC4B8;
  --btn-cta-shadow: -5px -5px 12px #F7F1EA, 5px 5px 12px #CFC4B8;
  --btn-cta-hover: -7px -7px 16px #F7F1EA, 7px 7px 16px #CFC4B8;
  --btn-active: inset 3px 3px 6px #CFC4B8, inset -3px -3px 6px #F7F1EA;

  /* CSS Box-Shadow Cekung (Inset) - HANYA input, progress bar, media, status well */
  --nm-inset: inset 4px 4px 10px #CFC4B8, inset -4px -4px 10px #F7F1EA;
  --nm-inset-sm: inset 2px 2px 6px #CFC4B8, inset -2px -2px 6px #F7F1EA;

  /* Garis Tepi Halus */
  --subtle-border: 1px solid rgba(255, 255, 255, 0.35);

  /* Tipografi */
  --ink-heading: #2E231C;
  --ink-body: #635347;
  --ink-muted: #877568;

  /* Aksen Utama & Sekunder */
  --accent-cta: #9E5834;
  --accent-cta-hover: #884928;
  --accent-cta-text: #F7F1EA;
  --accent-status: #4D6B53;
  --accent-alert: #A84338;
  --accent-soft: rgba(158, 88, 52, 0.12);

  /* Alias Kompatibilitas Script */
  --green: var(--accent-status);
  --red: var(--accent-alert);
  --blue: var(--accent-cta);
  --line: var(--surface-shadow);
  --muted: var(--ink-muted);
  --ink: var(--ink-heading);

  /* Border Radius Standar Sesuai DESIGN.md */
  --radius-bento: 24px;
  --radius-elem: 14px;
  --radius-pill: 99px;
}

[data-theme="dark"] {
  /* Mode Gelap: Warm Espresso */
  --bg: #2C241E;
  --surface: #2C241E;
  --surface-highlight: #382E26;
  --surface-shadow: #201A16;

  --bento-shadow: -7px -7px 16px #382E26, 7px 7px 16px #201A16;
  --btn-cta-shadow: -5px -5px 12px #382E26, 5px 5px 12px #201A16;
  --btn-cta-hover: -7px -7px 16px #382E26, 7px 7px 16px #201A16;
  --btn-active: inset 3px 3px 6px #201A16, inset -3px -3px 6px #382E26;

  --nm-inset: inset 4px 4px 10px #201A16, inset -4px -4px 10px #382E26;
  --nm-inset-sm: inset 2px 2px 6px #201A16, inset -2px -2px 6px #382E26;

  --subtle-border: 1px solid rgba(255, 255, 255, 0.08);

  --ink-heading: #F5EFE6;
  --ink-body: #C4B4A5;
  --ink-muted: #9A897B;

  --accent-cta: #D97736;
  --accent-cta-hover: #C56728;
  --accent-cta-text: #201A16;
  --accent-status: #648B6B;
  --accent-alert: #C7564B;
  --accent-soft: rgba(217, 119, 54, 0.16);

  --green: var(--accent-status);
  --red: var(--accent-alert);
  --blue: var(--accent-cta);
  --line: var(--surface-shadow);
  --muted: var(--ink-muted);
  --ink: var(--ink-heading);
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-body);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  transition: background 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
}

/* Headings: Fraunces / Serif Hangat */
h1, h2, h3, h4 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink-heading);
  margin-top: 0;
}

/* Angka & Data Selalu Menggunakan Tabular Nums */
.tabular,
.stat-value,
.metric-value,
.live-weight-display,
.weight,
.lcd-screen,
.lcd-screen-inset,
table td,
.acc-head b {
  font-variant-numeric: tabular-nums;
}

/* =========================================================
   CONTAINER UTAMA (MAKSIMAL 1200PX DENGAN PADDING LEGA)
   ========================================================= */
.bento-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 24px 60px;
}

/* Header & Navigasi */
.bento-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon-box {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-elem);
  box-shadow: var(--btn-cta-shadow);
  border: var(--subtle-border);
  display: grid;
  place-items: center;
  background: var(--surface);
  flex: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.brand-icon-box:hover {
  transform: translateY(-2px);
  box-shadow: var(--btn-cta-hover);
}

.brand-icon-box:active {
  transform: translateY(1px);
  box-shadow: var(--btn-active);
}

.brand-logo-img {
  width: 36px;
  height: 36px;
  display: block;
}

.brand-meta h1 {
  font-size: 24px;
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.brand-meta small {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Mode Switch: Inset Well */
.mode-toggle-well {
  display: inline-flex;
  padding: 4px;
  background: var(--surface);
  box-shadow: var(--nm-inset-sm);
  border-radius: var(--radius-pill);
  gap: 4px;
}

.mode-btn {
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-btn.active {
  background: var(--accent-cta);
  color: var(--accent-cta-text);
  box-shadow: var(--btn-cta-shadow);
}

/* Tombol Ikonik & Utilitas */
.btn-util {
  border: var(--subtle-border);
  background: var(--surface);
  box-shadow: var(--btn-cta-shadow);
  color: var(--ink-heading);
  border-radius: var(--radius-elem);
  padding: 10px 16px;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-util:hover {
  box-shadow: var(--btn-cta-hover);
  transform: translateY(-1px);
}

.btn-util:active {
  box-shadow: var(--btn-active);
  transform: translateY(1px);
}

/* Status Koneksi Pill (Inset) */
.conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--nm-inset-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-body);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-muted);
  display: inline-block;
  flex: none;
  transition: background 0.2s ease;
}

.status-dot.online {
  background: var(--accent-status);
}

/* Banner Notifikasi */
.connect-banner {
  background: var(--surface);
  border: var(--subtle-border);
  box-shadow: var(--btn-cta-shadow);
  border-radius: var(--radius-elem);
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.connect-banner strong {
  display: block;
  font-size: 14px;
  color: var(--accent-alert);
  margin-bottom: 4px;
}

.connect-banner p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-muted);
}

.connect-banner[hidden] {
  display: none !important;
}

/* =========================================================
   ASYMMETRIC BENTO GRID (12-KOLOM DENGAN GAP 24PX)
   ========================================================= */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
}

/* Kartu Bento Utama (Extruded Sesuai DESIGN.md) */
.bento-card {
  background: var(--surface);
  border-radius: var(--radius-bento);
  box-shadow: var(--bento-shadow);
  border: var(--subtle-border);
  padding: 28px;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Header di dalam kartu: Konten Datar (Flat) */
.card-head {
  margin-bottom: 20px;
}

.card-head h2 {
  font-size: 20px;
  margin: 0 0 4px;
  color: var(--ink-heading);
}

.card-head p {
  font-size: 13px;
  color: var(--ink-muted);
  margin: 0;
  line-height: 1.5;
}

/* Kolom Span Bento Grid */
.span-12 { grid-column: span 12; }
.span-8  { grid-column: span 8; }
.span-7  { grid-column: span 7; }
.span-6  { grid-column: span 6; }
.span-5  { grid-column: span 5; }
.span-4  { grid-column: span 4; }
.span-3  { grid-column: span 3; }

/* =========================================================
   KARTU BENTO 1: KENDALI MOTOR & BOBOT LIVE
   ========================================================= */
.motor-control-group {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.motor-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.indicator-badge-inset {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--nm-inset-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-body);
}

.indicator-badge-inset.online,
.indicator-badge-inset.running {
  color: var(--accent-status);
}

.indicator-badge-inset.offline,
.indicator-badge-inset.stopped {
  color: var(--accent-alert);
}

/* Tombol Aksi Utama (CTA Extruded Sesuai DESIGN.md) */
.action-buttons-wrap {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-cta {
  border: var(--subtle-border);
  border-radius: var(--radius-elem);
  padding: 12px 20px;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--btn-cta-shadow);
  transition: all 0.2s ease;
  user-select: none;
}

.btn-cta:hover {
  box-shadow: var(--btn-cta-hover);
  transform: translateY(-2px);
}

.btn-cta:active {
  box-shadow: var(--btn-active);
  transform: translateY(1px);
}

.btn-cta-primary,
.btn-primary {
  background: var(--accent-cta);
  color: var(--accent-cta-text);
}

.btn-cta-success,
.btn-success {
  background: var(--accent-status);
  color: var(--surface-highlight);
}

.btn-cta-danger,
.btn-danger {
  background: var(--accent-alert);
  color: var(--surface-highlight);
}

.btn-cta-neutral {
  background: var(--surface);
  color: var(--ink-heading);
}

/* Well Bacaan Bobot Live (Inset Sesuai DESIGN.md) */
.live-weight-well {
  padding: 18px 22px;
  border-radius: var(--radius-elem);
  background: var(--surface);
  box-shadow: var(--nm-inset);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.well-label {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: 2px;
}

.live-weight-display {
  font-family: "Fraunces", Georgia, serif;
  font-size: 36px;
  font-weight: 700;
  color: var(--ink-heading);
  line-height: 1.1;
}

.live-weight-display small {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-muted);
}

.well-meta {
  font-size: 12px;
  color: var(--ink-muted);
  text-align: right;
  line-height: 1.5;
  max-width: 260px;
}

/* =========================================================
   KARTU BENTO 2: TELEMETRI & STATUS SENSOR
   ========================================================= */
.telemetry-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.telemetry-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 16px;
  border-radius: var(--radius-elem);
  background: var(--surface);
  border: var(--subtle-border);
  box-shadow: none; /* Datar di dalam kartu bento */
}

.item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-heading);
}

.item-sub {
  display: block;
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 1px;
}

.item-status {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
}

.item-status.ok {
  color: var(--accent-status);
}

.item-status.err {
  color: var(--accent-alert);
}

/* Wi-Fi RSSI Bars */
.wifi-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}

.wifi-bars i {
  display: block;
  width: 3px;
  border-radius: 1px;
  background: var(--surface-shadow);
}

.wifi-bars i:nth-child(1) { height: 4px; }
.wifi-bars i:nth-child(2) { height: 7px; }
.wifi-bars i:nth-child(3) { height: 10px; }
.wifi-bars i:nth-child(4) { height: 14px; }

.wifi-bars.lvl-1 i:nth-child(1) { background: var(--accent-alert); }
.wifi-bars.lvl-2 i:nth-child(-n+2) { background: var(--accent-cta); }
.wifi-bars.lvl-3 i:nth-child(-n+3) { background: var(--accent-status); }
.wifi-bars.lvl-4 i:nth-child(-n+4) { background: var(--accent-status); }

/* =========================================================
   KARTU BENTO 3: METRIK STATISTIK OPERASIONAL
   ========================================================= */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.metric-tile {
  padding: 16px 18px;
  border-radius: var(--radius-elem);
  background: var(--surface);
  border: var(--subtle-border);
  box-shadow: none; /* Datar di dalam kartu bento */
  transition: background 0.15s ease;
}

.metric-tile:hover {
  background: rgba(158, 88, 52, 0.04);
}

.metric-tile.active-kpi {
  border-color: var(--accent-cta);
  background: rgba(158, 88, 52, 0.06);
}

.metric-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.metric-value {
  font-family: "Fraunces", Georgia, serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--ink-heading);
  line-height: 1.1;
}

.metric-sub {
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 4px;
}

/* =========================================================
   KARTU BENTO 4: RASIO KELOLOSAN (DONUT DIAL)
   ========================================================= */
.ratio-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.donut-dial-outer {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  box-shadow: var(--btn-cta-shadow);
  display: grid;
  place-items: center;
  background: conic-gradient(var(--accent-status) 0deg, var(--surface-shadow) 0deg);
  position: relative;
  transition: transform 0.2s ease;
}

.donut-dial-outer:hover {
  transform: scale(1.03);
}

.donut-dial-inner {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--nm-inset);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.donut-dial-inner strong {
  font-family: "Fraunces", Georgia, serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--ink-heading);
  line-height: 1;
}

.donut-dial-inner small {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.ratio-legend {
  display: flex;
  width: 100%;
  justify-content: space-around;
  font-size: 12px;
  font-weight: 600;
}

.legend-point {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-point i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.point-valid { background: var(--accent-status); }
.point-reject { background: var(--accent-alert); }

/* Progress Bar (Inset Well Sesuai DESIGN.md) */
.acc-track-inset {
  width: 100%;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--nm-inset-sm);
  overflow: hidden;
  border: var(--subtle-border);
}

.acc-fill-flat {
  height: 100%;
  width: 0%;
  background: var(--accent-status);
  border-radius: var(--radius-pill);
  transition: width 0.4s ease;
}

/* =========================================================
   KARTU BENTO 5: GRAFIK TELEMETRI BOBOT (FLAT SVG)
   ========================================================= */
.chart-well {
  width: 100%;
  height: 190px;
  border-radius: var(--radius-elem);
  background: var(--surface);
  box-shadow: var(--nm-inset);
  padding: 16px;
  position: relative;
}

#weightChart {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--ink-heading);
  color: var(--surface-highlight);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  white-space: nowrap;
  transform: translate(-50%, -115%);
  z-index: 10;
  box-shadow: 0 4px 12px rgba(46, 35, 28, 0.25);
}

.chart-tooltip[hidden] {
  display: none;
}

/* =========================================================
   KARTU BENTO 6: TABEL LOG RIWAYAT TRANSAKSI
   ========================================================= */
.table-toolbar {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-well {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  box-shadow: var(--nm-inset);
  border-radius: var(--radius-pill);
  padding: 0 16px;
  flex: 1;
  min-width: 240px;
}

.search-well input {
  border: 0;
  background: transparent;
  width: 100%;
  padding: 10px 0;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 14px;
  color: var(--ink-heading);
  outline: none;
}

.filter-well {
  display: flex;
  gap: 4px;
  background: var(--surface);
  box-shadow: var(--nm-inset-sm);
  border-radius: var(--radius-pill);
  padding: 4px;
}

.f-pill {
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 600;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s ease;
}

.f-pill.active {
  background: var(--surface);
  color: var(--accent-cta);
  box-shadow: var(--btn-cta-shadow);
  font-weight: 700;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

th {
  text-align: left;
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 12px 14px;
  border-bottom: 2px solid var(--surface-shadow);
  user-select: none;
}

th.sortable {
  cursor: pointer;
}

th.sortable:hover,
th.active-sort {
  color: var(--accent-cta);
}

td {
  padding: 14px;
  border-bottom: 1px solid var(--surface-shadow);
  font-size: 14px;
  color: var(--ink-body);
}

tbody tr.log-row {
  cursor: pointer;
  transition: background 0.15s ease;
}

tbody tr.log-row:hover {
  background: rgba(158, 88, 52, 0.05);
}

tbody tr.row-new {
  animation: rowHighlight 1.5s ease-out;
}

@keyframes rowHighlight {
  0% { background: rgba(158, 88, 52, 0.18); }
  100% { background: transparent; }
}

td:first-child {
  color: var(--ink-heading);
  font-weight: 600;
}

.uid-sub {
  display: block;
  font-size: 12px;
  color: var(--ink-muted);
  font-weight: 400;
  margin-top: 2px;
}

.pill,
.pill-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--surface);
  border: var(--subtle-border);
}

.pill.valid,
.pill-status.valid {
  color: var(--accent-status);
  background: rgba(77, 107, 83, 0.12);
}

.pill.reject,
.pill-status.reject {
  color: var(--accent-alert);
  background: rgba(168, 67, 56, 0.12);
}

.pill.beban,
.pill-status.beban {
  color: var(--accent-cta);
  background: rgba(158, 88, 52, 0.12);
}

.table-foot {
  display: flex;
  justify-content: space-between;
  padding-top: 16px;
  font-size: 12px;
  color: var(--ink-muted);
}

/* =========================================================
   KARTU BENTO 7: LAB SIMULATOR (MODE SIMULASI)
   ========================================================= */
.conveyor-stage-inset {
  background: var(--surface);
  box-shadow: var(--nm-inset);
  border-radius: var(--radius-elem);
  padding: 22px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 22px;
  position: relative;
}

.stage-card-flat {
  background: var(--surface);
  border: var(--subtle-border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.25s ease;
}

.stage-card-flat.lit {
  border-color: var(--accent-cta);
  background: var(--surface-highlight);
}

.stage-card-flat.lit-ok {
  border-color: var(--accent-status);
  background: rgba(77, 107, 83, 0.08);
}

.stage-card-flat.lit-err {
  border-color: var(--accent-alert);
  background: rgba(168, 67, 56, 0.08);
}

.station-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-muted);
  text-transform: uppercase;
}

.lcd-screen-inset {
  background: var(--surface);
  box-shadow: var(--nm-inset-sm);
  padding: 8px 12px;
  border-radius: 8px;
  font-family: "Fraunces", Georgia, monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-cta);
  text-align: center;
}

.gate-arm {
  width: 28px;
  height: 4px;
  background: var(--ink-muted);
  border-radius: 2px;
  transform-origin: left center;
  transition: transform 0.3s ease, background 0.3s ease;
}

.gate-arm.valid {
  transform: rotate(-35deg);
  background: var(--accent-status);
}

.gate-arm.reject {
  transform: rotate(35deg);
  background: var(--accent-alert);
}

.belt-track-inset {
  grid-column: 1 / -1;
  height: 60px;
  background: var(--surface);
  box-shadow: var(--nm-inset);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.belt-track-inset::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0px,
    transparent 20px,
    var(--surface-shadow) 20px,
    var(--surface-shadow) 24px
  );
  opacity: 0.35;
}

.belt-track-inset.running::before {
  animation: beltMove 0.8s linear infinite;
}

@keyframes beltMove {
  0% { transform: translateX(0); }
  100% { transform: translateX(24px); }
}

.sim-package {
  position: absolute;
  left: 4%;
  width: 140px;
  height: 46px;
  background: var(--surface);
  border: var(--subtle-border);
  border-radius: 10px;
  box-shadow: var(--btn-cta-shadow);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: left 0.45s ease;
  z-index: 2;
}

.sim-package.at-rfid { left: 14%; }
.sim-package.at-scale { left: 44%; }
.sim-package.at-gate-valid { left: 78%; border-color: var(--accent-status); color: var(--accent-status); }
.sim-package.at-gate-reject { left: 78%; border-color: var(--accent-alert); color: var(--accent-alert); }

.pkg-uid {
  font-size: 11px;
  font-weight: 700;
}

.pkg-prod {
  font-size: 10px;
  color: var(--ink-muted);
}

.burst-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.burst-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: burstAnim 0.7s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes burstAnim {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}

.preset-chips-wrap {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.chip-btn {
  border: var(--subtle-border);
  background: var(--surface);
  color: var(--ink-body);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip-btn.active {
  background: var(--accent-cta);
  color: var(--accent-cta-text);
  box-shadow: var(--btn-cta-shadow);
}

.slider-inset-wrap input[type="range"] {
  width: 100%;
  accent-color: var(--accent-cta);
  cursor: pointer;
}

/* =========================================================
   MODAL INSPECTOR & TOAST
   ========================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(46, 35, 28, 0.45);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 100;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-bento-card {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border-radius: var(--radius-bento);
  box-shadow: var(--bento-shadow);
  border: var(--subtle-border);
  padding: 32px;
}

.modal-bento-card-large {
  max-width: 660px;
  max-height: 88vh;
  overflow-y: auto;
}

.scale-mode-panel {
  background: var(--surface);
  box-shadow: var(--nm-inset-sm);
  border-radius: var(--radius-elem);
  padding: 14px 18px;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

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

@media (max-width: 600px) {
  .scale-step-grid {
    grid-template-columns: 1fr;
  }
}

.scale-step-card {
  background: var(--surface);
  border: var(--subtle-border);
  border-radius: var(--radius-elem);
  padding: 16px;
}

.scale-step-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

.scale-readout-well {
  background: var(--surface);
  box-shadow: var(--nm-inset-sm);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  margin-bottom: 10px;
}

.scale-readout-uid {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-heading);
  letter-spacing: 0.5px;
  word-break: break-all;
}

.scale-readout-weight {
  font-family: 'Fraunces', serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--ink-heading);
}

.scale-input,
.scale-select {
  width: 100%;
  padding: 8px 12px;
  border: 0;
  background: var(--surface);
  box-shadow: var(--nm-inset-sm);
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  color: var(--ink-heading);
  outline: none;
}

.scale-input-sm {
  width: 100%;
  padding: 6px 10px;
  border: 0;
  background: var(--surface);
  box-shadow: var(--nm-inset-sm);
  border-radius: 8px;
  font-family: inherit;
  font-size: 11px;
  color: var(--ink-heading);
  outline: none;
}

.scale-enroll-card {
  background: var(--surface);
  border: var(--subtle-border);
  border-radius: var(--radius-elem);
  padding: 16px;
  margin-bottom: 18px;
}

.scale-dataset-wrap {
  max-height: 140px;
  overflow-y: auto;
  background: var(--surface);
  box-shadow: var(--nm-inset-sm);
  border-radius: 10px;
  padding: 6px;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 18px 0;
}

.m-stat {
  background: var(--surface);
  border: var(--subtle-border);
  border-radius: var(--radius-elem);
  padding: 12px 14px;
}

.m-stat small {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.m-stat b {
  font-size: 14px;
  color: var(--ink-heading);
}

.modal-json {
  background: var(--surface);
  box-shadow: var(--nm-inset);
  padding: 14px;
  border-radius: var(--radius-elem);
  font-size: 12px;
  font-family: monospace;
  color: var(--ink-heading);
  overflow-x: auto;
  max-height: 180px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* Toast */
.toast-bento {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--surface);
  color: var(--ink-heading);
  box-shadow: var(--bento-shadow);
  border: var(--subtle-border);
  padding: 14px 22px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.25s ease;
  pointer-events: none;
  z-index: 120;
}

.toast-bento.show {
  opacity: 1;
  transform: translateY(0);
}

/* =========================================================
   RESPONSIVE DESIGN (BENTO ADAPTIVE BREAKPOINTS)
   ========================================================= */
@media (max-width: 1024px) {
  .span-8, .span-7, .span-5, .span-4 {
    grid-column: span 12;
  }
  .metrics-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .bento-container {
    padding: 24px 16px 40px;
  }
  .bento-card {
    padding: 20px;
  }
  .bento-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .metrics-row {
    grid-template-columns: 1fr;
  }
  .conveyor-stage-inset {
    grid-template-columns: 1fr;
  }
  .live-weight-well {
    flex-direction: column;
    align-items: flex-start;
  }
  .well-meta {
    text-align: left;
    max-width: none;
  }
}

body[data-mode="live"] #simulator,
body[data-mode="live"] [data-section="simulator"] {
  display: none !important;
}

/* =========================================================
   SISTEM AUTENTIKASI & HALAMAN LOGIN (SESUAI DESIGN.MD)
   ========================================================= */

.login-page-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 32px 20px;
}

.login-bento-container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

.login-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  width: 100%;
}

.login-bento-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
  align-items: stretch;
}

.auth-card {
  background: var(--surface);
  border-radius: var(--radius-bento);
  box-shadow: var(--bento-shadow);
  border: var(--subtle-border);
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.auth-card-head {
  margin-bottom: 24px;
}

.auth-card-head h2 {
  font-size: 24px;
  margin: 0 0 6px;
  color: var(--ink-heading);
}

.auth-card-head p {
  font-size: 13.5px;
  color: var(--ink-muted);
  margin: 0;
  line-height: 1.5;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-heading);
  letter-spacing: 0.01em;
}

.bento-input-well {
  display: flex;
  align-items: center;
  background: var(--surface);
  box-shadow: var(--nm-inset);
  border-radius: var(--radius-elem);
  padding: 0 14px;
  border: 1px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.bento-input-well:focus-within {
  border-color: rgba(158, 88, 52, 0.4);
}

[data-theme="dark"] .bento-input-well:focus-within {
  border-color: rgba(217, 119, 54, 0.4);
}

.bento-input {
  border: 0;
  background: transparent;
  width: 100%;
  padding: 12px 0;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 14.5px;
  color: var(--ink-heading);
  outline: none;
}

.bento-input::placeholder {
  color: var(--ink-muted);
  opacity: 0.7;
}

.btn-icon-subtle {
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s ease;
  flex: none;
}

.btn-icon-subtle:hover {
  color: var(--ink-heading);
}

.form-options-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--ink-body);
}

.bento-checkbox-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: var(--ink-body);
}

.bento-checkbox-wrap input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--nm-inset-sm);
  border: var(--subtle-border);
  cursor: pointer;
  display: grid;
  place-content: center;
  transition: background 0.2s ease, box-shadow 0.2s ease;
  margin: 0;
}

.bento-checkbox-wrap input[type="checkbox"]:checked {
  background: var(--accent-cta);
  box-shadow: var(--btn-cta-shadow);
}

.bento-checkbox-wrap input[type="checkbox"]:checked::after {
  content: "";
  width: 8px;
  height: 5px;
  border-left: 2px solid var(--accent-cta-text);
  border-bottom: 2px solid var(--accent-cta-text);
  transform: rotate(-45deg) translate(1px, -1px);
}

.auth-alert-inset {
  background: var(--surface);
  box-shadow: var(--nm-inset-sm);
  border-radius: var(--radius-elem);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--accent-alert);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.4;
  border-left: 4px solid var(--accent-alert);
}

.auth-alert-inset[hidden] {
  display: none !important;
}

/* Quick Fill Selector untuk Uji Coba Cepat */
.quick-fill-block {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--surface-shadow);
}

.quick-fill-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  margin-bottom: 10px;
}

.quick-fill-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-quick-fill {
  border: var(--subtle-border);
  background: var(--surface);
  box-shadow: var(--btn-cta-shadow);
  color: var(--ink-heading);
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-quick-fill:hover {
  transform: translateY(-1px);
  box-shadow: var(--btn-cta-hover);
}

.btn-quick-fill:active {
  transform: translateY(1px);
  box-shadow: var(--btn-active);
}

.btn-quick-fill strong {
  color: var(--accent-cta);
}

/* Kartu Info Tingkatan Hak Akses (Panel Kanan) */
.role-info-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.role-info-inset {
  background: var(--surface);
  box-shadow: var(--nm-inset-sm);
  border-radius: var(--radius-elem);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.role-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.role-badge-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}

.role-badge-tag.admin {
  background: var(--accent-cta);
  color: var(--accent-cta-text);
}

.role-badge-tag.operator {
  background: var(--accent-status);
  color: #F7F1EA;
}

.role-info-inset h4 {
  font-size: 14px;
  margin: 0;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 700;
  color: var(--ink-heading);
}

.role-info-inset p {
  font-size: 12.5px;
  color: var(--ink-muted);
  margin: 0;
  line-height: 1.5;
}

.role-checklist {
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.role-checklist li {
  font-size: 12px;
  color: var(--ink-body);
  display: flex;
  align-items: center;
  gap: 6px;
}

.role-checklist li::before {
  content: "•";
  color: var(--accent-cta);
  font-weight: bold;
}

/* User Session Badge di Header Dashboard */
.user-session-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--nm-inset-sm);
  border: var(--subtle-border);
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-heading);
}

.user-role-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  display: inline-block;
}

.user-role-badge.badge-admin {
  background: var(--accent-cta);
  color: var(--accent-cta-text);
}

.user-role-badge.badge-operator {
  background: var(--accent-status);
  color: #F7F1EA;
}

.user-role-badge.badge-guest {
  background: var(--surface-shadow);
  color: var(--ink-heading);
}

.btn-logout {
  border: var(--subtle-border);
  background: var(--surface);
  box-shadow: var(--btn-cta-shadow);
  color: var(--accent-alert);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  transform: translateY(-1px);
  box-shadow: var(--btn-cta-hover);
  background: var(--accent-alert);
  color: #FFFFFF;
}

.btn-logout:active {
  transform: translateY(1px);
  box-shadow: var(--btn-active);
}

/* Responsivitas Layar Login */
@media (max-width: 820px) {
  .login-bento-grid {
    grid-template-columns: 1fr;
  }
  .login-page-wrap {
    padding: 20px 14px;
  }
  .auth-card {
    padding: 24px 20px;
  }
}

/* =========================================================
   MODAL MANAJEMEN PENGGUNA (SESI ADMIN)
   ========================================================= */

.role-select-pill {
  display: block;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  color: var(--ink-muted);
  transition: all 0.2s ease;
  user-select: none;
}

.role-select-pill.active {
  background: var(--accent-cta);
  color: var(--accent-cta-text);
  box-shadow: var(--btn-cta-shadow);
}

.user-list-well {
  background: var(--surface);
  box-shadow: var(--nm-inset-sm);
  border-radius: var(--radius-elem);
  padding: 10px;
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface);
  border: var(--subtle-border);
  border-radius: 10px;
  transition: transform 0.15s ease;
}

.user-item-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-heading);
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-item-sub {
  font-size: 11px;
  color: var(--ink-muted);
}

.user-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-delete-user {
  border: var(--subtle-border);
  background: var(--surface);
  box-shadow: var(--btn-cta-shadow);
  color: var(--accent-alert);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-delete-user:hover {
  background: var(--accent-alert);
  color: #FFFFFF;
  transform: translateY(-1px);
}

.btn-delete-user:active {
  transform: translateY(1px);
  box-shadow: var(--btn-active);
}


