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

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

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  min-width: 1180px;
  overflow-x: auto;
  font-size: 14px;
}

body {
  margin: 0;
  width: 100%;
  min-width: 1180px;
  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-width: 1180px;
  min-height: calc(100vh - 78px);
}

main {
  min-width: 0;
  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,
nav a.tab {
  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;
  text-decoration: none;
}

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

.nav-group {
  margin-bottom: 8px;
}

nav .finance-toggle,
nav .adjustment-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.finance-chevron,
.adjustment-chevron {
  font-size: 12px;
  transition: transform .15s ease;
}

.nav-group.open .finance-chevron,
.nav-group.open .adjustment-chevron {
  transform: rotate(90deg);
}

.finance-submenu,
.adjustment-submenu {
  display: none;
  padding-left: 14px;
  margin: -2px 0 8px;
}

.nav-group.open .finance-submenu,
.nav-group.open .adjustment-submenu {
  display: block;
}

nav button.finance-subtab,
nav button.adjustment-subtab,
nav a.finance-subtab,
nav a.adjustment-subtab {
  margin-bottom: 6px;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  background: #f9fafb;
}

nav button.finance-subtab.active,
nav button.adjustment-subtab.active,
nav a.finance-subtab.active,
nav a.adjustment-subtab.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;
  min-width: 0;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .04);
}

.finance-panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.finance-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: #f9fafb;
  min-width: 0;
}

.finance-panel h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.master-data-card {
  padding: 22px;
}

.master-data-card h2 {
  margin-top: 0;
}

.master-data-section-title {
  margin: 10px 0 8px;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.master-data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.master-data-tile {
  width: 100%;
  min-height: 72px;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 8px 18px rgba(31, 78, 120, .18);
}

.master-data-tile:hover {
  filter: brightness(0.92);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(31, 78, 120, .22);
}

.master-config-formgrid-cashFundingSources,
.master-config-formgrid-paymentMethods {
  align-items: end;
  grid-template-columns: minmax(220px, 1.35fr) minmax(180px, 1fr) minmax(220px, 1.2fr) minmax(130px, .65fr);
}

.master-config-formgrid-cashFundingSources > div,
.master-config-formgrid-paymentMethods > div {
  min-width: 0;
}

.master-config-formgrid-cashFundingSources > div:nth-child(4),
.master-config-formgrid-paymentMethods > div:nth-child(4) {
  max-width: 220px;
}

@media (max-width: 760px) {
  .master-config-formgrid-cashFundingSources,
  .master-config-formgrid-paymentMethods {
    grid-template-columns: 1fr;
  }

  .master-config-formgrid-cashFundingSources > div:nth-child(4),
  .master-config-formgrid-paymentMethods > div:nth-child(4) {
    max-width: none;
  }
}

.coa-usage-cell {
  white-space: nowrap;
}

.coa-usage-amount-link {
  border: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
}

.coa-usage-amount-link:hover {
  text-decoration: underline;
}

.coa-usage-link {
  padding: 6px 10px;
  white-space: nowrap;
}

.modal-card.coa-usage-modal-card {
  width: min(1080px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.coa-usage-modal h3 {
  margin: 18px 0 10px;
}

.coa-usage-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 12px 0 18px;
}

.coa-usage-summary-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fafc;
}

.coa-usage-summary-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.coa-usage-summary-item b {
  font-size: 14px;
}

.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;
}

.link-button {
  background: none;
  border: 0;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 0;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.journal-link-btn {
  white-space: normal;
}

.account-ledger-link-btn {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.journal-group-first-row > td {
  border-top: 2px solid #e5e7eb;
}

.journal-group-detail-row > td {
  border-top-color: #eef2f7;
}

.accounting-journal-table tr.journal-group-reversed-original td {
  background: #fff7ed;
}

.accounting-journal-table tr.journal-group-reversed-original td:first-child {
  border-left: 4px solid #f59e0b;
}

.accounting-journal-table tr.journal-group-reversal td {
  background: #f5f3ff;
}

.accounting-journal-table tr.journal-group-reversal td:first-child {
  border-left: 4px solid #8b5cf6;
}

.journal-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
  vertical-align: middle;
}

.journal-badge-reversed {
  background: #fed7aa;
  color: #9a3412;
}

.journal-badge-reversal {
  background: #ddd6fe;
  color: #5b21b6;
}

.accounting-journal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 8px 0 10px;
  color: #475467;
  font-size: 13px;
}

.accounting-journal-legend-item {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.accounting-journal-legend-item > span {
  width: 16px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid #d0d5dd;
  background: #fff;
}

.journal-legend-reversed > span {
  background: #fff7ed;
  border-color: #f59e0b;
}

.journal-legend-reversal > span {
  background: #f5f3ff;
  border-color: #8b5cf6;
}

.journal-dependency-block-modal-card {
  width: min(1180px, 94vw);
}

.journal-dependency-block-table-wrap {
  max-height: 58vh;
  overflow: auto;
}

.journal-dependency-block-table {
  width: 100%;
  min-width: 980px;
}

.journal-dependency-block-table th,
.journal-dependency-block-table td {
  white-space: normal;
  vertical-align: top;
}

.accounting-journal-table-wrap {
  overflow-x: visible;
}

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

.accounting-journal-table th,
.accounting-journal-table td {
  white-space: normal !important;
  vertical-align: top;
}

.accounting-journal-table .journal-col-transaction {
  width: 230px;
}

.accounting-journal-table .journal-col-account {
  width: 32%;
}

.accounting-journal-table .journal-col-debit,
.accounting-journal-table .journal-col-credit {
  width: 170px;
  white-space: nowrap !important;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.accounting-journal-table .journal-col-description {
  width: auto;
}

.accounting-journal-table .journal-col-action {
  width: 56px;
  text-align: center;
}

.accounting-journal-meta {
  display: grid;
  gap: 3px;
  line-height: 1.35;
}

.accounting-journal-meta .journal-meta-main {
  font-weight: 700;
}

.accounting-journal-meta .journal-meta-sub,
.accounting-journal-meta .journal-meta-date {
  color: #667085;
  font-size: 12px;
}

.journal-reversal-icon-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.accounting-report-filter {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr)) auto;
  gap: 10px 12px;
  align-items: end;
  margin-bottom: 12px;
}

.accounting-period-field,
.accounting-report-filter > div,
.accounting-report-filter > label {
  min-width: 0;
}

.accounting-hide-zero-filter {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  color: #344054;
  font-weight: 600;
}

.accounting-report-filter-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
}

.trial-balance-ledger-link {
  font-weight: 700;
  color: #1d4ed8;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.trial-balance-ledger-link:hover {
  color: #1e40af;
}

.accounting-report-zero-note {
  margin: 8px 0;
  color: #667085;
  font-size: 13px;
}

.balance-sheet-filter {
  grid-template-columns: repeat(2, minmax(220px, 1fr)) auto;
}

.balance-sheet-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 14px;
}

.balance-sheet-summary-grid .stat {
  border-radius: 8px;
}

.balance-ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.balance-warning {
  border-color: #fecaca;
  background: #fef2f2;
}

.balance-sheet-warning {
  margin: 8px 0 14px;
}

.balance-sheet-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.balance-sheet-layout > section {
  min-width: 0;
}

.balance-sheet-layout h2 {
  margin: 0 0 10px;
}

.balance-sheet-subsection {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
  background: #fff;
}

.balance-sheet-subsection h3 {
  margin: 0;
  padding: 10px 12px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.balance-sheet-table-wrap {
  margin: 0;
}

.balance-sheet-table {
  width: 100%;
}

.balance-sheet-table th,
.balance-sheet-table td {
  white-space: normal;
}

.balance-sheet-table tfoot th {
  background: #f9fafb;
}

.coa-opening-balance-cell {
  display: grid;
  gap: 6px;
  min-width: 160px;
}

.coa-opening-balance-link {
  width: fit-content;
  padding: 6px 10px;
}

.modal-card.coa-opening-balance-modal-card {
  width: min(960px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.coa-opening-balance-form {
  margin: 12px 0;
}

@media (max-width: 1100px) {
  .accounting-journal-table-wrap {
    overflow-x: auto;
  }

  .accounting-journal-table {
    min-width: 980px !important;
  }
}

@media (max-width: 900px) {
  .balance-sheet-filter,
  .accounting-report-filter {
    grid-template-columns: 1fr;
  }

  .balance-sheet-layout {
    grid-template-columns: 1fr;
  }
}

.journal-reversal-btn {
  min-width: auto;
  padding: 6px 8px;
  white-space: nowrap;
}

button.icon-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 40px;
  min-width: 42px;
  min-height: 40px;
  padding: 0;
  border-radius: 9px;
  border: 0;
  background: #e5e7eb;
  color: #111827;
  cursor: pointer;
  line-height: 1;
  vertical-align: middle;
}

button.icon-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 8px;
  line-height: 1;
  vertical-align: middle;
}

.icon-action-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-action-btn:hover {
  filter: brightness(.98);
  box-shadow: 0 1px 4px rgba(15, 23, 42, .08);
}

.icon-filter-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-filter-btn:hover {
  filter: brightness(.98);
  box-shadow: 0 1px 4px rgba(15, 23, 42, .08);
}

.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;
}

.stock-request-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.stock-request-column {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.stock-request-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 2px;
  min-width: 0;
}


.request-qty-control {
  display: grid;
  grid-template-columns: minmax(58px, 72px) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.request-qty-control input {
  width: 100%;
  min-width: 0;
  text-align: center;
  font-weight: 700;
}

.qty-quick-options {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: start;
  max-width: 100%;
  min-width: 0;
}

.qty-quick-options button {
  min-height: 30px;
  min-width: 34px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  font-weight: 700;
  padding: 6px 11px;
  line-height: 1;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.qty-quick-options .qty-other-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

.qty-quick-options .qty-other-option svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.qty-quick-options button:hover {
  border-color: #9ca3af;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .08);
}

.qty-quick-options button.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, .22);
}

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

.barang-masuk-filter-row,
.barang-keluar-filter-row {
  align-items: end;
  gap: 10px;
}

.filter-icon-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: end;
  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%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  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;
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 20000;
  max-width: min(520px, calc(100vw - 36px));
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, .18);
}

.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;
}

.role-form-section {
  margin-top: 16px;
}

