:root {
  --bg: #f6f7fb;
  --card: #fff;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #1f4e78;
  --blue: #2563eb;
  --danger: #dc2626;
  --line: #e5e7eb;
}

/* ===============================
   BASE / GLOBAL
   =============================== */

* {
  box-sizing: border-box;
}

html {
  font-size: 14px;
}

body {
  margin: 0;
  min-width: 1024px;
  font-family: Arial, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  overflow-x: auto;
}

.hidden {
  display: none;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.text-right {
  text-align: right;
}

.nowrap {
  white-space: nowrap;
}

.small-text {
  font-size: 11px;
}

.print-only {
  display: none;
}

/* ===============================
   HEADER / LAYOUT
   =============================== */

header {
  background: var(--primary);
  color: #fff;
  padding: 18px 24px;
}

header h1 {
  margin: 0;
  font-size: 22px;
}

header p {
  margin: 6px 0 0;
  color: #dbeafe;
}

.wrap {
  display: grid;
  grid-template-columns: 245px 1fr;
  min-height: calc(100vh - 78px);
}

main {
  padding: 20px;
}

.app,
.container,
.main,
.page,
.content {
  max-width: 1500px;
  margin-left: auto;
  margin-right: auto;
}

/* ===============================
   NAVIGATION
   =============================== */

nav {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 16px;
}

nav button {
  display: block;
  width: 100%;
  padding: 12px;
  margin-bottom: 8px;
  border: 0;
  border-radius: 10px;
  background: #f3f4f6;
  text-align: left;
  cursor: pointer;
  font-weight: 700;
  color: #374151;
}

nav button.active {
  background: var(--primary);
  color: #fff;
}

/* ===============================
   CARDS / PANELS
   =============================== */

.card,
.panel,
.box {
  width: 100%;
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .04);
}

.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}

.stat h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.stat div {
  font-size: 24px;
  font-weight: 800;
}

/* ===============================
   TYPOGRAPHY
   =============================== */

h2 {
  margin: 0 0 14px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

/* ===============================
   FORMS / BUTTONS
   =============================== */

input,
select,
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 9px;
  background: #fff;
  font-size: 14px;
}

button {
  min-height: 36px;
}

button.primary {
  background: var(--blue);
  color: #fff;
  border: 0;
  border-radius: 9px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

button.secondary {
  background: #e5e7eb;
  color: #111827;
  border: 0;
  border-radius: 9px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

button.danger {
  background: var(--danger);
  color: #fff;
  border: 0;
  border-radius: 9px;
  padding: 8px 10px;
  cursor: pointer;
}

.search {
  max-width: 380px;
  margin-bottom: 12px;
}

/* ===============================
   GRID / ROW
   =============================== */

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

.formgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ===============================
   TABLES
   =============================== */

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  background: #fff;
}

th,
td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  background: #f9fafb;
  font-size: 13px;
  color: #374151;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.table-wrap table {
  min-width: 980px;
}

.cell-number {
  width: 40px;
  text-align: center;
  vertical-align: top;
  font-weight: bold;
}

/* ===============================
   STATUS BADGES
   =============================== */

