:root {
  --erp-navy: #0b1f3a;
  --erp-blue: #2563eb;
  --erp-blue-dark: #1d4ed8;
  --erp-red: #dc2626;
  --erp-bg: #f3f6fb;
  --erp-surface: #ffffff;
  --erp-border: #dfe7f1;
  --erp-text: #172033;
  --erp-muted: #64748b;
  --erp-shadow: 0 12px 32px rgba(15, 23, 42, .08);
}

html { min-height: 100%; background: var(--erp-bg); }
body {
  min-height: 100vh;
  margin: 0;
  padding-top: 82px;
  padding-bottom: 0;
  color: var(--erp-text);
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, .08), transparent 28rem),
    var(--erp-bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
}

.navbar-custom {
  min-height: 66px;
  background: linear-gradient(115deg, #081b34 0%, #0b3d91 62%, #164eaa 100%) !important;
  border-bottom: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 10px 28px rgba(11,31,58,.20) !important;
}
.navbar-custom .container-fluid { max-width: 1720px; }
.erp-brand { display: flex; align-items: center; gap: .7rem; min-width: max-content; }
.erp-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.18);
}
.erp-brand-copy { line-height: 1.05; }
.erp-brand-copy strong { display: block; font-size: .92rem; letter-spacing: .01em; }
.erp-brand-copy small { color: #bfdbfe; font-size: .67rem; letter-spacing: .08em; text-transform: uppercase; }
.erp-nav-actions .btn,
.erp-user-button {
  border-radius: 10px;
  border-color: rgba(255,255,255,.24);
  background: rgba(255,255,255,.08);
}
.erp-nav-actions .btn:hover,
.erp-user-button:hover { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.4); }
.erp-company-form { min-width: 260px; }
.erp-warehouse-form { min-width: 310px; }
.erp-company-control,
.erp-warehouse-control {
  min-height: 38px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 11px;
  color: #fff;
  background: rgba(5, 23, 48, .42);
  display: flex;
  align-items: center;
  padding-left: .75rem;
}
.erp-company-control i,
.erp-warehouse-control i { color: #93c5fd; }
.erp-company-control select,
.erp-warehouse-control select {
  color: #fff;
  background-color: transparent;
  border: 0;
  box-shadow: none !important;
  font-size: .82rem;
  font-weight: 600;
  padding-top: .25rem;
  padding-bottom: .25rem;
}
.erp-company-control select option,
.erp-warehouse-control select option { color: #172033; background: #fff; }
.erp-company-control select:focus,
.erp-warehouse-control select:focus { color: #fff; }
.erp-warehouse-control { width: 100%; }
.erp-warehouse-control .erp-searchable-root { flex: 1 1 auto; width: auto; }
.erp-warehouse-control .erp-searchable-trigger {
  min-height: 36px;
  padding: .25rem .35rem .25rem 0;
  color: #fff;
  background: transparent;
  border: 0;
  border-radius: 0;
}
.erp-warehouse-control .erp-searchable-trigger:hover,
.erp-warehouse-control .erp-searchable-trigger:focus,
.erp-warehouse-control .erp-searchable-trigger[aria-expanded="true"] {
  color: #fff;
  background: transparent;
  box-shadow: none;
}
.erp-warehouse-control .erp-searchable-value,
.erp-warehouse-control .erp-searchable-chevron { color: #fff; }
.erp-legacy-warehouse-switch { display: none !important; }
.erp-user-menu { border: 0; border-radius: 14px; box-shadow: var(--erp-shadow); padding: .5rem; min-width: 230px; }
.erp-user-menu .dropdown-item { border-radius: 9px; padding: .55rem .7rem; }
.erp-header-flash { margin-top: -2px; border: 0; border-radius: 0; box-shadow: 0 8px 24px rgba(15,23,42,.08); }

.erp-context-nav {
  position: relative;
  z-index: 1025;
  margin-top: -8px;
  padding: .55rem 0;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--erp-border);
  box-shadow: 0 8px 22px rgba(15,23,42,.05);
  backdrop-filter: blur(12px);
}
.erp-context-nav .container-fluid { max-width: 1720px; }
.erp-context-back {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: #334155;
  border: 1px solid #d9e2ee;
  box-shadow: 0 2px 8px rgba(15,23,42,.04);
}
.erp-context-back:hover { color: var(--erp-blue); border-color: #93c5fd; background: #eff6ff; }
.erp-context-label { align-items: center; gap: .45rem; color: var(--erp-muted); font-size: .78rem; font-weight: 700; }
.erp-workflow-nav { display: flex; align-items: center; gap: .35rem; overflow-x: auto; scrollbar-width: thin; }
.erp-workflow-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 34px;
  padding: .4rem .65rem;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  font-size: .76rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}
.erp-workflow-link:hover { color: var(--erp-blue); border-color: #93c5fd; background: #eff6ff; }
.erp-workflow-link.is-active { color: #fff; border-color: var(--erp-blue); background: var(--erp-blue); box-shadow: 0 5px 14px rgba(37,99,235,.2); }
.erp-workflow-arrow { color: #94a3b8; font-size: .7rem; }
.erp-reference-preview-content { height: min(88vh, 980px); }
.erp-reference-frame { width: 100%; height: 100%; min-height: 70vh; border: 0; background: var(--erp-bg); }
.erp-reference-preview-page { padding-top: 0 !important; padding-bottom: 0 !important; }
.erp-reference-preview-page .navbar-custom,
.erp-reference-preview-page .erp-app-sidebar,
.erp-reference-preview-page .erp-context-nav,
.erp-reference-preview-page > footer,
.erp-reference-preview-page .erp-header-flash { display: none !important; }
.erp-reference-preview-page > .container,
.erp-reference-preview-page > .container-fluid { margin-top: 0 !important; padding-top: 1rem; }
.erp-stock-unavailable { color: #b91c1c; font-weight: 700; }
.erp-reference-link { cursor: pointer; text-decoration-style: dotted !important; text-underline-offset: 3px; }

/* Searchable select shared by long ERP reference lists. */
.erp-searchable-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: .001 !important;
  pointer-events: none !important;
}
.erp-searchable-root { position: relative; display: block; width: 100%; min-width: 0; }
.erp-searchable-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
  width: 100%;
  min-height: 40px;
  padding: .48rem .75rem;
  color: #1e293b;
  text-align: left;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: none;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.erp-searchable-trigger:hover { border-color: #94a3b8; background: #fdfefe; }
.erp-searchable-trigger:focus,
.erp-searchable-trigger[aria-expanded="true"] { outline: 0; border-color: #60a5fa; box-shadow: 0 0 0 .2rem rgba(37,99,235,.13); }
.erp-searchable-trigger:disabled { color: #94a3b8; background: #f1f5f9; cursor: not-allowed; }
.erp-searchable-trigger.is-sm { min-height: 31px; padding: .3rem .55rem; border-radius: 8px; font-size: .875rem; }
.erp-searchable-trigger.is-placeholder .erp-searchable-value { color: #64748b; font-weight: 400; }
.erp-searchable-value { min-width: 0; overflow: hidden; color: #1e293b; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.erp-searchable-chevron { flex: 0 0 auto; color: #64748b; font-size: .75rem; transition: transform .15s ease; }
.erp-searchable-trigger[aria-expanded="true"] .erp-searchable-chevron { transform: rotate(180deg); }
.erp-searchable-root.is-invalid .erp-searchable-trigger { border-color: #dc3545; box-shadow: 0 0 0 .2rem rgba(220,53,69,.1); }
.erp-searchable-panel {
  position: fixed;
  z-index: 2200;
  display: none;
  padding: 8px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 13px;
  box-shadow: 0 22px 54px rgba(15,23,42,.22);
}
.erp-searchable-panel.is-open { display: block; }
.erp-searchable-input-wrap { position: relative; }
.erp-searchable-input-wrap .bi-search { position: absolute; left: 12px; top: 50%; color: #94a3b8; transform: translateY(-50%); pointer-events: none; }
.erp-searchable-input { width: 100%; min-height: 39px; padding: .45rem 2.25rem .45rem 2.1rem; border: 1px solid #cbd5e1; border-radius: 9px; outline: 0; }
.erp-searchable-input:focus { border-color: #60a5fa; box-shadow: 0 0 0 .18rem rgba(37,99,235,.12); }
.erp-searchable-close { position: absolute; right: 5px; top: 50%; padding: 5px 8px; color: #64748b; background: transparent; border: 0; transform: translateY(-50%); }
.erp-searchable-options { max-height: min(330px, 48vh); margin-top: 7px; overflow-y: auto; overscroll-behavior: contain; }
.erp-searchable-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin: 1px 0;
  padding: 9px 10px;
  color: #334155;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
}
.erp-searchable-option:hover,.erp-searchable-option.is-active { color: #1d4ed8; background: #eff6ff; }
.erp-searchable-option.is-selected { color: #1d4ed8; background: #dbeafe; font-weight: 700; }
.erp-searchable-option:disabled { color: #94a3b8; background: transparent; cursor: not-allowed; }
.erp-searchable-option-copy { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.erp-searchable-group { padding: 9px 10px 4px; color: #64748b; font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.erp-searchable-empty { padding: 24px 12px; color: #64748b; text-align: center; font-size: .875rem; }
.erp-searchable-hint { padding: 6px 8px 1px; color: #64748b; font-size: .72rem; text-align: center; }

.erp-page-shell { width: min(100%, 1720px); }
.erp-eyebrow { color: var(--erp-blue); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; margin-bottom: .3rem; }
h1, h2, h3, h4, h5, h6 { color: #15213a; font-weight: 700; }
.text-muted { color: var(--erp-muted) !important; }

.card {
  border: 1px solid rgba(203, 213, 225, .72);
  border-radius: 16px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .055);
  overflow: visible;
}
.card-header {
  padding: 1rem 1.15rem;
  background: rgba(248,250,252,.88);
  border-bottom: 1px solid var(--erp-border);
  border-radius: 16px 16px 0 0 !important;
}
.card-body { padding: 1.15rem; }
.erp-stat-card { position: relative; overflow: hidden; }
.erp-stat-card::after { content:""; position:absolute; width:90px; height:90px; border-radius:50%; right:-30px; top:-35px; background:rgba(37,99,235,.06); }
.erp-stat-icon { width: 42px; height: 42px; border-radius: 12px; display:grid; place-items:center; margin-bottom:.8rem; font-size:1.1rem; background:#dbeafe; color:#1d4ed8; }
.erp-stat-icon.is-success { background:#dcfce7; color:#15803d; }
.erp-stat-icon.is-warning { background:#fef3c7; color:#b45309; }
.erp-stat-icon.is-info { background:#cffafe; color:#0e7490; }

.btn { border-radius: 10px; font-weight: 600; }
.btn-primary, .btn-mtp { background: var(--erp-blue); border-color: var(--erp-blue); }
.btn-primary:hover, .btn-mtp:hover { background: var(--erp-blue-dark); border-color: var(--erp-blue-dark); }
.form-control, .form-select, .input-group-text {
  min-height: 40px;
  border-color: #cbd5e1;
  border-radius: 10px;
}
.form-control:focus, .form-select:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 .2rem rgba(37,99,235,.13);
}
.input-group > :not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group > :not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }

.table { --bs-table-bg: transparent; color: var(--erp-text); }
.table > :not(caption) > * > * { padding: .78rem .8rem; border-bottom-color: #e7edf5; }
.table thead th { background: #f7f9fc; color: #526079; font-size: .75rem; letter-spacing: .035em; text-transform: uppercase; white-space: nowrap; }
.table tbody tr { transition: background-color .15s ease; }
.table tbody tr:hover { background: rgba(37,99,235,.035); }
.badge { border-radius: 999px; font-weight: 700; letter-spacing: .01em; }
.alert { border-radius: 13px; }
.modal { z-index: 1080 !important; }
.modal-backdrop { z-index: 1070 !important; }
.modal-content { border: 0; border-radius: 18px; box-shadow: 0 24px 70px rgba(15,23,42,.22); overflow: hidden; }
.modal-header, .modal-footer { border-color: var(--erp-border); }
.pagination .page-link { border-radius: 8px; margin: 0 2px; color: var(--erp-blue); }

.erp-form-alert { scroll-margin-top: 120px; }
.erp-form-actions {
  position: sticky;
  bottom: 1rem;
  z-index: 1020;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.25rem;
  padding: .9rem 1rem;
  border: 1px solid rgba(203, 213, 225, .9);
  border-radius: 14px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 14px 36px rgba(15,23,42,.12);
  backdrop-filter: blur(12px);
}
.erp-form-actions__hint { color: var(--erp-muted); font-size: .8rem; }
.erp-form-actions__buttons { display: flex; align-items: center; gap: .55rem; margin-left: auto; }
.erp-form-actions .btn { min-height: 40px; padding-inline: 1rem; }

/* =========================================================
   TRANSACTION WORKSPACE
   Quotation, Sales Order, Delivery Order, and Invoice use the same visual
   hierarchy. It deliberately styles only the document pages marked by the
   shared header, leaving master data and report layouts unchanged.
   ========================================================= */
.erp-transaction-page {
  --erp-document-accent: #2563eb;
  --erp-document-soft: #eff6ff;
  --erp-document-border: #dbe5f1;
}
.erp-transaction-so,
.erp-transaction-do,
.erp-transaction-invoice,
.erp-transaction-quotation,
.erp-transaction-stock-in,
.erp-transaction-stock-adjustment,
.erp-transaction-stock-assembly,
.erp-transaction-stock-disassembly,
.erp-transaction-stock-transfer { --erp-document-accent: #2563eb; --erp-document-soft: #eff6ff; }
.erp-transaction-page > .container,
.erp-transaction-page > .container-fluid {
  width: min(100%, 1720px);
  margin-right: auto;
  margin-left: auto;
  padding-right: clamp(.85rem, 1.8vw, 1.6rem);
  padding-left: clamp(.85rem, 1.8vw, 1.6rem);
}
.erp-transaction-page > .container-fluid.mt-3,
.erp-transaction-page > .container.mt-3 { margin-top: 1.15rem !important; }
.erp-transaction-page > .container-fluid.mb-4,
.erp-transaction-page > .container.mb-4 { margin-bottom: 2.25rem !important; }

/* The first page header becomes a calm document identity bar: title/context
   on the left and document actions on the right. */
.erp-transaction-page > .container-fluid > .d-flex.justify-content-between.align-items-start,
.erp-transaction-page > .container > .d-flex.justify-content-between.align-items-start,
.erp-transaction-page > .container > .head-flex {
  gap: 1rem;
  margin-bottom: 1rem !important;
  padding: 1rem 1.15rem;
  background: linear-gradient(120deg, var(--erp-document-soft), rgba(255,255,255,.96));
  border: 1px solid var(--erp-document-border);
  border-left: 4px solid var(--erp-document-accent);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(15,23,42,.045);
}
.erp-transaction-page > .container-fluid > .d-flex.justify-content-between.align-items-center {
  gap: 1rem;
  margin-bottom: 1rem !important;
  padding: 1rem 1.15rem;
  background: linear-gradient(120deg, var(--erp-document-soft), rgba(255,255,255,.96));
  border: 1px solid var(--erp-document-border);
  border-left: 4px solid var(--erp-document-accent);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(15,23,42,.045);
}
.erp-transaction-page h2,
.erp-transaction-page h5 { letter-spacing: -.015em; }
.erp-transaction-page .card {
  border-color: var(--erp-document-border);
  box-shadow: 0 9px 26px rgba(15,23,42,.055) !important;
}
.erp-transaction-page .card-header {
  display: flex;
  align-items: center;
  min-height: 58px;
  color: #1e293b;
  background: linear-gradient(90deg, rgba(248,250,252,.96), #fff) !important;
}
.erp-transaction-page .card-header strong:first-child::before {
  display: inline-block;
  width: .55rem;
  height: .55rem;
  margin-right: .55rem;
  content: '';
  vertical-align: .02em;
  background: var(--erp-document-accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--erp-document-soft);
}
.erp-transaction-page .form-label,
.erp-transaction-page label.small { color: #475569; font-size: .76rem; font-weight: 750; letter-spacing: .015em; }
/* Restrict document-field styling to page content. The header's company
   switcher is also a .form-select, but must retain its dark-nav treatment. */
.erp-transaction-page > .container .form-control,
.erp-transaction-page > .container .form-select,
.erp-transaction-page > .container-fluid .form-control,
.erp-transaction-page > .container-fluid .form-select { background-color: #fff; }
.erp-transaction-page > .container .form-control[readonly],
.erp-transaction-page > .container .form-control:disabled,
.erp-transaction-page > .container .form-select:disabled,
.erp-transaction-page > .container-fluid .form-control[readonly],
.erp-transaction-page > .container-fluid .form-control:disabled,
.erp-transaction-page > .container-fluid .form-select:disabled { background-color: #f8fafc; }

/* Quotation keeps its document identity and item actions inside the two
   primary cards, so the page is easy to scan without scattered controls. */
.erp-transaction-page .erp-document-number {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 31px;
  padding: .32rem .55rem;
  background: var(--erp-document-soft);
  border: 1px solid var(--erp-document-border);
  border-radius: .45rem;
}
.erp-transaction-page .erp-document-number .badge-mono {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.erp-transaction-page .erp-item-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: .45rem;
}
.erp-transaction-page .erp-item-toolbar .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  white-space: nowrap;
}
.erp-transaction-page .erp-item-tool {
  color: #475569;
  font-weight: 600;
  background: #fff;
  border-color: #94a3b8;
}
.erp-transaction-page .erp-item-tool:hover,
.erp-transaction-page .erp-item-tool:focus {
  color: #1e293b;
  background: #f8fafc;
  border-color: #64748b;
}
.erp-transaction-page .erp-item-action {
  color: #fff !important;
  font-weight: 650;
  background-color: #2563eb;
  border-color: #2563eb;
  box-shadow: 0 2px 5px rgba(37,99,235,.24);
}
.erp-transaction-page .erp-item-action:hover,
.erp-transaction-page .erp-item-action:focus {
  color: #fff !important;
  background-color: #1d4ed8;
  border-color: #1d4ed8;
}
.erp-transaction-page .erp-item-file-trigger {
  max-width: 175px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.erp-transaction-page .erp-item-import-status:empty { display: none; }
.erp-transaction-page .erp-item-import-status:not(:empty) {
  padding: .45rem 1rem;
  background: #f8fafc;
  border-top: 1px solid var(--erp-document-border);
}

/* Tables stay dense for desktop work, but never collapse into unreadable
   columns on smaller screens. The native horizontal container is retained. */
.erp-transaction-page .table-responsive {
  position: relative;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-color: #94a3b8 transparent;
}
.erp-transaction-page .table-responsive::after {
  position: sticky;
  right: 0;
  display: block;
  width: 38px;
  height: 1px;
  margin-top: -1px;
  content: '';
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.96));
}
.erp-transaction-page .table-responsive > .table { min-width: 760px; margin-bottom: 0; }
.erp-transaction-page .table > :not(caption) > * > * { vertical-align: middle; }
.erp-transaction-page .table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #475569;
  background: #f8fafc;
}
.erp-transaction-page .table tfoot > tr > * {
  color: #334155;
  background: #fbfdff;
  border-top: 1px solid var(--erp-document-border);
}
.erp-transaction-page .table tfoot tr:last-child > * {
  color: #0f172a;
  font-size: 1rem;
  background: var(--erp-document-soft);
}
.erp-transaction-page .table .form-control,
.erp-transaction-page .table .form-select { min-width: 92px; }
.erp-transaction-page .subtotal-cell,
.erp-transaction-page .money,
.erp-transaction-page .total-val { font-variant-numeric: tabular-nums; font-weight: 700; }
.erp-transaction-page .total-box,
.erp-transaction-page .totals {
  width: min(100%, 460px);
  margin-left: auto;
  padding: .85rem 1rem;
  background: linear-gradient(135deg, #fff, var(--erp-document-soft));
  border: 1px solid var(--erp-document-border);
  border-radius: 13px;
}
.erp-transaction-page .total-box .total-row:last-child,
.erp-transaction-page .totals tr:last-child { color: #0f172a; font-size: 1.05rem; }

/* List filters and action rows stay usable when space is limited. */
.erp-transaction-list .card-body > form.row { row-gap: .8rem; }
.erp-transaction-list #searchInput { width: min(100%, 430px); max-width: none !important; }
.erp-transaction-list .pager { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.erp-transaction-list .pager a,
.erp-transaction-list .pager span { margin: 0; border-radius: 9px; }
.erp-transaction-view .block {
  border-color: var(--erp-document-border) !important;
  border-radius: 14px !important;
  box-shadow: 0 8px 22px rgba(15,23,42,.04);
}
.erp-transaction-view .hgrid { gap: 1rem; }
.erp-transaction-view .label { color: #64748b; font-weight: 650; }
.erp-transaction-view .value { color: #1e293b; }

@media (max-width: 767.98px) {
  .erp-transaction-page > .container-fluid,
  .erp-transaction-page > .container { padding-right: .75rem; padding-left: .75rem; }
  .erp-transaction-page > .container-fluid > .d-flex.justify-content-between.align-items-start,
  .erp-transaction-page > .container-fluid > .d-flex.justify-content-between.align-items-center,
  .erp-transaction-page > .container > .d-flex.justify-content-between.align-items-start,
  .erp-transaction-page > .container > .head-flex {
    align-items: stretch !important;
    flex-direction: column;
    padding: .9rem;
  }
  .erp-transaction-page > .container-fluid > .d-flex.justify-content-between.align-items-start > :last-child,
  .erp-transaction-page > .container-fluid > .d-flex.justify-content-between.align-items-center > :last-child,
  .erp-transaction-page > .container > .d-flex.justify-content-between.align-items-start > :last-child,
  .erp-transaction-page > .container > .head-flex > :last-child { text-align: left !important; }
  .erp-transaction-page > .container-fluid > .d-flex.justify-content-between.align-items-start .btn,
  .erp-transaction-page > .container-fluid > .d-flex.justify-content-between.align-items-center .btn,
  .erp-transaction-page > .container > .head-flex .btn { margin-bottom: .25rem; }
  .erp-transaction-page .card-header { min-height: 52px; padding: .8rem .9rem; }
  .erp-transaction-page .card-body { padding: .9rem; }
  .erp-transaction-page .card-body.p-0 { padding: 0; }
  .erp-transaction-page .erp-document-number { min-height: 31px; }
  .erp-transaction-page .erp-item-toolbar { width: 100%; }
  .erp-transaction-page .erp-item-toolbar .btn { flex: 1 1 auto; }
  .erp-transaction-page .table-responsive > .table { min-width: 690px; }
  .erp-transaction-page .hgrid { grid-template-columns: 1fr !important; }
  .erp-transaction-page .total-box,
  .erp-transaction-page .totals { width: 100%; }
  .erp-transaction-page .erp-form-actions { margin-right: 0; margin-left: 0; }
}

footer {
  position: relative !important;
  bottom: auto !important;
  width: 100%;
  margin-top: auto;
  padding: 18px 12px !important;
  color: #cbd5e1 !important;
  background: #081b34 !important;
  border-top: 0 !important;
  font-size: .82rem;
}

.erp-login-page { padding-top: 0; background: linear-gradient(135deg,#071a31 0%,#0b3d91 54%,#2563eb 100%); }
.erp-login-shell { min-height: calc(100vh - 57px); }
.erp-login-card { width: min(430px, 92vw); border: 1px solid rgba(255,255,255,.2); box-shadow: 0 28px 70px rgba(2,6,23,.28); }
.erp-login-logo { height: 68px; width: auto; }
.erp-login-page footer { background: transparent !important; color: #dbeafe !important; }

@media (max-width: 1199.98px) {
  body { padding-top: 74px; }
  .navbar-custom .navbar-collapse { padding: .8rem 0 .4rem; }
  .erp-company-form { width: 100%; min-width: 0; }
  .erp-nav-actions { order: 2; }
}

@media (max-width: 575.98px) {
  .erp-brand-copy small { display: none; }
  .erp-brand-copy strong { font-size: .82rem; }
  .erp-brand-mark { width: 32px; height: 32px; }
  .card { border-radius: 13px; }
  .card-body { padding: .95rem; }
  .table > :not(caption) > * > * { padding: .65rem; }
  .erp-context-nav { margin-top: 0; }
  .erp-context-nav .container-fluid { flex-wrap: nowrap !important; }
  .erp-context-back span { display: none; }
  .erp-workflow-nav { flex: 1; }
  .erp-workflow-link span { display: none; }
  .erp-workflow-link { justify-content: center; min-width: 36px; padding: .4rem .55rem; }
  .erp-form-actions { bottom: .5rem; flex-direction: column; align-items: stretch; padding: .75rem; }
  .erp-form-actions__hint { text-align: center; }
  .erp-form-actions__buttons { width: 100%; margin-left: 0; }
  .erp-form-actions__buttons .btn { flex: 1; }
}

/* =========================================================
   Sidebar navigation preview
   Aktif hanya saat body memiliki .erp-navigation-sidebar.
   ========================================================= */
.erp-app-sidebar { --erp-sidebar-width: 272px; }
.erp-app-sidebar .offcanvas-header {
  min-height: 66px;
  color: #fff;
  /* Warna ini sama dengan titik awal navbar utama. Sidebar tidak mengulang
     gradasi sendiri, sehingga sambungan di sisi kiri header menjadi mulus. */
  background: #081b34;
  border-bottom: 1px solid rgba(255,255,255,.14);
}
.erp-sidebar-app-head { display: flex; align-items: center; justify-content: space-between; gap: .3rem; padding: 0 .55rem; }
.erp-sidebar-brand { flex: 1 1 auto; min-width: 0; margin: 0; gap: .42rem; overflow: hidden; color: #fff; text-decoration: none; }
.erp-sidebar-brand:hover { color: #fff; }
.erp-sidebar-brand .erp-brand-mark { width: 34px; height: 34px; border-radius: 9px; }
.erp-sidebar-brand .erp-brand-copy { min-width: 0; }
.erp-sidebar-brand .erp-brand-copy strong { display: block; color: #fff; font-size: .81rem; line-height: 1.1; white-space: nowrap; }
.erp-sidebar-brand .erp-brand-copy small { display: block; color: rgba(255,255,255,.76); font-size: .54rem; line-height: 1.25; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.erp-sidebar-actions { display: grid !important; flex: 0 0 auto; grid-template-columns: repeat(3, 30px); gap: 4px !important; }
.erp-sidebar-actions .btn { display: grid; width: 30px; min-width: 30px; height: 30px; padding: 0; place-items: center; border-radius: 8px; line-height: 1; }
.erp-app-sidebar .btn-close { filter: invert(1) grayscale(1) brightness(3); }
.erp-sidebar-body { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; padding: .9rem .75rem 1rem; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.erp-sidebar-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  min-height: 38px;
  padding: .5rem .68rem;
  color: #475569;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: .82rem;
  font-weight: 700;
  transition: .15s ease;
}
.erp-sidebar-link:hover { color: #1d4ed8; background: #f8fbff; border-color: #bfdbfe; }
.erp-sidebar-link.is-active { color: #fff; background: var(--erp-blue); border-color: var(--erp-blue); box-shadow: 0 5px 14px rgba(37,99,235,.20); }
.erp-sidebar-link-icon {
  position: relative;
  display: inline-grid;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  place-items: center;
  overflow: visible;
}
.erp-sidebar-link-icon > i { font-size: .98rem; line-height: 1; }
.erp-sidebar-link-label { min-width: 0; flex: 1 1 auto; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.erp-sidebar-notification {
  position: absolute;
  top: -8px;
  right: -10px;
  display: inline-grid;
  z-index: 1;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  place-items: center;
  color: #fff;
  border: 2px solid #f8fafc;
  border-radius: 999px;
  background: #dc2626;
  box-shadow: 0 2px 7px rgba(220,38,38,.28);
  font-size: .62rem;
  font-weight: 800;
  line-height: 1;
}
.erp-sidebar-link.is-active .erp-sidebar-notification { border-color: var(--erp-blue); }
.erp-sidebar-space-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .45rem;
  margin: 0 0 .8rem;
  padding: .25rem;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #fff;
}
.erp-sidebar-space-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  min-height: 34px;
  padding: .35rem .45rem;
  color: #64748b;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-size: .72rem;
  font-weight: 800;
  white-space: nowrap;
}
.erp-sidebar-space-tab:hover { color: #1d4ed8; background: #eff6ff; }
.erp-sidebar-space-tab.is-active { color: #fff; background: #2563eb; box-shadow: 0 3px 10px rgba(37,99,235,.24); }
.erp-sidebar-menu-list[data-active-space="workspace"] .erp-sidebar-link[data-erp-sidebar-space="personal"],
.erp-sidebar-menu-list[data-active-space="personal"] .erp-sidebar-link[data-erp-sidebar-space="workspace"] { display: none; }
.erp-sidebar-menu-list { display: grid; gap: .15rem; }
.erp-sidebar-foot { margin-top: auto; padding-top: 1rem; }
.erp-sidebar-all-menu,
.erp-sidebar-switch-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 38px;
  margin-top: .45rem;
  color: #475569;
  text-decoration: none;
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  font-size: .76rem;
  font-weight: 700;
}
.erp-sidebar-all-menu:hover,
.erp-sidebar-switch-top:hover { color: #1d4ed8; background: #f8fbff; border-color: #93c5fd; }
.erp-sidebar-switch-top { color: #475569; background: #fff; }
.erp-mobile-nav { display: none; }

@media (min-width: 992px) {
  body.erp-navigation-sidebar { padding-left: 272px; }
  .erp-navigation-sidebar .navbar-custom {
    right: auto;
    left: 272px;
    width: calc(100% - 272px);
  }
  .erp-navigation-sidebar .erp-topbar-brand,
  .erp-navigation-sidebar .erp-topbar-actions { display: none !important; }
  .erp-navigation-sidebar .erp-app-sidebar {
    position: fixed !important;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1061;
    display: flex !important;
    flex-direction: column;
    width: 272px !important;
    max-width: 272px;
    visibility: visible !important;
    color: var(--erp-text);
    background: #f8fafc;
    border-right: 0;
    box-shadow: none;
    transform: none !important;
  }
  .erp-navigation-sidebar .erp-app-sidebar .offcanvas-header { display: flex !important; flex: 0 0 66px; }
  .erp-navigation-sidebar .erp-app-sidebar .offcanvas-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    border-right: 1px solid var(--erp-border);
    box-shadow: 12px 0 30px rgba(15,23,42,.08);
  }
}

@media (max-width: 991.98px) {
  body.erp-navigation-sidebar { padding-bottom: 76px; }
  /* Beranda, Kembali, dan Muat ulang sudah tersedia di navigasi bawah.
     Sembunyikan duplikasi ini hanya pada mode menu samping di layar ponsel. */
  .erp-navigation-sidebar .erp-topbar-actions,
  .erp-navigation-sidebar .erp-sidebar-actions { display: none !important; }
  .erp-navigation-sidebar .erp-app-sidebar { width: min(320px, 88vw) !important; }
  .erp-navigation-sidebar .erp-app-sidebar .offcanvas-body { overflow-y: auto; }
  .erp-sidebar-brand .erp-brand-copy strong { font-size: .77rem; }
  .erp-sidebar-brand .erp-brand-copy small { font-size: .5rem; }
  .erp-navigation-sidebar .erp-mobile-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1060;
    display: grid;
    grid-template-columns: repeat(var(--erp-mobile-nav-columns, 5), minmax(0, 1fr));
    min-height: 64px;
    padding: 6px max(.75rem, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(.75rem, env(safe-area-inset-left));
    background: rgba(255,255,255,.96);
    border-top: 1px solid #dbe3ee;
    box-shadow: 0 -8px 24px rgba(15,23,42,.10);
    backdrop-filter: blur(12px);
    grid-auto-flow: row;
    align-items: stretch;
  }
  .erp-mobile-nav a,
  .erp-mobile-nav button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 50px;
    color: #64748b;
    text-decoration: none;
    border: 0;
    background: transparent;
    font-size: .65rem;
    font-weight: 800;
    min-width: 0;
    width: 100%;
    white-space: nowrap;
  }
  .erp-mobile-nav i { color: #2563eb; font-size: 1.15rem; line-height: 1; }
  .erp-mobile-nav .is-active { color: #1d4ed8; }
  .erp-mobile-nav .is-active i { color: #1d4ed8; }
  .erp-mobile-nav .erp-mobile-primary { color: #1d4ed8; }
  .erp-mobile-nav .erp-mobile-primary i {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: #fff;
    border-radius: 12px;
    background: #2563eb;
    box-shadow: 0 6px 16px rgba(37,99,235,.28);
  }
}

@media print {
  body { padding: 0 !important; background: #fff !important; display: block; }
  .navbar-custom, footer, .erp-header-flash, .erp-context-nav, .erp-app-sidebar, .erp-mobile-nav { display: none !important; }
  .card { box-shadow: none; border-color: #bbb; }
}

/* Internal information homepage ------------------------------------------------ */
.erp-internal-home { max-width: 1540px; }
.erp-home-eyebrow { display: inline-flex; align-items: center; gap: .45rem; color: #2563eb; font-size: .76rem; font-weight: 800; letter-spacing: .045em; text-transform: uppercase; }
.erp-home-page-title { color: #0f2f61; font-weight: 800; font-size: clamp(1.45rem, 2.4vw, 2.15rem); }
.erp-home-manage-button { white-space: nowrap; }
.erp-home-carousel { border-radius: 24px; box-shadow: 0 18px 48px rgba(15, 35, 68, .16); overflow: hidden; }
.erp-home-hero, .erp-home-empty { position: relative; min-height: clamp(345px, 52vh, 555px); overflow: hidden; color: #fff; isolation: isolate; }
.erp-home-hero { display: flex; align-items: flex-end; padding: clamp(1.8rem, 5vw, 4.8rem); background-color: #164e9f; }
.erp-home-hero::before, .erp-home-empty::before { position: absolute; inset: 0; z-index: -1; content: ''; background: linear-gradient(105deg, rgba(5, 20, 53, .95) 0%, rgba(9, 43, 96, .80) 48%, rgba(9, 43, 96, .30) 100%); }
.erp-home-hero:not(.has-image)::before { background: transparent; }
.erp-home-theme-ocean { background-color: #0f4e9b; background-image: radial-gradient(circle at 88% 12%, rgba(85, 211, 255, .45), transparent 34%), linear-gradient(130deg, #08336e 0%, #1265bd 57%, #19a6cd 100%); }
.erp-home-theme-violet { background-color: #4c2a9b; background-image: radial-gradient(circle at 88% 12%, rgba(255, 162, 237, .42), transparent 34%), linear-gradient(130deg, #311266 0%, #6941bf 60%, #b050b9 100%); }
.erp-home-theme-forest { background-color: #0f6d57; background-image: radial-gradient(circle at 88% 12%, rgba(141, 235, 176, .38), transparent 34%), linear-gradient(130deg, #084a42 0%, #158257 59%, #77ac37 100%); }
.erp-home-theme-sunset { background-color: #bb4b18; background-image: radial-gradient(circle at 88% 12%, rgba(255, 229, 130, .45), transparent 34%), linear-gradient(130deg, #8f2519 0%, #df6b1f 58%, #f7ad38 100%); }
.erp-home-theme-midnight { background-color: #111c43; background-image: radial-gradient(circle at 88% 12%, rgba(77, 149, 255, .34), transparent 34%), linear-gradient(130deg, #0b1231 0%, #17245a 58%, #334a9b 100%); }
.erp-home-hero-media { position: absolute; inset: 0; z-index: 0; display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.erp-home-hero.has-image::before { z-index: 1; }
.erp-home-hero.has-image .erp-home-hero-grid { z-index: 2; }
.erp-home-hero.has-image .erp-home-hero-content,
.erp-home-hero.has-image .erp-home-hero-mark { z-index: 3; }
.erp-home-poster-card { overflow: hidden; background: #fff; border: 1px solid #dbe5f0; border-radius: 24px; box-shadow: 0 18px 48px rgba(15,35,68,.14); }
.erp-home-poster-media { width: 100%; margin: 0; aspect-ratio: 2 / 1; background: #eff5fb; }
.erp-home-poster-media img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center; }
.erp-home-poster-caption { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; padding: 1.25rem clamp(1.25rem, 3vw, 2rem); color: #16345e; background: #fff; }
.erp-home-poster-caption h2 { margin: .22rem 0 .35rem; color: #102f59; font-size: clamp(1.18rem, 2vw, 1.55rem); font-weight: 800; }
.erp-home-poster-caption p { max-width: 760px; margin: 0; color: #55708f; line-height: 1.55; }
.erp-home-poster-kicker { color: #2563eb; font-size: .72rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.erp-home-poster-action { flex: 0 0 auto; border-radius: 10px; padding: .68rem 1rem; font-weight: 700; white-space: nowrap; }
.erp-home-hero-grid { position: absolute; inset: 0; z-index: -1; opacity: .35; background-image: linear-gradient(rgba(255,255,255,.16) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.16) 1px, transparent 1px); background-size: 42px 42px; mask-image: linear-gradient(90deg, #000, transparent 80%); }
.erp-home-hero-content { max-width: min(700px, 80%); position: relative; z-index: 1; }
.erp-home-slide-number { display: inline-flex; margin-bottom: 1rem; padding: .4rem .75rem; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; background: rgba(7,22,54,.25); font-size: .74rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; backdrop-filter: blur(8px); }
.erp-home-hero h2, .erp-home-empty h2 { margin: 0 0 1rem; color: #fff; font-size: clamp(2rem, 4.7vw, 4.35rem); font-weight: 800; line-height: 1.05; text-wrap: balance; }
.erp-home-hero p, .erp-home-empty p { max-width: 640px; margin: 0 0 1.55rem; color: rgba(255,255,255,.92); font-size: clamp(1rem, 1.5vw, 1.22rem); line-height: 1.65; }
.erp-home-action { border: 0; border-radius: 11px; padding: .72rem 1.1rem; color: #12325d; font-weight: 750; box-shadow: 0 8px 20px rgba(4, 18, 49, .18); }
.erp-home-action i { font-size: 1.2em; vertical-align: -1px; }
.erp-home-hero-mark, .erp-home-empty-mark { position: absolute; right: clamp(1.5rem, 7vw, 8rem); bottom: clamp(1.5rem, 5vw, 5rem); z-index: 0; color: rgba(255,255,255,.18); font-size: clamp(5rem, 14vw, 12rem); line-height: 1; transform: rotate(-8deg); }
.erp-home-control { width: 9%; opacity: .85; }
.erp-home-empty { display: flex; align-items: center; min-height: 390px; padding: clamp(2rem, 6vw, 5rem); border-radius: 24px; box-shadow: 0 18px 48px rgba(15,35,68,.16); }
.erp-home-empty-content { position: relative; z-index: 1; max-width: 760px; }
.erp-home-management { max-width: 1540px; }
.erp-home-management-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.erp-home-poster-summary { max-width: 440px; }
.erp-home-select { min-width: 210px; }
@media (max-width: 767.98px) { .erp-internal-home { padding-bottom: 5.5rem !important; } .erp-home-manage-button { font-size: .85rem; } .erp-home-hero { min-height: 440px; padding: 1.5rem; } .erp-home-hero-content { max-width: 100%; } .erp-home-hero-mark { right: 1rem; top: 1rem; bottom: auto; opacity: .7; } .erp-home-control { display: none; } .erp-home-poster-card { border-radius: 17px; } .erp-home-poster-caption { align-items: flex-start; flex-direction: column; gap: .8rem; padding: 1rem; } .erp-home-poster-caption h2 { font-size: 1.17rem; } .erp-home-poster-caption p { font-size: .9rem; } .erp-home-poster-action { width: 100%; } .erp-home-management { padding-bottom: 5.5rem !important; } .erp-home-management-heading { align-items: stretch; flex-direction: column; } .erp-home-management-heading > .btn { width: 100%; } }