.role-form-section h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.role-permission-table table {
  min-width: 1080px;
}

.role-permission-table th,
.role-permission-table td {
  white-space: normal;
}

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

.role-outlet-mode,
.role-outlet-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.role-outlet-mode {
  margin-bottom: 10px;
  font-weight: 700;
}

.role-outlet-checklist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.role-outlet-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}

.master-role-form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

#masterRolePage .role-form-section,
#roleEditModal .role-form-section {
  margin-top: 18px;
}

#masterRolePage .role-form-section h3,
#roleEditModal .role-form-section h3 {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.3;
}

#masterRolePage input[type="checkbox"],
#roleEditModal input[type="checkbox"],
.role-permission-table input[type="checkbox"] {
  width: 16px;
  min-width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  margin: 0;
  flex: 0 0 16px;
  accent-color: var(--blue);
}

#masterRolePage .role-outlet-mode,
#roleEditModal .role-outlet-mode {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: auto;
  margin: 0 0 12px;
  font-weight: 700;
}

#masterRolePage .role-outlet-mode span,
#roleEditModal .role-outlet-mode span {
  line-height: 1.2;
}

#masterRolePage .role-outlet-checklist,
#roleEditModal .role-outlet-checklist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  align-items: stretch;
}

#masterRolePage .role-outlet-row,
#roleEditModal .role-outlet-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 700;
}

#masterRolePage .role-outlet-row span,
#roleEditModal .role-outlet-row span {
  flex: 1;
  min-width: 0;
  text-align: left;
  line-height: 1.25;
  word-break: normal;
}

.role-permission-table input[type="checkbox"] {
  width: 16px;
  min-width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  margin: 0 auto;
  display: inline-block;
}

@media (max-width: 1280px) {
  .master-role-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #masterRolePage .role-outlet-checklist,
  #roleEditModal .role-outlet-checklist {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

/* =====================================================
   FINAL APP SHELL SCROLL LOCK
   Keep this at the end so older responsive/compact rules
   do not move scrolling back to body or sidebar.
   ===================================================== */

html {
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

body {
  height: 100vh;
  min-height: 100vh;
  min-width: 1180px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

header {
  flex: 0 0 auto;
  position: relative;
  z-index: 50;
}

.userbar {
  flex: 0 0 auto;
  position: relative;
  z-index: 49;
}

.wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-width: 1180px;
  overflow: hidden;
}

nav {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--line);
}

main {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

@media (max-width: 900px) {
  body {
    min-width: 1180px;
    overflow: hidden;
  }

  .wrap {
    grid-template-columns: 230px minmax(0, 1fr);
    min-width: 1180px;
    overflow: hidden;
  }

  nav {
    display: block;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  nav button {
    width: 100%;
    min-width: 0;
    margin-right: 0;
  }

  main {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
  }
}

/* =====================================================
   APP SHELL SCROLL LOCK
   Header, userbar, and sidebar stay in place; main owns
   the vertical content scroll.
   ===================================================== */

html {
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

body {
  height: 100vh;
  min-height: 100vh;
  min-width: 1180px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

header {
  flex: 0 0 auto;
  position: relative;
  z-index: 50;
}

.userbar {
  flex: 0 0 auto;
  position: relative;
  z-index: 49;
}

.wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-width: 1180px;
  overflow: hidden;
}

nav {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--line);
}

main {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

@media (max-width: 900px) {
  body {
    min-width: 1180px;
    overflow: hidden;
  }

  .wrap {
    grid-template-columns: 230px minmax(0, 1fr);
    min-width: 1180px;
    overflow: hidden;
  }

  nav {
    display: block;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  nav button {
    width: 100%;
    min-width: 0;
    margin-right: 0;
  }

  main {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
  }
}

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

.login-screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  min-height: 100svh;
  background-color: #FFF7F1;
  z-index: 9999;
  overflow-y: auto;
  overflow-x: hidden;
}

.login-page {
  min-height: 100svh;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 480px);
  background: #FFF7F1;
  overflow-x: hidden;
}

.hero-visual {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: clamp(16px, 2.5vw, 40px);
}

.hero-visual img {
  width: 100%;
  height: calc(100svh - 32px);
  max-height: 960px;
  object-fit: contain;
  object-position: left center;
  display: block;
}

.login-panel {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 3vw, 48px);
  background: rgba(255, 247, 241, .72);
  backdrop-filter: blur(2px);
}

.login-box {
  background: rgba(255, 255, 255, .94);
  border-radius: 18px;
  padding: 24px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .28);
  backdrop-filter: blur(8px);
}

.login-panel .login-box {
  width: 100%;
  max-width: 420px;
}

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

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

.card-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  flex-wrap: wrap;
}

.card-pagination-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card-pagination button.small {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 12px;
}

.card-pagination button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

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

  .hero-visual {
    padding: 16px;
    justify-content: center;
  }

  .hero-visual img {
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
    object-position: center top;
  }

  .login-panel {
    min-height: auto;
    padding: 20px 16px 32px;
    background: #FFF7F1;
  }

  .login-box {
    max-width: 100%;
    border-radius: 14px;
  }

  .card-pagination {
    align-items: flex-start;
    flex-direction: column;
  }
}

.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;
}

.dashboard-stock-filterbar {
  align-items: end;
  display: grid;
  gap: 10px 12px;
  grid-template-columns:
    minmax(220px, 280px)
    minmax(220px, 1fr)
    minmax(150px, 165px)
    minmax(160px, 180px)
    minmax(150px, 170px)
    max-content;
  width: 100%;
}

.dashboard-stock-filter-field {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
}

.dashboard-stock-filter-field label {
  display: block;
  font-weight: 700;
  height: 18px;
  line-height: 18px;
  margin: 0 0 6px;
  min-height: 18px;
}

.dashboard-stock-filter-field input,
.dashboard-stock-filter-field select {
  box-sizing: border-box;
  height: 40px;
  min-height: 40px;
  width: 100%;
}

.dashboard-stock-filterbar .dashboard-stock-filter-search {
  align-self: end;
  margin-top: 0;
  padding-top: 0;
}

.dashboard-stock-filterbar .dashboard-stock-filter-search label {
  margin-top: 0;
}

.dashboard-stock-filterbar .dashboard-stock-filter-search input,
.dashboard-stock-filterbar .dashboard-stock-filter-search .search {
  height: 40px;
  margin-bottom: 0;
  margin-top: 0;
  max-width: none;
  min-height: 40px;
}

.dashboard-stock-filter-actions {
  align-items: center;
  align-self: end;
  display: inline-flex;
  gap: 8px;
  height: 40px;
  justify-content: flex-end;
  white-space: nowrap;
}

.dashboard-stock-filter-actions .icon-filter-btn,
.dashboard-stock-filter-actions button {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  height: 40px;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  width: 40px;
}

/* ===============================
   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;
}

.page-title-context-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.page-title-context-row h2 {
  margin-bottom: 6px;
}

.page-warehouse-context,
.page-outlet-context {
  min-width: 260px;
  max-width: 340px;
  flex: 0 0 300px;
}

.page-warehouse-context label,
.page-outlet-context label {
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 4px;
}

.page-warehouse-context select:disabled,
.page-outlet-context select:disabled {
  background: #f3f4f6;
  color: #374151;
  cursor: not-allowed;
  font-weight: 700;
}

.finance-tab-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.finance-subpage-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.finance-subpage-tabs button.primary {
  background: var(--primary);
  color: #fff;
}

.accounting-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  min-width: 26px;
  height: 26px;
  overflow: hidden;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.accounting-pending {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
}

.accounting-authorized {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #22c55e;
}

.accounting-voided {
  width: auto;
  min-width: 42px;
  padding: 0 7px;
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #9ca3af;
  font-size: 11px;
}

.accounting-authorize-btn {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
}

.finance-auth-cell {
  text-align: center;
  white-space: nowrap;
}

.finance-actions-cell {
  white-space: nowrap;
}

.finance-summary-grid {
  margin-top: 14px;
}

.finance-inline-filter-panel h3 {
  margin: 6px 0 0;
}

#debtReceivableSummaryFilterSlot {
  margin-top: 12px;
  margin-bottom: 14px;
}

#debtReceivableSummaryCard .finance-inline-filter-panel {
  margin-bottom: 14px;
}

.finance-filter-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 12px;
  margin-bottom: 14px;
}

.finance-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px 12px;
  align-items: end;
}

.finance-filter-actions {
  display: grid;
  grid-template-columns: repeat(4, 42px);
  gap: 8px;
  justify-content: end;
  align-self: end;
}

.finance-filter-actions button {
  width: 42px;
  height: 40px;
  min-height: 40px;
  padding: 0;
}

.accounting-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  min-width: 26px;
  height: 26px;
  overflow: hidden;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.accounting-status-badge svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.accounting-pending {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
}

.accounting-authorized {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #22c55e;
}

.accounting-voided {
  width: auto;
  min-width: 42px;
  padding: 0 7px;
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #9ca3af;
  font-size: 11px;
}

.accounting-authorize-btn {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
}

.accounting-authorize-btn svg {
  width: 15px;
  height: 15px;
}

/* ===============================
   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;
}
















.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;
  }

  .stock-request-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stock-request-actions {
    justify-content: flex-end;
  }
}

@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) {
  body {
    min-width: 1180px;
    overflow-x: auto;
  }

  .wrap {
    grid-template-columns: 245px 1fr;
    min-width: 1180px;
  }

  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;
  }

  .stock-request-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stock-request-actions {
    justify-content: flex-end;
  }

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

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

  .page-title-context-row {
    flex-direction: column;
    align-items: stretch;
  }

  .page-warehouse-context,
  .page-outlet-context {
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
  }

  .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;
  }
}

@media (max-width: 1100px) {
  .finance-filter-layout {
    grid-template-columns: 1fr;
  }

  .finance-filter-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .finance-filter-actions {
    justify-content: start;
  }
}

@media (max-width: 640px) {
  .finance-panel-grid {
    grid-template-columns: 1fr;
  }

  .stock-request-form {
    grid-template-columns: 1fr;
  }

  .request-qty-control {
    grid-template-columns: minmax(52px, 58px) minmax(0, 1fr);
  }

  .qty-quick-options {
    max-width: 100%;
    gap: 3px;
  }

  .qty-quick-options button {
    min-width: 26px;
    padding: 6px 7px;
  }

  .stock-request-actions {
    justify-content: flex-end;
  }
}

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

.daily-cash-manual-card,
.inter-outlet-pending-card {
  margin-top: 12px;
}

.purchasing-action-cell {
  min-width: 72px;
  white-space: nowrap;
}

.purchasing-action-buttons {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
}

.purchasing-status-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 92px;
}

.purchasing-payment-date {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.2;
}

.purchase-today-table {
  width: 100%;
  border-collapse: collapse;
}

.purchase-today-table th,
.purchase-today-table td {
  vertical-align: top;
}

.purchase-today-summary-row td {
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 10px 8px;
}

.purchase-today-detail-row td {
  background: #f8fafc;
  padding: 0 8px 12px;
  border-bottom: 1px solid var(--line);
}

.purchase-today-item-name {
  font-weight: 700;
  line-height: 1.25;
}

.purchase-today-request-count {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  background: #fff;
  white-space: nowrap;
}

.purchase-today-detail-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.purchase-today-detail-title {
  padding: 8px 10px;
  font-weight: 700;
  font-size: 12px;
  background: #f3f4f6;
  border-bottom: 1px solid var(--line);
}

.purchase-today-detail-wrap {
  border: 0;
  border-radius: 0;
  margin: 0;
}

.purchase-today-detail-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.purchase-today-detail-table th,
.purchase-today-detail-table td {
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.25;
  border-bottom: 1px solid #e5e7eb;
}

.purchase-today-detail-table tbody tr:last-child td {
  border-bottom: 0;
}

.purchase-today-detail-table .purchase-today-note-cell {
  white-space: normal;
  word-break: break-word;
}

.purchase-today-detail-table .purchase-today-date-cell,
.purchase-today-detail-table .purchase-today-status-cell {
  white-space: nowrap;
}

.daily-cash-manual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.daily-cash-manual-form {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.daily-cash-manual-form h3 {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.3;
}

.daily-cash-manual-form .formgrid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}

.inter-outlet-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: #eef2ff;
  color: #1d4ed8;
  white-space: nowrap;
}

.inter-outlet-status-badge.pending {
  background: #fff7ed;
  color: #c2410c;
}

.finance-debt-receivable-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 1280px) {
  .daily-cash-manual-grid,
  .finance-debt-receivable-grid {
    grid-template-columns: 1fr;
  }

  .daily-cash-manual-form .formgrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@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;
  }
}
































/* ===============================
   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;
}





















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


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

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

#masterTable table {
  width: 100%;
  min-width: 1180px;
  table-layout: auto;
}

#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;
  overflow-wrap: break-word;
  word-break: normal;
}

/* 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;
  overflow-wrap: break-word;
  word-break: normal;
}

/* 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;
}









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

.produksi-distribusi-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  border-radius: 10px;
}

.produksi-distribusi-table {
  width: 100%;
  min-width: 980px;
  table-layout: auto;
  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;
  overflow-wrap: break-word;
  word-break: normal;
}

.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: auto;
}

#productionTodayTable table {
  width: 100%;
  min-width: 1180px !important;
  table-layout: auto;
}

#productionTodayTable th,
#productionTodayTable td {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  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%;
  min-width: 1180px;
  table-layout: auto;
}

/* 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;
}


























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





































































/* Detail row tetap full mengikuti 8 kolom */
.request-detail-row td {
  width: auto !important;
  max-width: none !important;
}

