:root {
  font-family: "Segoe UI Variable", "Segoe UI", Inter, ui-sans-serif, system-ui, sans-serif;
  color: #173653;
  background: #f6faff;
  font-size: 16px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; padding-top: 76px; min-width: 0; }
header {
  position: fixed; z-index: 20; top: 0; left: 0; right: 0;
  display: flex; align-items: center; flex-wrap: nowrap; gap: 1rem;
  width: 100%; min-width: 0; height: 76px; padding: .7rem clamp(1rem, 2.5vw, 2rem);
  color: #173653; background: #fff; border-bottom: 1px solid #e1ebf7;
}
header strong { color: #1977d4; font-weight: 800; letter-spacing: .04em; }
header span, header small { color: #607992; }
header small { margin-left: auto; }
.brand { display: flex; align-items: center; gap: .75rem; min-width: 0; flex: 1 1 auto; }
.brand img { display: block; width: 39px; height: 52px; object-fit: contain; flex: none; }
.brand-text { display: grid; gap: .2rem; min-width: 0; }
.brand-text strong { font-size: 1rem; letter-spacing: 0; line-height: 1.2; overflow-wrap: anywhere; }
.brand-text span { font-size: .8rem; line-height: 1.2; overflow-wrap: anywhere; }
.header-profile { margin-left: auto; min-width: 0; max-width: min(42vw, 300px); display: flex; align-items: center; gap: .55rem; padding: .4rem .75rem; color: #173653; text-decoration: none; border-radius: 999px; background: #eef6ff; }
.party-edit { position: relative; }
.party-edit summary { display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; color: #1977d4; background: #eef6ff; border-radius: .55rem; cursor: pointer; list-style: none; }
.party-edit summary::-webkit-details-marker { display: none; }
.party-edit summary svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.party-edit[open] form { width: min(330px, 85vw); margin-top: .6rem; padding: 1rem; background: white; border: 1px solid #d7e5f6; border-radius: .75rem; box-shadow: 0 10px 35px #17365325; }
.party-edit-actions { display: flex; gap: .6rem; }
.party-edit-actions button { width: auto; }
.header-profile svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.header-profile span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: inherit; font-weight: 600; }
.header-profile:hover, .header-profile:focus-visible { background: #dceeff; }
nav {
  position: fixed; z-index: 10; inset: 76px auto 0 0;
  display: flex; flex-direction: column; justify-content: space-between;
  width: 246px; padding: 1.45rem .85rem 1rem;
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  background: #fff; border-right: 1px solid #e1ebf7;
  box-shadow: 8px 0 26px rgba(34, 83, 145, .025);
}
.nav-links { display: grid; gap: .3rem; width: 100%; }
.nav-bottom { width: 100%; }
.nav-settings { margin: 0 0 .45rem; padding: 0; border: 0; background: transparent; }
.nav-settings summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: .6rem; width: 100%; padding: .8rem 1rem; color: #607992; font-weight: 600; cursor: pointer; border: 1px solid transparent; border-radius: 10px; }
.nav-settings summary::after { content: ''; width: .48rem; height: .48rem; flex: none; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .18s ease; }
.nav-settings[open] summary::after { transform: rotate(225deg); }
.nav-settings summary::-webkit-details-marker { display: none; }
.nav-settings summary::marker { content: ''; }
.nav-settings summary.active, .nav-settings summary:hover { color: #1674d1; background: #eef6ff; }
.nav-submenu { margin: .15rem 0 .3rem 1.1rem; padding: .15rem 0 .3rem .55rem; border-left: 2px solid #e2ebf5; }
.nav-submenu a { padding: .53rem .7rem; font-size: .88rem; font-weight: 500; }
nav a, nav button {
  display: block; width: 100%; padding: .8rem 1rem; color: #607992;
  font: inherit; font-weight: 600; text-align: left; text-decoration: none;
  border: 1px solid transparent; border-radius: 10px; background: transparent; cursor: pointer;
}
nav a:hover, nav button:hover { color: #1674d1; background: #eef6ff; }
nav a.active { color: #1674d1; background: rgba(40, 139, 232, .1); border-color: rgba(40, 139, 232, .18); }
nav form { width: 100%; border-top: 1px solid #e1ebf7; padding-top: .7rem; }
main { width: calc(100% - 246px); min-width: 0; margin: 2.2rem 0 0 246px; padding: 0 clamp(1.25rem, 3vw, 3rem) 4rem; }
h1 { margin: 0 0 1.15rem; font-size: clamp(1.7rem, 2.5vw, 2.2rem); letter-spacing: -.035em; }
.dashboard-title { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.dashboard-title time { color: #607992; font-size: .9rem; font-weight: 500; letter-spacing: 0; white-space: nowrap; }
h2 { margin: 1.9rem 0 .9rem; font-size: 1.15rem; letter-spacing: -.015em; }
p { line-height: 1.6; }
.muted { color: #70859b; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 1rem; margin: 1.4rem 0 2.5rem; }
.cards article, .panel {
  padding: 1.35rem; background: #fff; border: 1px solid #e1eaf5; border-radius: 17px;
  box-shadow: 0 10px 30px rgba(31, 75, 133, .045);
}
.cards article { position: relative; min-height: 146px; overflow: hidden; }
.cards article::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: #258be7; }
.cards article:nth-child(2)::before { background: #f3a057; }
.cards article:nth-child(3)::before { background: #19baa8; }
.cards article:nth-child(4)::before { background: #8a7be7; }
.cards article small { display: block; margin: .25rem 0 1.1rem; color: #688198; font-size: .92rem; }
.cards article strong { color: #173d63; font-size: clamp(1.3rem, 2vw, 1.65rem); letter-spacing: -.035em; overflow-wrap: anywhere; }
.columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.columns > *, .panel, .form-grid, .table-wrap { min-width: 0; }
.panel h2:first-child { margin-top: 0; }
.form-grid { display: grid; gap: .85rem; max-width: 100%; }
.order-panel { width: 100%; max-width: none; }
.order-fields { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%, 255px),1fr)); gap: 1rem; }
.tax-field { min-width: 0; position: relative; display: grid; gap: .4rem; }
.tax-field > label { display: block; }
.tax-combobox { position: relative; min-width: 0; }
.tax-combobox > input { padding-right: 3rem; }
.tax-toggle { position: absolute; right: .25rem; top: .25rem; bottom: .25rem; width: 2.5rem; border: 0; border-radius: 7px; background: transparent; color: #315d84; font-size: 1.2rem; }
.tax-toggle:hover, .tax-toggle:focus-visible { background: #edf6ff; }
.tax-choices { position: absolute; z-index: 20; top: calc(100% + .3rem); left: 0; right: 0; padding: .35rem; background: #fff; border: 1px solid #c9d8e8; border-radius: 10px; box-shadow: 0 9px 20px #173d6322; }
.tax-choices button { display: block; width: 100%; padding: .65rem .75rem; border: 0; border-radius: 7px; background: transparent; color: #173d63; text-align: left; font-weight: 500; }
.tax-choices button:hover, .tax-choices button:focus-visible { background: #ecf5ff; }
.product-section-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; margin-top: 1rem; }
.product-section-head h3 { margin: 0; font-size: 1.15rem; }
.product-section-head p { margin: .4rem 0 0; }
#product-list, #purchase-product-list { display: grid; gap: .8rem; }
.item-input { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .85rem 1rem; padding: 1.1rem; background: #fbfdff; border: 1px solid #dce9f7; border-radius: 12px; }
.item-input > .unit-other:not([hidden]) { grid-column: 1 / -1; }
.item-input label { min-width: 0; overflow-wrap: anywhere; }
.product-row-title { display: flex; align-items: center; justify-content: space-between; grid-column: 1 / -1; gap: 1rem; }
.product-title { color: #2174c8; }
.secondary, .remove-product { padding: .7rem .85rem; color: #176fd0; font-weight: 650; border: 1px solid #cee5ff; border-radius: 9px; background: #eaf4ff; }
.secondary:hover, .remove-product:hover { background: #dceeff; }
.secondary:disabled { cursor: default; opacity: .55; }
.remove-product { padding: .35rem .65rem; background: #fff; }
.remove-product[hidden] { display: none; }
.order-form > .primary { justify-self: start; min-width: 175px; }
.customer-add { width: 100%; max-width: none; margin-top: 1rem; }
.customer-add .form-grid { max-width: 480px; margin-top: 1rem; }
fieldset { border: 1px solid #e1eaf5; border-radius: 10px; }
label { display: grid; gap: .4rem; color: #33536f; font-size: .9rem; font-weight: 500; }
input, select, textarea {
  width: 100%; min-width: 0; padding: .75rem .85rem; font: inherit; font-weight: 400; color: #173d63;
  background: #fff; border: 1px solid #c9d8e8; border-radius: 9px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #348fe6; outline-offset: 1px; }
textarea { resize: vertical; }
button { font: inherit; cursor: pointer; }
.primary { padding: .85rem 1rem; color: #fff; font-weight: 700; background: #2185df; border: 0; border-radius: 9px; }
.primary:hover { background: #156ec3; }
a { color: #1679d6; }
.table-wrap {
  /* Container daftar: selalu menyediakan ruang untuk 10 baris.
     Jika data > 10 baris, scroll tetap berada di dalam container. */
  height: calc(49px + 10 * 55px);
  overflow: auto;
  background: #fff; border: 1px solid #e1eaf5; border-radius: 15px;
  box-shadow: 0 10px 30px rgba(31, 75, 133, .04);
  overscroll-behavior: contain;
}

/* Tinggi standar baris daftar. Header tetap sticky dan data tetap punya
   ruang konsisten meskipun jumlah datanya kurang dari 10. */
.table-wrap > table > tbody > tr:not(:first-child),
.table-wrap > table > tr:not(:first-child) {
  height: 55px;
}

.table-wrap > table th,
.table-wrap > table td {
  vertical-align: middle;
}
.document-table-wrap, .transaction-table-wrap {
  flex: none;
  height: calc(49px + 10 * 55px);
  max-height: none;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}
.document-table-wrap table { display: block; width: 100%; min-width: 1066px; }
.document-table-wrap tbody { display: block; width: 100%; }
.document-table-wrap tr { display: grid; width: 100%; grid-template-columns: 110px 150px 178px 190px minmax(180px,1fr) 138px 120px; }
.document-table-wrap tr:first-child { position: sticky; top: 0; z-index: 3; }
.document-table-wrap th, .document-table-wrap td { display: block; min-width: 0; padding: .78rem .55rem; }
.document-table-wrap td:nth-child(5) { overflow: hidden; text-overflow: ellipsis; }
.document-table-wrap td a { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.transaction-table-wrap table { min-width: 1750px; }
.document-table-wrap th, .document-table-wrap td,
.transaction-table-wrap th, .transaction-table-wrap td { white-space: nowrap; vertical-align: middle; }
.document-table-wrap th, .transaction-table-wrap th { background: #f1f7ff; box-shadow: 0 1px 0 #dce8f5; }
.transaction-table-wrap th { position: sticky; top: 0; z-index: 2; }
.document-page-panel, .transaction-data-panel { display: flex; flex-direction: column; min-height: 0; padding: .85rem 1rem; }
.document-page-panel .list-filters, .transaction-data-panel .list-filters { margin: .25rem 0 .7rem; }
.document-page-panel > h2, .document-page-panel > .list-filters, .transaction-data-panel > .list-filters { flex: 0 0 auto; }

/* PAGE tetap menjadi area scroll utama. Section mengikuti tinggi kontennya. */
body { overflow-y: auto; }
main { height: auto; overflow: visible; }

table { width: 100%; min-width: 680px; border-collapse: collapse; }
th, td { padding: .85rem; text-align: left; vertical-align: top; border-bottom: 1px solid #edf2f8; }
th { color: #53708c; background: #f1f7ff; font-size: .85rem; font-weight: 700; }
td { font-size: .9rem; }
tr:last-child td { border-bottom: none; }
.num { text-align: right; white-space: nowrap; }
.table-wrap .form-grid { min-width: 170px; }
.notice { padding: 1rem; background: #e7f6ee; border-radius: 9px; }
.login-page main { width: 100%; max-width: none; min-height: calc(100vh - 76px); min-height: calc(100dvh - 76px); margin: 0; padding: clamp(1rem, 4vw, 2rem); display: grid; place-items: center; align-content: center; grid-auto-rows: max-content; gap: .25rem; }
.login-page .login { width: min(100%, 440px); margin: 0; }
.login-page .login .form-grid { width: 100%; }
.export-links { display: flex; flex-wrap: wrap; gap: .65rem; }
.export-links a, .download-link {
  display: inline-block; padding: .7rem .9rem; color: #176fd0; font-weight: 650;
  text-decoration: none; background: #eaf4ff; border: 1px solid #cee5ff; border-radius: 9px;
}
.export-links a:hover, .download-link:hover { background: #dceeff; }
main > .panel { margin: 1rem 0; }
details { margin: .4rem 0; padding: .7rem; background: #fff; border: 1px solid #e1eaf5; border-radius: 9px; }
.customer-add summary { list-style: none; color: #176fd0; font-weight: 600; cursor: pointer; }
.customer-add summary::-webkit-details-marker { display: none; }
.customer-add summary::marker { content: ''; }
.transaction-form .form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); align-items: end; }
.transaction-form .form-grid > button { grid-column: 1 / -1; }
.list-filters { display: flex; align-items: end; flex-wrap: wrap; gap: .7rem; margin: 1rem 0; }
.list-filters label { min-width: 170px; }
.list-filters .filter-search { flex: 1 1 270px; }
.list-filters button { min-height: 44px; }
.filter-pills { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.filter-pills a { padding: .55rem .8rem; border: 1px solid #cee0f5; border-radius: 9px; background: #fff; text-decoration: none; }
.filter-pills a.selected { background: #2174c8; color: #fff; }
.status-badge { display: inline-block; white-space: nowrap; padding: .25rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.status-badge.issued, .status-badge.incoming { color: #147058; background: #e3f6ed; }
.status-badge.cancelled, .status-badge.outgoing { color: #a2313a; background: #ffeaea; }
.status-badge.pending { color: #8b6318; background: #fff1d5; }
.quotation-preview { margin: .8rem 0 1rem; padding: .9rem; background: #f7fbff; border: 1px solid #dce9f7; border-radius: 10px; }
.quotation-preview h3 { margin: 0 0 .8rem; font-size: 1rem; }
.quotation-preview table { min-width: 500px; }
.quotation-totals { max-width: 400px; margin: 1rem 0 0 auto; }
.quotation-totals div { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; }
.quotation-totals strong { font-weight: 600; }
.quotation-totals .preview-grand { border-top: 1px solid #b9cfe5; font-weight: 700; }
.print { padding-top: 0; background: #fff; }
.print main { width: 100%; max-width: 1000px; margin: 0 auto; padding: 1.5rem; }
.print header { position: static; height: auto; min-height: 0; padding: 0 0 1rem; background: none; border: 0; box-shadow: none; }
.print table { min-width: 0; width: 100%; font-size: .8rem; }
.print th, .print td { padding: .55rem; }
.doc-meta { display: flex; justify-content: space-between; gap: 2rem; }
.doc-totals { width: min(350px,100%); margin: 1rem 0 1rem auto; }
.doc-totals div { display: flex; justify-content: space-between; gap: 2rem; padding: .4rem 0; }
.doc-grand { border-top: 2px solid #173653; font-weight: 700; }
.doc-signatures { display: flex; justify-content: space-between; gap: 2rem; margin: 3rem 0; }
.document-page { box-sizing: border-box; width: 210mm; max-width: 100% !important; min-height: 297mm; margin: 0 auto !important; padding: 12mm !important; color: #142e4b; background: #fff; font: 12px/1.4 Arial, sans-serif; }
.doc-header { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding-bottom: 22px; border-bottom: 2px solid #2c64ba; }
.doc-brand { display: flex; align-items: center; gap: 20px; min-width: 0; }
.doc-brand img { width: 86px; height: 108px; object-fit: contain; flex: none; }
.doc-brand strong { font-size: 19px; }
.doc-brand p { margin: 4px 0; font-size: 12px; line-height: 1.35; }
.doc-header h1 { min-width: 160px; margin: 0; padding: 12px 16px; color: #fff; background: #14548e; font-size: 18px; font-weight: 700; text-align: center; text-transform: uppercase; letter-spacing: 0; }
.doc-parties { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(0,.75fr); gap: 1rem; margin: 18px 0 32px; font-size: 12px; }
.doc-pair { display: grid; grid-template-columns: 100px minmax(0,1fr); gap: .4rem; margin: 2px 0; }
.doc-number .doc-pair { grid-template-columns: 100px minmax(0,1fr); }
.doc-pair span { overflow-wrap: anywhere; }
.doc-table-wrap { min-height: 210px; border: 1px solid #c9d9f2; }
.print .doc-items { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 12px; }
.print .doc-items th { padding: 8px 5px; color: #fff; background: #14548e; border: 0; font-size: 11px; text-align: left; }
.print .doc-items td { padding: 7px 5px; color: #142e4b; border: 0; vertical-align: top; }
.doc-items th:first-child, .doc-items td:first-child { width: 5%; text-align: center; }
.doc-items th:nth-child(2), .doc-items td:nth-child(2) { width: 28%; }
.doc-items th:nth-child(3), .doc-items td:nth-child(3) { width: 6%; text-align: center; }
.doc-items th:nth-child(4), .doc-items td:nth-child(4) { width: 14%; }
.doc-items th:nth-child(5), .doc-items td:nth-child(5) { width: 8%; }
.purchase-po .doc-header h1 { min-width: 185px; white-space: nowrap; font-size: 16px; }
.purchase-po .doc-items th:nth-child(1), .purchase-po .doc-items td:nth-child(1) { width: 6%; }
.purchase-po .doc-items th:nth-child(2), .purchase-po .doc-items td:nth-child(2) { width: 16%; }
.purchase-po .doc-items th:nth-child(3), .purchase-po .doc-items td:nth-child(3) { width: 30%; text-align: left; }
.purchase-po .doc-items th:nth-child(4), .purchase-po .doc-items td:nth-child(4) { width: 8%; text-align: center; }
.purchase-po .doc-items th:nth-child(5), .purchase-po .doc-items td:nth-child(5) { width: 27%; overflow-wrap: anywhere; }
.purchase-po .doc-items th:nth-child(6), .purchase-po .doc-items td:nth-child(6) { width: 13%; }
.purchase-po-bottom { grid-template-columns: minmax(0,1.3fr) minmax(220px,.7fr); }
.purchase-po-bottom .doc-note { min-height: 75px; }
.purchase-po-bottom .doc-signature { margin-top: 0; }
.purchase-notes { grid-column: 1 / -1; }
.purchase-notes textarea { width: 100%; }
.purchase-payment { margin: 0; padding: 0; border: 0; background: transparent; }
.purchase-payment > summary { display: inline-flex; align-items: center; justify-content: center; padding: .55rem .75rem; border: 1px solid #cee5ff; border-radius: 8px; background: #eaf4ff; color: #176fd0; font-weight: 600; white-space: nowrap; cursor: pointer; list-style: none; }
.purchase-payment > summary:hover { background: #dceeff; }
.purchase-payment > summary::-webkit-details-marker { display: none; }
.purchase-payment > summary::marker { content: ''; }
.purchase-payment .form-grid { display: grid; grid-template-columns: minmax(0,1fr); min-width: 205px; gap: .65rem; margin-top: .8rem; }
.doc-bottom { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(240px,.85fr); gap: 1rem; margin-top: 34px; }
.doc-left { display: grid; align-content: start; gap: 15px; }
.doc-note, .doc-words, .doc-bank { padding: 10px; background: #eaf4fc; font-size: 12px; }
.doc-note { display: grid; grid-template-columns: 90px minmax(0,1fr); min-height: 65px; }
.doc-note span { white-space: pre-wrap; }
.doc-npwp { font-size: 11px; }
.print .doc-summary { min-width: 0; width: 100%; border: 1px solid #c9d9f2; border-collapse: collapse; font-size: 12px; }
.print .doc-summary th, .print .doc-summary td { width: 50%; padding: 5px 8px; color: #142e4b; border: 0; text-align: right; }
.print .doc-summary th { background: #f0f7fd; }
.print .doc-summary .doc-total th, .print .doc-summary .doc-total td { background: #dceefb; font-weight: 800; }
.doc-payment-badge { margin-top: 18px; padding: 13px; background: #eef0f3; font-size: 19px; font-weight: 800; text-align: center; text-transform: uppercase; }
.doc-signature { margin-top: 22px; font-size: 12px; text-align: center; }
.doc-sign-space { height: 100px; }
.doc-delivery { margin-top: 26px; border: 1px solid #c9d9f2; font-size: 12px; }
.doc-delivery-sign { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
.doc-delivery-sign section { min-height: 135px; border-right: 1px solid #c9d9f2; }
.doc-delivery-sign section:last-child { border-right: 0; }
.doc-delivery-sign b { display: block; padding: 7px; color: #fff; background: #14548e; }
.doc-delivery-sign p { margin: 75px 7px 7px; }
.doc-condition { display: grid; grid-template-columns: 140px 1fr; border-top: 1px solid #c9d9f2; }
.doc-condition b, .doc-condition span { padding: 4px 7px; }
.doc-print-button { margin-top: 30px; }
@media (max-width: 800px) {
  .document-page { padding: 20px !important; }
  .doc-header { align-items: flex-start; flex-direction: column; }
  .doc-parties, .doc-bottom { grid-template-columns: 1fr; gap: 1rem; }
  .doc-table-wrap { overflow-x: auto; }
  .print .doc-items { min-width: 820px; }
}
@media (max-width: 850px) {
  .order-fields { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .item-input > .unit-other:not([hidden]) { grid-column: 1 / -1; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .columns { grid-template-columns: 1fr; }
  nav { width: 202px; }
  main { width: calc(100% - 202px); margin: 1.5rem 0 0 202px; }
}
@media (max-width: 640px) {
  .order-fields, .item-input { grid-template-columns: 1fr; }
  .item-input > .unit-other:not([hidden]) { grid-column: 1; }
  .transaction-form .form-grid { grid-template-columns: 1fr; }
  .transaction-form .form-grid > button { grid-column: 1; }
  .doc-meta { display: block; }
  body { padding-top: 0; }
  header { position: sticky; height: auto; min-height: 76px; }
  nav {
    position: static; width: 100%; padding: .55rem 1rem; overflow: visible;
    border-right: 0; border-bottom: 1px solid #e1ebf7; box-shadow: none;
  }
  .nav-links { display: flex; flex-wrap: wrap; gap: .2rem; }
  .nav-bottom { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
  .nav-settings { margin: 0; }
  .nav-submenu { padding-left: 0; }
  nav a, nav button { width: auto; padding: .65rem .8rem; }
  nav form { padding: 0; border: 0; }
  main { width: 100%; margin: 1.5rem auto; }
  .cards { gap: .7rem; }
  .cards article { min-height: 125px; padding: 1rem; }
  .cards article strong { font-size: 1.15rem; }
  header small { width: 100%; margin-left: 0; }
  header { gap: .3rem; }
  .brand-text strong { font-size: .92rem; }
  .header-profile { max-width: 40vw; padding: .4rem; }
  .login-page main { min-height: calc(100dvh - 76px); }
}
@media (max-width: 420px) {
  header { display: grid; grid-template-columns: minmax(0, 1fr); gap: .4rem; }
  .header-profile { margin-left: 0; justify-self: end; max-width: 100%; }
}
.draft-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; grid-column: 1 / -1; }
.draft-actions button { width: auto; }

/* Pembelian: kolom identitas harus tetap terbaca utuh.
   Jika layar lebih sempit, container menggunakan scroll horizontal. */
main > section.panel:last-of-type .table-wrap table {
  min-width: 1380px;
  table-layout: auto;
}
main > section.panel:last-of-type .table-wrap th:nth-child(1),
main > section.panel:last-of-type .table-wrap td:nth-child(1) {
  min-width: 140px;
  white-space: nowrap;
}
main > section.panel:last-of-type .table-wrap th:nth-child(2),
main > section.panel:last-of-type .table-wrap td:nth-child(2) {
  min-width: 190px;
  white-space: nowrap;
}
main > section.panel:last-of-type .table-wrap th:nth-child(3),
main > section.panel:last-of-type .table-wrap td:nth-child(3) {
  min-width: 220px;
  white-space: nowrap;
}
main > section.panel:last-of-type .table-wrap th:nth-child(4),
main > section.panel:last-of-type .table-wrap td:nth-child(4) {
  min-width: 230px;
  white-space: nowrap;
}

@page { size: A3 portrait; margin: 15mm; }
@media print {
  @page { size: A4 portrait; margin: 12mm; }
  nav, button, .muted { display: none; }
  body { padding-top: 0; background: #fff; }
  header { position: static; height: auto; }
  main { margin: 0; padding: 0; }
  .print header { display: block; }
  .print td { color: #173653; }
  .print .doc-items th { color: #fff; }
  .document-page { width: 100%; max-width: 100% !important; min-height: 0; padding: 0 !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .doc-header, .doc-parties, .doc-bottom, .doc-delivery, .doc-signature { break-inside: avoid; }
  .doc-items thead { display: table-header-group; }
  .doc-items tr { break-inside: avoid; }
  .doc-header { align-items: center; flex-direction: row; }
  .doc-parties { grid-template-columns: minmax(0,1.3fr) minmax(0,.75fr); gap: 2.5rem; }
  .doc-bottom { grid-template-columns: minmax(0,1.45fr) minmax(270px,.75fr); gap: 3rem; }
  .doc-table-wrap { overflow: visible; }
  .print .doc-items { min-width: 0; }
}

.download-confirm { width: min(360px,calc(100vw - 32px)); padding: 1.4rem; border: 1px solid #c9d8e8; border-radius: 14px; box-shadow: 0 18px 55px #16375a38; color: #173d63; }
.download-confirm::backdrop { background: #102c4b77; }
.download-confirm h2 { margin: 0 0 1.1rem; font-size: 1.2rem; }
.download-confirm-actions { display: flex; justify-content: flex-end; gap: .65rem; }
.download-confirm-actions button { min-width: 78px; padding: .65rem 1rem; border-radius: 8px; }
.download-confirm-actions .secondary { background: #f1f6fc; border: 1px solid #c9d8e8; color: #173d63; }
@media print { .download-confirm { display: none !important; } }

.password-field { position: relative; display: block; min-width: 0; }
.password-field input { padding-right: 3rem; }
.password-field button { position: absolute; right: .3rem; top: .3rem; bottom: .3rem; width: 2.4rem; display: grid; place-items: center; background: transparent; border: 0; border-radius: 7px; color: #477193; }
.password-field button:hover, .password-field button:focus-visible { background: #edf6ff; }
.password-field svg { width: 19px; height: 19px; }

.stock-low { color: #8a5816; font-weight: 600; }
.stock-search-label { display: block; max-width: 440px; margin: .65rem 0 .9rem; font-weight: 500; }
.stock-search-label input { display: block; width: 100%; margin-top: .4rem; }
.stock-list-wrap { height: calc(49px + 10 * 55px); max-height: none; overflow: auto; overscroll-behavior: contain; }
.stock-list-wrap table { min-width: 960px; border-collapse: separate; border-spacing: 0; }
.stock-list-wrap th, .stock-list-wrap td { height: 55px; padding: .65rem .75rem; vertical-align: middle; white-space: nowrap; }
.stock-list-wrap thead th { position: sticky; top: 0; z-index: 2; height: 49px; background: #edf4fd; box-shadow: 0 1px 0 #dce8f5; }
.stock-list-wrap tbody tr[hidden] { display: none; }
.stock-preview-table { height: calc(49px + 10 * 55px); max-height: none; overflow: auto; margin-bottom: 1rem; }
.stock-preview-table th { position: sticky; top: 0; z-index: 1; background: #e7f2fb; }
.purchase-serial-choice:not([hidden]) { display: flex; align-items: end; gap: .6rem; min-width: 0; }
.purchase-serial-choice label { flex: 1 1 auto; }
.purchase-serial-choice button { flex: 0 0 auto; min-height: 42px; }
@media (max-width: 700px) { .purchase-serial-choice:not([hidden]) { flex-wrap: wrap; } }


/* Pengelolaan User
   Tabel dibuat lebih rapat dan proporsional agar kolom tidak
   tersebar terlalu jauh ke kiri/kanan. Target hanya tabel yang
   memiliki form aksi /users/{id}/deactivate. */
.table-wrap:has(form[action^="/users/"]) > table {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
}

.table-wrap:has(form[action^="/users/"]) > table th,
.table-wrap:has(form[action^="/users/"]) > table td {
  white-space: nowrap;
  vertical-align: middle;
  padding-left: .85rem;
  padding-right: .85rem;
}

.table-wrap:has(form[action^="/users/"]) > table th:nth-child(1),
.table-wrap:has(form[action^="/users/"]) > table td:nth-child(1) {
  width: 18%;
}

.table-wrap:has(form[action^="/users/"]) > table th:nth-child(2),
.table-wrap:has(form[action^="/users/"]) > table td:nth-child(2) {
  width: 30%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-wrap:has(form[action^="/users/"]) > table th:nth-child(3),
.table-wrap:has(form[action^="/users/"]) > table td:nth-child(3) {
  width: 20%;
}

.table-wrap:has(form[action^="/users/"]) > table th:nth-child(4),
.table-wrap:has(form[action^="/users/"]) > table td:nth-child(4) {
  width: 15%;
}

.table-wrap:has(form[action^="/users/"]) > table th:nth-child(5),
.table-wrap:has(form[action^="/users/"]) > table td:nth-child(5) {
  width: 17%;
}

.table-wrap:has(form[action^="/users/"]) > table td:nth-child(5) form {
  margin: 0;
}

.table-wrap:has(form[action^="/users/"]) > table td:nth-child(5) button {
  white-space: nowrap;
}


/* Pengelolaan User — rapatkan lebar tabel agar kolom tidak tersebar.
   Tabel tidak dipaksa memenuhi seluruh lebar container. */
.table-wrap:has(form[action^="/users/"]) {
  overflow-x: auto;
}

.table-wrap:has(form[action^="/users/"]) > table {
  width: 1080px;
  min-width: 1080px;
  max-width: none;
  table-layout: fixed;
}

.table-wrap:has(form[action^="/users/"]) > table th,
.table-wrap:has(form[action^="/users/"]) > table td {
  padding-left: .75rem;
  padding-right: .75rem;
}

.table-wrap:has(form[action^="/users/"]) > table th:nth-child(1),
.table-wrap:has(form[action^="/users/"]) > table td:nth-child(1) {
  width: 180px;
}

.table-wrap:has(form[action^="/users/"]) > table th:nth-child(2),
.table-wrap:has(form[action^="/users/"]) > table td:nth-child(2) {
  width: 300px;
}

.table-wrap:has(form[action^="/users/"]) > table th:nth-child(3),
.table-wrap:has(form[action^="/users/"]) > table td:nth-child(3) {
  width: 220px;
}

.table-wrap:has(form[action^="/users/"]) > table th:nth-child(4),
.table-wrap:has(form[action^="/users/"]) > table td:nth-child(4) {
  width: 140px;
}

.table-wrap:has(form[action^="/users/"]) > table th:nth-child(5),
.table-wrap:has(form[action^="/users/"]) > table td:nth-child(5) {
  width: 180px;
}


/* Pengelolaan User — compact layout.
   Tabel sengaja TIDAK memenuhi lebar container/page. */
.table-wrap:has(form[action^="/users/"]) > table {
  width: 900px !important;
  min-width: 900px !important;
  max-width: 900px !important;
  table-layout: fixed !important;
}

.table-wrap:has(form[action^="/users/"]) > table th,
.table-wrap:has(form[action^="/users/"]) > table td {
  padding-left: 10px !important;
  padding-right: 10px !important;
}

.table-wrap:has(form[action^="/users/"]) > table th:nth-child(1),
.table-wrap:has(form[action^="/users/"]) > table td:nth-child(1) {
  width: 150px !important;
}

.table-wrap:has(form[action^="/users/"]) > table th:nth-child(2),
.table-wrap:has(form[action^="/users/"]) > table td:nth-child(2) {
  width: 270px !important;
}

.table-wrap:has(form[action^="/users/"]) > table th:nth-child(3),
.table-wrap:has(form[action^="/users/"]) > table td:nth-child(3) {
  width: 190px !important;
}

.table-wrap:has(form[action^="/users/"]) > table th:nth-child(4),
.table-wrap:has(form[action^="/users/"]) > table td:nth-child(4) {
  width: 120px !important;
}

.table-wrap:has(form[action^="/users/"]) > table th:nth-child(5),
.table-wrap:has(form[action^="/users/"]) > table td:nth-child(5) {
  width: 170px !important;
}