.status {
  display: inline-block;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.aman,
.paid {
  background: #dcfce7;
  color: #166534;
}

.menipis,
.partial {
  background: #fef3c7;
  color: #92400e;
}

.minus,
.ditolak,
.unpaid {
  background: #fee2e2;
  color: #991b1b;
}

/* ===============================
   NOTICE / INFO
   =============================== */

.notice {
  display: none;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
}

.notice.ok {
  display: block;
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.notice.err {
  display: block;
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.money-info {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-top: 10px;
}

.money-info b {
  font-size: 16px;
}

.staff-locked {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  color: #92400e;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 12px;
}

/* ===============================
   LOGIN
   =============================== */

.login-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #1f4e78, #0f172a);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.login-box {
  background: #fff;
  border-radius: 18px;
  padding: 24px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}

.login-box h2 {
  margin: 0 0 8px;
}

.login-box p {
  margin: 0 0 18px;
  color: #6b7280;
}

.userbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.badge-role {
  display: inline-block;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
}

/* ===============================
   DASHBOARD
   =============================== */

.dashboard-toolbar {
  display: grid;
  grid-template-columns: 2fr 180px auto 180px 220px auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.dashboard-toolbar .search {
  max-width: none;
  margin-bottom: 0;
}

.insight-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.insight-grid > div {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #f9fafb;
}

.dashboard-simple-table table {
  min-width: 0 !important;
}

.dashboard-simple-table th,
.dashboard-simple-table td {
  font-size: 13px;
  padding: 9px;
}

.dashboard-simple-table .nama-barang {
  max-width: 320px;
  white-space: normal;
}

/* ===============================
   MODAL
   =============================== */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  padding: 18px;
}

.modal.hidden {
  display: none !important;
}

.modal-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
  width: min(920px, 96vw);
  max-height: 88vh;
  overflow: auto;
  padding: 18px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.modal-head h2 {
  margin: 0;
}

/* ===============================
   ACTION MENU
   =============================== */

.action-cell {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.action-menu {
  position: relative;
  display: inline-block;
}

.action-menu summary {
  list-style: none;
  cursor: pointer;
  border: 1px solid var(--line);
  background: #f3f4f6;
  border-radius: 12px;
  padding: 0;
  width: 34px;
  height: 36px;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.action-menu summary::-webkit-details-marker {
  display: none;
}

.action-menu div {
  position: absolute;
  right: 0;
  top: 40px;
  z-index: 50;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .12);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  width: 220px;
  min-width: 220px;
}

.action-menu button {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 7px 8px;
  text-align: center;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  line-height: 1.15;
  font-size: 12px;
  border-radius: 12px;
}

/* ===============================
   STOCK REQUEST COMPACT TABLE
   =============================== */

.request-compact-table {
  width: 100%;
  overflow-x: hidden;
}

.request-compact-table table {
  width: 100%;
  min-width: 0 !important;
  table-layout: fixed;
  border-collapse: collapse;
}

.request-compact-table th,
.request-compact-table td {
  padding: 7px;
  font-size: 13px;
  vertical-align: top;
  word-wrap: break-word;
}

.request-compact-table th:nth-child(1),
.request-compact-table td:nth-child(1) {
  width: 8%;
}

.request-compact-table th:nth-child(2),
.request-compact-table td:nth-child(2) {
  width: 11%;
}

.request-compact-table th:nth-child(3),
.request-compact-table td:nth-child(3) {
  width: 12%;
}

.request-compact-table th:nth-child(4),
.request-compact-table td:nth-child(4) {
  width: 17%;
}

.request-compact-table th:nth-child(5),
.request-compact-table td:nth-child(5) {
  width: 8%;
}

.request-compact-table th:nth-child(6),
.request-compact-table td:nth-child(6) {
  width: 9%;
}

.request-compact-table th:nth-child(7),
.request-compact-table td:nth-child(7) {
  width: 15%;
}

.request-compact-table th:nth-child(8),
.request-compact-table td:nth-child(8) {
  width: 10%;
}

.request-compact-table th:nth-child(9),
.request-compact-table td:nth-child(9) {
  width: 8%;
}

.request-compact-table th:nth-child(10),
.request-compact-table td:nth-child(10) {
  width: 10%;
}

.request-compact-table .action-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.request-compact-table button {
  font-size: 12px;
  padding: 6px 8px;
}

.cell-note {
  max-height: 38px;
  overflow: hidden;
  line-height: 1.35;
}

.qty-cell b {
  font-size: 14px;
}

/* ===============================
   RESPONSIVE - MULTI PC
   =============================== */

@media screen and (max-width: 1200px) {
  html {
    font-size: 13px;
  }

  th,
  td {
    font-size: 12px;
    padding: 7px;
  }

  input,
  select,
  button,
  textarea {
    font-size: 13px;
  }
}

@media screen and (min-width: 1600px) {
  html {
    font-size: 15px;
  }

  th,
  td {
    font-size: 14px;
  }
}

@media (max-width: 1100px) {
  .dashboard-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-toolbar button {
    width: 100%;
  }
}

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

  nav {
    display: flex;
    overflow: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  nav button {
    min-width: 150px;
    margin-right: 8px;
  }

  .grid,
  .formgrid,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .modal-card .formgrid {
    grid-template-columns: 1fr;
  }

  .modal {
    align-items: flex-start;
  }

  .dashboard-simple-table th:nth-child(1),
  .dashboard-simple-table td:nth-child(1),
  .dashboard-simple-table th:nth-child(3),
  .dashboard-simple-table td:nth-child(3),
  .dashboard-simple-table th:nth-child(5),
  .dashboard-simple-table td:nth-child(5) {
    display: none;
  }

  .dashboard-simple-table .nama-barang {
    max-width: 220px;
  }
}

/* ===============================
   PRINT LOCK - ONLY PRINT AREA
   =============================== */

@media print {
  @page {
    size: A4 landscape;
    margin: 7mm;
  }

  html,
  body {
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    background: #fff !important;
    color: #000 !important;
    font-size: 10px !important;
  }

  header,
  nav,
  main,
  .wrap,
  .userbar,
  .notice,
  .modal,
  .login-screen {
    display: none !important;
  }

  body * {
    visibility: hidden !important;
  }

  #printArea,
  #printArea * {
    visibility: visible !important;
  }

  #printArea {
    display: block !important;
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    right: auto !important;
    bottom: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #fff !important;
    color: #000 !important;
  }

  .print-only {
    display: block !important;
  }

  #printArea > div {
    margin: 0 !important;
    padding: 0 !important;
    page-break-after: auto !important;
    break-after: auto !important;
  }

  #printArea table {
    width: 100% !important;
    border-collapse: collapse !important;
    table-layout: fixed !important;
    page-break-inside: auto !important;
  }

  #printArea tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  #printArea th,
  #printArea td {
    border: 1px solid #333 !important;
    padding: 4px !important;
    font-size: 9px !important;
    line-height: 1.15 !important;
    white-space: normal !important;
    word-break: break-word !important;
    color: #000 !important;
  }

  #printArea th {
    font-weight: bold !important;
    background: #f3f4f6 !important;
  }

  button,
  input,
  select,
  textarea,
  .no-print {
    display: none !important;
  }
}