.request-detail-info {
  width: 100% !important;
}






















/* Detail row tetap full mengikuti 8 kolom */
.request-detail-row td {
  width: auto !important;
  max-width: none !important;
}

.request-detail-info {
  width: 100% !important;
}





































































.purchasing-section {
  font-size: 13px;
}

.purchasing-section .card {
  padding: 14px;
}

.purchasing-section h2 {
  margin-bottom: 8px;
  font-size: 20px;
}

.purchasing-section h2 + .muted {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.35;
  color: #6b7280;
}

.purchasing-section label {
  margin-bottom: 5px;
  font-size: 13px;
}

.purchasing-section input,
.purchasing-section select {
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
}

.purchasing-section .formgrid {
  gap: 10px 12px;
}

.purchasing-section .card > br {
  display: none;
}

.purchasing-section #purchaseItems {
  margin-top: 12px;
}

.purchasing-section #btnAddPurchaseItem {
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
}

.purchasing-items-wrap {
  border-radius: 8px;
  overflow-x: auto;
}

.purchasing-items-table {
  width: 100%;
  table-layout: auto;
  min-width: 980px !important;
}

.purchasing-items-table th,
.purchasing-items-table td {
  padding: 7px 8px;
  vertical-align: middle;
  font-size: 13px;
  line-height: 1.25;
}

.purchasing-items-table th {
  font-size: 13px;
  font-weight: 700;
}

.purchasing-items-table th:nth-child(1),
.purchasing-items-table td:nth-child(1) {
  width: 36%;
}

.purchasing-items-table th:nth-child(2),
.purchasing-items-table td:nth-child(2) {
  width: 8%;
}

.purchasing-items-table th:nth-child(3),
.purchasing-items-table td:nth-child(3) {
  width: 10%;
}

.purchasing-items-table th:nth-child(4),
.purchasing-items-table td:nth-child(4),
.purchasing-items-table th:nth-child(5),
.purchasing-items-table td:nth-child(5) {
  width: 18%;
}

.purchasing-items-table th:nth-child(6),
.purchasing-items-table td:nth-child(6) {
  width: 10%;
  text-align: center;
}

.purchasing-items-table input {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 7px 8px;
  border-radius: 7px;
  font-size: 13px;
}

.purchasing-items-table button.danger {
  min-height: 34px;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 12px;
}

.purchaseItemSubtotal {
  font-weight: 700;
  text-align: right;
}

.purchaseItemPrice,
.purchaseItemSubtotal {
  text-align: right;
}

.purchaseItemUnit {
  background: #f3f4f6;
  cursor: not-allowed;
}

.purchase-bottom-layout {
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-top: 12px;
}

.purchase-bottom-left,
.purchase-bottom-right {
  min-width: 0;
}

.purchase-bottom-left {
  display: flex;
  align-items: flex-start;
}

.purchase-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
}

.purchase-summary-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.purchase-summary-column input,
.purchase-summary-column select,
.purchase-summary-column .money-info {
  height: 40px;
  min-height: 40px;
  margin-top: 0;
}

.purchase-summary-column .money-info {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 14px;
}

.purchase-extra-help {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.35;
  color: #6b7280;
}

.purchase-summary-lower {
  margin-top: 10px;
}

.purchase-summary-action {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.purchase-summary-action button {
  width: auto;
  min-width: 160px;
  height: 42px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
}

.purchase-history-filter-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.purchasing-filter-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px 12px;
  align-items: end;
  min-width: 0;
}

.purchasing-filter-actions {
  display: grid;
  grid-template-columns: repeat(4, 42px);
  gap: 8px;
  justify-content: end;
  align-self: end;
  min-width: 0;
}

.purchasing-filter-actions button {
  width: 100%;
  min-width: 0;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.purchasing-filter-actions .purchase-history-icon-btn {
  width: 42px;
  height: 40px;
  min-height: 40px;
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: center;
}

.purchasing-history-wrap {
  overflow-x: auto;
}

.purchasing-history-wrap table {
  width: 100%;
  min-width: 1100px !important;
  table-layout: auto;
}

.purchasing-history-table th,
.purchasing-history-table td {
  vertical-align: top;
  padding: 7px 6px;
  font-size: 12px;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  line-height: 1.25;
}

.purchasing-history-table th:nth-child(1),
.purchasing-history-table td:nth-child(1) {
  width: 7%;
}

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

.purchasing-history-table th:nth-child(3),
.purchasing-history-table td:nth-child(3) {
  width: 25%;
  white-space: normal;
  overflow-wrap: break-word;
}

.purchasing-history-table th:nth-child(4),
.purchasing-history-table td:nth-child(4) {
  width: 10%;
}

.purchasing-history-table th:nth-child(5),
.purchasing-history-table td:nth-child(5),
.purchasing-history-table th:nth-child(6),
.purchasing-history-table td:nth-child(6) {
  width: 7%;
}

.purchasing-history-table th:nth-child(7),
.purchasing-history-table td:nth-child(7),
.purchasing-history-table th:nth-child(8),
.purchasing-history-table td:nth-child(8) {
  width: 8%;
}

.purchasing-history-table th:nth-child(9),
.purchasing-history-table td:nth-child(9) {
  width: 17%;
}

.purchase-items-summary {
  display: grid;
  gap: 2px;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: break-word;
}

.purchase-action-stack {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex-wrap: wrap;
}

.purchase-action-stack button {
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.purchase-pay-btn {
  min-width: 58px;
}

.purchase-action-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  max-width: 100%;
}

.purchase-action-row select,
.purchase-action-row input {
  width: auto;
  min-width: 0;
  height: 32px;
  padding: 6px;
  font-size: 12px;
  border-radius: 8px;
}

.purchase-action-row select {
  width: 62px;
}

.purchase-action-row input {
  width: 112px;
}

.purchase-action-row button {
  height: 32px;
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.purchase-paid-info {
  display: inline-block;
  line-height: 1.35;
  white-space: normal;
}

.purchase-delete-btn {
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
}

#purchasePaymentModal .modal-card {
  max-width: 620px;
}

#purchasePaymentModal .money-info {
  margin: 0 0 14px;
  line-height: 1.45;
}

.purchase-edit-modal-card {
  width: min(1040px, calc(100vw - 28px));
  max-width: 1040px;
}

.purchase-edit-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.purchase-edit-section-head h3 {
  margin: 0;
  font-size: 16px;
}

.purchase-edit-items-wrap {
  max-height: 300px;
  overflow: auto;
}

.purchase-edit-items-table {
  min-width: 820px;
}

.purchase-edit-items-table th,
.purchase-edit-items-table td {
  padding: 7px 6px;
  vertical-align: top;
}

.purchase-edit-items-table input {
  min-width: 0;
  width: 100%;
  font-size: 13px;
  padding: 8px;
}

.purchase-edit-items-table th:nth-child(1),
.purchase-edit-items-table td:nth-child(1) {
  width: 34%;
}

.purchase-edit-items-table th:nth-child(2),
.purchase-edit-items-table td:nth-child(2) {
  width: 10%;
}

.purchase-edit-items-table th:nth-child(3),
.purchase-edit-items-table td:nth-child(3) {
  width: 12%;
}

.purchase-edit-items-table th:nth-child(4),
.purchase-edit-items-table td:nth-child(4),
.purchase-edit-items-table th:nth-child(5),
.purchase-edit-items-table td:nth-child(5) {
  width: 17%;
}

.purchase-edit-items-table th:nth-child(6),
.purchase-edit-items-table td:nth-child(6) {
  width: 10%;
}

.purchase-edit-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 12px;
  align-items: end;
}

.purchase-edit-summary-grid .money-info {
  min-height: 42px;
  display: flex;
  align-items: center;
  font-weight: 800;
}

.purchase-edit-paid-fields {
  margin-top: 12px;
}

.purchase-edit-actions {
  justify-content: flex-end;
}

.purchase-pay-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.purchase-pay-controls select,
.purchase-pay-controls input {
  min-width: 120px;
}

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

  .purchasing-section .formgrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .purchase-bottom-layout {
    grid-template-columns: 1fr;
  }

  .purchase-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .purchase-history-filter-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .purchasing-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .purchase-action-row {
    flex-wrap: wrap;
  }

  .purchase-edit-modal-card {
    width: calc(100vw - 18px);
  }
}

@media (max-width: 640px) {
  .purchasing-section .card {
    padding: 12px;
  }

  .purchasing-section .formgrid,
  .purchase-summary-grid,
  .purchasing-filter-grid {
    grid-template-columns: 1fr;
  }

  .purchase-history-filter-layout {
    grid-template-columns: 1fr;
  }

  .purchase-bottom-layout {
    grid-template-columns: 1fr;
  }

  .purchasing-items-table {
    min-width: 680px;
  }

  .purchase-summary-action button {
    width: 100%;
    min-width: 0;
  }

  .purchase-history-filter-actions {
    grid-template-columns: repeat(4, 42px);
    justify-content: start;
  }
}

button.icon-action-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

button.icon-action-btn svg {
  width: 17px;
  height: 17px;
}





















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






























































/* Detail row tetap full mengikuti 8 kolom */
.request-detail-row td {
  width: auto !important;
  max-width: none !important;
}

.request-detail-info {
  width: 100% !important;
}
/* =====================================================
   STOCK REQUEST TABLE - FINAL CLEAN VERSION
   ===================================================== */

.request-compact-table,
.request-compact-table.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.request-compact-table table {
  width: 100%;
  max-width: 100%;
  min-width: 1100px;
  table-layout: auto;
  border-collapse: collapse;
}

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

/* 8 kolom asli Daftar Request */
.request-compact-table .request-col-date {
  width: 96px;
}

.request-compact-table .request-col-outlet {
  width: 110px;
}

.request-compact-table .request-col-lokasi {
  width: 90px;
}

.request-compact-table .request-col-name {
  width: auto;
  min-width: 180px;
}

.request-compact-table .request-col-qty {
  width: 80px;
}

.request-compact-table .request-col-ship {
  width: 92px;
}

.request-compact-table .request-col-status {
  width: 140px;
}

.request-compact-table .request-col-action,
.request-compact-table .stock-request-action-col {
  width: 106px;
}

/* Nama barang harus paling fleksibel dan boleh turun baris */
.request-compact-table th:nth-child(4),
.request-compact-table td:nth-child(4) {
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  min-width: 180px;
}

/* Qty, status, dan aksi rata tengah */
.request-compact-table th:nth-child(5),
.request-compact-table td:nth-child(5),
.request-compact-table th:nth-child(6),
.request-compact-table td:nth-child(6),
.request-compact-table th:nth-child(7),
.request-compact-table td:nth-child(7),
.request-compact-table th:nth-child(8),
.request-compact-table td:nth-child(8) {
  text-align: center;
}

/* Qty kirim input compact */
.request-compact-table td:nth-child(6) input {
  width: 58px !important;
  height: 32px;
  padding: 4px 6px;
  text-align: center;
}

/* Badge status compact */
.request-compact-table .status {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.15;
  white-space: normal;
  text-align: center;
}

/* Kolom aksi kecil dan tidak melebar */
.request-compact-table .stock-request-action-cell {
  width: 106px;
  min-width: 106px;
  max-width: 106px;
  padding: 6px 4px;
  overflow: visible;
  white-space: normal;
}

/* Tombol aksi 2 baris:
   [Kirim] [Edit]
   [Tolak] [Delete]
*/
.request-compact-table .stock-request-action-buttons {
  display: grid;
  grid-template-columns: 52px 32px;
  gap: 5px;
  align-items: center;
  justify-content: center;
  width: 89px;
  max-width: 89px;
  margin: 0 auto;
  overflow: visible;
}

/* Reset tombol aksi khusus Stock Request */
.request-compact-table .stock-request-action-btn,
.request-compact-table .stock-request-action-buttons .primary,
.request-compact-table .stock-request-action-buttons .secondary,
.request-compact-table .stock-request-action-buttons .danger,
.request-compact-table .stock-request-action-buttons .icon-action-btn {
  height: 30px;
  min-height: 30px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  white-space: nowrap;
}

/* Tombol teks */
.request-compact-table .stock-request-send-btn,
.request-compact-table .stock-request-reject-btn,
.request-compact-table .request-primary-action,
.request-compact-table .request-reject-action {
  width: 52px;
  min-width: 52px;
  max-width: 52px;
  padding: 0 3px;
}

/* Tombol icon */
.request-compact-table .stock-request-edit-btn,
.request-compact-table .stock-request-delete-btn,
.request-compact-table .icon-action-btn {
  width: 32px;
  min-width: 32px;
  max-width: 32px;
  padding: 0;
}

.request-compact-table .stock-request-edit-btn svg,
.request-compact-table .stock-request-delete-btn svg,
.request-compact-table .icon-action-btn svg {
  width: 14px;
  height: 14px;
}

/* Detail row */
.request-detail-row td {
  width: auto;
  max-width: none;
}

.request-detail-info {
  width: 100%;
}

/* =====================================================
   RESPONSIVE OVERFLOW GUARD
   Keep the app readable on narrow browser windows by
   preserving desktop layout width and letting the page
   or table wrapper scroll horizontally.
   ===================================================== */

html,
body {
  width: 100%;
  min-width: 1180px;
  overflow-x: auto;
}

.wrap {
  grid-template-columns: 245px 1fr;
  min-width: 1180px;
}

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

nav button {
  min-width: 0;
  margin-right: 0;
}

main,
.page,
.card {
  min-width: 0;
  overflow: visible;
}

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

.formgrid,
.stock-request-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.dashboard-toolbar {
  grid-template-columns: 2fr 180px auto 180px 220px auto;
}

.purchase-bottom-layout {
  grid-template-columns: minmax(150px, 190px) minmax(0, 1fr);
}

.purchase-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.purchase-history-filter-layout {
  grid-template-columns: minmax(0, 1fr) auto;
}

.purchasing-filter-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.table-wrap,
.request-compact-table,
.request-compact-table.table-wrap,
.purchasing-items-wrap,
.purchasing-history-wrap,
#master .table-wrap,
#productionTodayTable .table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
}

.table-wrap table,
#masterTable table,
#productionTodayTable table,
.request-compact-table table,
.purchasing-items-table,
.purchasing-history-table,
.purchase-edit-items-table {
  width: 100%;
  min-width: 980px !important;
  table-layout: auto;
}

#masterTable table {
  min-width: 1180px !important;
}

.request-compact-table table,
.purchasing-history-table {
  min-width: 1100px !important;
}

.purchasing-items-table,
.purchase-edit-items-table {
  min-width: 980px !important;
}

#productionTodayTable table {
  min-width: 1180px !important;
}

#masterTable th,
#masterTable td,
#productionTodayTable th,
#productionTodayTable td,
.purchasing-history-table th,
.purchasing-history-table td,
.purchasing-items-table th,
.purchasing-items-table td,
.request-compact-table th,
.request-compact-table td {
  overflow-wrap: break-word;
  word-break: normal;
}

#masterTable th:nth-child(2),
#masterTable td:nth-child(2),
#masterTable th:nth-child(5),
#masterTable td:nth-child(5),
.purchasing-history-table th:nth-child(3),
.purchasing-history-table td:nth-child(3),
.purchase-items-summary,
.request-compact-table th:nth-child(4),
.request-compact-table td:nth-child(4) {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

.request-compact-table .stock-request-action-cell {
  min-width: 116px;
  max-width: none;
  overflow: visible;
}

.request-compact-table .stock-request-action-buttons,
.purchase-action-stack,
.purchasing-filter-actions {
  overflow: visible;
}

.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: table-cell;
}

/* =====================================================
   FINAL FIX - STOCK REQUEST AKSI 1 BARIS
   Target: Kirim | Tolak | Edit | Delete
   ===================================================== */

/* Wrapper tabel: kalau layar kecil, scroll kiri-kanan */
.request-compact-table,
.request-compact-table.table-wrap {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
}

/* Tabel punya minimum width agar kolom tidak hancur */
.request-compact-table table {
  width: 100% !important;
  min-width: 1180px !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
}

/* Padding dan vertical alignment */
.request-compact-table th,
.request-compact-table td {
  padding: 8px 8px !important;
  font-size: 13px !important;
  vertical-align: middle !important;
  overflow: visible !important;
}

/* 8 kolom asli Daftar Request */
.request-compact-table .request-col-date,
.request-compact-table th:nth-child(1),
.request-compact-table td:nth-child(1) {
  width: 110px !important;
}

.request-compact-table .request-col-outlet,
.request-compact-table th:nth-child(2),
.request-compact-table td:nth-child(2) {
  width: 120px !important;
}

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

.request-compact-table .request-col-name,
.request-compact-table th:nth-child(4),
.request-compact-table td:nth-child(4) {
  width: auto !important;
  min-width: 260px !important;
  white-space: normal !important;
  word-break: normal !important;
  overflow-wrap: break-word !important;
}

.request-compact-table .request-col-qty,
.request-compact-table th:nth-child(5),
.request-compact-table td:nth-child(5) {
  width: 95px !important;
  text-align: center !important;
}

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

.request-compact-table .request-col-status,
.request-compact-table th:nth-child(7),
.request-compact-table td:nth-child(7) {
  width: 145px !important;
  text-align: center !important;
}