/* ===============================
   FIX TABLE STOCK REQUEST
   Status & Aksi tidak bertabrakan
   =============================== */

.request-compact-table table {
  width: 100%;
  table-layout: fixed;
}

.request-compact-table th,
.request-compact-table td {
  vertical-align: middle;
}

/* Lebar kolom Stock Request */
.request-compact-table th:nth-child(1),
.request-compact-table td:nth-child(1) {
  width: 110px; /* Tanggal */
}

.request-compact-table th:nth-child(2),
.request-compact-table td:nth-child(2) {
  width: 130px; /* Outlet */
}

.request-compact-table th:nth-child(3),
.request-compact-table td:nth-child(3) {
  width: 120px; /* Kategori */
}

.request-compact-table th:nth-child(4),
.request-compact-table td:nth-child(4) {
  width: 230px; /* Nama Barang */
}

.request-compact-table th:nth-child(5),
.request-compact-table td:nth-child(5) {
  width: 90px; /* Qty Req */
}

.request-compact-table th:nth-child(6),
.request-compact-table td:nth-child(6) {
  width: 110px; /* Qty Kirim */
}

.request-compact-table th:nth-child(7),
.request-compact-table td:nth-child(7) {
  width: 170px; /* Catatan */
}

.request-compact-table th:nth-child(8),
.request-compact-table td:nth-child(8) {
  width: 110px; /* Subtotal */
}

.request-compact-table th:nth-child(9),
.request-compact-table td:nth-child(9) {
  width: 150px; /* Status */
}

.request-compact-table th:nth-child(10),
.request-compact-table td:nth-child(10) {
  width: 110px; /* Aksi */
}

/* Badge status jangan keluar kolom */
.request-compact-table .status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  white-space: normal;
  line-height: 1.2;
  text-align: center;
  padding: 8px 10px;
  word-break: normal;
}

/* Tombol aksi dirapikan */
.request-compact-table .action-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.request-compact-table .action-cell button,
.request-compact-table .action-menu summary {
  white-space: nowrap;
}

/* ===============================
   STOCK REQUEST - FIT 1 SCREEN
   =============================== */

.request-compact-table {
  overflow-x: hidden;
}

.request-compact-table table {
  width: 100%;
  table-layout: fixed;
}

.request-compact-table th,
.request-compact-table td {
  padding: 8px 6px;
  font-size: 13px;
  vertical-align: middle;
  white-space: normal;
}

/* Tanggal */
.request-compact-table th:nth-child(1),
.request-compact-table td:nth-child(1) {
  width: 85px;
}

/* Outlet */
.request-compact-table th:nth-child(2),
.request-compact-table td:nth-child(2) {
  width: 95px;
}

/* Kategori */
.request-compact-table th:nth-child(3),
.request-compact-table td:nth-child(3) {
  width: 85px;
}

/* Nama Barang */
.request-compact-table th:nth-child(4),
.request-compact-table td:nth-child(4) {
  width: 190px;
  word-break: break-word;
}

/* Qty Req */
.request-compact-table th:nth-child(5),
.request-compact-table td:nth-child(5) {
  width: 75px;
  text-align: center;
}

/* Qty Kirim */
.request-compact-table th:nth-child(6),
.request-compact-table td:nth-child(6) {
  width: 85px;
}

/* Catatan */
.request-compact-table th:nth-child(7),
.request-compact-table td:nth-child(7) {
  width: 110px;
  word-break: break-word;
}

/* Subtotal */
.request-compact-table th:nth-child(8),
.request-compact-table td:nth-child(8) {
  width: 90px;
}

/* Status */
.request-compact-table th:nth-child(9),
.request-compact-table td:nth-child(9) {
  width: 130px;
  text-align: center;
}

/* Aksi */
.request-compact-table th:nth-child(10),
.request-compact-table td:nth-child(10) {
  width: 75px;
  text-align: center;
}

/* Status badge dipaksa tetap dalam kolom */
.request-compact-table .status {
  max-width: 100%;
  white-space: normal;
  line-height: 1.15;
  text-align: center;
  padding: 7px 8px;
  font-size: 12px;
}

/* Aksi lebih compact */
.request-compact-table .action-cell {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
}

.request-compact-table .action-cell button {
  padding: 7px 9px;
  font-size: 12px;
}

.request-compact-table .action-menu summary {
  width: 32px;
  height: 32px;
  padding: 6px;
}
/* ===============================
   REQUEST EDIT MODAL
   =============================== */

#requestEditModal .modal-card {
  max-width: 900px;
  width: 92%;
}

#requestEditModal .formgrid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

#requestEditModal .money-info {
  margin-top: 8px;
}

/* ===============================
   STOCK REQUEST - STATUS & AKSI LEBIH RAPI
   =============================== */

.request-compact-table {
  overflow-x: hidden;
}

.request-compact-table table {
  width: 100%;
  table-layout: fixed;
}

.request-compact-table th,
.request-compact-table td {
  vertical-align: middle;
  padding: 10px 8px;
}