.request-compact-table .request-col-action,
.request-compact-table .stock-request-action-col,
.request-compact-table th:nth-child(8),
.request-compact-table td:nth-child(8) {
  width: 205px !important;
  min-width: 205px !important;
  max-width: 205px !important;
  text-align: left !important;
}

/* Qty Kirim input compact */
.request-compact-table td:nth-child(6) input {
  width: 64px !important;
  height: 32px !important;
  padding: 4px 6px !important;
  text-align: center !important;
}

/* Status badge compact dan sejajar */
.request-compact-table .status {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 30px !important;
  padding: 6px 10px !important;
  font-size: 12px !important;
  line-height: 1.15 !important;
  white-space: nowrap !important;
  text-align: center !important;
}

/* Kolom aksi jangan memotong tombol */
.request-compact-table .stock-request-action-cell {
  width: 205px !important;
  min-width: 205px !important;
  max-width: 205px !important;
  overflow: visible !important;
  white-space: nowrap !important;
  padding-left: 6px !important;
  padding-right: 6px !important;
}

/* Tombol aksi wajib 1 baris */
.request-compact-table .stock-request-action-buttons {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  flex-wrap: nowrap !important;
  width: 190px !important;
  max-width: 190px !important;
  min-width: 190px !important;
  overflow: visible !important;
  white-space: nowrap !important;
}

/* Reset style tombol aksi agar tidak kena CSS grid lama */
.request-compact-table .stock-request-action-buttons .stock-request-action-btn,
.request-compact-table .stock-request-action-buttons .primary,
.request-compact-table .stock-request-action-buttons .secondary,
.request-compact-table .stock-request-action-buttons .danger,
.request-compact-table .stock-request-action-buttons .icon-action-btn {
  height: 30px !important;
  min-height: 30px !important;
  border-radius: 8px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  padding: 0 !important;
  margin: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

/* Tombol teks: Kirim dan Tolak */
.request-compact-table .stock-request-send-btn,
.request-compact-table .stock-request-reject-btn,
.request-compact-table .request-primary-action,
.request-compact-table .request-reject-action {
  width: 58px !important;
  min-width: 58px !important;
  max-width: 58px !important;
  flex-basis: 58px !important;
  padding: 0 4px !important;
}

/* Tombol icon: Edit dan Delete */
.request-compact-table .stock-request-edit-btn,
.request-compact-table .stock-request-delete-btn,
.request-compact-table .icon-action-btn {
  width: 32px !important;
  min-width: 32px !important;
  max-width: 32px !important;
  flex-basis: 32px !important;
  padding: 0 !important;
}

/* SVG icon kecil */
.request-compact-table .stock-request-edit-btn svg,
.request-compact-table .stock-request-delete-btn svg,
.request-compact-table .icon-action-btn svg {
  width: 14px !important;
  height: 14px !important;
}

/* Detail row bawah tetap rapi */
.request-detail-row td {
  width: auto !important;
  max-width: none !important;
}

.request-detail-info {
  width: 100% !important;
}

/* =====================================================
   ADJUST - STOCK REQUEST ACTION BUTTON SPACING
   ===================================================== */

/* Kolom aksi diberi ruang napas */
.request-compact-table .request-col-action,
.request-compact-table .stock-request-action-col,
.request-compact-table th:nth-child(8),
.request-compact-table td:nth-child(8),
.request-compact-table .stock-request-action-cell {
  width: 210px !important;
  min-width: 210px !important;
  max-width: 210px !important;
  padding-left: 8px !important;
  padding-right: 8px !important;
}

/* Tombol aksi dibuat center dan tidak nempel kanan */
.request-compact-table .stock-request-action-buttons {
  width: 184px !important;
  min-width: 184px !important;
  max-width: 184px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  justify-content: center !important;
  gap: 5px !important;
}

/* Tombol teks sedikit lebih kecil */
.request-compact-table .stock-request-send-btn,
.request-compact-table .stock-request-reject-btn,
.request-compact-table .request-primary-action,
.request-compact-table .request-reject-action {
  width: 54px !important;
  min-width: 54px !important;
  max-width: 54px !important;
  flex-basis: 54px !important;
}

/* Tombol icon sedikit lebih kecil */
.request-compact-table .stock-request-edit-btn,
.request-compact-table .stock-request-delete-btn,
.request-compact-table .icon-action-btn {
  width: 30px !important;
  min-width: 30px !important;
  max-width: 30px !important;
  flex-basis: 30px !important;
}

/* =====================================================
   STOCK REQUEST COMPACT TABLE
   Scoped to Daftar Request only.
   ===================================================== */

.request-table-wrap,
.request-table-wrap.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
}

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

.request-table th,
.request-table td {
  font-size: 12px;
  padding: 8px 10px;
  vertical-align: middle;
  line-height: 1.25;
}

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

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

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

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

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

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

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

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

.request-product-name {
  white-space: normal;
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
  word-break: normal;
}

.request-qty-cell {
  text-align: center;
  white-space: nowrap;
}

.request-qty-number {
  font-weight: 800;
  font-size: 14px;
  line-height: 1.1;
}

.request-qty-unit {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.request-send-qty-input {
  width: 68px;
  min-width: 68px;
  height: 32px;
  padding: 5px 8px;
  text-align: center;
  border-radius: 8px;
  font-size: 12px;
}

.request-stock-note {
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.1;
}

.request-status-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  line-height: 1;
}

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

.request-icon-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0 !important;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 32px;
  line-height: 1;
}

.request-icon-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.request-detail-row td {
  width: auto !important;
  max-width: none !important;
  padding: 0 10px 10px !important;
  background: #fff;
}

.request-detail-info {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 7px 10px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.request-detail-left {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  min-width: 0;
  font-size: 12px;
  color: #475569;
}

.request-detail-right {
  display: flex;
  gap: 14px;
  justify-content: flex-end;
  align-items: center;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
  color: #111827;
}

.request-detail-left b,
.request-detail-right b {
  color: #111827;
}

@media (max-width: 1200px) {
  .request-detail-info {
    grid-template-columns: 1fr;
  }

  .request-detail-right {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

.warehouse-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 18px;
}

.warehouse-check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  font-weight: 700;
}

.warehouse-check-row input {
  width: auto;
}

.warehouse-config-btn svg,
.warehouse-stock-table .icon-action-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stock-warehouse-filter {
  align-items: end;
}

.warehouse-stock-wrap {
  width: 100%;
  overflow-x: auto;
}

.warehouse-stock-table {
  min-width: 920px;
}

.warehouse-stock-table th,
.warehouse-stock-table td {
  vertical-align: middle;
}

.warehouse-stock-table td:first-child {
  min-width: 220px;
  font-weight: 700;
}

#masterTable table {
  min-width: 980px;
}

#masterTable th,
#masterTable td {
  width: auto;
  max-width: none;
}

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

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

#masterTable th:nth-child(9),
#masterTable td:nth-child(9) {
  min-width: 130px;
}

#masterTable td:nth-child(10) {
  white-space: nowrap;
}

@media (max-width: 720px) {
  .warehouse-checklist {
    grid-template-columns: 1fr;
  }

  .warehouse-modal-card {
    width: min(96vw, 520px);
  }
}

/* =====================================================
   ERP COMPACT DENSITY OVERRIDES
   Tampilan lebih padat untuk workflow back-office/ERP.
   ===================================================== */

html,
body {
  font-size: 13px;
  line-height: 1.35;
}

header {
  padding: 14px 20px;
}

header h1 {
  font-size: 19px;
  line-height: 1.2;
}

header p {
  margin-top: 4px;
  font-size: 12px;
}

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

main {
  padding: 14px;
}

nav {
  padding: 12px;
}

nav button,
nav a.tab,
nav button.finance-subtab,
nav button.adjustment-subtab,
nav a.finance-subtab,
nav a.adjustment-subtab {
  min-height: 34px;
  padding: 9px 11px;
  margin-bottom: 6px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.2;
}

.finance-submenu,
.adjustment-submenu {
  padding-left: 10px;
  margin-bottom: 6px;
}

.card {
  padding: 14px;
  margin-bottom: 14px;
  border-radius: 10px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .035);
}

.panel,
.box,
.finance-panel {
  padding: 12px;
  border-radius: 8px;
}

h2 {
  margin-bottom: 10px;
  font-size: 18px;
  line-height: 1.25;
}

h3,
.finance-panel h3 {
  font-size: 15px;
  line-height: 1.25;
}

.muted {
  font-size: 12px;
  line-height: 1.35;
}

label,
.purchasing-section label,
.request-filter-grid label {
  margin-bottom: 4px;
  font-size: 12px;
  line-height: 1.25;
}

input,
select,
textarea,
.purchasing-section input,
.purchasing-section select,
.request-filter-grid input,
.request-filter-grid select,
.purchase-summary-column input,
.purchase-summary-column select {
  min-height: 34px;
  padding: 7px 9px;
  border-radius: 7px;
  font-size: 13px;
  line-height: 1.2;
}

textarea {
  min-height: 64px;
  line-height: 1.35;
}

button,
button.primary,
button.secondary,
button.danger {
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 7px;
  font-size: 13px;
  line-height: 1.15;
}

button.icon-filter-btn {
  width: 36px;
  height: 34px;
  min-width: 36px;
  min-height: 34px;
  border-radius: 7px;
}

button.icon-action-btn,
.request-icon-btn {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  border-radius: 7px;
}

.icon-action-btn svg,
.request-icon-btn svg,
.warehouse-config-btn svg,
.warehouse-stock-table .icon-action-btn svg {
  width: 14px;
  height: 14px;
}

.grid,
.formgrid,
.stock-request-form,
.purchasing-section .formgrid,
.request-filter-grid,
.purchasing-filter-grid,
.purchase-summary-grid,
.finance-panel-grid,
.master-data-grid {
  gap: 10px;
}

.row,
.filter-icon-actions,
.request-filter-actions {
  gap: 8px;
}

.stock-request-column {
  gap: 10px;
}

.request-qty-control {
  gap: 8px;
}

.qty-quick-options {
  gap: 5px;
}