/* Lebar kolom inti supaya tetap muat */
.request-compact-table th:nth-child(1),
.request-compact-table td:nth-child(1) {
  width: 90px;   /* Tanggal */
}

.request-compact-table th:nth-child(2),
.request-compact-table td:nth-child(2) {
  width: 95px;   /* Outlet */
}

.request-compact-table th:nth-child(3),
.request-compact-table td:nth-child(3) {
  width: 85px;   /* Kategori */
}

.request-compact-table th:nth-child(4),
.request-compact-table td:nth-child(4) {
  width: 180px;  /* Nama barang */
  word-break: break-word;
}

.request-compact-table th:nth-child(5),
.request-compact-table td:nth-child(5) {
  width: 75px;   /* Qty Req */
  text-align: center;
}

.request-compact-table th:nth-child(6),
.request-compact-table td:nth-child(6) {
  width: 95px;   /* Qty Kirim */
}

.request-compact-table th:nth-child(7),
.request-compact-table td:nth-child(7) {
  width: 90px;   /* Catatan */
  word-break: break-word;
}

.request-compact-table th:nth-child(8),
.request-compact-table td:nth-child(8) {
  width: 95px;   /* Subtotal */
}

.request-compact-table th:nth-child(9),
.request-compact-table td:nth-child(9) {
  width: 145px;  /* Status */
  text-align: center;
}

.request-compact-table th:nth-child(10),
.request-compact-table td:nth-child(10) {
  width: 110px;  /* Aksi */
  text-align: center;
}

/* Badge status lebih rapi */
.request-compact-table .status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 150px;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
  word-break: break-word;
  box-sizing: border-box;
}

/* Area aksi lebih compact */
.request-compact-table .action-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: nowrap;
}

/* Tombol utama di kolom aksi */
.request-compact-table .action-cell .primary,
.request-compact-table .action-cell .secondary,
.request-compact-table .action-cell .danger {
  min-width: 60px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.1;
  border-radius: 12px;
  white-space: nowrap;
}

/* Tombol tiga titik */
.request-compact-table .action-menu {
  position: relative;
}

.request-compact-table .action-menu summary {
  list-style: none;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.request-compact-table .action-menu summary::-webkit-details-marker {
  display: none;
}

/* Popup menu titik tiga */
.request-compact-table .action-menu[open] > div {
  right: 0;
  left: auto;
  width: 220px;
  min-width: 220px;
}

.action-menu button:last-child.danger {
  grid-column: 1 / -1;
}

/* Selesai tidak usah terlalu lebar */
.request-compact-table .action-cell .muted {
  font-size: 12px;
  white-space: nowrap;
}

/* ===============================
   MASTER BARANG - FIT 1 SCREEN
   =============================== */

#master .table-wrap,
#masterTable {
  overflow-x: hidden;
}

#masterTable table {
  width: 100%;
  table-layout: fixed;
}

#masterTable th,
#masterTable td {
  padding: 9px 8px;
  font-size: 13px;
  vertical-align: middle;
  white-space: normal;
}

/* Kode */
#masterTable th:nth-child(1),
#masterTable td:nth-child(1) {
  width: 75px;
}

/* Nama Barang */
#masterTable th:nth-child(2),
#masterTable td:nth-child(2) {
  width: 250px;
  word-break: break-word;
}

/* Kategori */
#masterTable th:nth-child(3),
#masterTable td:nth-child(3) {
  width: 80px;
}

/* Satuan */
#masterTable th:nth-child(4),
#masterTable td:nth-child(4) {
  width: 70px;
}

/* Supplier */
#masterTable th:nth-child(5),
#masterTable td:nth-child(5) {
  width: 210px;
  word-break: break-word;
}

/* Stok Awal */
#masterTable th:nth-child(6),
#masterTable td:nth-child(6) {
  width: 80px;
  text-align: center;
}

/* Min */
#masterTable th:nth-child(7),
#masterTable td:nth-child(7) {
  width: 60px;
  text-align: center;
}

/* Harga Outlet */
#masterTable th:nth-child(8),
#masterTable td:nth-child(8) {
  width: 90px;
}

/* Tipe Pemenuhan */
#masterTable th:nth-child(9),
#masterTable td:nth-child(9) {
  width: 100px;
  text-align: center;
}

/* Lead Time */
#masterTable th:nth-child(10),
#masterTable td:nth-child(10) {
  width: 85px;
  text-align: center;
}

/* Aksi */
#masterTable th:nth-child(11),
#masterTable td:nth-child(11) {
  width: 115px;
  text-align: center;
}

/* Tombol aksi master lebih compact */
#masterTable td:nth-child(11) {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
}

#masterTable td:nth-child(11) button {
  padding: 8px 10px;
  font-size: 12px;
  border-radius: 10px;
  white-space: nowrap;
}

/* ===============================
   STOCK REQUEST DETAIL ROW
   =============================== */

.request-detail-row td {
  padding: 0 8px 10px 8px !important;
  background: #ffffff;
  border-top: none !important;
}

.request-detail-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 8px 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  font-size: 12px;
  color: #475569;
}

.request-detail-left,
.request-detail-right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.request-detail-left {
  flex: 1 1 auto;
  min-width: 0;
}

.request-detail-right {
  flex: 0 0 auto;
  justify-content: flex-end;
  text-align: right;
  min-width: 220px;
}

.request-detail-left span,
.request-detail-right span {
  white-space: normal;
}

.request-detail-info b {
  color: #111827;
}

.request-detail-right span {
  font-weight: 600;
  color: #1f2937;
}

/* ===============================
   STOCK REQUEST - AKSI SEJAJAR
   =============================== */

.request-compact-table td:nth-child(9) {
  vertical-align: middle;
}

.request-compact-table .action-cell {
  display: grid;
  grid-template-columns: 74px 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
}

/* Tombol utama: Kirim / Isi Harga / Siap Kirim / Edit */
.request-compact-table .action-cell button {
  width: 74px;
  min-width: 74px;
  height: 40px;
  padding: 0 8px;
  font-size: 13px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: normal;
  line-height: 1.1;
}

/* Tombol titik tiga */
.request-compact-table .action-menu {
  width: 38px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.request-compact-table .action-menu summary {
  width: 38px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Hilangkan marker bawaan details */
.request-compact-table .action-menu summary::-webkit-details-marker {
  display: none;
}

/* Status selesai / ditolak yang berupa teks tetap sejajar */
.request-compact-table .action-cell .muted {
  width: 74px;
  min-width: 74px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  white-space: nowrap;
}

/* Kalau hanya ada teks tanpa titik tiga, tetap tidak terlalu geser */
.request-compact-table .action-cell:has(.muted):not(:has(.action-menu)) {
  grid-template-columns: 112px;
}

/* ===============================
   HARUS DIPRODUKSI - DISTRIBUSI RAPI
   =============================== */

.produksi-distribusi-wrap {
  width: 100%;
  overflow: hidden;
  border-radius: 10px;
}

.produksi-distribusi-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.produksi-distribusi-table th,
.produksi-distribusi-table td {
  padding: 8px 8px;
  font-size: 12px;
  line-height: 1.25;
  vertical-align: top;
  white-space: normal;
  word-break: break-word;
}

.produksi-distribusi-table th:nth-child(1),
.produksi-distribusi-table td:nth-child(1) {
  width: 16%;
}

.produksi-distribusi-table th:nth-child(2),
.produksi-distribusi-table td:nth-child(2) {
  width: 12%;
  text-align: right;
}

.produksi-distribusi-table th:nth-child(3),
.produksi-distribusi-table td:nth-child(3) {
  width: 14%;
}

.produksi-distribusi-table th:nth-child(4),
.produksi-distribusi-table td:nth-child(4) {
  width: 15%;
}

.produksi-distribusi-table th:nth-child(5),
.produksi-distribusi-table td:nth-child(5) {
  width: 10%;
}

.produksi-distribusi-table th:nth-child(6),
.produksi-distribusi-table td:nth-child(6) {
  width: 13%;
}

.produksi-distribusi-table th:nth-child(7),
.produksi-distribusi-table td:nth-child(7) {
  width: 20%;
}

/* ===============================
   HARUS DIPRODUKSI - DISTRIBUSI CARD
   =============================== */

#productionTodayTable .table-wrap {
  overflow-x: hidden;
}

#productionTodayTable table {
  width: 100%;
  min-width: 0 !important;
  table-layout: fixed;
}