.qty-quick-options button {
  min-height: 28px;
  min-width: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

.table-wrap {
  border-radius: 8px;
}

th,
td,
#masterTable th,
#masterTable td,
#productionTodayTable th,
#productionTodayTable td,
.purchasing-history-table th,
.purchasing-history-table td,
.purchasing-items-table th,
.purchasing-items-table td,
.purchase-edit-items-table th,
.purchase-edit-items-table td,
.warehouse-stock-table th,
.warehouse-stock-table td,
.request-table th,
.request-table td,
.request-compact-table th,
.request-compact-table td {
  padding: 6px 8px !important;
  font-size: 12px !important;
  line-height: 1.25 !important;
}

th,
#masterTable th,
#productionTodayTable th,
.purchasing-history-table th,
.purchasing-items-table th,
.purchase-edit-items-table th,
.warehouse-stock-table th,
.request-table th {
  font-size: 12px !important;
  font-weight: 800;
}

td {
  vertical-align: middle;
}

td:last-child,
th:last-child,
#masterTable td:last-child,
.request-table td:last-child,
.purchasing-history-table td:last-child,
.warehouse-stock-table td:last-child {
  white-space: nowrap;
}

.status,
.request-status-badge,
.request-table .status,
.request-compact-table .status {
  min-height: 0 !important;
  padding: 4px 7px !important;
  font-size: 11px !important;
  line-height: 1.1 !important;
}

.stat {
  padding: 13px;
  border-radius: 10px;
}

.stat h3 {
  margin-bottom: 6px;
  font-size: 12px;
}

.stat div {
  font-size: 21px;
}

.daily-cash-top-layout {
  align-items: stretch;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  margin-bottom: 16px;
}

.daily-cash-top-layout > .card,
.daily-cash-manual-column > .card {
  height: 100%;
  margin-bottom: 0;
}

.daily-cash-top-layout .daily-cash-manual-card {
  margin-top: 0;
}

.daily-cash-top-layout .daily-cash-manual-grid {
  grid-template-columns: 1fr;
}

.daily-cash-top-layout .daily-cash-manual-form {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.daily-cash-top-layout .daily-cash-manual-form h3 {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.daily-cash-top-layout .daily-cash-manual-form .formgrid {
  display: contents;
}

.daily-cash-top-layout .daily-cash-manual-form .formgrid > div {
  min-width: 0;
}

.daily-cash-top-layout .daily-cash-manual-form > button {
  align-self: end;
  justify-self: start;
  white-space: nowrap;
}

.daily-cash-summary-card .finance-filter-grid {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
}

.daily-cash-summary-card .finance-filter-layout {
  margin-top: 10px;
  margin-bottom: 10px;
}

.daily-cash-summary-card #dailyCashSummary p {
  margin: 7px 0;
}

.daily-cash-summary-list {
  border-top: 1px solid var(--line);
  margin-top: 10px;
}

.daily-cash-summary-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 11px 0;
}

.daily-cash-summary-row-label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.daily-cash-summary-row-label strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

.daily-cash-summary-row-label span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.daily-cash-summary-row-amount {
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.08;
  text-align: right;
  white-space: nowrap;
}

.daily-cash-summary-row.is-highlight .daily-cash-summary-row-amount {
  font-size: 20px;
}

.daily-cash-summary-list .daily-cash-summary-row:nth-child(3) .daily-cash-summary-row-amount {
  color: #dc2626;
}

.daily-cash-history-table-wrap {
  overflow-x: visible;
}

.daily-cash-history-table {
  min-width: 0 !important;
  table-layout: auto;
  width: 100%;
}

.daily-cash-history-table th,
.daily-cash-history-table td {
  vertical-align: top;
  white-space: normal;
}

.daily-cash-history-table th:nth-child(1),
.daily-cash-history-table td:nth-child(1) {
  width: 38px;
}

.daily-cash-history-table th:nth-child(2),
.daily-cash-history-table td:nth-child(2) {
  width: 88px;
}

.daily-cash-history-table th:nth-child(3),
.daily-cash-history-table td:nth-child(3) {
  width: 120px;
}

.daily-cash-history-table th:nth-child(6),
.daily-cash-history-table th:nth-child(7),
.daily-cash-history-table td:nth-child(6),
.daily-cash-history-table td:nth-child(7) {
  width: 108px;
}

.daily-cash-history-table th:nth-child(8),
.daily-cash-history-table td:nth-child(8) {
  width: 76px;
}

.daily-cash-history-table th:nth-child(9),
.daily-cash-history-table td:nth-child(9) {
  width: 128px;
}

.daily-cash-history-table th:nth-child(10),
.daily-cash-history-table td:nth-child(10) {
  width: 138px;
}

.daily-cash-history-table th:nth-child(7),
.daily-cash-history-table td:nth-child(7) {
  white-space: nowrap;
}

.daily-cash-history-main-row td {
  border-bottom: 0;
  padding-bottom: 4px;
}

.daily-cash-history-main-row.is-odd-group td,
.daily-cash-history-detail-row.is-odd-group td {
  background: #fff;
}

.daily-cash-history-main-row.is-even-group td,
.daily-cash-history-detail-row.is-even-group td {
  background: #f8fafc;
}

.daily-cash-history-detail-row td {
  border-top: 0;
  color: var(--muted);
  font-size: 11.5px;
  padding: 0 8px 7px;
}

.daily-cash-history-detail-inline,
.daily-cash-history-detail-grid {
  border-top: 1px dashed var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  line-height: 1.3;
  padding-top: 4px;
}

.daily-cash-history-detail-grid {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  line-height: 1.35;
}

.daily-cash-history-detail-inline span,
.daily-cash-history-detail-grid span {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

.daily-cash-history-detail-grid strong {
  color: #667085;
}

.daily-cash-journal-detail {
  align-items: baseline;
  display: inline-flex;
  gap: 4px;
}

.daily-cash-journal-link {
  white-space: normal;
}

.daily-cash-history-action-cell {
  min-width: 0;
}

.daily-cash-history-auth-cell,
.daily-cash-history-action-cell {
  vertical-align: middle;
}

.daily-cash-history-actions-inline {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.daily-cash-action-stack {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.daily-cash-edit-btn,
.daily-cash-delete-btn {
  min-width: 32px;
  height: 32px;
}

.daily-cash-authorize-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  line-height: 1.15;
  min-width: 110px;
  padding: 8px 10px;
  white-space: normal;
}

.daily-cash-authorize-btn span {
  display: block;
}

.daily-cash-history-table .daily-cash-authorize-in {
  background: #16a34a;
  color: #fff;
}

.daily-cash-history-table .daily-cash-authorize-out {
  background: #f59e0b;
  color: #111827;
}

.daily-cash-history-table .daily-cash-authorize-in:hover {
  background: #15803d;
}

.daily-cash-history-table .daily-cash-authorize-out:hover {
  background: #d97706;
}

.daily-cash-history-actions-inline .authorized-by-cell {
  display: none;
}

.daily-cash-history-actions-inline .purchasing-action-buttons {
  flex-wrap: wrap;
  gap: 4px;
}

.daily-cash-history-actions-inline button {
  padding: 4px 7px;
}

.opening-balance-form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.opening-balance-summary {
  margin-bottom: 10px;
}

.opening-balance-history .table-wrap {
  overflow-x: auto;
}

.opening-balance-history table {
  min-width: 1280px;
}

@media (max-width: 1280px) {
  .opening-balance-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1250px) {
  .daily-cash-top-layout {
    align-items: start;
    grid-template-columns: minmax(0, 1fr);
  }

  .daily-cash-top-layout > .card,
  .daily-cash-manual-column > .card {
    height: auto;
  }
}

@media (max-width: 720px) {
  .daily-cash-top-layout .daily-cash-manual-form {
    grid-template-columns: 1fr;
  }

  .daily-cash-top-layout .daily-cash-manual-form > button {
    justify-self: stretch;
    width: 100%;
  }

  .daily-cash-summary-row {
    align-items: flex-start;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .daily-cash-summary-row-amount,
  .daily-cash-summary-row.is-highlight .daily-cash-summary-row-amount {
    font-size: 18px;
    text-align: left;
  }
}

.dashboard-toolbar {
  gap: 10px;
}

.search {
  margin-bottom: 10px;
}

.modal-card {
  border-radius: 10px;
  padding: 16px;
}

.login-box {
  padding: 22px;
  border-radius: 10px;
}

.userbar {
  padding: 8px 14px;
  font-size: 12px;
}

.notice {
  margin-bottom: 10px;
  padding: 9px 11px;
  font-size: 12px;
}

.request-send-qty-input,
.request-compact-table td:nth-child(6) input {
  height: 30px !important;
  min-height: 30px !important;
  padding: 4px 6px !important;
  font-size: 12px !important;
}

.request-qty-number {
  font-size: 13px;
}

.request-stock-note,
.request-qty-unit {
  font-size: 10.5px;
}

.request-detail-row td {
  padding: 0 8px 8px !important;
}

.request-detail-info {
  padding: 6px 8px;
  border-radius: 8px;
}

.request-detail-left,
.request-detail-right {
  font-size: 11.5px;
}

.request-action-cell,
.purchase-action-stack {
  gap: 4px;
  flex-wrap: nowrap;
}

.purchasing-items-table input,
.purchase-edit-items-table input {
  min-height: 32px;
  padding: 6px 7px;
  font-size: 12px;
}

.purchase-summary-action button,
.purchase-action-stack button,
.purchasing-filter-actions button {
  min-height: 32px;
  font-size: 12px;
}

.warehouse-checklist {
  gap: 8px;
  margin: 10px 0 14px;
}

.warehouse-check-row {
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 12px;
}

.produksi-distribusi-card {
  gap: 6px;
  padding: 7px 8px;
  font-size: 11.5px;
  line-height: 1.25;
}

.master-data-card {
  padding: 16px;
}

.master-data-tile {
  min-height: 58px;
  border-radius: 9px;
  font-size: 13px;
}

/* =====================================================
   PURCHASING HISTORY TABLE LAYOUT
   Prioritaskan ruang untuk Nama Barang.
   ===================================================== */

.purchasing-history-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden !important;
}

.purchasing-history-wrap table,
.purchasing-history-table {
  width: 100%;
  max-width: 100%;
  min-width: 0 !important;
  table-layout: fixed !important;
}

.purchasing-history-table th,
.purchasing-history-table td {
  padding: 7px 7px !important;
  font-size: 12px !important;
  line-height: 1.25 !important;
  vertical-align: top !important;
  white-space: normal !important;
  overflow-wrap: break-word !important;
  word-break: normal !important;
}

.purchasing-history-table th:nth-child(1),
.purchasing-history-table td:nth-child(1) {
  width: 7% !important;
}

.purchasing-history-table th:nth-child(2),
.purchasing-history-table td:nth-child(2) {
  width: 9% !important;
}

.purchasing-history-table th:nth-child(3),
.purchasing-history-table td:nth-child(3) {
  width: 12% !important;
}

.purchasing-history-table th:nth-child(4),
.purchasing-history-table td:nth-child(4) {
  width: 27% !important;
}

.purchasing-history-table th:nth-child(5),
.purchasing-history-table td:nth-child(5) {
  width: 9% !important;
  text-align: right !important;
}

.purchasing-history-table th:nth-child(6),
.purchasing-history-table td:nth-child(6) {
  width: 6% !important;
  text-align: center !important;
}

.purchasing-history-table th:nth-child(7),
.purchasing-history-table td:nth-child(7) {
  width: 7% !important;
}

.purchasing-history-table th:nth-child(8),
.purchasing-history-table td:nth-child(8) {
  width: 8% !important;
}

.purchasing-history-table th:nth-child(9),
.purchasing-history-table td:nth-child(9) {
  width: 7% !important;
  text-align: center !important;
}

.purchasing-history-table th:nth-child(10),
.purchasing-history-table td:nth-child(10) {
  width: 8% !important;
  text-align: center !important;
}

.purchase-items-summary {
  display: grid;
  gap: 2px;
  line-height: 1.35;
  white-space: normal !important;
  overflow-wrap: break-word;
  word-break: normal;
}

.purchase-action-stack {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 5px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.purchase-action-stack button {
  flex: 0 0 auto;
  min-width: 30px;
  min-height: 30px;
  padding: 5px 7px;
  font-size: 12px;
}

.purchase-paid-info {
  display: block;
  font-size: 12px;
  line-height: 1.25;
  white-space: normal;
}

/* =====================================================
   PURCHASING ITEM DELETE BUTTON CONSISTENCY
   Samakan tombol hapus item form/modal dengan Riwayat Purchasing.
   ===================================================== */

.purchasing-items-table th:nth-child(6),
.purchasing-items-table td:nth-child(6),
.purchase-edit-items-table th:nth-child(6),
.purchase-edit-items-table td:nth-child(6) {
  text-align: center;
  vertical-align: middle !important;
  white-space: nowrap;
}

.purchasing-items-table button.icon-action-btn,
.purchase-edit-items-table button.icon-action-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  min-height: 30px !important;
  max-width: 30px !important;
  padding: 0 !important;
  border-radius: 7px !important;
  line-height: 1 !important;
}

.purchasing-items-table button.icon-action-btn svg,
.purchase-edit-items-table button.icon-action-btn svg {
  width: 14px !important;
  height: 14px !important;
}

/* =====================================================
   DATA AUDIT
   ===================================================== */

.data-audit-actions {
  align-items: center;
}

.data-audit-actions button[disabled] {
  opacity: .55;
  cursor: not-allowed;
}

.data-audit-warning {
  margin: 10px 0 0;
}

.data-audit-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.data-audit-summary-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
  min-width: 0;
}

.data-audit-summary-item span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.data-audit-summary-item b {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.data-audit-issues-wrap {
  overflow-x: auto;
}

.data-audit-issues-table {
  min-width: 980px;
  table-layout: fixed;
}

.data-audit-issues-table th,
.data-audit-issues-table td {
  white-space: normal;
  overflow-wrap: break-word;
  vertical-align: top;
}

.data-audit-issues-table th:nth-child(1),
.data-audit-issues-table td:nth-child(1) {
  width: 48px;
}

.data-audit-issues-table th:nth-child(2),
.data-audit-issues-table td:nth-child(2) {
  width: 22%;
}

.data-audit-issues-table th:nth-child(3),
.data-audit-issues-table td:nth-child(3) {
  width: 28%;
}

.data-audit-issues-table th:nth-child(4),
.data-audit-issues-table td:nth-child(4) {
  width: auto;
}

.data-audit-issues-table th:nth-child(5),
.data-audit-issues-table td:nth-child(5) {
  width: 70px;
  text-align: center;
}

@media (max-width: 1200px) {
  .data-audit-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1280px) {
  .master-role-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #masterRolePage .role-outlet-checklist,
  #roleEditModal .role-outlet-checklist {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

/* =====================================================
   FINAL APP SHELL SCROLL LOCK
   Keep this at the end so older responsive/compact rules
   do not move scrolling back to body or sidebar.
   ===================================================== */

html {
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

body {
  height: 100vh;
  min-height: 100vh;
  min-width: 1180px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

header {
  flex: 0 0 auto;
  position: relative;
  z-index: 50;
}

.userbar {
  flex: 0 0 auto;
  position: relative;
  z-index: 49;
}

.wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-width: 1180px;
  overflow: hidden;
}

nav {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--line);
}

main {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

@media (max-width: 900px) {
  body {
    min-width: 1180px;
    overflow: hidden;
  }

  .wrap {
    grid-template-columns: 230px minmax(0, 1fr);
    min-width: 1180px;
    overflow: hidden;
  }

  nav {
    display: block;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  nav button {
    width: 100%;
    min-width: 0;
    margin-right: 0;
  }

  main {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
  }
}
.locked-outlet-filter,
select.locked-outlet-filter:disabled {
  background: #e5e7eb;
  color: #374151;
  cursor: not-allowed;
  opacity: 1;
  border-color: #cbd5e1;
}

.section-title-row {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.inline-outlet-filter {
  align-items: center;
  display: flex;
  gap: 8px;
  min-width: 240px;
}

.inline-outlet-filter label {
  color: #64748b;
  font-size: 12px;
  margin: 0;
  white-space: nowrap;
}

.inline-outlet-filter select {
  min-width: 170px;
}

.authorized-by-cell strong {
  display: block;
}

.date-range-filter-field {
  min-width: 220px;
  position: relative;
}

.date-range-hidden {
  display: none !important;
}

.date-range-input,
.date-range-input[readonly] {
  background: #fff;
  cursor: pointer;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.date-range-picker-popover {
  background: #fff;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  max-width: calc(100vw - 24px);
  overflow: auto;
  padding: 10px;
  position: fixed;
  z-index: 9999;
}

.date-range-picker-popover.hidden {
  display: none;
}

.date-range-picker-header {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.date-range-picker-title,
.date-range-picker-month-title {
  font-weight: 700;
  text-align: center;
}

.date-range-picker-title {
  font-size: 14px;
}

.date-range-picker-month-title {
  font-size: 13px;
}

.date-range-nav {
  min-width: 32px;
  padding: 5px 8px;
}

.date-range-picker-months {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.date-range-picker-month-panel {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

.date-range-picker-weekdays,
.date-range-picker-days {
  display: grid;
  gap: 3px;
  grid-template-columns: repeat(7, 1fr);
}

.date-range-picker-weekdays {
  color: var(--muted);
  font-size: 11px;
  margin: 8px 0 5px;
  text-align: center;
}

.date-range-day {
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  height: 28px;
  min-width: 0;
  padding: 0;
  position: relative;
  width: 100%;
}

.date-range-day:hover {
  background: #eff6ff;
}

.date-range-day.is-selected,
.date-range-day.is-start,
.date-range-day.is-end {
  background: var(--blue);
  color: #fff;
}

.date-range-day.is-today {
  box-shadow: inset 0 0 0 1.5px var(--blue);
  color: var(--blue);
  font-weight: 700;
}

.date-range-day.is-today::after {
  background: var(--blue);
  border-radius: 999px;
  bottom: 3px;
  content: "";
  height: 3px;
  left: 50%;
  position: absolute;
  transform: translateX(-50%);
  width: 3px;
}

.date-range-day.is-selected.is-today,
.date-range-day.is-start.is-today,
.date-range-day.is-end.is-today {
  color: #fff;
  box-shadow: inset 0 0 0 2px #fff;
}

.date-range-day.is-selected.is-today::after,
.date-range-day.is-start.is-today::after,
.date-range-day.is-end.is-today::after {
  background: #fff;
}

.date-range-day.is-in-range {
  background: #dbeafe;
}

.date-range-day.is-muted {
  color: var(--muted);
}

.date-range-picker-actions {
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
  padding-top: 8px;
  position: sticky;
  bottom: 0;
  z-index: 1;
}

@media (max-width: 900px) {
  .date-range-picker-months {
    grid-template-columns: 1fr;
  }

  .date-range-picker-popover {
    max-height: calc(100vh - 24px);
    overflow: auto;
  }
}

@media (max-height: 620px) {
  .date-range-picker-popover {
    max-height: calc(100vh - 24px);
    overflow: auto;
  }

  .date-range-picker-actions {
    background: #fff;
    bottom: 0;
    position: sticky;
  }
}

@media (max-width: 1280px) {
  .dashboard-stock-filterbar {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
  }

  .dashboard-stock-filter-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

.finance-debt-table-wrap,
.finance-debt-table-wrap.table-wrap {
  overflow-x: auto;
}

.finance-debt-table-wrap.table-wrap .finance-debt-table,
.table-wrap .finance-debt-table {
  min-width: 1100px !important;
  table-layout: fixed !important;
  width: 100%;
}

.finance-debt-table th,
.finance-debt-table td {
  white-space: normal !important;
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: normal;
}

.finance-debt-table .debt-col-transaction {
  width: 16%;
}

.finance-debt-table .debt-col-party {
  width: 30%;
}

.finance-debt-table .debt-col-amount {
  width: 24%;
}

.finance-debt-table .debt-col-accounting {
  width: 22%;
}

.finance-debt-table .debt-col-action {
  width: 8%;
}

.purchase-debt-table .debt-col-transaction {
  width: 14%;
}

.purchase-debt-table .debt-col-party {
  width: 24%;
}

.purchase-debt-table .debt-col-amount {
  width: 22%;
}

.purchase-debt-table .debt-col-debt-authorization {
  width: 17%;
}

.purchase-debt-table .debt-col-payment-authorization {
  width: 16%;
}

.purchase-debt-table .debt-col-action {
  width: 7%;
}

.finance-debt-table .debt-col-action,
.finance-debt-table th:last-child,
.finance-debt-table td:last-child {
  max-width: 100px;
  text-align: center;
}

.debt-cell-stack {
  display: grid;
  gap: 3px;
  line-height: 1.3;
  min-width: 0;
}

.debt-cell-muted {
  color: #6b7280;
  font-size: 12px;
}

.debt-item-summary,
.debt-payment-history,
.debt-payment-line {
  min-width: 0;
}

.debt-payment-history {
  display: grid;
  gap: 4px;
}

.debt-payment-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
}

.debt-value-cell {
  gap: 5px;
  min-width: 220px;
}

.debt-amount-row {
  align-items: center;
  column-gap: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.debt-amount-row span {
  color: #334155;
  min-width: 0;
  white-space: nowrap;
}

.debt-amount-row strong {
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.debt-remaining-row {
  font-weight: 700;
}

.finance-debt-table .status,
.finance-debt-table .accounting-status-badge,
.finance-debt-table .accounting-authorize-btn,
.finance-debt-table button,
.finance-debt-table .purchase-debt-payment-actions {
  white-space: nowrap !important;
}

.accounting-authorize-btn {
  width: auto !important;
  min-width: auto !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 7px 10px !important;
  line-height: 1.2;
}

.invoice-authorize-btn {
  background: #2563eb !important;
  border-color: #2563eb !important;
}

.payment-authorize-btn {
  background: #059669 !important;
  border-color: #059669 !important;
}

.debt-accounting-subsection {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 4px;
  padding-top: 6px;
}

.debt-accounting-subsection:first-child {
  border-top: 0;
  padding-top: 0;
}

.debt-accounting-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.finance-debt-action-cell {
  display: flex;
  align-items: center;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: center;
  min-width: 0;
}

.finance-debt-action-cell button,
.finance-debt-table .purchase-debt-payment-actions button {
  line-height: 1.15;
  max-width: 88px;
  min-width: auto;
  padding: 6px 8px;
  white-space: normal !important;
  width: 100%;
}

@media (max-width: 900px) {
  .finance-debt-table-wrap,
  .finance-debt-table-wrap.table-wrap {
    overflow-x: auto;
  }

  .finance-debt-table-wrap.table-wrap .finance-debt-table,
  .table-wrap .finance-debt-table {
    min-width: 1100px !important;
  }

  .finance-debt-table-wrap.table-wrap .purchase-debt-table,
  .table-wrap .purchase-debt-table {
    min-width: 1200px !important;
  }
}

/* Stock Request: filter Daftar Request tetap rapi saat sidebar membuat area konten sempit. */
.request-filter-grid.stock-request-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  width: 100%;
}

.request-filter-grid.stock-request-filter-bar .filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
}

.request-filter-grid.stock-request-filter-bar .filter-period {
  order: 1;
  flex: 0 0 230px;
  min-width: 220px;
}

.request-filter-grid.stock-request-filter-bar .filter-outlet {
  order: 2;
  flex: 1 1 220px;
}

.request-filter-grid.stock-request-filter-bar .filter-item {
  order: 3;
  flex: 1 1 220px;
}

.request-filter-grid.stock-request-filter-bar .filter-location {
  order: 4;
  flex: 1 1 220px;
}

.request-filter-grid.stock-request-filter-bar .filter-status {
  order: 5;
  flex: 1 1 220px;
}

.request-filter-grid.stock-request-filter-bar input,
.request-filter-grid.stock-request-filter-bar select {
  width: 100%;
  min-height: 40px;
}

.request-filter-grid.stock-request-filter-bar .filter-actions {
  order: 6;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  margin-left: auto;
  padding-left: 8px;
  min-height: 40px;
}

.request-filter-grid.stock-request-filter-bar .filter-actions button {
  width: 44px;
  height: 40px;
  min-width: 44px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

@media (max-width: 900px) {
  .request-filter-grid.stock-request-filter-bar .filter-actions {
    width: 100%;
    margin-left: 0;
    padding-left: 0;
    justify-content: flex-start;
  }
}

/* Stock Request document list and detail modal */
.stock-request-document-table tbody tr.stock-request-document-row + tr.stock-request-document-row td {
  border-top: 1px solid var(--line);
}

.stock-request-document-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: center;
}

.stock-request-document-action-btn {
  width: 36px !important;
  height: 34px !important;
  min-width: 36px !important;
  min-height: 34px !important;
  padding: 0 !important;
}

.stock-request-document-action-btn svg {
  width: 16px;
  height: 16px;
}

.stock-request-document-modal {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 96px);
  max-width: 1200px;
  overflow: hidden;
  padding: 0;
  width: min(1200px, calc(100vw - 48px));
}

.stock-request-document-modal-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex: 0 0 auto;
  gap: 16px;
  justify-content: space-between;
  padding: 16px 18px 12px;
}

.stock-request-document-modal-header h3 {
  margin: 0 0 4px;
}

.stock-request-original-doc {
  color: #64748b;
  font-weight: 600;
  margin-left: 8px;
}

.stock-request-document-summary {
  border-bottom: 1px solid var(--line);
  display: grid;
  flex: 0 0 auto;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 12px 18px;
}

.stock-request-document-summary div {
  min-width: 0;
}

.stock-request-document-summary span {
  color: #64748b;
  display: block;
  font-size: 11px;
  line-height: 1.25;
  margin-bottom: 3px;
}

.stock-request-document-summary strong {
  color: #111827;
  display: block;
  font-size: 12px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.stock-request-document-summary-note {
  grid-column: span 2;
}

.stock-request-document-items-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0 18px 18px;
}

.stock-request-document-toolbar {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex: 0 0 auto;
  gap: 12px;
  justify-content: space-between;
  padding: 10px 18px;
  z-index: 2;
}

.stock-request-document-toolbar-actions {
  display: inline-flex;
  gap: 8px;
}

.stock-request-document-toolbar-left {
  align-items: center;
  display: flex;
  gap: 12px;
  min-width: 0;
}

.stock-request-document-toolbar-right {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  gap: 8px;
  justify-content: flex-end;
  margin-left: auto;
}

.stock-request-document-text-btn {
  align-items: center;
  border-radius: 8px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  justify-content: center;
  min-height: 34px;
  min-width: 72px;
  padding: 0 13px;
  white-space: nowrap;
}

.stock-request-document-receive-all-btn {
  background: #16a34a !important;
  border-color: #15803d !important;
  color: #fff !important;
}

.stock-request-document-receive-all-btn:hover:not(:disabled) {
  background: #15803d !important;
}

.stock-request-document-receive-all-btn:disabled {
  background: #dcfce7 !important;
  border-color: #86efac !important;
  color: #166534 !important;
  cursor: not-allowed;
}

.stock-request-document-dirty-label {
  color: #b45309;
  font-size: 12px;
  font-weight: 700;
}

.stock-request-document-items-scroll .stock-request-document-lines-wrap,
.stock-request-document-items-scroll .stock-request-document-lines-wrap.table-wrap {
  max-height: none;
  overflow: visible;
}

.stock-request-document-lines {
  min-width: 980px !important;
  table-layout: auto !important;
}

.stock-request-document-lines thead th {
  background: #f8fafc;
  line-height: 1.1;
  position: sticky;
  text-align: center;
  top: 0;
  white-space: normal;
  z-index: 1;
}

.stock-request-document-lines thead th span {
  display: block;
}

.stock-request-document-lines th,
.stock-request-document-lines td {
  padding: 7px 8px;
}

.stock-request-document-lines .srd-col-no {
  width: 42px;
}

.stock-request-document-lines .srd-col-name {
  min-width: 320px;
}

.stock-request-document-lines .srd-col-fulfillment {
  width: 68px;
}

.stock-request-document-lines .srd-col-qty {
  width: 66px;
}

.stock-request-document-lines .srd-col-unit {
  width: 58px;
}

.stock-request-document-lines .srd-col-money {
  width: 96px;
}

.stock-request-document-lines .srd-col-date {
  width: 88px;
}

.stock-request-document-lines .srd-col-status {
  width: 82px;
}

.stock-request-document-lines .srd-col-action {
  width: 54px;
}

.stock-request-document-lines .srd-cell-no,
.stock-request-document-lines .srd-cell-fulfillment,
.stock-request-document-lines .srd-cell-qty,
.stock-request-document-lines .srd-cell-unit,
.stock-request-document-lines .srd-cell-date,
.stock-request-document-lines .srd-cell-status,
.stock-request-document-lines .srd-cell-action {
  text-align: center;
}

.stock-request-document-lines .srd-cell-name {
  min-width: 320px;
  white-space: normal;
}

.stock-request-document-lines .srd-cell-qty {
  vertical-align: top;
}

.stock-request-document-lines .srd-cell-fulfillment,
.stock-request-document-lines .srd-cell-status {
  white-space: nowrap;
}

.stock-request-document-lines .srd-qty-input {
  background: #fff;
  height: 34px;
  min-height: 30px;
  padding: 4px 6px;
  text-align: center;
  width: 64px;
}

.stock-request-document-lines .srd-qty-input:disabled {
  background: #f8fafc;
  color: #64748b;
  opacity: 1;
}

.stock-request-document-lines .srd-qty-stack {
  align-items: center;
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  min-width: 64px;
}

.stock-request-document-lines .srd-qty-static {
  align-items: center;
  display: inline-flex;
  font-weight: 700;
  height: 34px;
  justify-content: center;
  min-width: 64px;
}

.stock-request-document-lines .srd-stock-hint {
  color: #64748b;
  display: block;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.stock-request-document-lines .srd-cell-money {
  text-align: right;
  white-space: nowrap;
}

.stock-request-document-lines .srd-cell-status .status {
  display: inline-flex;
  justify-content: center;
  min-width: 0;
  padding-left: 7px;
  padding-right: 7px;
}

.stock-request-document-line-actions {
  justify-content: center;
}

.stock-request-document-lines .stock-request-document-line-rejected {
  background: #fef2f2;
}

.stock-request-document-lines .stock-request-document-line-rejected td:first-child {
  border-left: 3px solid #dc2626;
}

@media (max-width: 900px) {
  .stock-request-document-modal {
    max-height: calc(100vh - 48px);
    width: calc(100vw - 24px);
  }

  .stock-request-document-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stock-request-document-summary-note {
    grid-column: 1 / -1;
  }
}