#productionTodayTable th,
#productionTodayTable td {
  white-space: normal;
  word-break: break-word;
  vertical-align: top;
}

#productionTodayTable th:nth-child(1),
#productionTodayTable td:nth-child(1) {
  width: 45px;
}

#productionTodayTable th:nth-child(2),
#productionTodayTable td:nth-child(2) {
  width: 210px;
}

#productionTodayTable th:nth-child(3),
#productionTodayTable td:nth-child(3) {
  width: 90px;
}

#productionTodayTable th:nth-child(4),
#productionTodayTable td:nth-child(4) {
  width: 120px;
}

#productionTodayTable th:nth-child(5),
#productionTodayTable td:nth-child(5) {
  width: 85px;
}

#productionTodayTable th:nth-child(6),
#productionTodayTable td:nth-child(6) {
  width: 85px;
}

#productionTodayTable th:nth-child(7),
#productionTodayTable td:nth-child(7) {
  width: auto;
}

.produksi-distribusi-list {
  display: grid;
  gap: 8px;
}

.produksi-distribusi-card {
  display: grid;
  grid-template-columns: 1.1fr 0.5fr 0.85fr 0.85fr 0.7fr 1fr 1fr;
  gap: 6px 10px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f8fafc;
  font-size: 12px;
  line-height: 1.25;
}

.produksi-distribusi-card b {
  color: #111827;
}

/* ===============================
   HARUS DIPRODUKSI - LEBARKAN DISTRIBUSI
   =============================== */

#productionTodayTable table {
  width: 100%;
  table-layout: fixed;
}

/* No */
#productionTodayTable th:nth-child(1),
#productionTodayTable td:nth-child(1) {
  width: 42px !important;
}

/* Nama Barang */
#productionTodayTable th:nth-child(2),
#productionTodayTable td:nth-child(2) {
  width: 230px !important;
}

/* Kategori */
#productionTodayTable th:nth-child(3),
#productionTodayTable td:nth-child(3) {
  width: 70px !important;
}

/* Total Qty Produksi */
#productionTodayTable th:nth-child(4),
#productionTodayTable td:nth-child(4) {
  width: 80px !important;
  text-align: center;
}

/* Satuan */
#productionTodayTable th:nth-child(5),
#productionTodayTable td:nth-child(5) {
  width: 70px !important;
}

/* Lead Time */
#productionTodayTable th:nth-child(6),
#productionTodayTable td:nth-child(6) {
  width: 70px !important;
}

/* Pembagian Distribusi ke Outlet */
#productionTodayTable th:nth-child(7),
#productionTodayTable td:nth-child(7) {
  width: auto !important;
}

/* ===============================
   FINAL OVERRIDE - STOCK REQUEST 8 KOLOM
   =============================== */

.request-compact-table table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
}

/* 1 Tanggal */
.request-compact-table th:nth-child(1),
.request-compact-table td:nth-child(1) {
  width: 90px !important;
}

/* 2 Outlet */
.request-compact-table th:nth-child(2),
.request-compact-table td:nth-child(2) {
  width: 105px !important;
}

/* 3 Kategori */
.request-compact-table th:nth-child(3),
.request-compact-table td:nth-child(3) {
  width: 105px !important;
}

/* 4 Nama Barang */
.request-compact-table th:nth-child(4),
.request-compact-table td:nth-child(4) {
  width: auto !important;
  min-width: 320px !important;
  word-break: break-word !important;
}

/* 5 Qty Req */
.request-compact-table th:nth-child(5),
.request-compact-table td:nth-child(5) {
  width: 80px !important;
  text-align: center !important;
}

/* 6 Qty Kirim */
.request-compact-table th:nth-child(6),
.request-compact-table td:nth-child(6) {
  width: 105px !important;
  text-align: center !important;
}

/* 7 Status */
.request-compact-table th:nth-child(7),
.request-compact-table td:nth-child(7) {
  width: 150px !important;
  text-align: center !important;
}

/* 8 Aksi */
.request-compact-table th:nth-child(8),
.request-compact-table td:nth-child(8) {
  width: 125px !important;
  text-align: center !important;
}

/* Kolom aksi */
.request-compact-table td:nth-child(8) .action-cell {
  display: grid !important;
  grid-template-columns: 74px 38px !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
}

/* Tombol utama */
.request-compact-table td:nth-child(8) .action-cell button {
  width: 74px !important;
  min-width: 74px !important;
  height: 40px !important;
  padding: 0 8px !important;
  font-size: 13px !important;
  border-radius: 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  white-space: normal !important;
  line-height: 1.1 !important;
}

/* Tombol titik tiga */
.request-compact-table td:nth-child(8) .action-menu summary {
  width: 38px !important;
  height: 40px !important;
  padding: 0 !important;
  border-radius: 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Popup action 2 kolom */
.request-compact-table td:nth-child(8) .action-menu[open] > div {
  position: absolute !important;
  right: 0 !important;
  top: 44px !important;
  z-index: 999 !important;
  width: 220px !important;
  min-width: 220px !important;
  padding: 8px !important;
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 7px !important;
  background: #fff !important;
  border: 1px solid var(--line) !important;
  border-radius: 14px !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .12) !important;
}

.request-compact-table td:nth-child(8) .action-menu[open] > div button {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 38px !important;
  padding: 7px 8px !important;
  font-size: 12px !important;
  line-height: 1.15 !important;
  border-radius: 12px !important;
  text-align: center !important;
  white-space: normal !important;
}

/* Tombol Hapus melebar penuh */
.request-compact-table td:nth-child(8) .action-menu[open] > div button:last-child.danger {
  grid-column: 1 / -1 !important;
}

/* ===============================
   STOCK REQUEST - 8 KOLOM TANPA SUBTOTAL
   =============================== */

.request-compact-table {
  table-layout: fixed;
  width: 100%;
}

.request-compact-table th,
.request-compact-table td {
  vertical-align: middle;
}

.request-compact-table th:nth-child(1),
.request-compact-table td:nth-child(1) {
  width: 90px;
}

.request-compact-table th:nth-child(2),
.request-compact-table td:nth-child(2) {
  width: 95px;
}

.request-compact-table th:nth-child(3),
.request-compact-table td:nth-child(3) {
  width: 110px;
}

.request-compact-table th:nth-child(4),
.request-compact-table td:nth-child(4) {
  width: auto;
  min-width: 320px;
  word-break: break-word;
}

.request-compact-table th:nth-child(5),
.request-compact-table td:nth-child(5) {
  width: 80px;
  text-align: center;
}

.request-compact-table th:nth-child(6),
.request-compact-table td:nth-child(6) {
  width: 110px;
  text-align: center;
}

.request-compact-table th:nth-child(7),
.request-compact-table td:nth-child(7) {
  width: 150px;
  text-align: center;
}

.request-compact-table th:nth-child(8),
.request-compact-table td:nth-child(8) {
  width: 95px;
  text-align: center;
}

.request-detail-row td {
  width: auto !important;
}